mirror of
https://github.com/10h30/genesis-simple-sidebars.git
synced 2026-06-05 15:08:34 +09:00
Introducing coding standards validation.
This commit is contained in:
committed by
Nathan Rice
parent
6e40c921ab
commit
fd504d41ac
@@ -49,8 +49,8 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
'submenu' => array(
|
||||
'parent_slug' => 'genesis',
|
||||
'page_title' => __( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ),
|
||||
'menu_title' => __( 'Simple Sidebars', 'genesis-simple-sidebars' )
|
||||
)
|
||||
'menu_title' => __( 'Simple Sidebars', 'genesis-simple-sidebars' ),
|
||||
),
|
||||
);
|
||||
|
||||
// Empty, as we'll be building the page manually
|
||||
@@ -69,18 +69,16 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
* Echoes out HTML.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
public function admin() {
|
||||
|
||||
echo '<div class="wrap">';
|
||||
|
||||
if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] ) {
|
||||
require_once( Genesis_Simple_Sidebars()->plugin_dir_path . '/includes/views/admin-edit.php' );
|
||||
}
|
||||
else {
|
||||
require_once( Genesis_Simple_Sidebars()->plugin_dir_path . '/includes/views/admin-main.php' );
|
||||
}
|
||||
if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] ) {
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/admin-edit.php';
|
||||
} else {
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/admin-main.php';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
@@ -92,7 +90,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
* Displays table rows of sidebars for viewing and editing on the main admin page.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
public function table_rows() {
|
||||
|
||||
@@ -106,32 +103,40 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
|
||||
$is_editable = isset( $info['editable'] ) && $info['editable'] ? true : false;
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr <?php if ( $alt ) { echo 'class="alternate"'; $alt = false; } else { $alt = true; } ?>>
|
||||
<tr
|
||||
<?php
|
||||
if ( $alt ) {
|
||||
echo 'class="alternate"';
|
||||
$alt = false;
|
||||
} else {
|
||||
$alt = true; }
|
||||
?>
|
||||
>
|
||||
<td class="name column-name">
|
||||
<?php
|
||||
if ( $is_editable ) {
|
||||
printf( '<a class="row-title" href="%s" title="Edit %s">%s</a>', admin_url('admin.php?page=simple-sidebars&action=edit&id=' . esc_html( $id ) ), esc_html( $info['name'] ), esc_html( $info['name'] ) );
|
||||
} else {
|
||||
printf( '<strong class="row-title">%s</strong>', esc_html( $info['name'] ) );
|
||||
}
|
||||
if ( $is_editable ) {
|
||||
printf( '<a class="row-title" href="%s" title="Edit %s">%s</a>', admin_url( 'admin.php?page=simple-sidebars&action=edit&id=' . esc_html( $id ) ), esc_html( $info['name'] ), esc_html( $info['name'] ) );
|
||||
} else {
|
||||
printf( '<strong class="row-title">%s</strong>', esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( $is_editable ) : ?>
|
||||
<br />
|
||||
<div class="row-actions">
|
||||
<span class="edit"><a href="<?php echo admin_url('admin.php?page=simple-sidebars&action=edit&id=' . esc_html( $id ) ); ?>"><?php _e('Edit', 'genesis-simple-sidebars'); ?></a> | </span>
|
||||
<span class="delete"><a class="delete-tag" href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=simple-sidebars&action=delete&id=' . esc_html( $id ) ), 'simple-sidebars-action_delete-sidebar' ); ?>"><?php _e('Delete', 'genesis-simple-sidebars'); ?></a></span>
|
||||
<span class="edit"><a href="<?php echo admin_url( 'admin.php?page=simple-sidebars&action=edit&id=' . esc_html( $id ) ); ?>"><?php _e( 'Edit', 'genesis-simple-sidebars' ); ?></a> | </span>
|
||||
<span class="delete"><a class="delete-tag" href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=simple-sidebars&action=delete&id=' . esc_html( $id ) ), 'simple-sidebars-action_delete-sidebar' ); ?>"><?php _e( 'Delete', 'genesis-simple-sidebars' ); ?></a></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</td>
|
||||
<td class="slug column-slug"><?php echo esc_html( $id ); ?></td>
|
||||
<td class="description column-description"><?php echo esc_html( $info['description'] )?></td>
|
||||
<td class="description column-description"><?php echo esc_html( $info['description'] ); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
}
|
||||
@@ -142,7 +147,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
* Depending on what action was intended by the user, this method calls the appropriate action method.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
public function actions() {
|
||||
|
||||
@@ -211,7 +215,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
* Create a sidebar.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
protected function create_sidebar( $args = array() ) {
|
||||
|
||||
@@ -231,7 +234,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
}
|
||||
|
||||
// Strip all but alphanumeric, sanitize with dashes.
|
||||
$id = preg_replace( "/[^a-zA-Z0-9 -]+/", "", sanitize_title_with_dashes( $args['id'] ) );
|
||||
$id = preg_replace( '/[^a-zA-Z0-9 -]+/', '', sanitize_title_with_dashes( $args['id'] ) );
|
||||
|
||||
// Preface numeric IDs with 'sidebar-'.
|
||||
$id = is_numeric( $id ) ? 'gss-sidebar-' . $id : $id;
|
||||
@@ -247,7 +250,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
$new = array(
|
||||
$id => array(
|
||||
'name' => esc_html( $args['name'] ),
|
||||
'description' => esc_html( $args['description'] )
|
||||
'description' => esc_html( $args['description'] ),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -268,7 +271,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
* Edit a sidebar.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
protected function edit_sidebar( $args = array() ) {
|
||||
|
||||
@@ -280,12 +282,12 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
// nonce verification
|
||||
check_admin_referer( 'simple-sidebars-action_edit-sidebar' );
|
||||
|
||||
$db = (array) get_option( $this->settings_field );
|
||||
$db = (array) get_option( $this->settings_field );
|
||||
$new = array(
|
||||
$args['id'] => array(
|
||||
'name' => esc_html( $args['name'] ),
|
||||
'description' => esc_html( $args['description'] )
|
||||
)
|
||||
'description' => esc_html( $args['description'] ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( ! array_key_exists( $args['id'], $db ) ) {
|
||||
@@ -305,7 +307,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
* Delete a sidebar.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
*/
|
||||
protected function delete_sidebar( $id = '' ) {
|
||||
|
||||
@@ -319,12 +320,12 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
|
||||
$_sidebars = (array) get_option( $this->settings_field );
|
||||
|
||||
if ( ! isset( $_sidebars[$id] ) ) {
|
||||
if ( ! isset( $_sidebars[ $id ] ) ) {
|
||||
wp_die( $this->error( 4 ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
unset( $_sidebars[$id] );
|
||||
unset( $_sidebars[ $id ] );
|
||||
|
||||
update_option( $this->settings_field, $_sidebars );
|
||||
wp_redirect( admin_url( 'admin.php?page=simple-sidebars&deleted=true' ) );
|
||||
@@ -341,10 +342,11 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
|
||||
*/
|
||||
protected function error( $error = false ) {
|
||||
|
||||
if ( ! $error )
|
||||
if ( ! $error ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch( (int) $error ) {
|
||||
switch ( (int) $error ) {
|
||||
|
||||
case 1:
|
||||
return __( 'Oops! Please choose a valid Name for this sidebar', 'genesis-simple-sidebars' );
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Genesis Simple Sidebars Core.
|
||||
*
|
||||
* @package genesis-simple-sidebars
|
||||
*/
|
||||
|
||||
/**
|
||||
* Controls the core functions of registration and output of Sidebars
|
||||
@@ -9,11 +14,15 @@ class Genesis_Simple_Sidebars_Core {
|
||||
|
||||
/**
|
||||
* The created sidebars.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $sidebars;
|
||||
|
||||
/**
|
||||
* Public taxonomies.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $public_taxonomies;
|
||||
|
||||
@@ -55,19 +64,21 @@ class Genesis_Simple_Sidebars_Core {
|
||||
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 ) {
|
||||
|
||||
if ( ! isset( $info['name'] ) || ! isset( $info['description'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
genesis_register_sidebar( array(
|
||||
'name' => esc_html( $info['name'] ),
|
||||
'id' => $id,
|
||||
'description' => esc_html( $info['description'] ),
|
||||
'editable' => 1,
|
||||
) );
|
||||
genesis_register_sidebar(
|
||||
array(
|
||||
'name' => esc_html( $info['name'] ),
|
||||
'id' => $id,
|
||||
'description' => esc_html( $info['description'] ),
|
||||
'editable' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +87,8 @@ class Genesis_Simple_Sidebars_Core {
|
||||
/**
|
||||
* Filter the widgets in each widget area.
|
||||
*
|
||||
* @param array $widgets Widgets.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function sidebars_widgets_filter( $widgets ) {
|
||||
@@ -111,6 +124,9 @@ class Genesis_Simple_Sidebars_Core {
|
||||
/**
|
||||
* Take the $widgets array and swap the contents of each widget area with a custom widget area, if specified.
|
||||
*
|
||||
* @param array $widgets Widgets.
|
||||
* @param array $sidebars Sidebars.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function swap_widgets( $widgets, $sidebars ) {
|
||||
@@ -128,7 +144,6 @@ class Genesis_Simple_Sidebars_Core {
|
||||
if ( $new_sidebar && ! empty( $widgets[ $new_sidebar ] ) ) {
|
||||
$widgets[ $old_sidebar ] = $widgets[ $new_sidebar ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $widgets;
|
||||
@@ -138,6 +153,8 @@ class Genesis_Simple_Sidebars_Core {
|
||||
/**
|
||||
* Get all custom registered sidebars.
|
||||
*
|
||||
* @param bool $cache Indicates if should get from cache.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function get_sidebars( $cache = true ) {
|
||||
@@ -164,10 +181,12 @@ class Genesis_Simple_Sidebars_Core {
|
||||
public function get_public_taxonomies() {
|
||||
|
||||
if ( is_null( $this->public_taxonomies ) ) {
|
||||
$this->public_taxonomies = get_taxonomies( array(
|
||||
'show_ui' => true,
|
||||
'public' => true,
|
||||
) );
|
||||
$this->public_taxonomies = get_taxonomies(
|
||||
array(
|
||||
'show_ui' => true,
|
||||
'public' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->public_taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) );
|
||||
|
||||
@@ -21,7 +21,6 @@ class Genesis_Simple_Sidebars_Entry {
|
||||
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
|
||||
add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'genesis-simple-sidebars' ), array( $this, 'metabox_content' ), $type, 'side', 'low' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,13 +32,15 @@ class Genesis_Simple_Sidebars_Entry {
|
||||
*/
|
||||
public function metabox_content() {
|
||||
|
||||
require_once( Genesis_Simple_Sidebars()->plugin_dir_path . 'includes/views/entry-metabox-content.php' );
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/entry-metabox-content.php';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the metabox fields when the entry is saved.
|
||||
*
|
||||
* @param string $post_id Post Id.
|
||||
* @param array $post Post.
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function metabox_save( $post_id, $post ) {
|
||||
@@ -48,11 +49,14 @@ class Genesis_Simple_Sidebars_Entry {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = wp_parse_args( $_POST['genesis_simple_sidebars'], array(
|
||||
'_ss_header' => '',
|
||||
'_ss_sidebar' => '',
|
||||
'_ss_sidebar_alt' => '',
|
||||
) );
|
||||
$data = wp_parse_args(
|
||||
$_POST['genesis_simple_sidebars'],
|
||||
array(
|
||||
'_ss_header' => '',
|
||||
'_ss_sidebar' => '',
|
||||
'_ss_sidebar_alt' => '',
|
||||
)
|
||||
);
|
||||
|
||||
genesis_save_custom_fields( $data, 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce', $post );
|
||||
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Genesis Simple Sidebars Term.
|
||||
*
|
||||
* @package genesis-simple-sidebars
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Genesis Simple Sidebars Term.
|
||||
*/
|
||||
class Genesis_Simple_Sidebars_Term {
|
||||
|
||||
/**
|
||||
* Init functiom.
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
add_action( 'init', array( $this, 'add_term_fields' ), 12 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds term fields.
|
||||
*/
|
||||
public function add_term_fields() {
|
||||
|
||||
$taxonomies = Genesis_Simple_Sidebars()->core->get_public_taxonomies();
|
||||
@@ -17,14 +31,19 @@ class Genesis_Simple_Sidebars_Term {
|
||||
foreach ( $taxonomies as $tax ) {
|
||||
add_action( "{$tax}_edit_form", array( $this, 'term_sidebar_form' ), 9, 2 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Import the sidebar form.
|
||||
*
|
||||
* @param string $tag Tag.
|
||||
* @param string $taxonomy Taxonomy.
|
||||
*/
|
||||
public function term_sidebar_form( $tag, $taxonomy ) {
|
||||
|
||||
require_once( Genesis_Simple_Sidebars()->plugin_dir_path . 'includes/views/term-edit-sidebar-form.php' );
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/term-edit-sidebar-form.php';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
/**
|
||||
* Genesis Simple Sidebars main class.
|
||||
*
|
||||
* @package genesis-simple-sidebars
|
||||
*/
|
||||
|
||||
/**
|
||||
* Genesis Simple Sidebars class.
|
||||
*/
|
||||
class Genesis_Simple_Sidebars {
|
||||
|
||||
/**
|
||||
* Minimum WordPress version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $min_wp_version = '4.7.2';
|
||||
|
||||
/**
|
||||
* Minimum Genesis version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $min_genesis_version = '2.4.2';
|
||||
|
||||
/**
|
||||
* The plugin textdomain, for translations.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $plugin_textdomain = 'genesis-simple-sidebars';
|
||||
|
||||
/**
|
||||
* The main settings field for this plugin.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $settings_field = 'ss-settings';
|
||||
|
||||
/**
|
||||
* Core functions of sidebar registration and output.
|
||||
*
|
||||
* @var Genesis_Simple_Sidebars_Core
|
||||
*/
|
||||
public $core;
|
||||
|
||||
/**
|
||||
* Admin menu and settings page.
|
||||
*
|
||||
* @var Genesis_Simple_Sidebars_Admin
|
||||
*/
|
||||
public $admin;
|
||||
|
||||
/**
|
||||
* Entry settings and metadata.
|
||||
*
|
||||
* @var Genesis_Simple_Sidebars_Entry
|
||||
*/
|
||||
public $entry;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
// For backward compatibility.
|
||||
define( 'SS_PLUGIN_DIR', GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
$this->load_plugin_textdomain();
|
||||
|
||||
add_action( 'admin_notices', array( $this, 'requirements_notice' ) );
|
||||
|
||||
$this->includes();
|
||||
$this->instantiate();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show admin notice if minimum requirements aren't met.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function requirements_notice() {
|
||||
|
||||
if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, $this->min_genesis_version, '>=' ) ) {
|
||||
|
||||
$action = defined( 'PARENT_THEME_VERSION' ) ? __( 'upgrade to', 'genesis-simple-sidebars' ) : __( 'install and activate', 'genesis-simple-sidebars' );
|
||||
|
||||
// translators: %1$s is WordPress minimum version, %2$s is Genesis minimum version, %3$s is action and %4$s is link.
|
||||
$message = sprintf( __( 'Genesis Simple Sidebars requires WordPress %1$s and Genesis %2$s, or greater. Please %3$s the latest version of <a href="%4$s" target="_blank">Genesis</a> to use this plugin.', 'genesis-simple-sidebars' ), $this->min_wp_version, $this->min_genesis_version, $action, 'http://my.studiopress.com/?download_id=91046d629e74d525b3f2978e404e7ffa' );
|
||||
echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . '</p></div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the plugin textdomain, for translation.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function load_plugin_textdomain() {
|
||||
load_plugin_textdomain( $this->plugin_textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* All general includes.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function includes() {
|
||||
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/functions.php';
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/deprecated.php';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Include the class file, instantiate the classes, create objects.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function instantiate() {
|
||||
|
||||
add_action( 'genesis_setup', array( $this, 'genesis_dependencies' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and instantiate any Genesis dependencies.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function genesis_dependencies() {
|
||||
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-core.php';
|
||||
$this->core = new Genesis_Simple_Sidebars_Core();
|
||||
$this->core->init();
|
||||
|
||||
// Anything beyond this point should only be loaded if in the admin.
|
||||
if ( ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-entry.php';
|
||||
$this->entry = new Genesis_Simple_Sidebars_Entry();
|
||||
$this->entry->init();
|
||||
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-term.php';
|
||||
$this->term = new Genesis_Simple_Sidebars_Term();
|
||||
$this->term->init();
|
||||
|
||||
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-admin.php';
|
||||
$this->admin = new Genesis_Simple_Sidebars_Admin();
|
||||
$this->admin->admin_menu();
|
||||
|
||||
// For backward compatibility.
|
||||
global $_genesis_simple_sidebars;
|
||||
$_genesis_simple_sidebars = $this->admin;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+10
-3
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Deprecated functions file.
|
||||
*
|
||||
* @package genesis-simple-sidebars
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
@@ -53,19 +58,21 @@ function ss_sidebars_init() {
|
||||
/**
|
||||
* Deprecated.
|
||||
*
|
||||
* @param string $sidebar_key Sidebar Key.
|
||||
*
|
||||
* @since 0.9.0
|
||||
* @deprecated 2.1.0
|
||||
*/
|
||||
function ss_do_one_sidebar( $sidebar_key = '' ) {
|
||||
|
||||
_deprecated_function( __FUNCTION__, '2.1.0', __( 'dynamic_sidebar() with sidebars_widget filter', 'genesis-simple-sidebars' ) );
|
||||
_deprecated_function( __FUNCTION__, '2.1.0', esc_html__( 'dynamic_sidebar() with sidebars_widget filter', 'genesis-simple-sidebars' ) );
|
||||
|
||||
if ( '_ss_sidebar' == $sidebar_key ) {
|
||||
if ( '_ss_sidebar' === $sidebar_key ) {
|
||||
genesis_do_sidebar();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( '_ss_sidebar_alt' == $sidebar_key ) {
|
||||
if ( '_ss_sidebar_alt' === $sidebar_key ) {
|
||||
genesis_do_sidebar_alt();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Functions file.
|
||||
*
|
||||
* @package genesis-simple-sidebars
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dummy function for backward compatibility. Outputs the primary sidebar.
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Genesis view for metabox content.
|
||||
*
|
||||
* @package genesis-simple-sidebars
|
||||
*/
|
||||
|
||||
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
|
||||
global $wp_registered_sidebars;
|
||||
wp_nonce_field( 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce' );
|
||||
@@ -7,40 +13,45 @@ if ( is_registered_sidebar( 'header-right' ) ) : ?>
|
||||
<p>
|
||||
<label class="howto" for="genesis_simple_sidebars[_ss_header]"><span><?php echo esc_attr( $wp_registered_sidebars['header-right']['name'] ); ?><span></label>
|
||||
<select name="genesis_simple_sidebars[_ss_header]" id="genesis_simple_sidebars[_ss_header]" style="width: 99%">
|
||||
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<?php
|
||||
foreach ( (array) $sidebars as $id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_header' ), false), esc_html( $info['name'] ) );
|
||||
foreach ( (array) $sidebars as $sidebar_id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $sidebar_id ), selected( $sidebar_id, genesis_get_custom_field( '_ss_header' ), false ), esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( is_registered_sidebar( 'sidebar' ) ) : ?>
|
||||
if ( is_registered_sidebar( 'sidebar' ) ) :
|
||||
?>
|
||||
<p>
|
||||
<label class="howto" for="genesis_simple_sidebars[_ss_sidebar]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar']['name'] ); ?><span></label>
|
||||
<select name="genesis_simple_sidebars[_ss_sidebar]" id="genesis_simple_sidebars[_ss_sidebar]" style="width: 99%">
|
||||
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<?php
|
||||
foreach ( (array) $sidebars as $id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_sidebar' ), false), esc_html( $info['name'] ) );
|
||||
foreach ( (array) $sidebars as $sidebar_id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $sidebar_id ), selected( $sidebar_id, genesis_get_custom_field( '_ss_sidebar' ), false ), esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( is_registered_sidebar( 'sidebar-alt' ) ) : ?>
|
||||
if ( is_registered_sidebar( 'sidebar-alt' ) ) :
|
||||
?>
|
||||
<p>
|
||||
<label class="howto" for="genesis_simple_sidebars[_ss_sidebar_alt]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar-alt']['name'] ); ?><span></label>
|
||||
<select name="genesis_simple_sidebars[_ss_sidebar_alt]" id="genesis_simple_sidebars[_ss_sidebar_alt]" style="width: 99%">
|
||||
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<?php
|
||||
foreach ( (array) $sidebars as $id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_sidebar_alt' ), false ), esc_html( $info['name'] ) );
|
||||
foreach ( (array) $sidebars as $sidebar_id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $sidebar_id ), selected( $sidebar_id, genesis_get_custom_field( '_ss_sidebar_alt' ), false ), esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php endif;
|
||||
<?php
|
||||
endif;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<?php
|
||||
foreach ( (array) $sidebars as $id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_header', true ), false), esc_html( $info['name'] ) );
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_header', true ), false ), esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -26,7 +26,7 @@
|
||||
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<?php
|
||||
foreach ( (array) $sidebars as $id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar', true ), false), esc_html( $info['name'] ) );
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar', true ), false ), esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -41,7 +41,7 @@
|
||||
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
|
||||
<?php
|
||||
foreach ( (array) $sidebars as $id => $info ) {
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar_alt', true ) , false), esc_html( $info['name'] ) );
|
||||
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar_alt', true ), false ), esc_html( $info['name'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user