diff --git a/includes/admin.php b/includes/admin.php index 01cf047..d55d0bb 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -34,14 +34,14 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic { ) ); - /** Empty, as we'll be building the page manually */ + //* Empty, as we'll be building the page manually $page_ops = array(); $settings_field = SS_SETTINGS_FIELD; $this->create( $page_id, $menu_ops, $page_ops, $settings_field ); - /** Simpe Sidebar actions (create, edit, or delete) */ + //* Simpe Sidebar actions (create, edit, or delete) add_action( 'admin_init', array( $this, 'actions' ) ); } @@ -123,7 +123,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic { * Action handler. * * Depending on what action was intended by the user, this method calls the appropriate action method. - * + * * @since 1.0.0 * */ @@ -201,10 +201,10 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic { exit; } - // nonce verification + //* nonce verification check_admin_referer( 'simple-sidebars-action_create-sidebar' ); - // WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user + //* WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user if ( is_numeric( $args['id'] ) ) $args['id'] = sanitize_title_with_dashes( $args['name'] ); @@ -242,10 +242,10 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic { exit; } - // nonce verification + //* nonce verification check_admin_referer( 'simple-sidebars-action_edit-sidebar' ); - // WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user + //* WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user if ( is_numeric( $args['id'] ) ) $args['id'] = sanitize_title_with_dashes( $args['name'] ); @@ -283,7 +283,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic { exit; } - // nonce verification + //* nonce verification check_admin_referer( 'simple-sidebars-action_delete-sidebar' ); $_sidebars = (array) get_option( SS_SETTINGS_FIELD ); @@ -346,4 +346,4 @@ function simplesidebars_settings_menu() { new Genesis_Simple_Sidebars_Admin; -} \ No newline at end of file +} diff --git a/includes/inpost.php b/includes/inpost.php index 4012419..e639cff 100644 --- a/includes/inpost.php +++ b/includes/inpost.php @@ -1,15 +1,15 @@ true ) ) as $type ) { + foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) { if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) { - add_meta_box('ss_inpost_metabox', __('Sidebar Selection', 'ss'), 'ss_inpost_metabox', $type, 'side', 'low'); + add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'ss' ), 'ss_inpost_metabox', $type, 'side', 'low' ); } } @@ -22,31 +22,31 @@ function ss_inpost_metabox() { ?> - +

- +

