8 Commits

Author SHA1 Message Date
Nathan Rice 357bc65a70 Only allow alphanumeric characters in IDs. fixes #10. 2017-03-01 19:48:53 -05:00
Nathan Rice 4e5bfa7caf Remove errors when no ID is passed. see #11. 2017-03-01 19:28:32 -05:00
Nathan Rice f96e67d4df Allow for empty ID. fixes #11. 2017-03-01 19:27:10 -05:00
Nathan Rice fde95b0dd7 Add header widget area support. fixes #7. 2017-03-01 18:48:22 -05:00
Nathan Rice 76e5f73e28 Begine updating readme.txt. 2017-03-01 18:17:23 -05:00
Nathan Rice 5a1b4bec6e Make ID field readonly. 2017-03-01 18:16:49 -05:00
Nathan Rice 2f6eb81ed6 Rewrite based on plugin boilerplate. 2017-03-01 17:38:34 -05:00
Nathan Rice 13505bdc2b Fix errors associated with variables not being set. see #8, #17. 2016-04-21 11:32:39 -04:00
22 changed files with 498 additions and 1354 deletions
-39
View File
@@ -1,39 +0,0 @@
version: 2.1
orbs:
wp-svn: studiopress/wp-svn@0.2
jobs:
lint:
docker:
- image: cimg/php:7.3-node
steps:
- checkout
- run: composer install && composer phpcs
workflows:
lint-deploy:
jobs:
- lint
- approval-for-deploy-tested-up-to-bump:
requires:
- lint
type: approval
filters:
tags:
ignore: /.*/
branches:
only: /^bump-tested-up-to.*/
- wp-svn/deploy-tested-up-to-bump:
context: genesis-svn
requires:
- approval-for-deploy-tested-up-to-bump
- wp-svn/deploy:
context: genesis-svn
filters:
tags:
only: /^\d+\.\d+\.\d+$/
branches:
ignore: /.*/
requires:
- lint
-21
View File
@@ -1,21 +0,0 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# WordPress Coding Standards
# http://make.wordpress.org/core/handbook/coding-standards/
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
[*.yml]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
-2
View File
@@ -2,5 +2,3 @@
Thumbs.db Thumbs.db
.svn .svn
node_modules/ node_modules/
vendor/
*.swp
-1
View File
@@ -3,4 +3,3 @@
.gitattributes .gitattributes
.svnignore .svnignore
node_modules node_modules
.circleci
-36
View File
@@ -1,36 +0,0 @@
{
"name": "studiopress/genesis-simple-sidebars",
"type": "wordpress-plugin",
"description": "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.",
"homepage": "https://github.com/studiopress/genesis-simple-sidebars",
"license": "GPL-2.0-or-later",
"require": {
"php": "^5.3 || ^7 || ^8",
"composer/installers": "^1"
},
"require-dev": {
"php": "^5.6 || ^7 || ^8",
"dealerdirect/phpcodesniffer-composer-installer": "*",
"squizlabs/php_codesniffer": "^3.6.2",
"phpcompatibility/phpcompatibility-wp": "*",
"wp-coding-standards/wpcs": "^1"
},
"config": {
"sort-order": true,
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"phpcs": "phpcs --standard=WordPress --ignore=vendor/,node_modules/,assets/ --extensions=php -p ./",
"phpcs-compat": "phpcs --extensions=php --standard=PHPCompatibilityWP --ignore=vendor/,node_modules/,assets/ --runtime-set testVersion 5.6- -p ./",
"phpcbf": "phpcbf --standard=WordPress --ignore=vendor/,node_modules/,assets/ --extensions=php -p ./"
},
"support": {
"issues": "https://github.com/studiopress/genesis-simple-sidebars/issues",
"source": "https://github.com/studiopress/genesis-simple-sidebars"
}
}
Generated
-526
View File
@@ -1,526 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "60bdbed78b63458c8decfc4af93cae8a",
"packages": [
{
"name": "composer/installers",
"version": "v1.12.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0"
},
"replace": {
"roundcube/plugin-installer": "*",
"shama/baton": "*"
},
"require-dev": {
"composer/composer": "1.6.* || ^2.0",
"composer/semver": "^1 || ^3",
"phpstan/phpstan": "^0.12.55",
"phpstan/phpstan-phpunit": "^0.12.16",
"symfony/phpunit-bridge": "^4.2 || ^5",
"symfony/process": "^2.3"
},
"type": "composer-plugin",
"extra": {
"class": "Composer\\Installers\\Plugin",
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Installers\\": "src/Composer/Installers"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle Robinson Young",
"email": "kyle@dontkry.com",
"homepage": "https://github.com/shama"
}
],
"description": "A multi-framework Composer library installer",
"homepage": "https://composer.github.io/installers/",
"keywords": [
"Craft",
"Dolibarr",
"Eliasis",
"Hurad",
"ImageCMS",
"Kanboard",
"Lan Management System",
"MODX Evo",
"MantisBT",
"Mautic",
"Maya",
"OXID",
"Plentymarkets",
"Porto",
"RadPHP",
"SMF",
"Starbug",
"Thelia",
"Whmcs",
"WolfCMS",
"agl",
"aimeos",
"annotatecms",
"attogram",
"bitrix",
"cakephp",
"chef",
"cockpit",
"codeigniter",
"concrete5",
"croogo",
"dokuwiki",
"drupal",
"eZ Platform",
"elgg",
"expressionengine",
"fuelphp",
"grav",
"installer",
"itop",
"joomla",
"known",
"kohana",
"laravel",
"lavalite",
"lithium",
"magento",
"majima",
"mako",
"mediawiki",
"miaoxing",
"modulework",
"modx",
"moodle",
"osclass",
"pantheon",
"phpbb",
"piwik",
"ppi",
"processwire",
"puppet",
"pxcms",
"reindex",
"roundcube",
"shopware",
"silverstripe",
"sydes",
"sylius",
"symfony",
"tastyigniter",
"typo3",
"wordpress",
"yawik",
"zend",
"zikula"
],
"support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v1.12.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2021-09-13T08:19:44+00:00"
}
],
"packages-dev": [
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.7.2",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db",
"reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"phpcompatibility/php-compatibility": "^9.0"
},
"type": "composer-plugin",
"extra": {
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
},
{
"name": "Contributors",
"homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcbf",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2022-02-04T12:51:07+00:00"
},
{
"name": "phpcompatibility/php-compatibility",
"version": "9.3.5",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
"shasum": ""
},
"require": {
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
},
"conflict": {
"squizlabs/php_codesniffer": "2.6.2"
},
"require-dev": {
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Wim Godden",
"homepage": "https://github.com/wimg",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"homepage": "https://github.com/jrfnl",
"role": "lead"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
}
],
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
"keywords": [
"compatibility",
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
"time": "2019-12-27T09:44:58+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-paragonie",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
"reference": "ddabec839cc003651f2ce695c938686d1086cf43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43",
"reference": "ddabec839cc003651f2ce695c938686d1086cf43",
"shasum": ""
},
"require": {
"phpcompatibility/php-compatibility": "^9.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"paragonie/random_compat": "dev-master",
"paragonie/sodium_compat": "dev-master"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Wim Godden",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "lead"
}
],
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
"homepage": "http://phpcompatibility.com/",
"keywords": [
"compatibility",
"paragonie",
"phpcs",
"polyfill",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
},
"time": "2021-02-15T10:24:51+00:00"
},
{
"name": "phpcompatibility/phpcompatibility-wp",
"version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
"reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308",
"reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308",
"shasum": ""
},
"require": {
"phpcompatibility/php-compatibility": "^9.0",
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "Wim Godden",
"role": "lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "lead"
}
],
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
"homepage": "http://phpcompatibility.com/",
"keywords": [
"compatibility",
"phpcs",
"standards",
"wordpress"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
},
"time": "2021-12-30T16:37:40+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.6.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a",
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2021-12-12T21:44:58+00:00"
},
{
"name": "wp-coding-standards/wpcs",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
"reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
"reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
"shasum": ""
},
"require": {
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
},
"require-dev": {
"phpcompatibility/php-compatibility": "^9.0"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Contributors",
"homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
}
],
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
"keywords": [
"phpcs",
"standards",
"wordpress"
],
"support": {
"issues": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues",
"source": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards",
"wiki": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki"
},
"time": "2018-12-18T09:43:51+00:00"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^5.3 || ^7 || ^8"
},
"platform-dev": {
"php": "^5.6 || ^7"
},
"plugin-api-version": "2.2.0"
}
+163 -19
View File
@@ -1,38 +1,182 @@
<?php <?php
/**
* Genesis Simple Sidebars constants. class Genesis_Simple_Sidebars {
/**
* Plugin version
*/
public $plugin_version = '2.1.0';
/**
* Minimum WordPress version.
*/
public $min_wp_version = '4.7.2';
/**
* Minimum Genesis version.
*/
public $min_genesis_version = '2.4.2';
/**
* The plugin textdomain, for translations.
*/
public $plugin_textdomain = 'genesis-simple-sidebars';
/**
* The url to the plugin directory.
*/
public $plugin_dir_url;
/**
* The path to the plugin directory.
*/
public $plugin_dir_path;
/**
* The main settings field for this plugin.
*/
public $settings_field = 'ss-settings';
/**
* Core functions of sidebar registration and output.
*/
public $core;
/**
* Admin menu and settings page.
*/
public $admin;
/**
* Entry settings and metadata.
*/
public $entry;
/**
* Constructor.
* *
* @package genesis-simple-sidebars * @since 2.1.0
*/ */
public function __construct() {
/** $this->plugin_dir_url = plugin_dir_url( __FILE__ );
* Load the plugin file. $this->plugin_dir_path = plugin_dir_path( __FILE__ );
// For backward compatibility
define( 'SS_PLUGIN_DIR', $this->plugin_dir_path );
}
/**
* Initialize.
*
* @since 2.1.0
*/ */
public function init() {
register_activation_hook( __FILE__, array( $this, 'activation' ) );
$this->load_plugin_textdomain();
$this->includes();
$this->instantiate();
}
/**
* Plugin activation hook. Runs when plugin is activated.
*
* @since 2.1.0
*/
public function activation() {
if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, $this->min_genesis_version, '>=' ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die( sprintf( __( 'Sorry, you cannot run Genesis Simple Sidebars without WordPress %s and <a href="%s">Genesis %s</a>, or greater.', 'genesis-simple-sidebars' ), $this->min_wp_version, 'http://my.studiopress.com/?download_id=91046d629e74d525b3f2978e404e7ffa', $this->min_genesis_version ) );
}
}
/**
* Load the plugin textdomain, for translation.
*
* @since 2.1.0
*/
public function load_plugin_textdomain() {
load_plugin_textdomain( $this->plugin_textdomain, false, $this->plugin_dir_path . 'languages/' );
}
/**
* All general includes.
*
* @since 2.1.0
*/
public function includes() {
//require_once( $this->plugin_dir_path . 'includes/functions.php' );
//require_once( $this->plugin_dir_path . '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( $this->plugin_dir_path . '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( $this->plugin_dir_path . 'includes/class-genesis-simple-sidebars-entry.php' );
$this->entry = new Genesis_Simple_Sidebars_Entry;
$this->entry->init();
require_once( $this->plugin_dir_path . 'includes/class-genesis-simple-sidebars-term.php' );
$this->term = new Genesis_Simple_Sidebars_Term;
$this->term->init();
require_once( $this->plugin_dir_path . '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;
}
if ( ! defined( 'ABSPATH' ) ) {
exit;
} }
define( 'GENESIS_SIMPLE_SIDEBARS_SETTINGS_FIELD', 'genesis_simple_sidebars_settings' );
define( 'GENESIS_SIMPLE_SIDEBARS_VERSION', '2.2.3' );
define( 'GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'GENESIS_SIMPLE_SIDEBARS_PLUGIN_URL', plugins_url( '', __FILE__ ) );
require_once plugin_dir_path( __FILE__ ) . 'includes/class-genesis-simple-sidebars.php';
/** /**
* Helper function to retrieve the static object without using globals. * Helper function to retrieve the static object without using globals.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
function genesis_simple_sidebars() { function Genesis_Simple_Sidebars() {
static $object; static $object;
if ( null === $object ) { if ( null == $object ) {
$object = new Genesis_Simple_Sidebars(); $object = new Genesis_Simple_Sidebars;
} }
return $object; return $object;
@@ -3,7 +3,6 @@
* Controls the creation, deletion, and editing of Simple Sidebar. * Controls the creation, deletion, and editing of Simple Sidebar.
* *
* @author StudioPress * @author StudioPress
* @package genesis-simple-sidebars
*/ */
/** /**
@@ -17,8 +16,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
/** /**
* Settings field. * Settings field.
* *
* @var string
*
* @since 2.1.0 * @since 2.1.0
*/ */
public $settings_field; public $settings_field;
@@ -30,7 +27,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
$this->settings_field = Genesis_Simple_Sidebars()->settings_field; $this->settings_field = Genesis_Simple_Sidebars()->settings_field;
// For backward compatibility. // For backward compatibility
define( 'SS_SETTINGS_FIELD', $this->settings_field ); define( 'SS_SETTINGS_FIELD', $this->settings_field );
} }
@@ -51,27 +48,17 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
$menu_ops = array( $menu_ops = array(
'submenu' => array( 'submenu' => array(
'parent_slug' => 'genesis', 'parent_slug' => 'genesis',
'page_title' => __( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ),
/* 'menu_title' => __( 'Simple Sidebars', 'genesis-simple-sidebars' )
* These strings intentionally avoid using the plugin text )
* domain here because this method can be called before the
* `init` action (via `genesis_setup`). Using `__()` with the
* `genesis-simple-sidebars` domain at that point would cause
* WordPress 6.7+ to emit a "_load_textdomain_just_in_time
* was called incorrectly" notice. Other plugin strings remain
* fully translatable once the text domain is loaded on `init`.
*/
'page_title' => 'Genesis - Simple Sidebars',
'menu_title' => 'Simple Sidebars',
),
); );
// Empty, as we'll be building the page manually. // Empty, as we'll be building the page manually
$page_ops = array(); $page_ops = array();
$this->create( $page_id, $menu_ops, $page_ops, $this->settings_field ); $this->create( $page_id, $menu_ops, $page_ops, $this->settings_field );
// Simpe Sidebar actions (create, edit, or delete). // Simpe Sidebar actions (create, edit, or delete)
add_action( 'admin_init', array( $this, 'actions' ) ); add_action( 'admin_init', array( $this, 'actions' ) );
} }
@@ -82,16 +69,17 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
* Echoes out HTML. * Echoes out HTML.
* *
* @since 1.0.0 * @since 1.0.0
*
*/ */
public function admin() { public function admin() {
echo '<div class="wrap">'; echo '<div class="wrap">';
// phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] ) {
if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] ) { require_once( Genesis_Simple_Sidebars()->plugin_dir_path . '/includes/views/admin-edit.php' );
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/admin-edit.php'; }
} else { else {
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/admin-main.php'; require_once( Genesis_Simple_Sidebars()->plugin_dir_path . '/includes/views/admin-main.php' );
} }
echo '</div>'; echo '</div>';
@@ -104,6 +92,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
* Displays table rows of sidebars for viewing and editing on the main admin page. * Displays table rows of sidebars for viewing and editing on the main admin page.
* *
* @since 1.0.0 * @since 1.0.0
*
*/ */
public function table_rows() { public function table_rows() {
@@ -119,19 +108,11 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
?> ?>
<tr <tr <?php if ( $alt ) { echo 'class="alternate"'; $alt = false; } else { $alt = true; } ?>>
<?php
if ( $alt ) {
echo 'class="alternate"';
$alt = false;
} else {
$alt = true; }
?>
>
<td class="name column-name"> <td class="name column-name">
<?php <?php
if ( $is_editable ) { if ( $is_editable ) {
printf( '<a class="row-title" href="%s" title="Edit %s">%s</a>', esc_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=edit&amp;id=' . esc_html( $id ) ) ), esc_html( $info['name'] ), esc_html( $info['name'] ) ); printf( '<a class="row-title" href="%s" title="Edit %s">%s</a>', admin_url('admin.php?page=simple-sidebars&amp;action=edit&amp;id=' . esc_html( $id ) ), esc_html( $info['name'] ), esc_html( $info['name'] ) );
} else { } else {
printf( '<strong class="row-title">%s</strong>', esc_html( $info['name'] ) ); printf( '<strong class="row-title">%s</strong>', esc_html( $info['name'] ) );
} }
@@ -140,14 +121,14 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
<?php if ( $is_editable ) : ?> <?php if ( $is_editable ) : ?>
<br /> <br />
<div class="row-actions"> <div class="row-actions">
<span class="edit"><a href="<?php echo esc_attr( admin_url( 'admin.php?page=simple-sidebars&amp;action=edit&amp;id=' . esc_html( $id ) ) ); ?>"><?php esc_html_e( 'Edit', 'genesis-simple-sidebars' ); ?></a> | </span> <span class="edit"><a href="<?php echo admin_url('admin.php?page=simple-sidebars&amp;action=edit&amp;id=' . esc_html( $id ) ); ?>"><?php _e('Edit', 'genesis-simple-sidebars'); ?></a> | </span>
<span class="delete"><a class="delete-tag" href="<?php echo esc_attr( wp_nonce_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=delete&amp;id=' . esc_html( $id ) ), 'simple-sidebars-action_delete-sidebar' ) ); ?>"><?php esc_html_e( 'Delete', '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&amp;action=delete&amp;id=' . esc_html( $id ) ), 'simple-sidebars-action_delete-sidebar' ); ?>"><?php _e('Delete', 'genesis-simple-sidebars'); ?></a></span>
</div> </div>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="slug column-slug"><?php echo esc_html( $id ); ?></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> </tr>
<?php <?php
@@ -161,6 +142,7 @@ 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. * Depending on what action was intended by the user, this method calls the appropriate action method.
* *
* @since 1.0.0 * @since 1.0.0
*
*/ */
public function actions() { public function actions() {
@@ -171,26 +153,24 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
/** /**
* This section handles the data if a new sidebar is created * This section handles the data if a new sidebar is created
*/ */
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification if ( isset( $_REQUEST['action'] ) && 'create' == $_REQUEST['action'] ) {
if ( isset( $_REQUEST['action'] ) && 'create' === $_REQUEST['action'] && isset( $_POST['new_sidebar'] ) ) { $this->create_sidebar( $_POST['new_sidebar'] );
$this->create_sidebar( array_map( 'sanitize_text_field', wp_unslash( $_POST['new_sidebar'] ) ) );
} }
/** /**
* This section will handle the data if a sidebar is deleted * This section will handle the data if a sidebar is deleted
*/ */
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification if ( isset( $_REQUEST['action'] ) && 'delete' == $_REQUEST['action'] && isset( $_REQUEST['id'] ) ) {
if ( isset( $_REQUEST['action'] ) && 'delete' === $_REQUEST['action'] && isset( $_REQUEST['id'] ) ) { $this->delete_sidebar( $_REQUEST['id'] );
$this->delete_sidebar( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) );
} }
/** /**
* This section will handle the data if a sidebar is to be modified * This section will handle the data if a sidebar is to be modified
*/ */
if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] && ! isset( $_REQUEST['id'] ) && isset( $_POST['edit_sidebar'] ) ) { if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] && ! isset( $_REQUEST['id'] ) ) {
$this->edit_sidebar( array_map( 'sanitize_text_field', wp_unslash( $_POST['edit_sidebar'] ) ) ); $this->edit_sidebar( $_POST['edit_sidebar'] );
} }
// phpcs:enable
} }
/** /**
@@ -208,78 +188,67 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
$pattern = '<div id="message" class="updated"><p><strong>%s</strong></p></div>'; $pattern = '<div id="message" class="updated"><p><strong>%s</strong></p></div>';
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( isset( $_REQUEST['created'] ) && 'true' === $_REQUEST['created'] ) { if ( isset( $_REQUEST['created'] ) && 'true' === $_REQUEST['created'] ) {
printf( wp_kses_post( $pattern ), esc_html__( 'New sidebar successfully created!', 'genesis-simple-sidebars' ) ); printf( $pattern, __( 'New sidebar successfully created!', 'genesis-simple-sidebars' ) );
return; return;
} }
if ( isset( $_REQUEST['edited'] ) && 'true' === $_REQUEST['edited'] ) { if ( isset( $_REQUEST['edited'] ) && 'true' === $_REQUEST['edited'] ) {
printf( wp_kses_post( $pattern ), esc_html__( 'Sidebar successfully edited!', 'genesis-simple-sidebars' ) ); printf( $pattern, __( 'Sidebar successfully edited!', 'genesis-simple-sidebars' ) );
return; return;
} }
if ( isset( $_REQUEST['deleted'] ) && 'true' === $_REQUEST['deleted'] ) { if ( isset( $_REQUEST['deleted'] ) && 'true' === $_REQUEST['deleted'] ) {
printf( wp_kses_post( $pattern ), esc_html__( 'Sidebar successfully deleted.', 'genesis-simple-sidebars' ) ); printf( $pattern, __( 'Sidebar successfully deleted.', 'genesis-simple-sidebars' ) );
return; return;
} }
return;
} }
/** /**
* Create a sidebar. * Create a sidebar.
* *
* @param array $args Arguments.
*
* @since 1.0.0 * @since 1.0.0
*
*/ */
protected function create_sidebar( $args = array() ) { protected function create_sidebar( $args = array() ) {
if ( empty( $args['name'] ) ) { if ( empty( $args['name'] ) ) {
wp_die( esc_html( $this->error( 1 ) ) ); wp_die( $this->error( 1 ) );
exit; exit;
} }
// nonce verification. // nonce verification
check_admin_referer( 'simple-sidebars-action_create-sidebar' ); check_admin_referer( 'simple-sidebars-action_create-sidebar' );
$db = (array) get_option( $this->settings_field );
// Change empty or numeric IDs to the name, lowercased and separated by dashes. // Change empty or numeric IDs to the name, lowercased and separated by dashes.
if ( empty( $args['id'] ) || is_numeric( $args['id'] ) ) { if ( empty( $args['id'] ) || is_numeric( $args['id'] ) ) {
$args['id'] = $args['name']; $args['id'] = $args['name'];
} }
// Strip all but alphanumeric, sanitize with dashes. // 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-'. $db = (array) get_option( $this->settings_field );
$id = is_numeric( $id ) ? 'gss-sidebar-' . $id : $id;
// If empty after all the sanitizing ...
if ( ! $id || is_registered_sidebar( $id ) ) {
$n = count( $db ) + 1;
do {
$n = $n++;
$id = 'gss-sidebar-' . $n;
} while ( is_registered_sidebar( $id ) );
}
$new = array( $new = array(
$id => array( $id => array(
'name' => esc_html( $args['name'] ), 'name' => esc_html( $args['name'] ),
'description' => esc_html( $args['description'] ), 'description' => esc_html( $args['description'] )
), ),
); );
if ( array_key_exists( $id, $db ) ) { if ( array_key_exists( $id, $db ) ) {
wp_die( esc_html( $this->error( 2 ) ) ); wp_die( $this->error( 2 ) );
exit; exit;
} }
$_sidebars = wp_parse_args( $new, $db ); $_sidebars = wp_parse_args( $new, $db );
update_option( $this->settings_field, $_sidebars ); update_option( $this->settings_field, $_sidebars );
wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&created=true' ) ); wp_redirect( admin_url( 'admin.php?page=simple-sidebars&created=true' ) );
exit; exit;
} }
@@ -287,36 +256,36 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
/** /**
* Edit a sidebar. * Edit a sidebar.
* *
* @param array $args Arguments.
* @since 1.0.0 * @since 1.0.0
*
*/ */
protected function edit_sidebar( $args = array() ) { protected function edit_sidebar( $args = array() ) {
if ( empty( $args['name'] ) || empty( $args['id'] ) ) { if ( empty( $args['name'] ) || empty( $args['id'] ) ) {
wp_die( esc_html( $this->error( 3 ) ) ); wp_die( $this->error( 3 ) );
exit; exit;
} }
// nonce verification. // nonce verification
check_admin_referer( 'simple-sidebars-action_edit-sidebar' ); check_admin_referer( 'simple-sidebars-action_edit-sidebar' );
$db = (array) get_option( $this->settings_field ); $db = (array) get_option( $this->settings_field );
$new = array( $new = array(
$args['id'] => array( $args['id'] => array(
'name' => esc_html( $args['name'] ), 'name' => esc_html( $args['name'] ),
'description' => esc_html( $args['description'] ), 'description' => esc_html( $args['description'] )
), )
); );
if ( ! array_key_exists( $args['id'], $db ) ) { if ( ! array_key_exists( $args['id'], $db ) ) {
wp_die( esc_html( $this->error( 3 ) ) ); wp_die( $this->error( 3 ) );
exit; exit;
} }
$_sidebars = wp_parse_args( $new, $db ); $_sidebars = wp_parse_args( $new, $db );
update_option( $this->settings_field, $_sidebars ); update_option( $this->settings_field, $_sidebars );
wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&edited=true' ) ); wp_redirect( admin_url( 'admin.php?page=simple-sidebars&edited=true' ) );
exit; exit;
} }
@@ -324,29 +293,30 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
/** /**
* Delete a sidebar. * Delete a sidebar.
* *
* @param string $id Id.
* @since 1.0.0 * @since 1.0.0
*
*/ */
protected function delete_sidebar( $id = '' ) { protected function delete_sidebar( $id = '' ) {
if ( empty( $id ) ) { if ( empty( $id ) ) {
wp_die( esc_html( $this->error( 4 ) ) ); wp_die( $this->error( 4 ) );
exit; exit;
} }
// nonce verification. // nonce verification
check_admin_referer( 'simple-sidebars-action_delete-sidebar' ); check_admin_referer( 'simple-sidebars-action_delete-sidebar' );
$_sidebars = (array) get_option( $this->settings_field ); $_sidebars = (array) get_option( $this->settings_field );
if ( ! isset( $_sidebars[ $id ] ) ) { if ( ! isset( $_sidebars[$id] ) ) {
wp_die( esc_html( $this->error( 4 ) ) ); wp_die( $this->error( 4 ) );
exit; exit;
} }
unset( $_sidebars[ $id ] ); unset( $_sidebars[$id] );
update_option( $this->settings_field, $_sidebars ); update_option( $this->settings_field, $_sidebars );
wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&deleted=true' ) ); wp_redirect( admin_url( 'admin.php?page=simple-sidebars&deleted=true' ) );
exit; exit;
} }
@@ -354,28 +324,29 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
/** /**
* Returns an error message by ID. * Returns an error message by ID.
* *
* @param bool $error Error id.
*
* @since 1.0.0 * @since 1.0.0
* *
* @return string Returns an error string based on an error ID. * @return string Returns an error string based on an error ID.
*/ */
protected function error( $error = false ) { protected function error( $error = false ) {
if ( ! $error ) { if ( ! $error )
return false; return false;
}
switch ( (int) $error ) { switch( (int) $error ) {
case 1: case 1:
return __( 'Oops! Please choose a valid Name for this sidebar', 'genesis-simple-sidebars' ); return __( 'Oops! Please choose a valid Name for this sidebar', 'genesis-simple-sidebars' );
break;
case 2: case 2:
return __( 'Oops! That sidebar ID already exists', 'genesis-simple-sidebars' ); return __( 'Oops! That sidebar ID already exists', 'genesis-simple-sidebars' );
break;
case 3: case 3:
return __( 'Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'genesis-simple-sidebars' ); return __( 'Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'genesis-simple-sidebars' );
break;
case 4: case 4:
return __( 'Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted', 'genesis-simple-sidebars' ); return __( 'Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted', 'genesis-simple-sidebars' );
break;
default: default:
return __( 'Oops! Something went wrong. Try again.', 'genesis-simple-sidebars' ); return __( 'Oops! Something went wrong. Try again.', 'genesis-simple-sidebars' );
+88 -100
View File
@@ -1,9 +1,4 @@
<?php <?php
/**
* Genesis Simple Sidebars Core.
*
* @package genesis-simple-sidebars
*/
/** /**
* Controls the core functions of registration and output of Sidebars * Controls the core functions of registration and output of Sidebars
@@ -14,15 +9,11 @@ class Genesis_Simple_Sidebars_Core {
/** /**
* The created sidebars. * The created sidebars.
*
* @var array
*/ */
private $sidebars; private $sidebars;
/** /**
* Public taxonomies. * Public taxonomies.
*
* @var array
*/ */
private $public_taxonomies; private $public_taxonomies;
@@ -31,23 +22,8 @@ class Genesis_Simple_Sidebars_Core {
*/ */
public function init() { public function init() {
add_action( 'after_setup_theme', array( $this, 'backward_compatibility' ) );
add_action( 'widgets_init', array( $this, 'register_sidebars' ) ); add_action( 'widgets_init', array( $this, 'register_sidebars' ) );
add_filter( 'sidebars_widgets', array( $this, 'sidebars_widgets_filter' ) ); add_action( 'get_header', array( $this, 'swap_sidebars' ) );
}
/**
* For backward compatibility, we need to use old functions to hook in sidebar output.
*
* @since 2.1.0
*/
public function backward_compatibility() {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
add_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );
} }
@@ -58,126 +34,140 @@ class Genesis_Simple_Sidebars_Core {
*/ */
public function register_sidebars() { public function register_sidebars() {
$sidebars = $this->get_sidebars(); $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
if ( ! $sidebars ) { if ( ! $sidebars ) {
return; 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 ) { foreach ( (array) $sidebars as $id => $info ) {
if ( ! isset( $info['name'] ) || ! isset( $info['description'] ) ) { if ( ! isset( $info['name'] ) || ! isset( $info['description'] ) ) {
continue; continue;
} }
genesis_register_sidebar( genesis_register_sidebar( array(
array(
'name' => esc_html( $info['name'] ), 'name' => esc_html( $info['name'] ),
'id' => $id, 'id' => $id,
'description' => esc_html( $info['description'] ), 'description' => esc_html( $info['description'] ),
'editable' => 1, 'editable' => 1,
) ) );
);
} }
} }
/** /**
* Filter the widgets in each widget area. * Remove default sidebars and inject custom sidebars.
*
* @param array $widgets Widgets.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
public function sidebars_widgets_filter( $widgets ) { public function swap_sidebars() {
$sidebars = array(); // Header
if ( is_registered_sidebar( 'header-right' ) ) {
global $wp_registered_sidebars;
$wp_registered_sidebars['ss-header-right-temp'] = $wp_registered_sidebars['header-right'];
unset( $wp_registered_sidebars['header-right'] );
add_action( 'genesis_header_right', array( $this, 'do_header_right' ) );
}
if ( is_singular() || is_home() && isset( get_queried_object()->ID ) ) { // Sidebars
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
add_action( 'genesis_sidebar', array( $this, 'do_primary_sidebar' ) );
add_action( 'genesis_sidebar_alt', array( $this, 'do_secondary_sidebar' ) );
$post_id = get_queried_object()->ID; }
$sidebars = array( /**
'sidebar' => genesis_get_custom_field( '_ss_sidebar', $post_id ), * Output custom header widget area, if one is set. Otherwise output default.
'sidebar-alt' => genesis_get_custom_field( '_ss_sidebar_alt', $post_id ), *
'header-right' => genesis_get_custom_field( '_ss_header', $post_id ), * @since 2.1.0
); */
public function do_header_right() {
global $wp_registered_sidebars;
if ( ! $this->do_sidebar( '_ss_header' ) ) {
$wp_registered_sidebars['header-right'] = $wp_registered_sidebars['ss-header-right-temp'];
}
unset( $wp_registered_sidebars['ss-header-right-temp'] );
}
/**
* Output custom primary sidebar, if one is set. Otherwise output default.
*
* @since 2.1.0
*/
public function do_primary_sidebar() {
if ( ! $this->do_sidebar( '_ss_sidebar' ) ) {
genesis_do_sidebar();
}
}
/**
* Output custom secondary sidebar, if one is set. Otherwise output default.
*
* @since 2.1.0
*/
public function do_secondary_sidebar() {
if ( ! $this->do_sidebar( '_ss_sidebar_alt' ) ) {
genesis_do_sidebar_alt();
}
}
/**
* Show widgets in a particular sidebar.
*
* @param string $key sidebar id you wish to output.
*
* @since 2.1.0
*/
public function do_sidebar( $key ) {
if ( is_singular() && $key = genesis_get_custom_field( $key ) ) {
if ( dynamic_sidebar( $key ) ) {
return true;
}
} }
if ( is_tax() || is_category() || is_tag() ) { if ( is_tax() || is_category() || is_tag() ) {
$sidebars = array( if ( $key = get_term_meta( get_queried_object()->term_id, $key, true ) ) {
'sidebar' => get_term_meta( get_queried_object()->term_id, '_ss_sidebar', true ), dynamic_sidebar( $key );
'sidebar-alt' => get_term_meta( get_queried_object()->term_id, '_ss_sidebar_alt', true ), return true;
'header-right' => get_term_meta( get_queried_object()->term_id, '_ss_header', true ), }
);
} }
$widgets = $this->swap_widgets( $widgets, $sidebars ); return false;
return $widgets;
}
/**
* 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 ) {
if ( is_admin() ) {
return $widgets;
}
foreach ( (array) $sidebars as $old_sidebar => $new_sidebar ) {
if ( ! is_registered_sidebar( $old_sidebar ) ) {
continue;
}
if ( $new_sidebar && ! empty( $widgets[ $new_sidebar ] ) ) {
$widgets[ $old_sidebar ] = $widgets[ $new_sidebar ];
}
}
return $widgets;
} }
/** /**
* Get all custom registered sidebars. * Get all custom registered sidebars.
* *
* @param bool $cache Indicates if should get from cache.
*
* @since 2.1.0 * @since 2.1.0
*/ */
public function get_sidebars( $cache = true ) { public function get_sidebars( $cache = true ) {
if ( $cache && ! is_null( $this->sidebars ) ) { if ( ! $cache ) {
return $this->sidebars; return stripslashes_deep( get_option( Genesis_Simple_Sidebars()->settings_field ) );
} }
$sidebars = stripslashes_deep( get_option( Genesis_Simple_Sidebars()->settings_field ) ); if ( is_null( $this->sidebars ) ) {
$this->sidebars = stripslashes_deep( get_option( Genesis_Simple_Sidebars()->settings_field ) );
/**
* Sidebars without a name are invalid. Filtering these prevents
* corrupted sidebar data from throwing errors, as seen in:
* https://wordpress.org/support/topic/php-8-2-error-6/#post-17472734
*/
$this->sidebars = array_filter(
(array) $sidebars,
function( $sidebar ) {
return isset( $sidebar['name'] );
} }
);
return $this->sidebars; return $this->sidebars;
@@ -193,12 +183,10 @@ class Genesis_Simple_Sidebars_Core {
public function get_public_taxonomies() { public function get_public_taxonomies() {
if ( is_null( $this->public_taxonomies ) ) { if ( is_null( $this->public_taxonomies ) ) {
$this->public_taxonomies = get_taxonomies( $this->public_taxonomies = get_taxonomies( array(
array(
'show_ui' => true, 'show_ui' => true,
'public' => true, 'public' => true,
) ) );
);
} }
$this->public_taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) ); $this->public_taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) );
@@ -1,18 +1,7 @@
<?php <?php
/**
* Genesis Simple Sidebars Entry file.
*
* @package genesis-simple-sidebars
*/
/**
* Genesis Simple Sidebars Entry class.
*/
class Genesis_Simple_Sidebars_Entry { class Genesis_Simple_Sidebars_Entry {
/**
* Init function.
*/
public function init() { public function init() {
add_action( 'admin_menu', array( $this, 'add_metaboxes' ) ); add_action( 'admin_menu', array( $this, 'add_metaboxes' ) );
@@ -29,9 +18,10 @@ class Genesis_Simple_Sidebars_Entry {
foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) { foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) {
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || 'post' === $type || 'page' === $type ) { 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' ); add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'genesis-simple-sidebars' ), array( $this, 'metabox_content' ), $type, 'side', 'low' );
} }
} }
} }
@@ -43,34 +33,28 @@ class Genesis_Simple_Sidebars_Entry {
*/ */
public function metabox_content() { public function metabox_content() {
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/entry-metabox-content.php'; require_once( Genesis_Simple_Sidebars()->plugin_dir_path . 'includes/views/entry-metabox-content.php' );
print_r( get_post_meta( get_the_ID() ) );
} }
/** /**
* Save the metabox fields when the entry is saved. * Save the metabox fields when the entry is saved.
* *
* @param string $post_id Post Id.
* @param array $post Post.
* @since 2.1.0 * @since 2.1.0
*/ */
public function metabox_save( $post_id, $post ) { public function metabox_save( $post_id, $post ) {
// phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification if ( ! isset( $_POST['genesis_simple_sidebars'] ) ) {
$genesis_simple_sidebars = isset( $_POST['genesis_simple_sidebars'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['genesis_simple_sidebars'] ) ) : '';
if ( empty( $genesis_simple_sidebars ) ) {
return; return;
} }
$data = wp_parse_args( $data = wp_parse_args( $_POST['genesis_simple_sidebars'], array(
$genesis_simple_sidebars,
array(
'_ss_header' => '', '_ss_header' => '',
'_ss_sidebar' => '', '_ss_sidebar' => '',
'_ss_sidebar_alt' => '', '_ss_sidebar_alt' => '',
) ) );
);
genesis_save_custom_fields( $data, 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce', $post ); genesis_save_custom_fields( $data, 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce', $post );
@@ -1,27 +1,13 @@
<?php <?php
/**
* Genesis Simple Sidebars Term.
*
* @package genesis-simple-sidebars
*/
/**
* Class Genesis Simple Sidebars Term.
*/
class Genesis_Simple_Sidebars_Term { class Genesis_Simple_Sidebars_Term {
/**
* Init function.
*/
public function init() { public function init() {
add_action( 'init', array( $this, 'add_term_fields' ), 12 ); add_action( 'init', array( $this, 'add_term_fields' ) );
} }
/**
* Adds term fields.
*/
public function add_term_fields() { public function add_term_fields() {
$taxonomies = Genesis_Simple_Sidebars()->core->get_public_taxonomies(); $taxonomies = Genesis_Simple_Sidebars()->core->get_public_taxonomies();
@@ -31,19 +17,14 @@ class Genesis_Simple_Sidebars_Term {
foreach ( $taxonomies as $tax ) { foreach ( $taxonomies as $tax ) {
add_action( "{$tax}_edit_form", array( $this, 'term_sidebar_form' ), 9, 2 ); 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 ) { public function term_sidebar_form( $tag, $taxonomy ) {
require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/term-edit-sidebar-form.php'; require_once( Genesis_Simple_Sidebars()->plugin_dir_path . 'includes/views/term-edit-sidebar-form.php' );
} }
-191
View File
@@ -1,191 +0,0 @@
<?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;
/**
* Term.
*
* @var Genesis_Simple_Sidebars_Term
*/
public $term;
/**
* 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() {
add_action( 'init', array( $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' );
$allowed_html = array(
'a' => array(
'href' => array(),
'target' => array(),
),
);
echo '<div class="notice notice-warning"><p>' . wp_kses( $message, $allowed_html ) . '</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;
}
}
+20 -19
View File
@@ -1,9 +1,4 @@
<?php <?php
/**
* Deprecated functions file.
*
* @package genesis-simple-sidebars
*/
/** /**
* Deprecated. * Deprecated.
@@ -58,25 +53,31 @@ function ss_sidebars_init() {
/** /**
* Deprecated. * Deprecated.
* *
* @param string $sidebar_key Sidebar Key. * @since 0.9.0
* @deprecated 2.1.0
*/
function ss_do_sidebar() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
* *
* @since 0.9.0 * @since 0.9.0
* @deprecated 2.1.0 * @deprecated 2.1.0
*/ */
function ss_do_one_sidebar( $sidebar_key = '' ) { function ss_do_sidebar_alt() {
_deprecated_function( __FUNCTION__, '2.1.0' );
_deprecated_function( __FUNCTION__, '2.1.0', esc_html__( 'dynamic_sidebar() with sidebars_widget filter', 'genesis-simple-sidebars' ) ); }
if ( '_ss_sidebar' === $sidebar_key ) {
genesis_do_sidebar();
return true;
}
if ( '_ss_sidebar_alt' === $sidebar_key ) {
genesis_do_sidebar_alt();
return true;
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_do_one_sidebar() {
_deprecated_function( __FUNCTION__, '2.1.0' );
} }
/** /**
-24
View File
@@ -1,24 +0,0 @@
<?php
/**
* Functions file.
*
* @package genesis-simple-sidebars
*/
/**
* Dummy function for backward compatibility. Outputs the primary sidebar.
*
* @since 0.9.0
*/
function ss_do_sidebar() {
genesis_do_sidebar();
}
/**
* Dummy function for backward compatibility. Outputs the secondary sidebar.
*
* @since 0.9.0
*/
function ss_do_sidebar_alt() {
genesis_do_sidebar_alt();
}
+13 -22
View File
@@ -1,49 +1,40 @@
<?php <?php
/**
* Admin edit.
*
* @package genesis-simple-sidebars
*/
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars(); $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification if ( array_key_exists( $_REQUEST['id'], (array) $sidebars ) ) {
if ( isset( $_REQUEST['id'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ), (array) $sidebars ) ) { $sidebar = stripslashes_deep( $sidebars[ $_REQUEST['id'] ] );
$sidebar = stripslashes_deep( $sidebars[ sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ] );
} else { } else {
wp_die( esc_html__( 'Nice try, partner. But that sidebar doesn\'t exist. Click back and try again.', 'genesis-simple-sidebars' ) ); wp_die( __( 'Nice try, partner. But that sidebar doesn\'t exist. Click back and try again.', 'genesis-simple-sidebars' ) );
} }
// phpcs:enable
?> ?>
<h1><?php esc_html_e( 'Edit Sidebar', 'genesis-simple-sidebars' ); ?></h1> <h1><?php _e( 'Edit Sidebar', 'genesis-simple-sidebars' ); ?></h1>
<form method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=edit' ) ); ?>"> <form method="post" action="<?php echo admin_url( 'admin.php?page=simple-sidebars&amp;action=edit' ); ?>">
<?php wp_nonce_field( 'simple-sidebars-action_edit-sidebar' ); ?> <?php wp_nonce_field( 'simple-sidebars-action_edit-sidebar' ); ?>
<table class="form-table"> <table class="form-table">
<tr class="form-field"> <tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[name]"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></label></th> <th scope="row" valign="top"><label for="edit_sidebar[name]"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></label></th>
<td><input name="edit_sidebar[name]" id="edit_sidebar[name]" type="text" value="<?php echo esc_html( $sidebar['name'] ); ?>" size="40" /> <td><input name="edit_sidebar[name]" id="edit_sidebar[name]" type="text" value="<?php echo esc_html( $sidebar['name'] ); ?>" size="40" />
<p class="description"><?php esc_html_e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p></td> <p class="description"><?php _e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p></td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[id]"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></label></th> <th scope="row" valign="top"><label for="edit_sidebar[id]"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></label></th>
<td> <td>
<?php // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification ?> <input type="text" value="<?php echo esc_html( $_REQUEST['id'] ); ?>" size="40" readonly />
<input type="text" value="<?php echo esc_html( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ); ?>" size="40" readonly /> <input name="edit_sidebar[id]" id="edit_sidebar[id]" type="hidden" value="<?php echo esc_html( $_REQUEST['id'] ); ?>" size="40" />
<input name="edit_sidebar[id]" id="edit_sidebar[id]" type="hidden" value="<?php echo esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ); ?>" size="40" /> <p class="description"><?php _e( 'The unique ID is used to register the sidebar widget area (cannot be changed)', 'genesis-simple-sidebars' ); ?></p></td>
<p class="description"><?php esc_html_e( 'The unique ID is used to register the sidebar widget area (cannot be changed)', 'genesis-simple-sidebars' ); ?></p></td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[description]"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></label></th> <th scope="row" valign="top"><label for="edit_sidebar[description]"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></label></th>
<td><textarea name="edit_sidebar[description]" id="edit_sidebar[description]" rows="3" cols="50" style="width: 97%;"><?php echo esc_html( $sidebar['description'] ); ?></textarea></td> <td><textarea name="edit_sidebar[description]" id="edit_sidebar[description]" rows="3" cols="50" style="width: 97%;"><?php echo esc_html( $sidebar['description'] ); ?></textarea></td>
</tr> </tr>
</table> </table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e( 'Update', 'genesis-simple-sidebars' ); ?>" /></p> <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e( 'Update', 'genesis-simple-sidebars' ); ?>" /></p>
</form> </form>
+16 -25
View File
@@ -1,34 +1,25 @@
<?php <h1><?php _e( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ); ?></h1>
/**
* Main Admin View.
*
* @package genesis-simple-sidebar
*/
?>
<h1><?php esc_html_e( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ); ?></h1>
<div id="col-container"> <div id="col-container">
<div id="col-right"> <div id="col-right">
<div class="col-wrap"> <div class="col-wrap">
<h3><?php esc_html_e( 'Current Sidebars', 'genesis-simple-sidebars' ); ?></h3> <h3><?php _e( 'Current Sidebars', 'genesis-simple-sidebars' ); ?></h3>
<table class="widefat tag fixed" cellspacing="0"> <table class="widefat tag fixed" cellspacing="0">
<thead> <thead>
<tr> <tr>
<th scope="col" id="name" class="manage-column column-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></th> <th scope="col" id="name" class="manage-column column-name"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></th>
<th scope="col" class="manage-column column-slug"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></th> <th scope="col" class="manage-column column-slug"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></th>
<th scope="col" id="description" class="manage-column column-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></th> <th scope="col" id="description" class="manage-column column-description"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></th>
</tr> </tr>
</thead> </thead>
<tfoot> <tfoot>
<tr> <tr>
<th scope="col" class="manage-column column-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></th> <th scope="col" class="manage-column column-name"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></th>
<th scope="col" class="manage-column column-slug"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></th> <th scope="col" class="manage-column column-slug"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></th>
<th scope="col" class="manage-column column-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></th> <th scope="col" class="manage-column column-description"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></th>
</tr> </tr>
</tfoot> </tfoot>
@@ -47,29 +38,29 @@
<div class="form-wrap"> <div class="form-wrap">
<h3><?php esc_html_e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?></h3> <h3><?php _e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?></h3>
<form method="post" action="<?php echo esc_attr( esc_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=create' ) ) ); ?>"> <form method="post" action="<?php echo admin_url( 'admin.php?page=simple-sidebars&amp;action=create' ); ?>">
<?php wp_nonce_field( 'simple-sidebars-action_create-sidebar' ); ?> <?php wp_nonce_field( 'simple-sidebars-action_create-sidebar' ); ?>
<div class="form-field form-required"> <div class="form-field form-required">
<label for="sidebar-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></label> <label for="sidebar-name"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></label>
<input name="new_sidebar[name]" id="sidebar-name" type="text" value="" size="40" aria-required="true" /> <input name="new_sidebar[name]" id="sidebar-name" type="text" value="" size="40" aria-required="true" />
<p><?php esc_html_e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p> <p><?php _e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
<label for="sidebar-id"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></label> <label for="sidebar-id"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></label>
<input name="new_sidebar[id]" id="sidebar-id" type="text" value="" size="40" /> <input name="new_sidebar[id]" id="sidebar-id" type="text" value="" size="40" />
<p><?php esc_html_e( 'The unique ID is used to register the sidebar widget area', 'genesis-simple-sidebars' ); ?></p> <p><?php _e( 'The unique ID is used to register the sidebar widget area', 'genesis-simple-sidebars' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
<label for="sidebar-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></label> <label for="sidebar-description"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></label>
<textarea name="new_sidebar[description]" id="sidebar-description" rows="5" cols="40"></textarea> <textarea name="new_sidebar[description]" id="sidebar-description" rows="5" cols="40"></textarea>
</div> </div>
<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php esc_attr_e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?>" /></p> <p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php _e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?>" /></p>
</form></div> </form></div>
</div> </div>
+17 -28
View File
@@ -1,10 +1,4 @@
<?php <?php
/**
* Genesis view for metabox content.
*
* @package genesis-simple-sidebars
*/
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars(); $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
global $wp_registered_sidebars; global $wp_registered_sidebars;
wp_nonce_field( 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce' ); wp_nonce_field( 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce' );
@@ -12,46 +6,41 @@ wp_nonce_field( 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-s
if ( is_registered_sidebar( 'header-right' ) ) : ?> if ( is_registered_sidebar( 'header-right' ) ) : ?>
<p> <p>
<label class="howto" for="genesis_simple_sidebars[_ss_header]"><span><?php echo esc_attr( $wp_registered_sidebars['header-right']['name'] ); ?><span></label> <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]"> <select name="genesis_simple_sidebars[_ss_header]" id="genesis_simple_sidebars[_ss_header]" style="width: 99%">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option> <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php <?php
foreach ( (array) $sidebars as $sidebar_id => $info ) { foreach ( (array) $sidebars as $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'] ) ); printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_header' ), false), esc_html( $info['name'] ) );
} }
?> ?>
</select> </select>
</p> </p>
<?php <?php endif;
endif;
if ( is_registered_sidebar( 'sidebar' ) ) : if ( is_registered_sidebar( 'sidebar' ) ) : ?>
?>
<p> <p>
<label class="howto" for="genesis_simple_sidebars[_ss_sidebar]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar']['name'] ); ?><span></label> <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]"> <select name="genesis_simple_sidebars[_ss_sidebar]" id="genesis_simple_sidebars[_ss_sidebar]" style="width: 99%">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option> <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php <?php
foreach ( (array) $sidebars as $sidebar_id => $info ) { foreach ( (array) $sidebars as $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'] ) ); printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_sidebar' ), false), esc_html( $info['name'] ) );
} }
?> ?>
</select> </select>
</p> </p>
<?php <?php endif;
endif;
if ( is_registered_sidebar( 'sidebar-alt' ) ) : if ( is_registered_sidebar( 'sidebar-alt' ) ) : ?>
?>
<p> <p>
<label class="howto" for="genesis_simple_sidebars[_ss_sidebar_alt]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar-alt']['name'] ); ?><span></label> <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]"> <select name="genesis_simple_sidebars[_ss_sidebar_alt]" id="genesis_simple_sidebars[_ss_sidebar_alt]" style="width: 99%">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option> <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php <?php
foreach ( (array) $sidebars as $sidebar_id => $info ) { foreach ( (array) $sidebars as $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'] ) ); printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_sidebar_alt' ), false ), esc_html( $info['name'] ) );
} }
?> ?>
</select> </select>
</p> </p>
<?php <?php endif;
endif;
+14 -22
View File
@@ -1,25 +1,17 @@
<?php <?php $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars(); ?>
/**
* Term Edit Form View.
*
* @package genesis-simple-sidebars
*/
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars(); <h3><?php _e( 'Sidebar Options', 'genesis-simple-sidebars' ); ?></h3>
?>
<h3><?php esc_html_e( 'Sidebar Options', 'genesis-simple-sidebars' ); ?></h3>
<table class="form-table"> <table class="form-table">
<?php if ( is_registered_sidebar( 'header-right' ) ) : ?> <?php if ( is_registered_sidebar( 'header-right' ) ) : ?>
<tr class="form-field"> <tr class="form-field">
<th scope="row" valign="top"><label for="genesis-meta[_ss_header]"><?php esc_html_e( 'Header Right', 'genesis-simple-sidebars' ); ?></label></th> <th scope="row" valign="top"><label for="genesis-meta[_ss_header]"><?php _e( 'Header Right', 'genesis-simple-sidebars' ); ?></label></th>
<td> <td>
<select name="genesis-meta[_ss_header]" id="genesis-meta[_ss_header]" style="padding-right: 10px;"> <select name="genesis-meta[_ss_header]" id="genesis-meta[_ss_header]" style="padding-right: 10px;">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option> <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php <?php
foreach ( (array) $sidebars as $sidebar_id => $info ) { foreach ( (array) $sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $sidebar_id ), selected( $sidebar_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> </select>
@@ -28,13 +20,13 @@ $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
<?php endif; ?> <?php endif; ?>
<tr class="form-field"> <tr class="form-field">
<th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar]"><?php esc_html_e( 'Primary Sidebar', 'genesis-simple-sidebars' ); ?></label></th> <th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar]"><?php _e( 'Primary Sidebar', 'genesis-simple-sidebars' ); ?></label></th>
<td> <td>
<select name="genesis-meta[_ss_sidebar]" id="genesis-meta[_ss_sidebar]" style="padding-right: 10px;"> <select name="genesis-meta[_ss_sidebar]" id="genesis-meta[_ss_sidebar]" style="padding-right: 10px;">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option> <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php <?php
foreach ( (array) $sidebars as $sidebar_id => $info ) { foreach ( (array) $sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $sidebar_id ), selected( $sidebar_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> </select>
@@ -43,13 +35,13 @@ $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
<?php if ( Genesis_Simple_Sidebars()->core->has_3_column_layout() ) : ?> <?php if ( Genesis_Simple_Sidebars()->core->has_3_column_layout() ) : ?>
<tr class="form-field"> <tr class="form-field">
<th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar_alt]"><?php esc_html_e( 'Secondary Sidebar', 'genesis-simple-sidebars' ); ?></label></th> <th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar_alt]"><?php _e( 'Secondary Sidebar', 'genesis-simple-sidebars' ); ?></label></th>
<td> <td>
<select name="genesis-meta[_ss_sidebar_alt]" id="genesis-meta[_ss_sidebar_alt]" style="padding-right: 10px;"> <select name="genesis-meta[_ss_sidebar_alt]" id="genesis-meta[_ss_sidebar_alt]" style="padding-right: 10px;">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option> <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php <?php
foreach ( (array) $sidebars as $sidebar_id => $info ) { foreach ( (array) $sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $sidebar_id ), selected( $sidebar_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> </select>
+48 -72
View File
@@ -1,14 +1,14 @@
# Copyright (C) 2024 StudioPress # Copyright (C) 2015 Nathan Rice
# This file is distributed under the GNU General Public License v2.0 (or later). # This file is distributed under the GNU General Public License v2.0 (or later).
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Genesis Simple Sidebars 2.2.3\n" "Project-Id-Version: Genesis Simple Sidebars 2.0.2\n"
"Report-Msgid-Bugs-To: StudioPress <translations@studiopress.com>\n" "Report-Msgid-Bugs-To: StudioPress <translations@studiopress.com>\n"
"POT-Creation-Date: 2024-03-06 09:04:30+00:00\n" "POT-Creation-Date: 2015-09-29 20:53:32+00:00\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
"Last-Translator: StudioPress <translations@studiopress.com>\n" "Last-Translator: StudioPress <translations@studiopress.com>\n"
"Language-Team: English <translations@studiopress.com>\n" "Language-Team: English <translations@studiopress.com>\n"
"X-Generator: grunt-wp-i18n 0.4.4\n" "X-Generator: grunt-wp-i18n 0.4.4\n"
@@ -24,156 +24,132 @@ msgstr ""
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
"X-Textdomain-Support: yes\n" "X-Textdomain-Support: yes\n"
#: includes/class-genesis-simple-sidebars-admin.php:54 #: includes/admin.php:32 includes/views/main.php:2
#: includes/views/admin-main.php:10
msgid "Genesis - Simple Sidebars" msgid "Genesis - Simple Sidebars"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:55 #: includes/admin.php:33
msgid "Simple Sidebars" msgid "Simple Sidebars"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:133 #: includes/admin.php:107
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:134 #: includes/admin.php:108
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:203 #: includes/admin.php:173
msgid "New sidebar successfully created!" msgid "New sidebar successfully created!"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:208 #: includes/admin.php:178
msgid "Sidebar successfully edited!" msgid "Sidebar successfully edited!"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:213 #: includes/admin.php:183
msgid "Sidebar successfully deleted." msgid "Sidebar successfully deleted."
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:362 #: includes/admin.php:319
msgid "Oops! Please choose a valid Name for this sidebar" msgid "Oops! Please choose a valid Name and ID for this sidebar"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:364 #: includes/admin.php:322
msgid "Oops! That sidebar ID already exists" msgid "Oops! That sidebar ID already exists"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:366 #: includes/admin.php:325
msgid "" msgid ""
"Oops! You are trying to edit a sidebar that does not exist, or is not " "Oops! You are trying to edit a sidebar that does not exist, or is not "
"editable" "editable"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:368 #: includes/admin.php:328
msgid "" msgid ""
"Oops! You are trying to delete a sidebar that does not exist, or cannot be " "Oops! You are trying to delete a sidebar that does not exist, or cannot be "
"deleted" "deleted"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:370 #: includes/admin.php:331
msgid "Oops! Something went wrong. Try again." msgid "Oops! Something went wrong. Try again."
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars-entry.php:33 #: includes/inpost.php:12
msgid "Sidebar Selection" msgid "Sidebar Selection"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars.php:99 #: includes/inpost.php:35 includes/inpost.php:50 includes/term.php:37
msgid "upgrade to" #: includes/term.php:54
msgid "Default"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars.php:99 #: includes/term.php:30
msgid "install and activate" msgid "Sidebar Options"
msgstr "" msgstr ""
#: includes/class-genesis-simple-sidebars.php:102 #: includes/term.php:34
#. translators: %1$s is WordPress minimum version, %2$s is Genesis minimum msgid "Primary Sidebar"
#. version, %3$s is action and %4$s is link.
msgid ""
"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."
msgstr "" msgstr ""
#: includes/deprecated.php:68 #: includes/term.php:51
msgid "dynamic_sidebar() with sidebars_widget filter" msgid "Secondary Sidebar"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:14 #: includes/views/edit.php:5
msgid "Nice try, partner. But that sidebar doesn't exist. Click back and try again." msgid "Nice try, partner. But that sidebar doesn't exist. Click back and try again."
msgstr "" msgstr ""
#: includes/views/admin-edit.php:18 #: includes/views/edit.php:9
msgid "Edit Sidebar" msgid "Edit Sidebar"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:26 includes/views/admin-main.php:21 #: includes/views/edit.php:17 includes/views/main.php:13
#: includes/views/admin-main.php:29 includes/views/admin-main.php:56 #: includes/views/main.php:21 includes/views/main.php:48
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:28 includes/views/admin-main.php:58 #: includes/views/edit.php:19 includes/views/main.php:50
msgid "A recognizable name for your new sidebar widget area" msgid "A recognizable name for your new sidebar widget area"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:32 includes/views/admin-main.php:22 #: includes/views/edit.php:23 includes/views/main.php:14
#: includes/views/admin-main.php:30 includes/views/admin-main.php:62 #: includes/views/main.php:22 includes/views/main.php:54
msgid "ID" msgid "ID"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:37 #: includes/views/edit.php:27
msgid "" msgid ""
"The unique ID is used to register the sidebar widget area (cannot be " "The unique ID is used to register the sidebar widget area (cannot be "
"changed)" "changed)"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:41 includes/views/admin-main.php:23 #: includes/views/edit.php:31 includes/views/main.php:15
#: includes/views/admin-main.php:31 includes/views/admin-main.php:68 #: includes/views/main.php:23 includes/views/main.php:60
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: includes/views/admin-edit.php:47 #: includes/views/edit.php:37
msgid "Update" msgid "Update"
msgstr "" msgstr ""
#: includes/views/admin-main.php:17 #: includes/views/main.php:9
msgid "Current Sidebars" msgid "Current Sidebars"
msgstr "" msgstr ""
#: includes/views/admin-main.php:50 includes/views/admin-main.php:72 #: includes/views/main.php:42 includes/views/main.php:64
msgid "Add New Sidebar" msgid "Add New Sidebar"
msgstr "" msgstr ""
#: includes/views/admin-main.php:64 #: includes/views/main.php:56
msgid "The unique ID is used to register the sidebar widget area" msgid "The unique ID is used to register the sidebar widget area"
msgstr "" msgstr ""
#: includes/views/entry-metabox-content.php:16 #: plugin.php:48
#: includes/views/entry-metabox-content.php:32 msgid ""
#: includes/views/entry-metabox-content.php:48 "Sorry, you cannot run Simple Sidebars without WordPress %s and <a "
#: includes/views/term-edit-sidebar-form.php:19 "href=\"%s\">Genesis %s</a>, or greater."
#: includes/views/term-edit-sidebar-form.php:34
#: includes/views/term-edit-sidebar-form.php:49
msgid "Default"
msgstr ""
#: includes/views/term-edit-sidebar-form.php:11
msgid "Sidebar Options"
msgstr ""
#: includes/views/term-edit-sidebar-form.php:16
msgid "Header Right"
msgstr ""
#: includes/views/term-edit-sidebar-form.php:31
msgid "Primary Sidebar"
msgstr ""
#: includes/views/term-edit-sidebar-form.php:46
msgid "Secondary Sidebar"
msgstr "" msgstr ""
#. Plugin Name of the plugin/theme #. Plugin Name of the plugin/theme
@@ -181,7 +157,7 @@ msgid "Genesis Simple Sidebars"
msgstr "" msgstr ""
#. Plugin URI of the plugin/theme #. Plugin URI of the plugin/theme
msgid "https://github.com/studiopress/genesis-simple-sidebars" msgid "http://www.studiopress.com/plugins/simple-sidebars"
msgstr "" msgstr ""
#. Description of the plugin/theme #. Description of the plugin/theme
@@ -191,9 +167,9 @@ msgid ""
msgstr "" msgstr ""
#. Author of the plugin/theme #. Author of the plugin/theme
msgid "StudioPress" msgid "Nathan Rice"
msgstr "" msgstr ""
#. Author URI of the plugin/theme #. Author URI of the plugin/theme
msgid "https://www.studiopress.com/" msgid "http://www.nathanrice.net/"
msgstr "" msgstr ""
+3 -3
View File
@@ -5,11 +5,11 @@
"type": "git", "type": "git",
"url": "https://github.com/copyblogger/genesis-simple-sidebars" "url": "https://github.com/copyblogger/genesis-simple-sidebars"
}, },
"dependencies": {},
"devDependencies": { "devDependencies": {
"grunt": "^0.4.5", "grunt": "^0.4.5",
"grunt-autoprefixer": "^0.8.1", "grunt-autoprefixer": "^0.8.1",
"grunt-checktextdomain": "^0.1.1", "grunt-checktextdomain": "^0.1.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-cssmin": "^0.10.0", "grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-imagemin": "^0.7.1", "grunt-contrib-imagemin": "^0.7.1",
"grunt-contrib-jshint": "^0.10.0", "grunt-contrib-jshint": "^0.10.0",
@@ -20,7 +20,7 @@
"grunt-jsvalidate": "^0.2.2", "grunt-jsvalidate": "^0.2.2",
"grunt-phplint": "0.0.5", "grunt-phplint": "0.0.5",
"grunt-styledocco": "^0.1.4", "grunt-styledocco": "^0.1.4",
"grunt-wp-i18n": "^1.0.3", "grunt-wp-i18n": "^0.4.7",
"load-grunt-tasks": "^0.6.0" "load-grunt-tasks": "^0.6.0"
}, },
"plugin": { "plugin": {
@@ -29,7 +29,7 @@
"description": "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.", "description": "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.",
"author": "StudioPress", "author": "StudioPress",
"authoruri": "http://www.studiopress.com/", "authoruri": "http://www.studiopress.com/",
"version": "2.2.3", "version": "2.0.2",
"license": "GPL-2.0+", "license": "GPL-2.0+",
"licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html", "licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html",
"textdomain": "genesis-simple-sidebars" "textdomain": "genesis-simple-sidebars"
+16 -22
View File
@@ -1,26 +1,20 @@
<?php <?php
/** /*
* Plugin Name: Genesis Simple Sidebars Plugin Name: Genesis Simple Sidebars
* Plugin URI: https://github.com/studiopress/genesis-simple-sidebars Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
* Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
* Version: 2.2.3
* Author: StudioPress
* Author URI: https://www.studiopress.com/
* License: GNU General Public License v2.0 (or later)
* License URI: https://www.opensource.org/licenses/gpl-license.php
*
* Text Domain: genesis-simple-sidebars
* Domain Path: /languages
*
* @package genesis-simple-sidebars
*/
/** Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
* Load the plugin file.
*/
if ( ! defined( 'ABSPATH' ) ) { Author: Nathan Rice
exit; Author URI: http://www.nathanrice.net/
}
require_once plugin_dir_path( __FILE__ ) . 'genesis-simple-sidebars.php'; Version: 2.1.0
Text Domain: genesis-simple-sidebars
Domain Path: /languages/
License: GNU General Public License v2.0 (or later)
License URI: http://www.opensource.org/licenses/gpl-license.php
*/
require_once( plugin_dir_path( __FILE__ ) . 'genesis-simple-sidebars.php' );
+6 -24
View File
@@ -1,10 +1,10 @@
=== Plugin Name === === Plugin Name ===
Contributors: nathanrice, wpmuguru, marksabbath Contributors: nathanrice, wpmuguru
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
Tags: hooks, genesis, genesiswp, studiopress Tags: hooks, genesis, genesiswp, studiopress
Requires at least: 4.7.3 Requires at least: 3.6
Tested up to: 6.9 Tested up to: 4.5
Stable tag: 2.2.3 Stable tag: 2.1.0
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. 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.
@@ -37,28 +37,8 @@ Not in the way you're probably thinking. The markup surrounding the widget area
== Changelog == == Changelog ==
= 2.2.3 =
* Prevent a PHP fatal error under PHP 8.x if incomplete sidebar data exists.
* Fix a PHP deprecation warning under PHP 8.x.
* Fix Genesis download link in admin notice if a Genesis child theme is not active.
= 2.2.2 =
* Fix overlapping of sidebar selector in editor.
= 2.2.1 =
* Allow sidebars to show in the WordPress Posts page.
= 2.2.0 =
* Fixed coding standards errors.
* Introduced coding standards validation.
= 2.1.0 = = 2.1.0 =
* Rewrite based on new plugin boilerplate. * Rewrite based on new plugin boilerplate.
* Make ID field readonly, rather than disabled.
* Add header widget area support.
* Allow for empty ID (auto-generate ID from name).
* Allow for only alphanumeric characters in ID.
* Use WordPress native term meta functions.
= 2.0.3 = = 2.0.3 =
* Fix warnings and notices. * Fix warnings and notices.
@@ -100,3 +80,5 @@ Not in the way you're probably thinking. The markup surrounding the widget area
= 0.1 = = 0.1 =
* Initial Alpha Release. * Initial Alpha Release.