135 Commits

Author SHA1 Message Date
Benjamin Turner ad21a5c2e1 Merge pull request #66 from studiopress/bump-tested-up-to-6.9
[LOC-6743] chore: bump 'tested up to' to 6.9
2025-12-04 11:48:50 -08:00
joshuapregua 375dea894a chore: bump 'tested up to' to 6.9 2025-12-04 22:52:00 +08:00
Joshua Pregua 4363fd13af Merge pull request #64 from studiopress/joshua/fix-early-trigger
Defer textdomain loading and admin menu registration to fix early translation notice
2025-12-02 22:16:44 +08:00
joshuapregua 316b404131 fix: resolved deprecated notice for early trigger 2025-12-02 20:53:38 +08:00
Ryan Kienstra e18445a021 Merge pull request #62 from studiopress/update/workflow-name
Trivial changes to maybe trigger CI/CD
2024-03-06 11:39:13 -06:00
Ryan Kienstra d93e124665 Remove needless executor 2024-03-06 11:34:44 -06:00
Ryan Kienstra 660de9f64c Change requires job name 2024-03-06 11:33:54 -06:00
Ryan Kienstra 75bd5d75f6 Trivial change to maybe trigger CI/CD 2024-03-06 11:32:08 -06:00
Ryan Kienstra a993edb891 Merge pull request #61 from studiopress/update/svn
Fix `svn` deployment by using `wp-svn` orb
2024-03-06 11:22:04 -06:00
Ryan Kienstra fd1d0c8557 Remove a needless executor 2024-03-06 11:11:43 -06:00
Ryan Kienstra 5d57141f32 Disable dry-run, enable real deployement 2024-03-06 11:07:48 -06:00
Ryan Kienstra ecf4e962cd Use wp-svn orb for deployment 2024-03-06 10:57:06 -06:00
Nick Cernis cedc1a8eaa [NOJIRA] Prepare for release of 2.2.3 (#60)
* chore: bump version to 2.2.3

* chore: add changelog for 2.2.3

* chore: bump tested up to

* chore: add grunt-cli

Allows us to run grunt tasks for release prep without having
to install grunt globally.

For example:

```sh
npx grunt checktextdomain
npx grunt makepot
```

* chore: upgrade grunt-wp-i18n

`npx grunt makepot` fails otherwise.

* chore: regenerate pot file

By running `npx grunt makepot`.

No changes to strings, just updates to the version and dates.
2024-03-06 15:07:10 +01:00
Nick Cernis b56186f3d8 fix: display Genesis download link (#59)
Instead of the anchor tag as plaintext, show the clickable link.
2024-03-06 09:28:32 +01:00
Nick Cernis c735f066ae fix: deprecation warning dynamic 'term' property (#58)
Resolves:

PHP Deprecated:  Creation of dynamic property Genesis_Simple_Sidebars::$term is deprecated in /Users/user.name/Local Sites/php82/app/public/wp-content/plugins/genesis-simple-sidebars/includes/class-genesis-simple-sidebars.php on line 162
2024-03-06 09:27:59 +01:00
Nick Cernis 0552098a50 [GF-3978] fix: stop corrupt sidebar data from causing errors (#56)
* fix: stop corrupt sidebar data from causing errors

By filtering out sidebars without a name in get_sidebars.

The name is a required field when entering new sidebars,
so sidebars missing a name are likely corrupt.

Designed to address "Cannot access offset of type string on string"
when trying to access $sidebar['name'] for sidebars without a name.

See https://wordpress.org/support/topic/php-8-2-error-6/.

* chore: formatting
2024-03-06 09:27:45 +01:00
Ryan Kienstra 730d22e4d5 Merge pull request #55 from studiopress/bump-tested-up-to/6.3
Bump 'Tested up to' version to 6.3
2023-08-07 11:31:45 -05:00
Ryan Kienstra d2a262cd37 Bump 'Tested up to' version to 6.3 2023-08-07 10:57:48 -05:00
Ryan Kienstra d49d37d866 Merge pull request #54 from studiopress/bump-tested-up-to/6.2
Bump 'Tested up to' version to 6.2
2023-04-03 11:46:10 -06:00
Ryan Kienstra 73de1a8c5b Bump 'Tested up to' version to 6.2 2023-04-03 10:21:44 -06:00
Ryan Kienstra a3dd4192c2 Merge pull request #53 from studiopress/bump-tested-up-to/6.1
Bump 'Tested up to' version to 6.1
2022-11-01 13:23:12 -06:00
Ryan Kienstra c800c19da9 Bump 'Tested up to' version to 6.1 2022-11-01 12:49:35 -06:00
Ryan Kienstra e61a2d862d Merge pull request #52 from studiopress/bump-tested-up-to/6.0
Bump 'Tested up to' version to 6.0
2022-05-18 11:15:58 -05:00
Ryan Kienstra 3733b6d7a2 And another empty commit to trigger a build 2022-05-17 14:32:02 -05:00
Ryan Kienstra 902baa2c0b Another empty commit to see if this job runs 2022-05-11 15:21:59 -05:00
Ryan Kienstra 1865fc7080 Remove the workflows version 2022-05-11 12:38:12 -05:00
Ryan Kienstra 43e0b9a824 Bump 'Tested up to' version to 6.0 2022-05-11 12:36:35 -05:00
Ryan Kienstra 161091eef1 Merge pull request #51 from studiopress/update/php-8.1-checks
Update `composer.json` to run linting for PHP `8.1`
2022-04-28 12:37:49 -06:00
Ryan Kienstra f1a919335e Update version of php_codesniffer 2022-04-28 10:45:53 -06:00
Ryan Kienstra 8e11069aa4 Add PHP 8 to require-dev 2022-04-28 10:43:40 -06:00
Ryan Kienstra 1d845a9766 Allow plugins and do composer update 2022-04-28 10:41:08 -06:00
Ben Moore c8da5ccbb4 Merge pull request #49 from studiopress/try/deploy
CircleCI changes
2020-04-09 13:41:12 -05:00
Ben Moore 49c6a700a4 CircleCI Deploy to WP Repo
CircleCI Deploy to WP Repo

CircleCI Deploy to WP Repo

CircleCI Deploy to WP Repo

ci: swap order for tag deploy

ci: swap order for tag deploy
2020-04-09 13:38:44 -05:00
Ben Moore 9974ed6b7c Merge branch 'develop' 2020-04-09 12:17:21 -05:00
Ben Moore 11692634b2 Merge pull request #48 from studiopress/try/deploy
Git to WP SVN bugs fixed
2020-04-09 12:16:55 -05:00
Ben Moore 76472f6623 ci: Git to WP SVN bugs fixed
ci: working_directory during svn push

ci: working_directory during svn push

ci: working_directory during svn push

ci: svn_add_changes bug

ci: double check env vars and context is working

ci: svn_setup bug fixed
2020-04-09 12:15:28 -05:00
Ben Moore 35dbd21c7a Merge branch 'develop' 2020-04-09 10:38:00 -05:00
Ben Moore 21718787a6 Merge pull request #47 from studiopress/try/deploy
ci: deploy to WordPress Repo
2020-04-09 10:37:28 -05:00
Ben Moore 9275d2cb7e ci: remove debug steps 2020-04-09 10:36:15 -05:00
Ben Moore e0fde9ecd2 chore: merge conflicts fixed 2020-04-09 10:32:21 -05:00
Ben Moore b4f4078de0 ci: deploy to WP Repo
ci: fix bug in bash scripting

ci: remove manual approval job from tag deploy workflow

ci: remove manual approval job from tag deploy workflow

ci: circle config testig

ci: fix svn_setup error

ci: fix svn_setup error

ci: split up svn commands for better error reporting

ci: test svn_setup fix

ci: svn_setup fix

ci: debug working_directory

ci: svn_setup fix maybe?

ci: working_directory updates

ci: working_directory updates

ci: working_directory updates

ci: working_directory updates

ci: svn scripting is working
2020-04-09 10:28:27 -05:00
Ben Moore de75732223 Merge branch 'develop' 2020-04-08 15:59:03 -05:00
Ben Moore 3ebf3b3514 Merge pull request #46 from studiopress/BMO/GF-1933-git-to-s3
ci: fix svn_setup error
2020-04-08 15:58:50 -05:00
Ben Moore d356b1228b ci: fix svn_setup error 2020-04-08 15:57:03 -05:00
Ben Moore 4559c21dd9 Merge branch 'develop' 2020-04-08 15:48:55 -05:00
Ben Moore 69024b6254 Merge pull request #45 from studiopress/BMO/GF-1933-git-to-s3
ci: fix svn_setup error
2020-04-08 15:45:23 -05:00
Ben Moore 4329d4952d ci: fix svn_setup error 2020-04-08 15:43:44 -05:00
Ben Moore b12403fcbd Merge pull request #44 from studiopress/develop
2.2.2 Version Bump and readme
2020-04-08 15:39:58 -05:00
Ben Moore 5bf21ecdb2 Merge pull request #43 from studiopress/BMO/GF-1933-git-to-s3
GF-1933 Git to SVN
2020-04-08 14:44:57 -05:00
Ben Moore edec87910b ci: circle config testig 2020-04-08 14:41:13 -05:00
Ben Moore c93f511288 ci: remove manual approval job from tag deploy workflow 2020-04-08 12:48:40 -05:00
Ben Moore 4f5e53d36e ci: remove manual approval job from tag deploy workflow 2020-04-08 12:47:01 -05:00
Ben Moore 4f8ea7a7ec ci: fix bug in bash scripting 2020-04-06 11:06:07 -05:00
Ben Moore 0933a3007d ci: include extra protections against tags in other branches 2020-04-06 11:03:39 -05:00
Phil Johnston 000eee84fa 2.2.2 Version Bump and readme (#42)
* 2.2.2 Version Bump and readme

Co-Authored-By: Nick Cernis <nick@cern.is>
Co-authored-by: Nathan Rice <ncrice@gmail.com>
2020-04-03 09:54:57 -04:00
Ben Moore 11dd0872e6 Merge pull request #40 from studiopress/BMO/GF-1933-git-to-s3
GF-1933 Git to SVN config in CircleCI
2020-04-02 13:17:23 -05:00
Phil Johnston 236a8705b0 Merge pull request #41 from studiopress/PJ/tested-up-to-5.4
Fix for 5.4
2020-04-02 11:43:55 -04:00
Phil Johnston b5a76505ff Remove inline width (created overlap) 2020-04-01 14:06:57 -04:00
Phil Johnston 46921d818d Bump tested up to 2020-04-01 13:53:47 -04:00
Ben Moore 80191d03b1 chore: adjust order of requires and filters in workflows 2020-03-31 10:33:58 -05:00
Ben Moore f90e899c8f fix: typo in .svnignore file 2020-03-31 09:38:44 -05:00
Ben Moore 34a568754e ci: forgot to add context to branch_deploy workflow 2020-03-30 15:48:48 -05:00
Ben Moore 52e99ccf1f ci: fix new job naming 2020-03-30 15:28:16 -05:00
Ben Moore 27315c4b74 ci: fix deploy typo 2020-03-30 15:27:11 -05:00
Ben Moore 8baf6f4a0f ci: fix missing param 2020-03-30 15:26:15 -05:00
Ben Moore 013f0c7563 ci: fix branches typo 2020-03-30 15:23:48 -05:00
Ben Moore 258993ffaf ci: include all deploy scripting in config 2020-03-30 15:22:25 -05:00
Ben Moore e51f16c591 ci: add git to s3 script and CircleCI config 2020-03-30 12:52:19 -05:00
Marcos Antonio Schratzenstaller 51084ca1b1 2.2.1 release 2019-07-09 12:01:19 -03:00
Marcos Antonio Schratzenstaller e5d32cca14 Allow sidebars to show in the custom Blog Posts page
Adds the ability to show the sidebars when using a custom Blog Posts page set via Settings->Reading.

Fixes #28
2019-07-03 11:26:08 -03:00
Marcos Schratzenstaller f42b9c04db Allow sidebars to show in the custom Blog Posts page 2019-07-01 17:28:17 -03:00
Nathan Rice c44b89af61 Prep 2.2.0 for release 2019-05-07 08:56:32 -04:00
Marcos Schratzenstaller 1b47ad4228 Other composer.json indentation fixes. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller f7b4169fb7 Indentation fix. Again. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller f86eff86b0 Indentation fix. 2019-05-07 08:54:54 -04:00
Jen Baumann 4313fdd01a Update composer.json
Co-Authored-By: marksabbath <marksabbath@gmail.com>
2019-05-07 08:54:54 -04:00
Jen Baumann cb2ddf1c26 Update composer.json
Co-Authored-By: marksabbath <marksabbath@gmail.com>
2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller 274ca9fd6f Fix new sidebar not saving when using classic editor. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller 1707410622 Fix hanging when a sidebar with the same id is added. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller 70084ece61 Rolling back plugin header to plugin.php, updating composer.json. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller cb0fdc65b2 Bumping up the version on plugin's variable. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller f1d1f65f7d Bumping up the version again. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller d6b32b1e70 Coding standards erorrs fixed, sanitization and escaping strings. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller 442cb88868 Removing vendor/ directory. 2019-05-07 08:54:54 -04:00
Marcos Schratzenstaller fd504d41ac Introducing coding standards validation. 2019-05-07 08:54:54 -04:00
Nick Cernis 6e40c921ab Ensure term fields are added after the PODS plugin registers terms
Fixes #34.
2019-04-24 10:22:34 -04:00
Nathan Rice 87b2e738d4 Docs, and bump WP version. Fixes #24. 2017-04-13 15:05:19 -04:00
Nathan Rice f83f625c84 Merge from develop. 2017-04-13 13:12:29 -04:00
Nathan Rice 42315b2944 Indicate replacement for ss_do_one_sidebar(). see #22. 2017-03-10 17:18:33 -05:00
Nathan Rice 6f8b1a2069 Modify deprecated functions for backward compatibility. see #22. 2017-03-10 14:27:11 -05:00
Nathan Rice 7b439c95a7 Use more reliable method for switching sidebars. should eliminate issues moving sidebars in #22. 2017-03-08 22:42:02 -05:00
Nathan Rice 775ece1a8b Forgot to change version after copy/paste. 2017-03-07 15:21:21 -05:00
Nathan Rice a3dc69479a Load textdomain first thing. 2017-03-07 15:18:28 -05:00
Nathan Rice f2280a3fae Change minimum requirement message. 2017-03-06 15:41:58 -05:00
Nathan Rice 991b354175 Fix typo. 2017-03-06 13:32:33 -05:00
Nathan Rice 491a2b74fc Better wording for admin notice. 2017-03-06 12:32:21 -05:00
Nathan Rice e5afd4f9ef Better wording for admin notice. 2017-03-06 12:29:22 -05:00
Nathan Rice 7d10d3c408 Fix translations issues. see #20. 2017-03-06 11:36:53 -05:00
Nathan Rice 1509276708 Change activation hook to admin notice. see #19. 2017-03-06 11:01:36 -05:00
Nathan Rice e5c3b527f1 Account for net result empty sidebar ID. 2017-03-03 13:09:34 -05:00
Nathan Rice 6afb3213f7 Account for numeric sidebars. 2017-03-03 10:50:52 -05:00
Nathan Rice dffb99c57b Remove debugging code. 2017-03-03 10:44:09 -05:00
Nathan Rice 49d5cfce79 Include deprecated.php, update readme.txt. 2017-03-01 20:01:43 -05:00
Nathan Rice febb5ede11 Rewrite based on new plugin boilerplate. 2017-03-01 19:51:34 -05:00
Nathan Rice c7fdc4387e Bump version. 2016-06-17 17:04:30 -04:00
Tiago Hillebrandt eff4992b6c ping gitbot 2016-06-13 14:20:36 -05:00
Nathan Rice 97fac5c57b Fix errors associated with variables not being set. see #8, #17. 2016-04-21 11:36:53 -04:00
Nathan Rice 36553a6557 Bump version, update Readme.txt. 2016-02-24 14:54:21 -05:00
Nathan Rice 4d09f1c1ac Update POT. 2016-02-24 14:51:29 -05:00
Nathan Rice 93a304aa06 Update for new term meta handling. 2016-02-24 14:48:19 -05:00
Lauren Mancke 4106eb6c68 Add StudioPress 2016-01-25 14:11:33 -05:00
Nathan Rice be896fd123 Update grunt dependencies. 2015-10-12 16:04:42 -04:00
Nathan Rice e63975e620 Update grunt tasks. 2015-09-29 17:34:15 -04:00
Nathan Rice ed788e7432 Merge branch 'develop' 2015-09-29 17:19:05 -04:00
Nathan Rice 5d5b60de23 Grunt, POT. 2015-09-29 17:18:50 -04:00
Nick Croft 7395bd6db3 don't show metabox if both sidebars disabled
addresses #9
2014-06-25 13:10:30 -04:00
Nick Croft ee29d99335 Revert "Updated to simplify admin load"
This reverts commit 5300ec9601.
2014-06-20 10:22:55 -04:00
Nick Croft 5300ec9601 Updated to simplify admin load
added a class exist check before requiring the admin.php file to ensure
that the class will exist and removed the genesis_admin_menu hook to
simplify issues when working with the global admin class object.
2014-06-20 09:59:55 -04:00
Nick Croft ff6077078d Merge branch 'develop' 2014-06-10 10:57:54 -04:00
Nick Croft 8d371db957 Make admin object global
To make it easier to alter the admin behavior the admin object should
be made into a global variable. This addresses that.
2014-06-09 11:45:48 -04:00
Nathan Rice 4b8381b9ca Comment standard. 2013-08-26 20:10:32 -04:00
Nathan Rice 4ab113f4a8 Sync with develop. 2013-08-26 20:05:25 -04:00
Nathan Rice eeddc174f8 sweep. 2013-08-26 20:03:20 -04:00
Nathan Rice 62da09e2df Merge to master. 2013-08-26 15:08:01 -04:00
Nathan Rice f021c01b25 Tagging 2.0.1. 2013-08-26 15:04:07 -04:00
Nathan Rice eedd494ae5 Use proper key for Genesis 2.0.1 compatibility. 2013-08-26 15:02:02 -04:00
Nathan Rice d8e63f2ccd Merge pull request #2 from GaryJones/patch-1
Fix incorrect text domain
2013-08-26 11:58:40 -07:00
Nathan Rice dcae718c4a Merge pull request #1 from billerickson/develop
use sidebar name rather than hardcoded labels
2013-08-26 11:58:24 -07:00
Gary Jones b69d318af9 Fix incorrect text domain 2013-08-20 03:40:55 +01:00
Bill Erickson f84db05c75 use sidebar name rather than hardcoded labels 2013-08-09 18:44:30 -05:00
Nathan Rice c47dd22e92 Tagging 2.0.0. 2013-08-09 13:43:39 -04:00
Nathan Rice 39f21130f4 Better Genesis version detection. 2013-08-09 13:38:26 -04:00
Nathan Rice 718dfd9a55 Genesis 2.0 compatibility, standards. 2013-08-09 13:35:43 -04:00
Nathan Rice cf767d3206 Tagging 1.0.0. 2013-08-09 13:11:17 -04:00
Nathan Rice 160fe214ed Clean slate. 2013-08-09 13:04:24 -04:00
31 changed files with 2478 additions and 849 deletions
+39
View File
@@ -0,0 +1,39 @@
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
@@ -0,0 +1,21 @@
# 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
+14
View File
@@ -0,0 +1,14 @@
# Default behavior
* text=auto
# Text files
*.php text
*.css text
*.js text
*.md text
# Binary files
*.png binary
*.jpg binary
*.gif binary
*.ico binary
+6
View File
@@ -0,0 +1,6 @@
.DS_Store
Thumbs.db
.svn
node_modules/
vendor/
*.swp
+6
View File
@@ -0,0 +1,6 @@
.git
.gitignore
.gitattributes
.svnignore
node_modules
.circleci
+101
View File
@@ -0,0 +1,101 @@
'use strict';
module.exports = function(grunt) {
// Load tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Dependencies
// PHP
// Lint .php files for syntax errors
phplint: {
all: [ '*.php', 'lib/**/*.php' ]
},
// I18n
// Add text domain as last argument of i18n functions
addtextdomain: {
php: {
options: {
updateDomains: true
},
target: {
files: {
src: [
'*.php',
'lib/**/*.php'
]
}
}
}
},
// Check text domain is last argument of i18n functions
checktextdomain: {
options: {
text_domain: '<%= pkg.name %>',
keywords: [
'__:1,2d',
'_e:1,2d',
'_x:1,2c,3d',
'_ex:1,2c,3d',
'_n:1,2,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d',
'esc_attr__:1,2d',
'esc_html__:1,2d',
'esc_attr_e:1,2d',
'esc_html_e:1,2d',
'esc_attr_x:1,2c,3d',
'esc_html_x:1,2c,3d'
]
},
files: {
expand: true,
src: [
'*.php',
'includes/**/*.php'
]
}
},
// Build language .pot file
makepot: {
plugin: {
options: {
domainPath: '/languages',
processPot: function( pot ) {
pot.headers['report-msgid-bugs-to'] = 'StudioPress <translations@studiopress.com>';
pot.headers['last-translator'] = 'StudioPress <translations@studiopress.com>';
pot.headers['language-team'] = 'English <translations@studiopress.com>';
pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;';
pot.headers['x-generator'] = 'grunt-wp-i18n 0.4.4';
pot.headers['x-poedit-basepath'] = '.';
pot.headers['x-poedit-language'] = 'English';
pot.headers['x-poedit-country'] = 'UNITED STATES';
pot.headers['x-poedit-sourcecharset'] = 'utf-8';
pot.headers['x-poedit-keywordslist'] = '__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;';
pot.headers['x-poedit-bookmarks'] = '';
pot.headers['x-poedit-searchpath-0'] = '.';
pot.headers['x-textdomain-support'] = 'yes';
return pot;
},
type: 'wp-plugin'
}
}
},
});
};
-181
View File
@@ -1,181 +0,0 @@
<?php
/**
* This registers the settings field and adds empty array to the options table
*/
add_action('admin_init', 'register_ss_settings');
function register_ss_settings() {
register_setting(SS_SETTINGS_FIELD, SS_SETTINGS_FIELD);
add_option(SS_SETTINGS_FIELD, array(), '', 'yes');
}
/**
* This function adds our "Simple Sidebars" submenu item
*/
add_action('admin_menu', 'ss_settings_init', 15);
function ss_settings_init() {
add_submenu_page('genesis', __('Simple Sidebars','ss'), __('Simple Sidebars','ss'), 'manage_options', 'simple-sidebars', 'ss_settings_admin');
}
add_action('admin_init', 'ss_action_functions');
function ss_action_functions() {
if ( !isset( $_REQUEST['page'] ) || $_REQUEST['page'] != 'simple-sidebars' ) {
return;
}
/**
* This section handles the data if a new sidebar is created
*/
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'create' ) {
ss_create_sidebar( $_POST['new_sidebar'] );
}
/**
* This section will handle the data if a sidebar is deleted
*/
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'delete' && isset( $_REQUEST['id'] ) ) {
ss_delete_sidebar( $_REQUEST['id'] );
}
/**
* This section will handle the data if a sidebar is to be modified
*/
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'edit' && !isset( $_REQUEST['id'] ) ) {
ss_edit_sidebar( $_POST['edit_sidebar'] );
}
}
/**
* This function is what actually gets output to the page.
* It handles the markup, builds the form, etc.
*/
function ss_settings_admin() { ?>
<div class="wrap">
<?php
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'edit' ) :
$_sidebars = get_option( SS_SETTINGS_FIELD );
if ( array_key_exists( $_REQUEST['id'], (array)$_sidebars ) ) {
$_sidebar = stripslashes_deep( $_sidebars[$_REQUEST['id']] );
} else {
wp_die( __('Nice try, partner. But that sidebar doesn\'t exist. Click back and try again.', 'ss') );
}
?>
<?php screen_icon('themes'); ?>
<h2><?php _e('Edit Sidebar', 'ss'); ?></h2>
<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'); ?>
<table class="form-table">
<tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[name]"><?php _e('Name', 'ss'); ?></label></th>
<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 _e('A recognizable name for your new sidebar widget area', 'ss'); ?></p></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[id]"><?php _e('ID', 'ss'); ?></label></th>
<td>
<input type="text" value="<?php echo esc_html( $_REQUEST['id'] ); ?>" size="40" disabled="disabled" />
<input name="edit_sidebar[id]" id="edit_sidebar[id]" type="hidden" value="<?php echo esc_html( $_REQUEST['id'] ); ?>" size="40" />
<p class="description"><?php _e('The unique ID is used to register the sidebar widget area (cannot be changed)', 'ss'); ?></p></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[description]"><?php _e('Description', 'ss'); ?></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>
</tr>
</table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update', 'ss'); ?>" /></p>
</form>
<?php else : ?>
<?php screen_icon('themes'); ?>
<h2><?php _e('Genesis - Simple Sidebars', 'ss'); ?></h2>
<div id="col-container">
<div id="col-right">
<div class="col-wrap">
<h3><?php _e('Current Sidebars', 'ss'); ?></h3>
<table class="widefat tag fixed" cellspacing="0">
<thead>
<tr>
<th scope="col" id="name" class="manage-column column-name"><?php _e('Name', 'ss'); ?></th>
<th scope="col" class="manage-column column-slug"><?php _e('ID', 'ss'); ?></th>
<th scope="col" id="description" class="manage-column column-description"><?php _e('Description', 'ss'); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col" class="manage-column column-name"><?php _e('Name', 'ss'); ?></th>
<th scope="col" class="manage-column column-slug"><?php _e('ID', 'ss'); ?></th>
<th scope="col" class="manage-column column-description"><?php _e('Description', 'ss'); ?></th>
</tr>
</tfoot>
<tbody id="the-list" class="list:tag">
<?php ss_sidebar_table_rows(); ?>
</tbody>
</table>
</div>
</div><!-- /col-right -->
<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php _e('Add New Sidebar', 'ss'); ?></h3>
<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'); ?>
<div class="form-field form-required">
<label for="sidebar-name"><?php _e('Name', 'ss'); ?></label>
<input name="new_sidebar[name]" id="sidebar-name" type="text" value="" size="40" aria-required="true" />
<p><?php _e('A recognizable name for your new sidebar widget area', 'ss'); ?></p>
</div>
<div class="form-field">
<label for="sidebar-id"><?php _e('ID', 'ss'); ?></label>
<input name="new_sidebar[id]" id="sidebar-id" type="text" value="" size="40" />
<p><?php _e('The unique ID is used to register the sidebar widget area', 'ss'); ?></p>
</div>
<div class="form-field">
<label for="sidebar-description"><?php _e('Description', 'ss'); ?></label>
<textarea name="new_sidebar[description]" id="sidebar-description" rows="5" cols="40"></textarea>
</div>
<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php _e('Add New Sidebar', 'ss'); ?>" /></p>
</form></div>
</div>
</div><!-- /col-left -->
</div><!-- /col-container -->
<?php endif; ?>
</div><!-- /wrap -->
<?php
}
+36
View File
@@ -0,0 +1,36 @@
{
"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
@@ -0,0 +1,526 @@
{
"_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"
}
-189
View File
@@ -1,189 +0,0 @@
<?php
function ss_sidebar_table_rows() {
global $wp_registered_sidebars;
$_sidebars = $wp_registered_sidebars;
$alt = true;
foreach ( (array)$_sidebars as $id => $info ) { ?>
<?php
$is_editable = isset( $info['editable'] ) && $info['editable'] ? true : false;
?>
<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&amp;action=edit&amp;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&amp;action=edit&amp;id=' . esc_html( $id ) ); ?>"><?php _e('Edit', 'ss'); ?></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', 'ss'); ?></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>
</tr>
<?php
}
}
function ss_create_sidebar( $args = array() ) {
if ( empty( $args['name'] ) || empty( $args['id'] ) ) {
wp_die( ss_error_message(1) );
exit;
}
// nonce verification
check_admin_referer('simple-sidebars-action_create-sidebar');
// WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user
if ( is_numeric( $args['id'] ) )
$args['id'] = sanitize_title_with_dashes( $args['name'] );
$db = (array)get_option(SS_SETTINGS_FIELD);
$new = array(
sanitize_title_with_dashes( $args['id'] ) => array(
'name' => esc_html( $args['name'] ),
'description' => esc_html( $args['description'] )
)
);
if ( array_key_exists( $args['id'], $db ) ) {
wp_die( ss_error_message(2) );
exit;
}
$_sidebars = wp_parse_args( $new, $db );
update_option( SS_SETTINGS_FIELD, $_sidebars );
wp_redirect( admin_url('admin.php?page=simple-sidebars&created=true') );
exit;
}
function ss_edit_sidebar( $args = array() ) {
if ( empty( $args['name'] ) || empty( $args['id'] ) ) {
wp_die( ss_error_message(3) );
exit;
}
// nonce verification
check_admin_referer('simple-sidebars-action_edit-sidebar');
// WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user
if ( is_numeric( $args['id'] ) )
$args['id'] = sanitize_title_with_dashes( $args['name'] );
$db = (array)get_option(SS_SETTINGS_FIELD);
$new = array(
sanitize_title_with_dashes( $args['id'] ) => array(
'name' => esc_html( $args['name'] ),
'description' => esc_html( $args['description'] )
)
);
if ( !array_key_exists( $args['id'], $db ) ) {
wp_die( ss_error_message(3) );
exit;
}
$_sidebars = wp_parse_args( $new, $db );
update_option( SS_SETTINGS_FIELD, $_sidebars );
wp_redirect( admin_url('admin.php?page=simple-sidebars&edited=true') );
exit;
}
function ss_delete_sidebar( $id = '' ) {
if ( empty( $id ) ) {
wp_die( ss_error_message(4) );
exit;
}
// nonce verification
check_admin_referer('simple-sidebars-action_delete-sidebar');
$_sidebars = (array)get_option( SS_SETTINGS_FIELD );
if ( !isset( $_sidebars[$id] ) ) {
wp_die( ss_error_message(4) );
exit;
}
unset( $_sidebars[$id] );
update_option( SS_SETTINGS_FIELD, $_sidebars );
wp_redirect( admin_url('admin.php?page=simple-sidebars&deleted=true') );
exit;
}
function ss_error_message( $error = false ) {
if ( !$error ) return false;
switch( (int)$error ) {
case 1:
return __('Oops! Please choose a valid Name and ID for this sidebar', 'ss');
break;
case 2:
return __('Oops! That sidebar ID already exists', 'ss');
break;
case 3:
return __('Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'ss');
break;
case 4:
return __('Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted', 'ss');
break;
default:
return __('Oops! Something went wrong. Try again.', 'ss');
}
}
add_action('admin_notices', 'ss_success_message');
function ss_success_message() {
if ( !isset( $_REQUEST['page'] ) || $_REQUEST['page'] != 'simple-sidebars' ) {
return;
}
$format = '<div id="message" class="updated"><p><strong>%s</strong></p></div>';
if ( isset( $_REQUEST['created'] ) && $_REQUEST['created'] === 'true' ) {
printf( $format, __('New sidebar successfully created!', 'ss') );
return;
}
if ( isset( $_REQUEST['edited'] ) && $_REQUEST['edited'] === 'true' ) {
printf( $format, __('Sidebar successfully edited!', 'ss') );
return;
}
if ( isset( $_REQUEST['deleted'] ) && $_REQUEST['deleted'] === 'true' ) {
printf( $format, __('Sidebar successfully deleted.', 'ss') );
return;
}
return;
}
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* Genesis Simple Sidebars constants.
*
* @package genesis-simple-sidebars
*/
/**
* Load the plugin file.
*/
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.
*
* @since 2.1.0
*/
function genesis_simple_sidebars() {
static $object;
if ( null === $object ) {
$object = new Genesis_Simple_Sidebars();
}
return $object;
}
/**
* Initialize the object on `plugins_loaded`.
*/
add_action( 'plugins_loaded', array( Genesis_Simple_Sidebars(), 'init' ) );
@@ -0,0 +1,386 @@
<?php
/**
* Controls the creation, deletion, and editing of Simple Sidebar.
*
* @author StudioPress
* @package genesis-simple-sidebars
*/
/**
* Registers a new admin page, providing content and corresponding menu item
* for the Genesis Simple Sidebars plugin.
*
* @since 1.0.0
*/
class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
/**
* Settings field.
*
* @var string
*
* @since 2.1.0
*/
public $settings_field;
/**
* Constructor.
*/
public function __construct() {
$this->settings_field = Genesis_Simple_Sidebars()->settings_field;
// For backward compatibility.
define( 'SS_SETTINGS_FIELD', $this->settings_field );
}
/**
* Create an admin menu item and settings page.
*
* @since 1.0.0
*
* @uses Genesis_Admin::create() Register the admin page
*
* @see Genesis_Admin_Import_Export::actions() Handle creating, editing, and deleting sidebars.
*/
public function admin_menu() {
$page_id = 'simple-sidebars';
$menu_ops = array(
'submenu' => array(
'parent_slug' => 'genesis',
/*
* 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.
$page_ops = array();
$this->create( $page_id, $menu_ops, $page_ops, $this->settings_field );
// Simpe Sidebar actions (create, edit, or delete).
add_action( 'admin_init', array( $this, 'actions' ) );
}
/**
* Callback for displaying the Simple Sidebars admin page.
*
* Echoes out HTML.
*
* @since 1.0.0
*/
public function admin() {
echo '<div class="wrap">';
// phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
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>';
}
/**
* Display sidebar table rows.
*
* Displays table rows of sidebars for viewing and editing on the main admin page.
*
* @since 1.0.0
*/
public function table_rows() {
global $wp_registered_sidebars;
$_sidebars = $wp_registered_sidebars;
$alt = true;
foreach ( (array) $_sidebars as $id => $info ) :
$is_editable = isset( $info['editable'] ) && $info['editable'] ? true : false;
?>
<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>', 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'] ) );
} 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 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="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>
</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>
</tr>
<?php
endforeach;
}
/**
* Action handler.
*
* Depending on what action was intended by the user, this method calls the appropriate action method.
*
* @since 1.0.0
*/
public function actions() {
if ( ! genesis_is_menu_page( 'simple-sidebars' ) ) {
return;
}
/**
* This section handles the data if a new sidebar is created
*/
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( isset( $_REQUEST['action'] ) && 'create' === $_REQUEST['action'] && isset( $_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
*/
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( isset( $_REQUEST['action'] ) && 'delete' === $_REQUEST['action'] && isset( $_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
*/
if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] && ! isset( $_REQUEST['id'] ) && isset( $_POST['edit_sidebar'] ) ) {
$this->edit_sidebar( array_map( 'sanitize_text_field', wp_unslash( $_POST['edit_sidebar'] ) ) );
}
// phpcs:enable
}
/**
* Add custom notices that display when you successfully create, edit, or delete a sidebar.
*
* @since 1.0.0
*
* @return null Returns null if not on the correct admin page.
*/
public function notices() {
if ( ! genesis_is_menu_page( 'simple-sidebars' ) ) {
return;
}
$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'] ) {
printf( wp_kses_post( $pattern ), esc_html__( 'New sidebar successfully created!', 'genesis-simple-sidebars' ) );
return;
}
if ( isset( $_REQUEST['edited'] ) && 'true' === $_REQUEST['edited'] ) {
printf( wp_kses_post( $pattern ), esc_html__( 'Sidebar successfully edited!', 'genesis-simple-sidebars' ) );
return;
}
if ( isset( $_REQUEST['deleted'] ) && 'true' === $_REQUEST['deleted'] ) {
printf( wp_kses_post( $pattern ), esc_html__( 'Sidebar successfully deleted.', 'genesis-simple-sidebars' ) );
return;
}
}
/**
* Create a sidebar.
*
* @param array $args Arguments.
*
* @since 1.0.0
*/
protected function create_sidebar( $args = array() ) {
if ( empty( $args['name'] ) ) {
wp_die( esc_html( $this->error( 1 ) ) );
exit;
}
// nonce verification.
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.
if ( empty( $args['id'] ) || is_numeric( $args['id'] ) ) {
$args['id'] = $args['name'];
}
// Strip all but alphanumeric, sanitize with dashes.
$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;
// 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(
$id => array(
'name' => esc_html( $args['name'] ),
'description' => esc_html( $args['description'] ),
),
);
if ( array_key_exists( $id, $db ) ) {
wp_die( esc_html( $this->error( 2 ) ) );
exit;
}
$_sidebars = wp_parse_args( $new, $db );
update_option( $this->settings_field, $_sidebars );
wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&created=true' ) );
exit;
}
/**
* Edit a sidebar.
*
* @param array $args Arguments.
* @since 1.0.0
*/
protected function edit_sidebar( $args = array() ) {
if ( empty( $args['name'] ) || empty( $args['id'] ) ) {
wp_die( esc_html( $this->error( 3 ) ) );
exit;
}
// nonce verification.
check_admin_referer( 'simple-sidebars-action_edit-sidebar' );
$db = (array) get_option( $this->settings_field );
$new = array(
$args['id'] => array(
'name' => esc_html( $args['name'] ),
'description' => esc_html( $args['description'] ),
),
);
if ( ! array_key_exists( $args['id'], $db ) ) {
wp_die( esc_html( $this->error( 3 ) ) );
exit;
}
$_sidebars = wp_parse_args( $new, $db );
update_option( $this->settings_field, $_sidebars );
wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&edited=true' ) );
exit;
}
/**
* Delete a sidebar.
*
* @param string $id Id.
* @since 1.0.0
*/
protected function delete_sidebar( $id = '' ) {
if ( empty( $id ) ) {
wp_die( esc_html( $this->error( 4 ) ) );
exit;
}
// nonce verification.
check_admin_referer( 'simple-sidebars-action_delete-sidebar' );
$_sidebars = (array) get_option( $this->settings_field );
if ( ! isset( $_sidebars[ $id ] ) ) {
wp_die( esc_html( $this->error( 4 ) ) );
exit;
}
unset( $_sidebars[ $id ] );
update_option( $this->settings_field, $_sidebars );
wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&deleted=true' ) );
exit;
}
/**
* Returns an error message by ID.
*
* @param bool $error Error id.
*
* @since 1.0.0
*
* @return string Returns an error string based on an error ID.
*/
protected function error( $error = false ) {
if ( ! $error ) {
return false;
}
switch ( (int) $error ) {
case 1:
return __( 'Oops! Please choose a valid Name for this sidebar', 'genesis-simple-sidebars' );
case 2:
return __( 'Oops! That sidebar ID already exists', 'genesis-simple-sidebars' );
case 3:
return __( 'Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'genesis-simple-sidebars' );
case 4:
return __( 'Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted', 'genesis-simple-sidebars' );
default:
return __( 'Oops! Something went wrong. Try again.', 'genesis-simple-sidebars' );
}
}
}
@@ -0,0 +1,235 @@
<?php
/**
* Genesis Simple Sidebars Core.
*
* @package genesis-simple-sidebars
*/
/**
* Controls the core functions of registration and output of Sidebars
*
* @since 2.1.0
*/
class Genesis_Simple_Sidebars_Core {
/**
* The created sidebars.
*
* @var array
*/
private $sidebars;
/**
* Public taxonomies.
*
* @var array
*/
private $public_taxonomies;
/**
* Initialize the class.
*/
public function init() {
add_action( 'after_setup_theme', array( $this, 'backward_compatibility' ) );
add_action( 'widgets_init', array( $this, 'register_sidebars' ) );
add_filter( 'sidebars_widgets', array( $this, 'sidebars_widgets_filter' ) );
}
/**
* 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' );
}
/**
* Take created sidebars and register them with WordPress.
*
* @since 2.1.0
*/
public function register_sidebars() {
$sidebars = $this->get_sidebars();
if ( ! $sidebars ) {
return;
}
// 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,
)
);
}
}
/**
* Filter the widgets in each widget area.
*
* @param array $widgets Widgets.
*
* @since 2.1.0
*/
public function sidebars_widgets_filter( $widgets ) {
$sidebars = array();
if ( is_singular() || is_home() && isset( get_queried_object()->ID ) ) {
$post_id = get_queried_object()->ID;
$sidebars = array(
'sidebar' => genesis_get_custom_field( '_ss_sidebar', $post_id ),
'sidebar-alt' => genesis_get_custom_field( '_ss_sidebar_alt', $post_id ),
'header-right' => genesis_get_custom_field( '_ss_header', $post_id ),
);
}
if ( is_tax() || is_category() || is_tag() ) {
$sidebars = array(
'sidebar' => get_term_meta( get_queried_object()->term_id, '_ss_sidebar', true ),
'sidebar-alt' => get_term_meta( get_queried_object()->term_id, '_ss_sidebar_alt', true ),
'header-right' => get_term_meta( get_queried_object()->term_id, '_ss_header', true ),
);
}
$widgets = $this->swap_widgets( $widgets, $sidebars );
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.
*
* @param bool $cache Indicates if should get from cache.
*
* @since 2.1.0
*/
public function get_sidebars( $cache = true ) {
if ( $cache && ! is_null( $this->sidebars ) ) {
return $this->sidebars;
}
$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 taxonomy ids.
*
* Helper function to return the array keys from a taxonomy query.
*
* @since 2.1.0
*/
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 = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) );
return $this->public_taxonomies;
}
/**
* Determines if this site has disabled 3 column layouts or not.
*
* @since 2.1.0
*/
public function has_3_column_layout() {
$layouts = genesis_get_layouts();
$three_column_layouts = array(
'content-sidebar-sidebar',
'sidebar-content-sidebar',
'sidebar-sidebar-content',
);
foreach ( $three_column_layouts as $layout ) {
if ( array_key_exists( $layout, $layouts ) ) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,79 @@
<?php
/**
* Genesis Simple Sidebars Entry file.
*
* @package genesis-simple-sidebars
*/
/**
* Genesis Simple Sidebars Entry class.
*/
class Genesis_Simple_Sidebars_Entry {
/**
* Init function.
*/
public function init() {
add_action( 'admin_menu', array( $this, 'add_metaboxes' ) );
add_action( 'save_post', array( $this, 'metabox_save' ), 1, 2 );
}
/**
* Cycle through supported post types and add metaboxes.
*
* @since 2.1.0
*/
public function add_metaboxes() {
foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) {
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || 'post' === $type || 'page' === $type ) {
add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'genesis-simple-sidebars' ), array( $this, 'metabox_content' ), $type, 'side', 'low' );
}
}
}
/**
* Include the metabox content.
*
* @since 2.1.0
*/
public function metabox_content() {
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 ) {
// phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
$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;
}
$data = wp_parse_args(
$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 );
}
}
@@ -0,0 +1,50 @@
<?php
/**
* Genesis Simple Sidebars Term.
*
* @package genesis-simple-sidebars
*/
/**
* Class Genesis Simple Sidebars Term.
*/
class Genesis_Simple_Sidebars_Term {
/**
* Init function.
*/
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();
if ( ! empty( $taxonomies ) && is_admin() && is_array( $taxonomies ) ) {
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 . '/includes/views/term-edit-sidebar-form.php';
}
}
+191
View File
@@ -0,0 +1,191 @@
<?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;
}
}
+160
View File
@@ -0,0 +1,160 @@
<?php
/**
* Deprecated functions file.
*
* @package genesis-simple-sidebars
*/
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_activation_check() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 1.0.0
* @deprecated 2.1.0
*/
function ss_deactivate() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_genesis_init() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_register_sidebars() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_sidebars_init() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* 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', 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_get_taxonomies() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.2
* @deprecated 2.1.0
*/
function ss_has_3_column_layouts() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 1.0.0
* @deprecated 2.1.0
*/
function simplesidebars_settings_menu() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_add_inpost_metabox() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_inpost_metabox() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_inpost_metabox_save() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_term_edit_init() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
/**
* Deprecated.
*
* @since 0.9.0
* @deprecated 2.1.0
*/
function ss_term_sidebar() {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
+24
View File
@@ -0,0 +1,24 @@
<?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();
}
+49
View File
@@ -0,0 +1,49 @@
<?php
/**
* Admin edit.
*
* @package genesis-simple-sidebars
*/
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( isset( $_REQUEST['id'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ), (array) $sidebars ) ) {
$sidebar = stripslashes_deep( $sidebars[ sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ] );
} else {
wp_die( esc_html__( '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>
<form method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=edit' ) ); ?>">
<?php wp_nonce_field( 'simple-sidebars-action_edit-sidebar' ); ?>
<table class="form-table">
<tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[name]"><?php esc_html_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" />
<p class="description"><?php esc_html_e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[id]"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></label></th>
<td>
<?php // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification ?>
<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_attr( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ); ?>" size="40" />
<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 class="form-field">
<th scope="row" valign="top"><label for="edit_sidebar[description]"><?php esc_html_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>
</tr>
</table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e( 'Update', 'genesis-simple-sidebars' ); ?>" /></p>
</form>
+78
View File
@@ -0,0 +1,78 @@
<?php
/**
* 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-right">
<div class="col-wrap">
<h3><?php esc_html_e( 'Current Sidebars', 'genesis-simple-sidebars' ); ?></h3>
<table class="widefat tag fixed" cellspacing="0">
<thead>
<tr>
<th scope="col" id="name" class="manage-column column-name"><?php esc_html_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" id="description" class="manage-column column-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></th>
</tr>
</thead>
<tfoot>
<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-slug"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></th>
<th scope="col" class="manage-column column-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></th>
</tr>
</tfoot>
<tbody id="the-list" class="list:tag">
<?php $this->table_rows(); ?>
</tbody>
</table>
</div>
</div><!-- /col-right -->
<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php esc_html_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' ) ) ); ?>">
<?php wp_nonce_field( 'simple-sidebars-action_create-sidebar' ); ?>
<div class="form-field form-required">
<label for="sidebar-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></label>
<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>
</div>
<div class="form-field">
<label for="sidebar-id"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></label>
<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>
</div>
<div class="form-field">
<label for="sidebar-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></label>
<textarea name="new_sidebar[description]" id="sidebar-description" rows="5" cols="40"></textarea>
</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>
</form></div>
</div>
</div><!-- /col-left -->
</div><!-- /col-container -->
+57
View File
@@ -0,0 +1,57 @@
<?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' );
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]">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php
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;
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]">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php
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;
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]">
<option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php
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;
+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* Term Edit Form View.
*
* @package genesis-simple-sidebars
*/
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
?>
<h3><?php esc_html_e( 'Sidebar Options', 'genesis-simple-sidebars' ); ?></h3>
<table class="form-table">
<?php if ( is_registered_sidebar( 'header-right' ) ) : ?>
<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>
<td>
<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>
<?php
foreach ( (array) $sidebars as $sidebar_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'] ) );
}
?>
</select>
</td>
</tr>
<?php endif; ?>
<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>
<td>
<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>
<?php
foreach ( (array) $sidebars as $sidebar_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'] ) );
}
?>
</select>
</td>
</tr>
<?php if ( Genesis_Simple_Sidebars()->core->has_3_column_layout() ) : ?>
<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>
<td>
<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>
<?php
foreach ( (array) $sidebars as $sidebar_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'] ) );
}
?>
</select>
</td>
</tr>
<?php endif; ?>
</table>
-91
View File
@@ -1,91 +0,0 @@
<?php
/**
* This bit of code registers the meta box on posts/pages,
* so that users can choose what sidebar to use.
*/
add_action('admin_menu', 'ss_add_inpost_metabox');
function ss_add_inpost_metabox() {
foreach ( (array)get_post_types( array( 'public' => true ) ) as $type ) {
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
add_meta_box('ss_inpost_metabox', __('Sidebar Selection', 'ss'), 'ss_inpost_metabox', $type, 'side', 'low');
}
}
}
function ss_inpost_metabox() {
$_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );
?>
<input type="hidden" name="ss_inpost_nonce" value="<?php echo wp_create_nonce(plugin_basename(__FILE__)); ?>" />
<p>
<label class="howto" for="_ss_sidebar"><span><?php _e('Primary Sidebar', 'ss'); ?><span></label>
<select name="_ss_sidebar" id="_ss_sidebar" style="width: 99%">
<option value=""><?php _e('Default', 'ss'); ?></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'] ) );
}
?>
</select>
</p>
<?php
// don't show the option if there are no 3 column layouts registered
if ( !ss_has_3_column_layouts() )
return;
?>
<p>
<label class="howto" for="_ss_sidebar_alt"><span><?php _e('Secondary Sidebar', 'ss'); ?><span></label>
<select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
<option value=""><?php _e('Default', 'ss'); ?></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'] ) );
}
?>
</select>
</p>
<?php
}
/**
* This bit of code saves the sidebars chosen as post meta.
*/
add_action('save_post', 'ss_inpost_metabox_save', 1, 2);
function ss_inpost_metabox_save( $post_id, $post ) {
// verify the nonce
if ( !isset($_POST['ss_inpost_nonce']) || !wp_verify_nonce( $_POST['ss_inpost_nonce'], plugin_basename(__FILE__) ) )
return $post->ID;
// don't try to save the data under autosave, ajax, or future post.
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
if ( defined('DOING_AJAX') && DOING_AJAX ) return;
if ( defined('DOING_CRON') && DOING_CRON ) return;
// is the user allowed to edit the post or page?
if ( ( 'page' == $_POST['post_type'] && !current_user_can('edit_page', $post->ID) ) || !current_user_can('edit_post', $post->ID ) )
return $post->ID;
$_sidebars = array(
'_ss_sidebar' => $_POST['_ss_sidebar'],
'_ss_sidebar_alt' => $_POST['_ss_sidebar_alt']
);
// store the custom fields
foreach ( $_sidebars as $key => $value ) {
if ( $post->post_type == 'revision' ) return; // don't try to store data during revision save
if ( $value ) {
// save/update
update_post_meta($post->ID, $key, $value);
} else {
// delete if blank
delete_post_meta($post->ID, $key);
}
}
}
+199
View File
@@ -0,0 +1,199 @@
# Copyright (C) 2024 StudioPress
# This file is distributed under the GNU General Public License v2.0 (or later).
msgid ""
msgstr ""
"Project-Id-Version: Genesis Simple Sidebars 2.2.3\n"
"Report-Msgid-Bugs-To: StudioPress <translations@studiopress.com>\n"
"POT-Creation-Date: 2024-03-06 09:04:30+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n"
"Last-Translator: StudioPress <translations@studiopress.com>\n"
"Language-Team: English <translations@studiopress.com>\n"
"X-Generator: grunt-wp-i18n 0.4.4\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: English\n"
"X-Poedit-Country: UNITED STATES\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-KeywordsList: "
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
"X-Poedit-Bookmarks: \n"
"X-Poedit-SearchPath-0: .\n"
"X-Textdomain-Support: yes\n"
#: includes/class-genesis-simple-sidebars-admin.php:54
#: includes/views/admin-main.php:10
msgid "Genesis - Simple Sidebars"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:55
msgid "Simple Sidebars"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:133
msgid "Edit"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:134
msgid "Delete"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:203
msgid "New sidebar successfully created!"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:208
msgid "Sidebar successfully edited!"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:213
msgid "Sidebar successfully deleted."
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:362
msgid "Oops! Please choose a valid Name for this sidebar"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:364
msgid "Oops! That sidebar ID already exists"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:366
msgid ""
"Oops! You are trying to edit a sidebar that does not exist, or is not "
"editable"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:368
msgid ""
"Oops! You are trying to delete a sidebar that does not exist, or cannot be "
"deleted"
msgstr ""
#: includes/class-genesis-simple-sidebars-admin.php:370
msgid "Oops! Something went wrong. Try again."
msgstr ""
#: includes/class-genesis-simple-sidebars-entry.php:33
msgid "Sidebar Selection"
msgstr ""
#: includes/class-genesis-simple-sidebars.php:99
msgid "upgrade to"
msgstr ""
#: includes/class-genesis-simple-sidebars.php:99
msgid "install and activate"
msgstr ""
#: includes/class-genesis-simple-sidebars.php:102
#. translators: %1$s is WordPress minimum version, %2$s is Genesis minimum
#. 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 ""
#: includes/deprecated.php:68
msgid "dynamic_sidebar() with sidebars_widget filter"
msgstr ""
#: includes/views/admin-edit.php:14
msgid "Nice try, partner. But that sidebar doesn't exist. Click back and try again."
msgstr ""
#: includes/views/admin-edit.php:18
msgid "Edit Sidebar"
msgstr ""
#: includes/views/admin-edit.php:26 includes/views/admin-main.php:21
#: includes/views/admin-main.php:29 includes/views/admin-main.php:56
msgid "Name"
msgstr ""
#: includes/views/admin-edit.php:28 includes/views/admin-main.php:58
msgid "A recognizable name for your new sidebar widget area"
msgstr ""
#: includes/views/admin-edit.php:32 includes/views/admin-main.php:22
#: includes/views/admin-main.php:30 includes/views/admin-main.php:62
msgid "ID"
msgstr ""
#: includes/views/admin-edit.php:37
msgid ""
"The unique ID is used to register the sidebar widget area (cannot be "
"changed)"
msgstr ""
#: includes/views/admin-edit.php:41 includes/views/admin-main.php:23
#: includes/views/admin-main.php:31 includes/views/admin-main.php:68
msgid "Description"
msgstr ""
#: includes/views/admin-edit.php:47
msgid "Update"
msgstr ""
#: includes/views/admin-main.php:17
msgid "Current Sidebars"
msgstr ""
#: includes/views/admin-main.php:50 includes/views/admin-main.php:72
msgid "Add New Sidebar"
msgstr ""
#: includes/views/admin-main.php:64
msgid "The unique ID is used to register the sidebar widget area"
msgstr ""
#: includes/views/entry-metabox-content.php:16
#: includes/views/entry-metabox-content.php:32
#: includes/views/entry-metabox-content.php:48
#: includes/views/term-edit-sidebar-form.php:19
#: 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 ""
#. Plugin Name of the plugin/theme
msgid "Genesis Simple Sidebars"
msgstr ""
#. Plugin URI of the plugin/theme
msgid "https://github.com/studiopress/genesis-simple-sidebars"
msgstr ""
#. Description of the plugin/theme
msgid ""
"Genesis Simple Sidebars allows you to easily create and use new sidebar "
"widget areas."
msgstr ""
#. Author of the plugin/theme
msgid "StudioPress"
msgstr ""
#. Author URI of the plugin/theme
msgid "https://www.studiopress.com/"
msgstr ""
-148
View File
@@ -1,148 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-06 21:23-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: admin.php:17
msgid "Simple Sidebars"
msgstr ""
#: admin.php:66
msgid ""
"Nice try, partner. But that sidebar doesn't exist. Click back and try again."
msgstr ""
#: admin.php:72
msgid "Edit Sidebar"
msgstr ""
#: admin.php:79 admin.php:117 admin.php:125 admin.php:152
msgid "Name"
msgstr ""
#: admin.php:81 admin.php:154
msgid "A recognizable name for your new sidebar widget area"
msgstr ""
#: admin.php:85 admin.php:118 admin.php:126 admin.php:158
msgid "ID"
msgstr ""
#: admin.php:89
msgid ""
"The unique ID is used to register the sidebar widget area (cannot be changed)"
msgstr ""
#: admin.php:93 admin.php:119 admin.php:127 admin.php:164
msgid "Description"
msgstr ""
#: admin.php:99
msgid "Update"
msgstr ""
#: admin.php:106
msgid "Genesis - Simple Sidebars"
msgstr ""
#: admin.php:113
msgid "Current Sidebars"
msgstr ""
#: admin.php:146 admin.php:168
msgid "Add New Sidebar"
msgstr ""
#: admin.php:160
msgid "The unique ID is used to register the sidebar widget area"
msgstr ""
#: functions.php:28
msgid "Edit"
msgstr ""
#: functions.php:29
msgid "Delete"
msgstr ""
#: functions.php:137
msgid "Oops! Please choose a valid Name and ID for this sidebar"
msgstr ""
#: functions.php:140
msgid "Oops! That sidebar ID already exists"
msgstr ""
#: functions.php:143
msgid ""
"Oops! You are trying to edit a sidebar that does not exist, or is not "
"editable"
msgstr ""
#: functions.php:146
msgid ""
"Oops! You are trying to delete a sidebar that does not exist, or cannot be "
"deleted"
msgstr ""
#: functions.php:149
msgid "Oops! Something went wrong. Try again."
msgstr ""
#: functions.php:165
msgid "New sidebar successfully created!"
msgstr ""
#: functions.php:170
msgid "Sidebar successfully edited!"
msgstr ""
#: functions.php:175
msgid "Sidebar successfully deleted."
msgstr ""
#: inpost.php:10
msgid "Sidebar Selection"
msgstr ""
#: inpost.php:22 term.php:29
msgid "Primary Sidebar"
msgstr ""
#: inpost.php:24 inpost.php:36 term.php:32 term.php:46
msgid "Default"
msgstr ""
#: inpost.php:34 term.php:43
msgid "Secondary Sidebar"
msgstr ""
#: plugin.php:21
#, php-format
msgid ""
"Sorry, you can't activate unless you have installed <a href=\"%s\">Genesis</"
"a>"
msgstr ""
#: plugin.php:26
#, php-format
msgid ""
"Sorry, you cannot activate without <a href=\"%s\">Genesis %s</a> or greater"
msgstr ""
#: term.php:25
msgid "Sidebar Options"
msgstr ""
+37
View File
@@ -0,0 +1,37 @@
{
"name": "genesis-simple-sidebars",
"description": "Development files for the Genesis Simple Sidebars plugin.",
"repository": {
"type": "git",
"url": "https://github.com/copyblogger/genesis-simple-sidebars"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-autoprefixer": "^0.8.1",
"grunt-checktextdomain": "^0.1.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-imagemin": "^0.7.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.5.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-csscomb": "~2.0.1",
"grunt-jsbeautifier": "^0.2.7",
"grunt-jsvalidate": "^0.2.2",
"grunt-phplint": "0.0.5",
"grunt-styledocco": "^0.1.4",
"grunt-wp-i18n": "^1.0.3",
"load-grunt-tasks": "^0.6.0"
},
"plugin": {
"name": "Genesis Simple Sidebars",
"uri": "https://github.com/copyblogger/genesis-simple-sidebars",
"description": "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.",
"author": "StudioPress",
"authoruri": "http://www.studiopress.com/",
"version": "2.2.3",
"license": "GPL-2.0+",
"licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html",
"textdomain": "genesis-simple-sidebars"
}
}
+19 -154
View File
@@ -1,161 +1,26 @@
<?php <?php
/* /**
Plugin Name: Genesis Simple Sidebars * Plugin Name: Genesis Simple Sidebars
Plugin URI: http://www.studiopress.com/plugins/simple-sidebars * Plugin URI: https://github.com/studiopress/genesis-simple-sidebars
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.
Version: 0.9.2.1 * Version: 2.2.3
Author: Nathan Rice * Author: StudioPress
Author URI: http://www.nathanrice.net/ * Author URI: https://www.studiopress.com/
Text Domain: ss * License: GNU General Public License v2.0 (or later)
Domain Path: /languages/ * License URI: https://www.opensource.org/licenses/gpl-license.php
*/ *
* Text Domain: genesis-simple-sidebars
// require Genesis 1.2 upon activation * Domain Path: /languages
register_activation_hook(__FILE__, 'ss_activation_check'); *
function ss_activation_check() { * @package genesis-simple-sidebars
*/
$latest = '1.2';
$theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
if( basename(TEMPLATEPATH) != 'genesis' ) {
load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );
deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
wp_die( sprintf( __('Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'ss'), 'http://www.studiopress.com/themes/genesis' ) );
}
if( version_compare( $theme_info['Version'], $latest, '<' ) ) {
deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
wp_die( sprintf( __('Sorry, you cannot activate without <a href="%s">Genesis %s</a> or greater', 'ss'), 'http://www.studiopress.com/support/showthread.php?t=19576', $latest ) );
}
}
/** /**
* Hook into Genesis * Load the plugin file.
*/ */
add_action( 'genesis_init', 'ss_genesis_init', 12 );
function ss_genesis_init() {
// Define our constants
define( 'SS_SETTINGS_FIELD', 'ss-settings' );
define( 'SS_PLUGIN_DIR', dirname( __FILE__ ) );
// required hooks if ( ! defined( 'ABSPATH' ) ) {
add_action( 'get_header', 'ss_sidebars_init' ); exit;
add_action( 'widgets_init', 'ss_register_sidebars' );
if ( !is_admin() )
return;
// Include admin files
load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );
require_once( SS_PLUGIN_DIR . '/admin.php' );
require_once( SS_PLUGIN_DIR . '/functions.php' );
require_once( SS_PLUGIN_DIR . '/inpost.php' );
require_once( SS_PLUGIN_DIR . '/term.php' );
// let the child theme hook the genesis_simple_sidebars_taxonomies filter before hooking term edit
add_action( 'init', 'ss_term_edit_init' );
}
/**
* This function registers the created sidebars
*/
function ss_register_sidebars() {
$_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );
if ( !$_sidebars ) return;
foreach ( (array)$_sidebars as $id => $info ) {
register_sidebar(array(
'name' => esc_html( $info['name'] ),
'id' => $id,
'description' => esc_html( $info['description'] ),
'editable' => 1,
'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-wrap">',
'after_widget' => "</div></div>\n",
'before_title' => '<h4 class="widgettitle">',
'after_title' => "</h4>\n"
));
}
} }
require_once plugin_dir_path( __FILE__ ) . 'genesis-simple-sidebars.php';
/**
* Remove the default sidebars, run some conditional logic,
* use alternate sidebars if necessary, else fallback on default sidebars.
*/
function ss_sidebars_init() {
remove_action('genesis_sidebar', 'genesis_do_sidebar');
remove_action('genesis_sidebar_alt', 'genesis_do_sidebar_alt');
add_action('genesis_sidebar', 'ss_do_sidebar');
add_action('genesis_sidebar_alt', 'ss_do_sidebar_alt');
}
function ss_do_sidebar() {
if ( ! ss_do_one_sidebar( '_ss_sidebar' ) )
genesis_do_sidebar();
}
function ss_do_sidebar_alt() {
if ( ! ss_do_one_sidebar( '_ss_sidebar_alt' ) )
genesis_do_sidebar_alt();
}
function ss_do_one_sidebar( $bar = '_ss_sidebar' ) {
static $taxonomies = null;
if ( is_singular() && $_bar = genesis_get_custom_field( $bar ) ) {
if ( dynamic_sidebar( $_bar ) ) return true;
}
if ( is_category() ) {
$term = get_term( get_query_var('cat'), 'category' );
if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
}
if ( is_tag() ) {
$term = get_term( get_query_var('tag_id'), 'post_tag' );
if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
}
if ( is_tax() ) {
if( $taxonomies === null )
$taxonomies = ss_get_taxonomies();
foreach( $taxonomies as $tax ) {
if( $tax == 'post_tag' || $tax == 'category' )
continue;
if( is_tax( $tax ) ) {
$obj = get_queried_object();
$term = get_term( $obj->term_id, $tax );
if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
break;
}
}
}
return false;
}
function ss_get_taxonomies() {
$taxonomies = get_taxonomies( array( 'show_ui' => true, 'public' => true ) );
return apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $taxonomies ) );
}
function ss_has_3_column_layouts() {
$_layouts = (array) genesis_get_layouts();
$_layouts = array_keys( $_layouts );
$_3_column = array_intersect( $_layouts, array( 'content-sidebar-sidebar', 'sidebar-content-sidebar', 'sidebar-sidebar-content' ) );
return ! empty( $_3_column );
}
+63 -22
View File
@@ -1,16 +1,16 @@
=== Plugin Name === === Plugin Name ===
Contributors: nathanrice, wpmuguru Contributors: nathanrice, wpmuguru, marksabbath
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: 3.0 Requires at least: 4.7.3
Tested up to: 3.3 Tested up to: 6.9
Stable tag: 0.9.2.1 Stable tag: 2.2.3
This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis. This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Framework on a per post, per page, or per tag/category archive basis.
== Description == == Description ==
This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis. This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Framework on a per post, per page, or per tag/category archive basis.
Creating widget areas programmatically, then using conditional logic to properly assign them to sidebar locations can be a complex task for a beginner. This plugin allows you to do all this from a simple administration menu, and assign widget areas to sidebar locations with simple drop-down menus within the post/page edit screens, or when editing a tag or category. Creating widget areas programmatically, then using conditional logic to properly assign them to sidebar locations can be a complex task for a beginner. This plugin allows you to do all this from a simple administration menu, and assign widget areas to sidebar locations with simple drop-down menus within the post/page edit screens, or when editing a tag or category.
@@ -37,25 +37,66 @@ Not in the way you're probably thinking. The markup surrounding the widget area
== Changelog == == Changelog ==
= 0.1 = = 2.2.3 =
* Initial Alpha Release * 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.
= 0.9 = = 2.2.2 =
* Fixed "is not array" errors reported by users * Fix overlapping of sidebar selector in editor.
* Added nonce verification for security purposes
* Added error and success messages
* Bump to pre-release 0.9 branch
= 0.9.1 = = 2.2.1 =
* Added support for custom post types * Allow sidebars to show in the WordPress Posts page.
= 0.9.2 = = 2.2.0 =
* Added support for custom taxonomies * Fixed coding standards errors.
* Added translation support * Introduced coding standards validation.
* bug fix to prevent invalid sidebar creation
= 2.1.0 =
* 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 =
* Fix warnings and notices.
= 2.0.2 =
* Change text domain, update POT file.
= 2.0.1 =
* Genesis 2.0.1 compatibility with term meta keys.
* Use actual sidebar name, instead of hard coded names.
* Fix incorrect textdomain.
= 2.0.0 =
* Compatibility with Genesis 2.0.0.
* Standards.
= 1.0.0 =
* Reorganize theme files.
* Standards
= 0.9.2.1 = = 0.9.2.1 =
* Restore default tag/category support * Restore default tag/category support.
* Default custom taxonomy support to on for public taxonomies * Default custom taxonomy support to on for public taxonomies.
* Remove secondary selection when no 3 column layouts are enabled * Remove secondary selection when no 3 column layouts are enabled.
= 0.9.2 =
* Added support for custom taxonomies.
* Added translation support.
* bug fix to prevent invalid sidebar creation.
= 0.9.1 =
* Added support for custom post types.
= 0.9 =
* Fixed "is not array" errors reported by users.
* Added nonce verification for security purposes.
* Added error and success messages.
* Bump to pre-release 0.9 branch.
= 0.1 =
* Initial Alpha Release.
-64
View File
@@ -1,64 +0,0 @@
<?php
/**
* This function, hooked to display on the category/tag edit forms,
* adds new fields to select a sidebar. The variables $tag and $taxonomy
* are passed via the hook so that we can use them.
*/
function ss_term_edit_init() {
$taxonomies = ss_get_taxonomies();
if( !empty( $taxonomies ) && is_admin() && is_array( $taxonomies ) ) {
foreach( $taxonomies as $tax )
add_action( "{$tax}_edit_form", 'ss_term_sidebar', 9, 2 );
}
}
function ss_term_sidebar($tag, $taxonomy) {
// Merge Defaults to prevent notices
$tag->meta = wp_parse_args( $tag->meta, array( '_ss_sidebar' => '', '_ss_sidebar_alt' => '' ) );
// Pull custom sidebars
$_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );
?>
<h3><?php _e('Sidebar Options', 'ss'); ?></h3>
<table class="form-table">
<tr class="form-field">
<th scope="row" valign="top"><label for="meta[_ss_sidebar]"><?php _e('Primary Sidebar', 'ss'); ?></label></th>
<td>
<select name="meta[_ss_sidebar]" id="meta[_ss_sidebar]" style="padding-right: 10px;">
<option value=""><?php _e('Default', 'ss'); ?></option>
<?php
foreach ( (array)$_sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, $tag->meta['_ss_sidebar'] , false), esc_html( $info['name'] ) );
}
?>
</select>
</td>
</tr>
<?php
// don't show the option if there are no 3 column layouts registered
if ( ss_has_3_column_layouts() ) {
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="meta[_ss_sidebar_alt]"><?php _e('Secondary Sidebar', 'ss'); ?></label></th>
<td>
<select name="meta[_ss_sidebar_alt]" id="meta[_ss_sidebar_alt]" style="padding-right: 10px;">
<option value=""><?php _e('Default', 'ss'); ?></option>
<?php
foreach ( (array)$_sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, $tag->meta['_ss_sidebar_alt'] , false), esc_html( $info['name'] ) );
}
?>
</select>
</td>
</tr>
<?php
}
?>
</table>
<?php
}