- + @@ -55,43 +55,43 @@ function ss_inpost_metabox() { ID; - // don't try to save the data under autosave, ajax, or future post. + //* don't try to save the data under autosave, ajax, or future post. if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return; if ( defined('DOING_AJAX') && DOING_AJAX ) return; if ( defined('DOING_CRON') && DOING_CRON ) return; - // is the user allowed to edit the post or page? - if ( ( 'page' == $_POST['post_type'] && !current_user_can('edit_page', $post->ID) ) || !current_user_can('edit_post', $post->ID ) ) + //* is the user allowed to edit the post or page? + if ( ( 'page' == $_POST['post_type'] && ! current_user_can( 'edit_page', $post->ID ) ) || ! current_user_can( 'edit_post', $post->ID ) ) return $post->ID; $_sidebars = array( - '_ss_sidebar' => $_POST['_ss_sidebar'], - '_ss_sidebar_alt' => $_POST['_ss_sidebar_alt'] + '_ss_sidebar' => $_POST['_ss_sidebar'], + '_ss_sidebar_alt' => $_POST['_ss_sidebar_alt'], ); - // store the custom fields + //* store the custom fields foreach ( $_sidebars as $key => $value ) { - if ( $post->post_type == 'revision' ) return; // don't try to store data during revision save + //* don't try to store data during revision save + if ( 'revision' === $post->post_type ) + return; if ( $value ) { - // save/update update_post_meta($post->ID, $key, $value); } else { - // delete if blank delete_post_meta($post->ID, $key); } } -} \ No newline at end of file +} diff --git a/includes/term.php b/includes/term.php index abbc6b4..c4a2c0f 100644 --- a/includes/term.php +++ b/includes/term.php @@ -27,16 +27,16 @@ function ss_term_sidebar($tag, $taxonomy) { ?> -

+

- + - +
-

+screen_icon( 'themes' ); ?> +

- + - + +

- + +

- +
-

-

-

+

-
\ No newline at end of file + diff --git a/includes/views/main.php b/includes/views/main.php index d3e3501..721676e 100644 --- a/includes/views/main.php +++ b/includes/views/main.php @@ -1,26 +1,26 @@ - -

+ +

-

+

- - - + + + - - - + + + @@ -39,29 +39,29 @@
-

+

- +
- + -

+

- + -

+

- +
-

+

diff --git a/plugin.php b/plugin.php index 13be297..15a4e5e 100644 --- a/plugin.php +++ b/plugin.php @@ -9,7 +9,7 @@ Author URI: http://www.nathanrice.net/ Text Domain: ss Domain Path: /languages/ -Version: 1.0.0 +Version: 2.0.0-dev License: GNU General Public License v2.0 (or later) License URI: http://www.opensource.org/licenses/gpl-license.php @@ -60,27 +60,27 @@ add_action( 'genesis_init', 'ss_genesis_init', 12 ); */ function ss_genesis_init() { - /** Deactivate if not running Genesis 1.8.0 or greater */ + //* Deactivate if not running Genesis 1.8.0 or greater if ( ! class_exists( 'Genesis_Admin_Boxes' ) ) add_action( 'admin_init', 'ss_deactivate', 10, 0 ); - /** Load translations */ + //* Load translations load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' ); - /** required hooks */ + //* required hooks add_action( 'get_header', 'ss_sidebars_init' ); add_action( 'widgets_init', 'ss_register_sidebars' ); - /** The rest is admin stuff, so load only if we're in the admin area */ + //* The rest is admin stuff, so load only if we're in the admin area if ( ! is_admin() ) return; - /** Include admin files */ + //* Include admin files require_once( SS_PLUGIN_DIR . '/includes/admin.php' ); require_once( SS_PLUGIN_DIR . '/includes/inpost.php' ); require_once( SS_PLUGIN_DIR . '/includes/term.php' ); - /** let the child theme hook the genesis_simple_sidebars_taxonomies filter before hooking term edit */ + //* let the child theme hook the genesis_simple_sidebars_taxonomies filter before hooking term edit add_action( 'init', 'ss_term_edit_init' ); } @@ -95,23 +95,18 @@ function ss_register_sidebars() { $_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) ); - /** If no sidebars have been created, do nothing */ + //* If no sidebars have been created, do nothing if ( ! $_sidebars ) return; - /** Cycle through created sidebars, register them as widget areas */ + //* Cycle through created sidebars, register them as widget areas foreach ( (array) $_sidebars as $id => $info ) { - register_sidebar( array( - 'name' => esc_html( $info['name'] ), - 'id' => $id, + genesis_register_sidebar( array( + 'name' => esc_html( $info['name'] ), + 'id' => $id, 'description' => esc_html( $info['description'] ), - 'editable' => 1, - - 'before_widget' => '
', - 'after_widget' => "
\n", - 'before_title' => '

', - 'after_title' => "

\n" + 'editable' => 1, ) ); } diff --git a/readme.txt b/readme.txt index 7a4ccf2..52100d1 100644 --- a/readme.txt +++ b/readme.txt @@ -4,13 +4,13 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: hooks, genesis, genesiswp, studiopress Requires at least: 3.0 Tested up to: 3.3 -Stable tag: 0.9.2.1 +Stable tag: 1.0.0 -This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis. +This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Framework on a per post, per page, or per tag/category archive basis. == Description == -This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis. +This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Framework on a per post, per page, or per tag/category archive basis. Creating widget areas programmatically, then using conditional logic to properly assign them to sidebar locations can be a complex task for a beginner. This plugin allows you to do all this from a simple administration menu, and assign widget areas to sidebar locations with simple drop-down menus within the post/page edit screens, or when editing a tag or category.