Genesis Simple Sidebars - Version 2.2.0

Version Description

  • Fixed coding standards errors.
  • Introduced coding standards validation.
Download this release

Release Info

Developer studiopress
Plugin Icon 128x128 Genesis Simple Sidebars
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.0 to 2.2.0

.circleci/config.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2.1
2
+
3
+ jobs:
4
+ test:
5
+ docker:
6
+ - image: circleci/php:7.3.3-stretch-node-browsers
7
+ steps:
8
+ - checkout
9
+ - prepare-environment
10
+ - run: composer phpcs
11
+
12
+ commands:
13
+ prepare-environment:
14
+ description: "Install dependencies."
15
+ steps:
16
+ - run: composer install
17
+
18
+ workflows:
19
+ version: 2
20
+ check-wp-cs:
21
+ jobs:
22
+ - test
.editorconfig ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is for unifying the coding style for different editors and IDEs
2
+ # editorconfig.org
3
+
4
+ # WordPress Coding Standards
5
+ # http://make.wordpress.org/core/handbook/coding-standards/
6
+
7
+ root = true
8
+
9
+ [*]
10
+ charset = utf-8
11
+ end_of_line = lf
12
+ insert_final_newline = true
13
+ trim_trailing_whitespace = true
14
+ indent_style = tab
15
+
16
+ [*.yml]
17
+ indent_style = space
18
+ indent_size = 2
19
+
20
+ [*.md]
21
+ trim_trailing_whitespace = false
composer.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "studiopress/genesis-simple-sidebars",
3
+ "type": "wordpress-plugin",
4
+ "description": "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.",
5
+ "homepage": "https://github.com/studiopress/genesis-simple-sidebars",
6
+ "license": "GPL-2.0-or-later",
7
+ "require": {
8
+ "php": "^5.3 || ^7",
9
+ "composer/installers": "^1"
10
+ },
11
+ "require-dev": {
12
+ "php": "^5.6 || ^7",
13
+ "dealerdirect/phpcodesniffer-composer-installer": "*",
14
+ "squizlabs/php_codesniffer": "^3.3.1",
15
+ "phpcompatibility/phpcompatibility-wp": "*",
16
+ "wp-coding-standards/wpcs": "^1"
17
+ },
18
+ "config": {
19
+ "sort-order": true
20
+ },
21
+ "minimum-stability": "dev",
22
+ "prefer-stable": true,
23
+ "scripts": {
24
+ "phpcs": "phpcs --standard=WordPress --ignore=vendor/,node_modules/,assets/ --extensions=php -p ./",
25
+ "phpcs-compat": "phpcs --extensions=php --standard=PHPCompatibilityWP --ignore=vendor/,node_modules/,assets/ --runtime-set testVersion 5.6- -p ./",
26
+ "phpcbf": "phpcbf --standard=WordPress --ignore=vendor/,node_modules/,assets/ --extensions=php -p ./"
27
+ },
28
+ "support": {
29
+ "issues": "https://github.com/studiopress/genesis-simple-sidebars/issues",
30
+ "source": "https://github.com/studiopress/genesis-simple-sidebars"
31
+ }
32
+ }
composer.lock ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "a8300ed9bb532b9d84d4cb8a37879f11",
8
+ "packages": [
9
+ {
10
+ "name": "composer/installers",
11
+ "version": "v1.6.0",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/composer/installers.git",
15
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
20
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "composer-plugin-api": "^1.0"
25
+ },
26
+ "replace": {
27
+ "roundcube/plugin-installer": "*",
28
+ "shama/baton": "*"
29
+ },
30
+ "require-dev": {
31
+ "composer/composer": "1.0.*@dev",
32
+ "phpunit/phpunit": "^4.8.36"
33
+ },
34
+ "type": "composer-plugin",
35
+ "extra": {
36
+ "class": "Composer\\Installers\\Plugin",
37
+ "branch-alias": {
38
+ "dev-master": "1.0-dev"
39
+ }
40
+ },
41
+ "autoload": {
42
+ "psr-4": {
43
+ "Composer\\Installers\\": "src/Composer/Installers"
44
+ }
45
+ },
46
+ "notification-url": "https://packagist.org/downloads/",
47
+ "license": [
48
+ "MIT"
49
+ ],
50
+ "authors": [
51
+ {
52
+ "name": "Kyle Robinson Young",
53
+ "email": "kyle@dontkry.com",
54
+ "homepage": "https://github.com/shama"
55
+ }
56
+ ],
57
+ "description": "A multi-framework Composer library installer",
58
+ "homepage": "https://composer.github.io/installers/",
59
+ "keywords": [
60
+ "Craft",
61
+ "Dolibarr",
62
+ "Eliasis",
63
+ "Hurad",
64
+ "ImageCMS",
65
+ "Kanboard",
66
+ "Lan Management System",
67
+ "MODX Evo",
68
+ "Mautic",
69
+ "Maya",
70
+ "OXID",
71
+ "Plentymarkets",
72
+ "Porto",
73
+ "RadPHP",
74
+ "SMF",
75
+ "Thelia",
76
+ "WolfCMS",
77
+ "agl",
78
+ "aimeos",
79
+ "annotatecms",
80
+ "attogram",
81
+ "bitrix",
82
+ "cakephp",
83
+ "chef",
84
+ "cockpit",
85
+ "codeigniter",
86
+ "concrete5",
87
+ "croogo",
88
+ "dokuwiki",
89
+ "drupal",
90
+ "eZ Platform",
91
+ "elgg",
92
+ "expressionengine",
93
+ "fuelphp",
94
+ "grav",
95
+ "installer",
96
+ "itop",
97
+ "joomla",
98
+ "kohana",
99
+ "laravel",
100
+ "lavalite",
101
+ "lithium",
102
+ "magento",
103
+ "majima",
104
+ "mako",
105
+ "mediawiki",
106
+ "modulework",
107
+ "modx",
108
+ "moodle",
109
+ "osclass",
110
+ "phpbb",
111
+ "piwik",
112
+ "ppi",
113
+ "puppet",
114
+ "pxcms",
115
+ "reindex",
116
+ "roundcube",
117
+ "shopware",
118
+ "silverstripe",
119
+ "sydes",
120
+ "symfony",
121
+ "typo3",
122
+ "wordpress",
123
+ "yawik",
124
+ "zend",
125
+ "zikula"
126
+ ],
127
+ "time": "2018-08-27T06:10:37+00:00"
128
+ }
129
+ ],
130
+ "packages-dev": [
131
+ {
132
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
133
+ "version": "v0.5.0",
134
+ "source": {
135
+ "type": "git",
136
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
137
+ "reference": "e749410375ff6fb7a040a68878c656c2e610b132"
138
+ },
139
+ "dist": {
140
+ "type": "zip",
141
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
142
+ "reference": "e749410375ff6fb7a040a68878c656c2e610b132",
143
+ "shasum": ""
144
+ },
145
+ "require": {
146
+ "composer-plugin-api": "^1.0",
147
+ "php": "^5.3|^7",
148
+ "squizlabs/php_codesniffer": "^2|^3"
149
+ },
150
+ "require-dev": {
151
+ "composer/composer": "*",
152
+ "phpcompatibility/php-compatibility": "^9.0",
153
+ "sensiolabs/security-checker": "^4.1.0"
154
+ },
155
+ "type": "composer-plugin",
156
+ "extra": {
157
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
158
+ },
159
+ "autoload": {
160
+ "psr-4": {
161
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
162
+ }
163
+ },
164
+ "notification-url": "https://packagist.org/downloads/",
165
+ "license": [
166
+ "MIT"
167
+ ],
168
+ "authors": [
169
+ {
170
+ "name": "Franck Nijhof",
171
+ "email": "franck.nijhof@dealerdirect.com",
172
+ "homepage": "http://www.frenck.nl",
173
+ "role": "Developer / IT Manager"
174
+ }
175
+ ],
176
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
177
+ "homepage": "http://www.dealerdirect.com",
178
+ "keywords": [
179
+ "PHPCodeSniffer",
180
+ "PHP_CodeSniffer",
181
+ "code quality",
182
+ "codesniffer",
183
+ "composer",
184
+ "installer",
185
+ "phpcs",
186
+ "plugin",
187
+ "qa",
188
+ "quality",
189
+ "standard",
190
+ "standards",
191
+ "style guide",
192
+ "stylecheck",
193
+ "tests"
194
+ ],
195
+ "time": "2018-10-26T13:21:45+00:00"
196
+ },
197
+ {
198
+ "name": "phpcompatibility/php-compatibility",
199
+ "version": "9.1.1",
200
+ "source": {
201
+ "type": "git",
202
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
203
+ "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c"
204
+ },
205
+ "dist": {
206
+ "type": "zip",
207
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/2b63c5d284ab8857f7b1d5c240ddb507a6b2293c",
208
+ "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c",
209
+ "shasum": ""
210
+ },
211
+ "require": {
212
+ "php": ">=5.3",
213
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
214
+ },
215
+ "conflict": {
216
+ "squizlabs/php_codesniffer": "2.6.2"
217
+ },
218
+ "require-dev": {
219
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
220
+ },
221
+ "suggest": {
222
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
223
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
224
+ },
225
+ "type": "phpcodesniffer-standard",
226
+ "notification-url": "https://packagist.org/downloads/",
227
+ "license": [
228
+ "LGPL-3.0-or-later"
229
+ ],
230
+ "authors": [
231
+ {
232
+ "name": "Contributors",
233
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
234
+ },
235
+ {
236
+ "name": "Wim Godden",
237
+ "homepage": "https://github.com/wimg",
238
+ "role": "lead"
239
+ },
240
+ {
241
+ "name": "Juliette Reinders Folmer",
242
+ "homepage": "https://github.com/jrfnl",
243
+ "role": "lead"
244
+ }
245
+ ],
246
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
247
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
248
+ "keywords": [
249
+ "compatibility",
250
+ "phpcs",
251
+ "standards"
252
+ ],
253
+ "time": "2018-12-30T23:16:27+00:00"
254
+ },
255
+ {
256
+ "name": "phpcompatibility/phpcompatibility-paragonie",
257
+ "version": "1.0.1",
258
+ "source": {
259
+ "type": "git",
260
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
261
+ "reference": "9160de79fcd683b5c99e9c4133728d91529753ea"
262
+ },
263
+ "dist": {
264
+ "type": "zip",
265
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/9160de79fcd683b5c99e9c4133728d91529753ea",
266
+ "reference": "9160de79fcd683b5c99e9c4133728d91529753ea",
267
+ "shasum": ""
268
+ },
269
+ "require": {
270
+ "phpcompatibility/php-compatibility": "^9.0"
271
+ },
272
+ "require-dev": {
273
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4"
274
+ },
275
+ "suggest": {
276
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
277
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
278
+ },
279
+ "type": "phpcodesniffer-standard",
280
+ "notification-url": "https://packagist.org/downloads/",
281
+ "license": [
282
+ "LGPL-3.0-or-later"
283
+ ],
284
+ "authors": [
285
+ {
286
+ "name": "Wim Godden",
287
+ "role": "lead"
288
+ },
289
+ {
290
+ "name": "Juliette Reinders Folmer",
291
+ "role": "lead"
292
+ }
293
+ ],
294
+ "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.",
295
+ "homepage": "http://phpcompatibility.com/",
296
+ "keywords": [
297
+ "compatibility",
298
+ "paragonie",
299
+ "phpcs",
300
+ "polyfill",
301
+ "standards"
302
+ ],
303
+ "time": "2018-12-16T19:10:44+00:00"
304
+ },
305
+ {
306
+ "name": "phpcompatibility/phpcompatibility-wp",
307
+ "version": "2.0.0",
308
+ "source": {
309
+ "type": "git",
310
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
311
+ "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd"
312
+ },
313
+ "dist": {
314
+ "type": "zip",
315
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
316
+ "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
317
+ "shasum": ""
318
+ },
319
+ "require": {
320
+ "phpcompatibility/php-compatibility": "^9.0",
321
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
322
+ },
323
+ "require-dev": {
324
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
325
+ },
326
+ "suggest": {
327
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
328
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
329
+ },
330
+ "type": "phpcodesniffer-standard",
331
+ "notification-url": "https://packagist.org/downloads/",
332
+ "license": [
333
+ "LGPL-3.0-or-later"
334
+ ],
335
+ "authors": [
336
+ {
337
+ "name": "Wim Godden",
338
+ "role": "lead"
339
+ },
340
+ {
341
+ "name": "Juliette Reinders Folmer",
342
+ "role": "lead"
343
+ }
344
+ ],
345
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
346
+ "homepage": "http://phpcompatibility.com/",
347
+ "keywords": [
348
+ "compatibility",
349
+ "phpcs",
350
+ "standards",
351
+ "wordpress"
352
+ ],
353
+ "time": "2018-10-07T18:31:37+00:00"
354
+ },
355
+ {
356
+ "name": "squizlabs/php_codesniffer",
357
+ "version": "3.4.2",
358
+ "source": {
359
+ "type": "git",
360
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
361
+ "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
362
+ },
363
+ "dist": {
364
+ "type": "zip",
365
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
366
+ "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
367
+ "shasum": ""
368
+ },
369
+ "require": {
370
+ "ext-simplexml": "*",
371
+ "ext-tokenizer": "*",
372
+ "ext-xmlwriter": "*",
373
+ "php": ">=5.4.0"
374
+ },
375
+ "require-dev": {
376
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
377
+ },
378
+ "bin": [
379
+ "bin/phpcs",
380
+ "bin/phpcbf"
381
+ ],
382
+ "type": "library",
383
+ "extra": {
384
+ "branch-alias": {
385
+ "dev-master": "3.x-dev"
386
+ }
387
+ },
388
+ "notification-url": "https://packagist.org/downloads/",
389
+ "license": [
390
+ "BSD-3-Clause"
391
+ ],
392
+ "authors": [
393
+ {
394
+ "name": "Greg Sherwood",
395
+ "role": "lead"
396
+ }
397
+ ],
398
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
399
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
400
+ "keywords": [
401
+ "phpcs",
402
+ "standards"
403
+ ],
404
+ "time": "2019-04-10T23:49:02+00:00"
405
+ },
406
+ {
407
+ "name": "wp-coding-standards/wpcs",
408
+ "version": "1.2.1",
409
+ "source": {
410
+ "type": "git",
411
+ "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
412
+ "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c"
413
+ },
414
+ "dist": {
415
+ "type": "zip",
416
+ "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
417
+ "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
418
+ "shasum": ""
419
+ },
420
+ "require": {
421
+ "php": ">=5.3",
422
+ "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
423
+ },
424
+ "require-dev": {
425
+ "phpcompatibility/php-compatibility": "^9.0"
426
+ },
427
+ "suggest": {
428
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
429
+ },
430
+ "type": "phpcodesniffer-standard",
431
+ "notification-url": "https://packagist.org/downloads/",
432
+ "license": [
433
+ "MIT"
434
+ ],
435
+ "authors": [
436
+ {
437
+ "name": "Contributors",
438
+ "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
439
+ }
440
+ ],
441
+ "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
442
+ "keywords": [
443
+ "phpcs",
444
+ "standards",
445
+ "wordpress"
446
+ ],
447
+ "time": "2018-12-18T09:43:51+00:00"
448
+ }
449
+ ],
450
+ "aliases": [],
451
+ "minimum-stability": "dev",
452
+ "stability-flags": [],
453
+ "prefer-stable": true,
454
+ "prefer-lowest": false,
455
+ "platform": {
456
+ "php": "^5.3 || ^7"
457
+ },
458
+ "platform-dev": {
459
+ "php": "^5.6 || ^7"
460
+ }
461
+ }
genesis-simple-sidebars.php CHANGED
@@ -1,190 +1,43 @@
1
  <?php
 
 
 
 
 
2
 
3
- class Genesis_Simple_Sidebars {
4
-
5
- /**
6
- * Plugin version
7
- */
8
- public $plugin_version = '2.1.0';
9
-
10
- /**
11
- * Minimum WordPress version.
12
- */
13
- public $min_wp_version = '4.7.2';
14
-
15
- /**
16
- * Minimum Genesis version.
17
- */
18
- public $min_genesis_version = '2.4.2';
19
-
20
- /**
21
- * The plugin textdomain, for translations.
22
- */
23
- public $plugin_textdomain = 'genesis-simple-sidebars';
24
-
25
- /**
26
- * The url to the plugin directory.
27
- */
28
- public $plugin_dir_url;
29
-
30
- /**
31
- * The path to the plugin directory.
32
- */
33
- public $plugin_dir_path;
34
-
35
- /**
36
- * The main settings field for this plugin.
37
- */
38
- public $settings_field = 'ss-settings';
39
-
40
- /**
41
- * Core functions of sidebar registration and output.
42
- */
43
- public $core;
44
-
45
- /**
46
- * Admin menu and settings page.
47
- */
48
- public $admin;
49
-
50
- /**
51
- * Entry settings and metadata.
52
- */
53
- public $entry;
54
-
55
- /**
56
- * Constructor.
57
- *
58
- * @since 2.1.0
59
- */
60
- public function __construct() {
61
-
62
- $this->plugin_dir_url = plugin_dir_url( __FILE__ );
63
- $this->plugin_dir_path = plugin_dir_path( __FILE__ );
64
-
65
- // For backward compatibility
66
- define( 'SS_PLUGIN_DIR', $this->plugin_dir_path );
67
-
68
- }
69
-
70
- /**
71
- * Initialize.
72
- *
73
- * @since 2.1.0
74
- */
75
- public function init() {
76
-
77
- $this->load_plugin_textdomain();
78
-
79
- add_action( 'admin_notices', array( $this, 'requirements_notice' ) );
80
-
81
- $this->includes();
82
- $this->instantiate();
83
-
84
- }
85
-
86
- /**
87
- * Show admin notice if minimum requirements aren't met.
88
- *
89
- * @since 2.1.0
90
- */
91
- public function requirements_notice() {
92
-
93
- if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, $this->min_genesis_version, '>=' ) ) {
94
-
95
- $action = defined( 'PARENT_THEME_VERSION' ) ? __( 'upgrade to', 'genesis-simple-sidebars' ) : __( 'install and activate', 'genesis-simple-sidebars' );
96
-
97
- $message = sprintf( __( 'Genesis Simple Sidebars requires WordPress %s and Genesis %s, or greater. Please %s the latest version of <a href="%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' );
98
- echo '<div class="notice notice-warning"><p>' . $message . '</p></div>';
99
-
100
- }
101
-
102
- }
103
-
104
- /**
105
- * Load the plugin textdomain, for translation.
106
- *
107
- * @since 2.1.0
108
- */
109
- public function load_plugin_textdomain() {
110
- load_plugin_textdomain( $this->plugin_textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
111
- }
112
-
113
- /**
114
- * All general includes.
115
- *
116
- * @since 2.1.0
117
- */
118
- public function includes() {
119
-
120
- require_once( $this->plugin_dir_path . 'includes/functions.php' );
121
- require_once( $this->plugin_dir_path . 'includes/deprecated.php' );
122
-
123
- }
124
-
125
- /**
126
- * Include the class file, instantiate the classes, create objects.
127
- *
128
- * @since 2.1.0
129
- */
130
- public function instantiate() {
131
-
132
- add_action( 'genesis_setup', array( $this, 'genesis_dependencies' ) );
133
-
134
- }
135
-
136
- /**
137
- * Load and instantiate any Genesis dependencies.
138
- *
139
- * @since 2.1.0
140
- */
141
- public function genesis_dependencies() {
142
-
143
- require_once( $this->plugin_dir_path . 'includes/class-genesis-simple-sidebars-core.php' );
144
- $this->core = new Genesis_Simple_Sidebars_Core;
145
- $this->core->init();
146
-
147
- // Anything beyond this point should only be loaded if in the admin.
148
- if ( ! is_admin() ) {
149
- return;
150
- }
151
-
152
- require_once( $this->plugin_dir_path . 'includes/class-genesis-simple-sidebars-entry.php' );
153
- $this->entry = new Genesis_Simple_Sidebars_Entry;
154
- $this->entry->init();
155
 
156
- require_once( $this->plugin_dir_path . 'includes/class-genesis-simple-sidebars-term.php' );
157
- $this->term = new Genesis_Simple_Sidebars_Term;
158
- $this->term->init();
159
 
160
- require_once( $this->plugin_dir_path . 'includes/class-genesis-simple-sidebars-admin.php' );
161
- $this->admin = new Genesis_Simple_Sidebars_Admin;
162
- $this->admin->admin_menu();
 
163
 
164
- // For backward compatibility
165
- global $_genesis_simple_sidebars;
166
- $_genesis_simple_sidebars = $this->admin;
167
 
168
- }
169
 
170
- }
171
 
172
  /**
173
  * Helper function to retrieve the static object without using globals.
174
  *
175
  * @since 2.1.0
176
  */
177
- function Genesis_Simple_Sidebars() {
178
 
179
  static $object;
180
 
181
- if ( null == $object ) {
182
- $object = new Genesis_Simple_Sidebars;
183
  }
184
 
185
  return $object;
186
  }
187
  /**
188
- * Initialize the object on `plugins_loaded`.
189
  */
190
  add_action( 'plugins_loaded', array( Genesis_Simple_Sidebars(), 'init' ) );
1
  <?php
2
+ /**
3
+ * Genesis Simple Sidebars constants.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
 
8
+ /**
9
+ * Load the plugin file.
10
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
 
16
+ define( 'GENESIS_SIMPLE_SIDEBARS_SETTINGS_FIELD', 'genesis_simple_sidebars_settings' );
17
+ define( 'GENESIS_SIMPLE_SIDEBARS_VERSION', '2.2.0' );
18
+ define( 'GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
19
+ define( 'GENESIS_SIMPLE_SIDEBARS_PLUGIN_URL', plugins_url( '', __FILE__ ) );
20
 
21
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-genesis-simple-sidebars.php';
 
 
22
 
 
23
 
 
24
 
25
  /**
26
  * Helper function to retrieve the static object without using globals.
27
  *
28
  * @since 2.1.0
29
  */
30
+ function genesis_simple_sidebars() {
31
 
32
  static $object;
33
 
34
+ if ( null === $object ) {
35
+ $object = new Genesis_Simple_Sidebars();
36
  }
37
 
38
  return $object;
39
  }
40
  /**
41
+ * Initialize the object on `plugins_loaded`.
42
  */
43
  add_action( 'plugins_loaded', array( Genesis_Simple_Sidebars(), 'init' ) );
includes/class-genesis-simple-sidebars-admin.php CHANGED
@@ -3,6 +3,7 @@
3
  * Controls the creation, deletion, and editing of Simple Sidebar.
4
  *
5
  * @author StudioPress
 
6
  */
7
 
8
  /**
@@ -16,6 +17,8 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
16
  /**
17
  * Settings field.
18
  *
 
 
19
  * @since 2.1.0
20
  */
21
  public $settings_field;
@@ -27,7 +30,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
27
 
28
  $this->settings_field = Genesis_Simple_Sidebars()->settings_field;
29
 
30
- // For backward compatibility
31
  define( 'SS_SETTINGS_FIELD', $this->settings_field );
32
 
33
  }
@@ -49,16 +52,16 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
49
  'submenu' => array(
50
  'parent_slug' => 'genesis',
51
  'page_title' => __( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ),
52
- 'menu_title' => __( 'Simple Sidebars', 'genesis-simple-sidebars' )
53
- )
54
  );
55
 
56
- // Empty, as we'll be building the page manually
57
  $page_ops = array();
58
 
59
  $this->create( $page_id, $menu_ops, $page_ops, $this->settings_field );
60
 
61
- // Simpe Sidebar actions (create, edit, or delete)
62
  add_action( 'admin_init', array( $this, 'actions' ) );
63
 
64
  }
@@ -69,18 +72,17 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
69
  * Echoes out HTML.
70
  *
71
  * @since 1.0.0
72
- *
73
  */
74
  public function admin() {
75
 
76
  echo '<div class="wrap">';
77
 
78
- if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] ) {
79
- require_once( Genesis_Simple_Sidebars()->plugin_dir_path . '/includes/views/admin-edit.php' );
80
- }
81
- else {
82
- require_once( Genesis_Simple_Sidebars()->plugin_dir_path . '/includes/views/admin-main.php' );
83
- }
84
 
85
  echo '</div>';
86
 
@@ -92,7 +94,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
92
  * Displays table rows of sidebars for viewing and editing on the main admin page.
93
  *
94
  * @since 1.0.0
95
- *
96
  */
97
  public function table_rows() {
98
 
@@ -106,32 +107,40 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
106
 
107
  $is_editable = isset( $info['editable'] ) && $info['editable'] ? true : false;
108
 
109
- ?>
110
-
111
- <tr <?php if ( $alt ) { echo 'class="alternate"'; $alt = false; } else { $alt = true; } ?>>
 
 
 
 
 
 
 
 
112
  <td class="name column-name">
113
  <?php
114
- if ( $is_editable ) {
115
- 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'] ) );
116
- } else {
117
- printf( '<strong class="row-title">%s</strong>', esc_html( $info['name'] ) );
118
- }
119
  ?>
120
 
121
  <?php if ( $is_editable ) : ?>
122
  <br />
123
  <div class="row-actions">
124
- <span class="edit"><a href="<?php echo admin_url('admin.php?page=simple-sidebars&amp;action=edit&amp;id=' . esc_html( $id ) ); ?>"><?php _e('Edit', 'genesis-simple-sidebars'); ?></a> | </span>
125
- <span class="delete"><a class="delete-tag" href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=delete&amp;id=' . esc_html( $id ) ), 'simple-sidebars-action_delete-sidebar' ); ?>"><?php _e('Delete', 'genesis-simple-sidebars'); ?></a></span>
126
  </div>
127
  <?php endif; ?>
128
 
129
  </td>
130
  <td class="slug column-slug"><?php echo esc_html( $id ); ?></td>
131
- <td class="description column-description"><?php echo esc_html( $info['description'] )?></td>
132
  </tr>
133
 
134
- <?php
135
  endforeach;
136
 
137
  }
@@ -142,7 +151,6 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
142
  * Depending on what action was intended by the user, this method calls the appropriate action method.
143
  *
144
  * @since 1.0.0
145
- *
146
  */
147
  public function actions() {
148
 
@@ -153,24 +161,26 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
153
  /**
154
  * This section handles the data if a new sidebar is created
155
  */
156
- if ( isset( $_REQUEST['action'] ) && 'create' == $_REQUEST['action'] ) {
157
- $this->create_sidebar( $_POST['new_sidebar'] );
 
158
  }
159
 
160
  /**
161
  * This section will handle the data if a sidebar is deleted
162
  */
163
- if ( isset( $_REQUEST['action'] ) && 'delete' == $_REQUEST['action'] && isset( $_REQUEST['id'] ) ) {
164
- $this->delete_sidebar( $_REQUEST['id'] );
 
165
  }
166
 
167
  /**
168
  * This section will handle the data if a sidebar is to be modified
169
  */
170
- if ( isset( $_REQUEST['action'] ) && 'edit' == $_REQUEST['action'] && ! isset( $_REQUEST['id'] ) ) {
171
- $this->edit_sidebar( $_POST['edit_sidebar'] );
172
  }
173
-
174
  }
175
 
176
  /**
@@ -188,39 +198,38 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
188
 
189
  $pattern = '<div id="message" class="updated"><p><strong>%s</strong></p></div>';
190
 
 
191
  if ( isset( $_REQUEST['created'] ) && 'true' === $_REQUEST['created'] ) {
192
- printf( $pattern, __( 'New sidebar successfully created!', 'genesis-simple-sidebars' ) );
193
  return;
194
  }
195
 
196
  if ( isset( $_REQUEST['edited'] ) && 'true' === $_REQUEST['edited'] ) {
197
- printf( $pattern, __( 'Sidebar successfully edited!', 'genesis-simple-sidebars' ) );
198
  return;
199
  }
200
 
201
  if ( isset( $_REQUEST['deleted'] ) && 'true' === $_REQUEST['deleted'] ) {
202
- printf( $pattern, __( 'Sidebar successfully deleted.', 'genesis-simple-sidebars' ) );
203
  return;
204
  }
205
 
206
- return;
207
-
208
  }
209
 
210
  /**
211
  * Create a sidebar.
212
  *
213
- * @since 1.0.0
214
  *
 
215
  */
216
  protected function create_sidebar( $args = array() ) {
217
-
218
  if ( empty( $args['name'] ) ) {
219
- wp_die( $this->error( 1 ) );
220
  exit;
221
  }
222
 
223
- // nonce verification
224
  check_admin_referer( 'simple-sidebars-action_create-sidebar' );
225
 
226
  $db = (array) get_option( $this->settings_field );
@@ -231,7 +240,7 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
231
  }
232
 
233
  // Strip all but alphanumeric, sanitize with dashes.
234
- $id = preg_replace( "/[^a-zA-Z0-9 -]+/", "", sanitize_title_with_dashes( $args['id'] ) );
235
 
236
  // Preface numeric IDs with 'sidebar-'.
237
  $id = is_numeric( $id ) ? 'gss-sidebar-' . $id : $id;
@@ -240,26 +249,27 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
240
  if ( ! $id || is_registered_sidebar( $id ) ) {
241
  $n = count( $db ) + 1;
242
  do {
243
- $id = 'gss-sidebar-' . $n++;
 
244
  } while ( is_registered_sidebar( $id ) );
245
  }
246
 
247
  $new = array(
248
  $id => array(
249
  'name' => esc_html( $args['name'] ),
250
- 'description' => esc_html( $args['description'] )
251
  ),
252
  );
253
 
254
  if ( array_key_exists( $id, $db ) ) {
255
- wp_die( $this->error( 2 ) );
256
  exit;
257
  }
258
 
259
  $_sidebars = wp_parse_args( $new, $db );
260
 
261
  update_option( $this->settings_field, $_sidebars );
262
- wp_redirect( admin_url( 'admin.php?page=simple-sidebars&created=true' ) );
263
  exit;
264
 
265
  }
@@ -267,36 +277,36 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
267
  /**
268
  * Edit a sidebar.
269
  *
 
270
  * @since 1.0.0
271
- *
272
  */
273
  protected function edit_sidebar( $args = array() ) {
274
 
275
  if ( empty( $args['name'] ) || empty( $args['id'] ) ) {
276
- wp_die( $this->error( 3 ) );
277
  exit;
278
  }
279
 
280
- // nonce verification
281
  check_admin_referer( 'simple-sidebars-action_edit-sidebar' );
282
 
283
- $db = (array) get_option( $this->settings_field );
284
  $new = array(
285
  $args['id'] => array(
286
  'name' => esc_html( $args['name'] ),
287
- 'description' => esc_html( $args['description'] )
288
- )
289
  );
290
 
291
  if ( ! array_key_exists( $args['id'], $db ) ) {
292
- wp_die( $this->error( 3 ) );
293
  exit;
294
  }
295
 
296
  $_sidebars = wp_parse_args( $new, $db );
297
 
298
  update_option( $this->settings_field, $_sidebars );
299
- wp_redirect( admin_url( 'admin.php?page=simple-sidebars&edited=true' ) );
300
  exit;
301
 
302
  }
@@ -304,30 +314,29 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
304
  /**
305
  * Delete a sidebar.
306
  *
 
307
  * @since 1.0.0
308
- *
309
  */
310
  protected function delete_sidebar( $id = '' ) {
311
-
312
  if ( empty( $id ) ) {
313
- wp_die( $this->error( 4 ) );
314
  exit;
315
  }
316
 
317
- // nonce verification
318
  check_admin_referer( 'simple-sidebars-action_delete-sidebar' );
319
 
320
  $_sidebars = (array) get_option( $this->settings_field );
321
 
322
- if ( ! isset( $_sidebars[$id] ) ) {
323
- wp_die( $this->error( 4 ) );
324
  exit;
325
  }
326
 
327
- unset( $_sidebars[$id] );
328
 
329
  update_option( $this->settings_field, $_sidebars );
330
- wp_redirect( admin_url( 'admin.php?page=simple-sidebars&deleted=true' ) );
331
  exit;
332
 
333
  }
@@ -335,29 +344,28 @@ class Genesis_Simple_Sidebars_Admin extends Genesis_Admin_Basic {
335
  /**
336
  * Returns an error message by ID.
337
  *
 
 
338
  * @since 1.0.0
339
  *
340
  * @return string Returns an error string based on an error ID.
341
  */
342
  protected function error( $error = false ) {
343
 
344
- if ( ! $error )
345
  return false;
 
346
 
347
- switch( (int) $error ) {
348
 
349
  case 1:
350
  return __( 'Oops! Please choose a valid Name for this sidebar', 'genesis-simple-sidebars' );
351
- break;
352
  case 2:
353
  return __( 'Oops! That sidebar ID already exists', 'genesis-simple-sidebars' );
354
- break;
355
  case 3:
356
  return __( 'Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'genesis-simple-sidebars' );
357
- break;
358
  case 4:
359
  return __( 'Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted', 'genesis-simple-sidebars' );
360
- break;
361
  default:
362
  return __( 'Oops! Something went wrong. Try again.', 'genesis-simple-sidebars' );
363
 
3
  * Controls the creation, deletion, and editing of Simple Sidebar.
4
  *
5
  * @author StudioPress
6
+ * @package genesis-simple-sidebars
7
  */
8
 
9
  /**
17
  /**
18
  * Settings field.
19
  *
20
+ * @var string
21
+ *
22
  * @since 2.1.0
23
  */
24
  public $settings_field;
30
 
31
  $this->settings_field = Genesis_Simple_Sidebars()->settings_field;
32
 
33
+ // For backward compatibility.
34
  define( 'SS_SETTINGS_FIELD', $this->settings_field );
35
 
36
  }
52
  'submenu' => array(
53
  'parent_slug' => 'genesis',
54
  'page_title' => __( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ),
55
+ 'menu_title' => __( 'Simple Sidebars', 'genesis-simple-sidebars' ),
56
+ ),
57
  );
58
 
59
+ // Empty, as we'll be building the page manually.
60
  $page_ops = array();
61
 
62
  $this->create( $page_id, $menu_ops, $page_ops, $this->settings_field );
63
 
64
+ // Simpe Sidebar actions (create, edit, or delete).
65
  add_action( 'admin_init', array( $this, 'actions' ) );
66
 
67
  }
72
  * Echoes out HTML.
73
  *
74
  * @since 1.0.0
 
75
  */
76
  public function admin() {
77
 
78
  echo '<div class="wrap">';
79
 
80
+ // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
81
+ if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] ) {
82
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/admin-edit.php';
83
+ } else {
84
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/admin-main.php';
85
+ }
86
 
87
  echo '</div>';
88
 
94
  * Displays table rows of sidebars for viewing and editing on the main admin page.
95
  *
96
  * @since 1.0.0
 
97
  */
98
  public function table_rows() {
99
 
107
 
108
  $is_editable = isset( $info['editable'] ) && $info['editable'] ? true : false;
109
 
110
+ ?>
111
+
112
+ <tr
113
+ <?php
114
+ if ( $alt ) {
115
+ echo 'class="alternate"';
116
+ $alt = false;
117
+ } else {
118
+ $alt = true; }
119
+ ?>
120
+ >
121
  <td class="name column-name">
122
  <?php
123
+ if ( $is_editable ) {
124
+ 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'] ) );
125
+ } else {
126
+ printf( '<strong class="row-title">%s</strong>', esc_html( $info['name'] ) );
127
+ }
128
  ?>
129
 
130
  <?php if ( $is_editable ) : ?>
131
  <br />
132
  <div class="row-actions">
133
+ <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>
134
+ <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>
135
  </div>
136
  <?php endif; ?>
137
 
138
  </td>
139
  <td class="slug column-slug"><?php echo esc_html( $id ); ?></td>
140
+ <td class="description column-description"><?php echo esc_html( $info['description'] ); ?></td>
141
  </tr>
142
 
143
+ <?php
144
  endforeach;
145
 
146
  }
151
  * Depending on what action was intended by the user, this method calls the appropriate action method.
152
  *
153
  * @since 1.0.0
 
154
  */
155
  public function actions() {
156
 
161
  /**
162
  * This section handles the data if a new sidebar is created
163
  */
164
+ // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
165
+ if ( isset( $_REQUEST['action'] ) && 'create' === $_REQUEST['action'] && isset( $_POST['new_sidebar'] ) ) {
166
+ $this->create_sidebar( array_map( 'sanitize_text_field', wp_unslash( $_POST['new_sidebar'] ) ) );
167
  }
168
 
169
  /**
170
  * This section will handle the data if a sidebar is deleted
171
  */
172
+ // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
173
+ if ( isset( $_REQUEST['action'] ) && 'delete' === $_REQUEST['action'] && isset( $_REQUEST['id'] ) ) {
174
+ $this->delete_sidebar( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) );
175
  }
176
 
177
  /**
178
  * This section will handle the data if a sidebar is to be modified
179
  */
180
+ if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] && ! isset( $_REQUEST['id'] ) && isset( $_POST['edit_sidebar'] ) ) {
181
+ $this->edit_sidebar( array_map( 'sanitize_text_field', wp_unslash( $_POST['edit_sidebar'] ) ) );
182
  }
183
+ // phpcs:enable
184
  }
185
 
186
  /**
198
 
199
  $pattern = '<div id="message" class="updated"><p><strong>%s</strong></p></div>';
200
 
201
+ // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
202
  if ( isset( $_REQUEST['created'] ) && 'true' === $_REQUEST['created'] ) {
203
+ printf( wp_kses_post( $pattern ), esc_html__( 'New sidebar successfully created!', 'genesis-simple-sidebars' ) );
204
  return;
205
  }
206
 
207
  if ( isset( $_REQUEST['edited'] ) && 'true' === $_REQUEST['edited'] ) {
208
+ printf( wp_kses_post( $pattern ), esc_html__( 'Sidebar successfully edited!', 'genesis-simple-sidebars' ) );
209
  return;
210
  }
211
 
212
  if ( isset( $_REQUEST['deleted'] ) && 'true' === $_REQUEST['deleted'] ) {
213
+ printf( wp_kses_post( $pattern ), esc_html__( 'Sidebar successfully deleted.', 'genesis-simple-sidebars' ) );
214
  return;
215
  }
216
 
 
 
217
  }
218
 
219
  /**
220
  * Create a sidebar.
221
  *
222
+ * @param array $args Arguments.
223
  *
224
+ * @since 1.0.0
225
  */
226
  protected function create_sidebar( $args = array() ) {
 
227
  if ( empty( $args['name'] ) ) {
228
+ wp_die( esc_html( $this->error( 1 ) ) );
229
  exit;
230
  }
231
 
232
+ // nonce verification.
233
  check_admin_referer( 'simple-sidebars-action_create-sidebar' );
234
 
235
  $db = (array) get_option( $this->settings_field );
240
  }
241
 
242
  // Strip all but alphanumeric, sanitize with dashes.
243
+ $id = preg_replace( '/[^a-zA-Z0-9 -]+/', '', sanitize_title_with_dashes( $args['id'] ) );
244
 
245
  // Preface numeric IDs with 'sidebar-'.
246
  $id = is_numeric( $id ) ? 'gss-sidebar-' . $id : $id;
249
  if ( ! $id || is_registered_sidebar( $id ) ) {
250
  $n = count( $db ) + 1;
251
  do {
252
+ $n = $n++;
253
+ $id = 'gss-sidebar-' . $n;
254
  } while ( is_registered_sidebar( $id ) );
255
  }
256
 
257
  $new = array(
258
  $id => array(
259
  'name' => esc_html( $args['name'] ),
260
+ 'description' => esc_html( $args['description'] ),
261
  ),
262
  );
263
 
264
  if ( array_key_exists( $id, $db ) ) {
265
+ wp_die( esc_html( $this->error( 2 ) ) );
266
  exit;
267
  }
268
 
269
  $_sidebars = wp_parse_args( $new, $db );
270
 
271
  update_option( $this->settings_field, $_sidebars );
272
+ wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&created=true' ) );
273
  exit;
274
 
275
  }
277
  /**
278
  * Edit a sidebar.
279
  *
280
+ * @param array $args Arguments.
281
  * @since 1.0.0
 
282
  */
283
  protected function edit_sidebar( $args = array() ) {
284
 
285
  if ( empty( $args['name'] ) || empty( $args['id'] ) ) {
286
+ wp_die( esc_html( $this->error( 3 ) ) );
287
  exit;
288
  }
289
 
290
+ // nonce verification.
291
  check_admin_referer( 'simple-sidebars-action_edit-sidebar' );
292
 
293
+ $db = (array) get_option( $this->settings_field );
294
  $new = array(
295
  $args['id'] => array(
296
  'name' => esc_html( $args['name'] ),
297
+ 'description' => esc_html( $args['description'] ),
298
+ ),
299
  );
300
 
301
  if ( ! array_key_exists( $args['id'], $db ) ) {
302
+ wp_die( esc_html( $this->error( 3 ) ) );
303
  exit;
304
  }
305
 
306
  $_sidebars = wp_parse_args( $new, $db );
307
 
308
  update_option( $this->settings_field, $_sidebars );
309
+ wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&edited=true' ) );
310
  exit;
311
 
312
  }
314
  /**
315
  * Delete a sidebar.
316
  *
317
+ * @param string $id Id.
318
  * @since 1.0.0
 
319
  */
320
  protected function delete_sidebar( $id = '' ) {
 
321
  if ( empty( $id ) ) {
322
+ wp_die( esc_html( $this->error( 4 ) ) );
323
  exit;
324
  }
325
 
326
+ // nonce verification.
327
  check_admin_referer( 'simple-sidebars-action_delete-sidebar' );
328
 
329
  $_sidebars = (array) get_option( $this->settings_field );
330
 
331
+ if ( ! isset( $_sidebars[ $id ] ) ) {
332
+ wp_die( esc_html( $this->error( 4 ) ) );
333
  exit;
334
  }
335
 
336
+ unset( $_sidebars[ $id ] );
337
 
338
  update_option( $this->settings_field, $_sidebars );
339
+ wp_safe_redirect( admin_url( 'admin.php?page=simple-sidebars&deleted=true' ) );
340
  exit;
341
 
342
  }
344
  /**
345
  * Returns an error message by ID.
346
  *
347
+ * @param bool $error Error id.
348
+ *
349
  * @since 1.0.0
350
  *
351
  * @return string Returns an error string based on an error ID.
352
  */
353
  protected function error( $error = false ) {
354
 
355
+ if ( ! $error ) {
356
  return false;
357
+ }
358
 
359
+ switch ( (int) $error ) {
360
 
361
  case 1:
362
  return __( 'Oops! Please choose a valid Name for this sidebar', 'genesis-simple-sidebars' );
 
363
  case 2:
364
  return __( 'Oops! That sidebar ID already exists', 'genesis-simple-sidebars' );
 
365
  case 3:
366
  return __( 'Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'genesis-simple-sidebars' );
 
367
  case 4:
368
  return __( 'Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted', 'genesis-simple-sidebars' );
 
369
  default:
370
  return __( 'Oops! Something went wrong. Try again.', 'genesis-simple-sidebars' );
371
 
includes/class-genesis-simple-sidebars-core.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
 
3
  /**
4
  * Controls the core functions of registration and output of Sidebars
@@ -9,11 +14,15 @@ class Genesis_Simple_Sidebars_Core {
9
 
10
  /**
11
  * The created sidebars.
 
 
12
  */
13
  private $sidebars;
14
 
15
  /**
16
  * Public taxonomies.
 
 
17
  */
18
  private $public_taxonomies;
19
 
@@ -28,6 +37,11 @@ class Genesis_Simple_Sidebars_Core {
28
 
29
  }
30
 
 
 
 
 
 
31
  public function backward_compatibility() {
32
 
33
  remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
@@ -50,19 +64,21 @@ class Genesis_Simple_Sidebars_Core {
50
  return;
51
  }
52
 
53
- // Cycle through created sidebars, register them as widget areas
54
  foreach ( (array) $sidebars as $id => $info ) {
55
 
56
  if ( ! isset( $info['name'] ) || ! isset( $info['description'] ) ) {
57
  continue;
58
  }
59
 
60
- genesis_register_sidebar( array(
61
- 'name' => esc_html( $info['name'] ),
62
- 'id' => $id,
63
- 'description' => esc_html( $info['description'] ),
64
- 'editable' => 1,
65
- ) );
 
 
66
 
67
  }
68
 
@@ -71,6 +87,8 @@ class Genesis_Simple_Sidebars_Core {
71
  /**
72
  * Filter the widgets in each widget area.
73
  *
 
 
74
  * @since 2.1.0
75
  */
76
  public function sidebars_widgets_filter( $widgets ) {
@@ -106,6 +124,9 @@ class Genesis_Simple_Sidebars_Core {
106
  /**
107
  * Take the $widgets array and swap the contents of each widget area with a custom widget area, if specified.
108
  *
 
 
 
109
  * @since 2.1.0
110
  */
111
  public function swap_widgets( $widgets, $sidebars ) {
@@ -123,7 +144,6 @@ class Genesis_Simple_Sidebars_Core {
123
  if ( $new_sidebar && ! empty( $widgets[ $new_sidebar ] ) ) {
124
  $widgets[ $old_sidebar ] = $widgets[ $new_sidebar ];
125
  }
126
-
127
  }
128
 
129
  return $widgets;
@@ -133,6 +153,8 @@ class Genesis_Simple_Sidebars_Core {
133
  /**
134
  * Get all custom registered sidebars.
135
  *
 
 
136
  * @since 2.1.0
137
  */
138
  public function get_sidebars( $cache = true ) {
@@ -159,10 +181,12 @@ class Genesis_Simple_Sidebars_Core {
159
  public function get_public_taxonomies() {
160
 
161
  if ( is_null( $this->public_taxonomies ) ) {
162
- $this->public_taxonomies = get_taxonomies( array(
163
- 'show_ui' => true,
164
- 'public' => true,
165
- ) );
 
 
166
  }
167
 
168
  $this->public_taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) );
1
  <?php
2
+ /**
3
+ * Genesis Simple Sidebars Core.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
 
8
  /**
9
  * Controls the core functions of registration and output of Sidebars
14
 
15
  /**
16
  * The created sidebars.
17
+ *
18
+ * @var string
19
  */
20
  private $sidebars;
21
 
22
  /**
23
  * Public taxonomies.
24
+ *
25
+ * @var array
26
  */
27
  private $public_taxonomies;
28
 
37
 
38
  }
39
 
40
+ /**
41
+ * For backward compatibility, we need to use old functions to hook in sidebar output.
42
+ *
43
+ * @since 2.1.0
44
+ */
45
  public function backward_compatibility() {
46
 
47
  remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
64
  return;
65
  }
66
 
67
+ // Cycle through created sidebars, register them as widget areas.
68
  foreach ( (array) $sidebars as $id => $info ) {
69
 
70
  if ( ! isset( $info['name'] ) || ! isset( $info['description'] ) ) {
71
  continue;
72
  }
73
 
74
+ genesis_register_sidebar(
75
+ array(
76
+ 'name' => esc_html( $info['name'] ),
77
+ 'id' => $id,
78
+ 'description' => esc_html( $info['description'] ),
79
+ 'editable' => 1,
80
+ )
81
+ );
82
 
83
  }
84
 
87
  /**
88
  * Filter the widgets in each widget area.
89
  *
90
+ * @param array $widgets Widgets.
91
+ *
92
  * @since 2.1.0
93
  */
94
  public function sidebars_widgets_filter( $widgets ) {
124
  /**
125
  * Take the $widgets array and swap the contents of each widget area with a custom widget area, if specified.
126
  *
127
+ * @param array $widgets Widgets.
128
+ * @param array $sidebars Sidebars.
129
+ *
130
  * @since 2.1.0
131
  */
132
  public function swap_widgets( $widgets, $sidebars ) {
144
  if ( $new_sidebar && ! empty( $widgets[ $new_sidebar ] ) ) {
145
  $widgets[ $old_sidebar ] = $widgets[ $new_sidebar ];
146
  }
 
147
  }
148
 
149
  return $widgets;
153
  /**
154
  * Get all custom registered sidebars.
155
  *
156
+ * @param bool $cache Indicates if should get from cache.
157
+ *
158
  * @since 2.1.0
159
  */
160
  public function get_sidebars( $cache = true ) {
181
  public function get_public_taxonomies() {
182
 
183
  if ( is_null( $this->public_taxonomies ) ) {
184
+ $this->public_taxonomies = get_taxonomies(
185
+ array(
186
+ 'show_ui' => true,
187
+ 'public' => true,
188
+ )
189
+ );
190
  }
191
 
192
  $this->public_taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $this->public_taxonomies ) );
includes/class-genesis-simple-sidebars-entry.php CHANGED
@@ -1,7 +1,18 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
3
  class Genesis_Simple_Sidebars_Entry {
4
 
 
 
 
5
  public function init() {
6
 
7
  add_action( 'admin_menu', array( $this, 'add_metaboxes' ) );
@@ -18,10 +29,9 @@ class Genesis_Simple_Sidebars_Entry {
18
 
19
  foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) {
20
 
21
- if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
22
  add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'genesis-simple-sidebars' ), array( $this, 'metabox_content' ), $type, 'side', 'low' );
23
  }
24
-
25
  }
26
 
27
  }
@@ -33,26 +43,34 @@ class Genesis_Simple_Sidebars_Entry {
33
  */
34
  public function metabox_content() {
35
 
36
- require_once( Genesis_Simple_Sidebars()->plugin_dir_path . 'includes/views/entry-metabox-content.php' );
37
 
38
  }
39
 
40
  /**
41
  * Save the metabox fields when the entry is saved.
42
  *
 
 
43
  * @since 2.1.0
44
  */
45
  public function metabox_save( $post_id, $post ) {
46
 
47
- if ( ! isset( $_POST['genesis_simple_sidebars'] ) ) {
 
 
 
48
  return;
49
  }
50
 
51
- $data = wp_parse_args( $_POST['genesis_simple_sidebars'], array(
52
- '_ss_header' => '',
53
- '_ss_sidebar' => '',
54
- '_ss_sidebar_alt' => '',
55
- ) );
 
 
 
56
 
57
  genesis_save_custom_fields( $data, 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce', $post );
58
 
1
  <?php
2
+ /**
3
+ * Genesis Simple Sidebars Entry file.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
+
8
+ /**
9
+ * Genesis Simple Sidebars Entry class.
10
+ */
11
  class Genesis_Simple_Sidebars_Entry {
12
 
13
+ /**
14
+ * Init function.
15
+ */
16
  public function init() {
17
 
18
  add_action( 'admin_menu', array( $this, 'add_metaboxes' ) );
29
 
30
  foreach ( (array) get_post_types( array( 'public' => true ) ) as $type ) {
31
 
32
+ if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || 'post' === $type || 'page' === $type ) {
33
  add_meta_box( 'ss_inpost_metabox', __( 'Sidebar Selection', 'genesis-simple-sidebars' ), array( $this, 'metabox_content' ), $type, 'side', 'low' );
34
  }
 
35
  }
36
 
37
  }
43
  */
44
  public function metabox_content() {
45
 
46
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/entry-metabox-content.php';
47
 
48
  }
49
 
50
  /**
51
  * Save the metabox fields when the entry is saved.
52
  *
53
+ * @param string $post_id Post Id.
54
+ * @param array $post Post.
55
  * @since 2.1.0
56
  */
57
  public function metabox_save( $post_id, $post ) {
58
 
59
+ // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
60
+ $genesis_simple_sidebars = isset( $_POST['genesis_simple_sidebars'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['genesis_simple_sidebars'] ) ) : '';
61
+
62
+ if ( empty( $genesis_simple_sidebars ) ) {
63
  return;
64
  }
65
 
66
+ $data = wp_parse_args(
67
+ $genesis_simple_sidebars,
68
+ array(
69
+ '_ss_header' => '',
70
+ '_ss_sidebar' => '',
71
+ '_ss_sidebar_alt' => '',
72
+ )
73
+ );
74
 
75
  genesis_save_custom_fields( $data, 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce', $post );
76
 
includes/class-genesis-simple-sidebars-term.php CHANGED
@@ -1,13 +1,27 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
3
  class Genesis_Simple_Sidebars_Term {
4
 
 
 
 
5
  public function init() {
6
 
7
- add_action( 'init', array( $this, 'add_term_fields' ) );
8
 
9
  }
10
 
 
 
 
11
  public function add_term_fields() {
12
 
13
  $taxonomies = Genesis_Simple_Sidebars()->core->get_public_taxonomies();
@@ -17,14 +31,19 @@ class Genesis_Simple_Sidebars_Term {
17
  foreach ( $taxonomies as $tax ) {
18
  add_action( "{$tax}_edit_form", array( $this, 'term_sidebar_form' ), 9, 2 );
19
  }
20
-
21
  }
22
 
23
  }
24
 
 
 
 
 
 
 
25
  public function term_sidebar_form( $tag, $taxonomy ) {
26
 
27
- require_once( Genesis_Simple_Sidebars()->plugin_dir_path . 'includes/views/term-edit-sidebar-form.php' );
28
 
29
  }
30
 
1
  <?php
2
+ /**
3
+ * Genesis Simple Sidebars Term.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
+
8
+ /**
9
+ * Class Genesis Simple Sidebars Term.
10
+ */
11
  class Genesis_Simple_Sidebars_Term {
12
 
13
+ /**
14
+ * Init function.
15
+ */
16
  public function init() {
17
 
18
+ add_action( 'init', array( $this, 'add_term_fields' ), 12 );
19
 
20
  }
21
 
22
+ /**
23
+ * Adds term fields.
24
+ */
25
  public function add_term_fields() {
26
 
27
  $taxonomies = Genesis_Simple_Sidebars()->core->get_public_taxonomies();
31
  foreach ( $taxonomies as $tax ) {
32
  add_action( "{$tax}_edit_form", array( $this, 'term_sidebar_form' ), 9, 2 );
33
  }
 
34
  }
35
 
36
  }
37
 
38
+ /**
39
+ * Import the sidebar form.
40
+ *
41
+ * @param string $tag Tag.
42
+ * @param string $taxonomy Taxonomy.
43
+ */
44
  public function term_sidebar_form( $tag, $taxonomy ) {
45
 
46
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/views/term-edit-sidebar-form.php';
47
 
48
  }
49
 
includes/class-genesis-simple-sidebars.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Genesis Simple Sidebars main class.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
+
8
+ /**
9
+ * Genesis Simple Sidebars class.
10
+ */
11
+ class Genesis_Simple_Sidebars {
12
+
13
+ /**
14
+ * Minimum WordPress version.
15
+ *
16
+ * @var string
17
+ */
18
+ public $min_wp_version = '4.7.2';
19
+
20
+ /**
21
+ * Minimum Genesis version.
22
+ *
23
+ * @var string
24
+ */
25
+ public $min_genesis_version = '2.4.2';
26
+
27
+ /**
28
+ * The plugin textdomain, for translations.
29
+ *
30
+ * @var string
31
+ */
32
+ public $plugin_textdomain = 'genesis-simple-sidebars';
33
+
34
+ /**
35
+ * The main settings field for this plugin.
36
+ *
37
+ * @var string
38
+ */
39
+ public $settings_field = 'ss-settings';
40
+
41
+ /**
42
+ * Core functions of sidebar registration and output.
43
+ *
44
+ * @var Genesis_Simple_Sidebars_Core
45
+ */
46
+ public $core;
47
+
48
+ /**
49
+ * Admin menu and settings page.
50
+ *
51
+ * @var Genesis_Simple_Sidebars_Admin
52
+ */
53
+ public $admin;
54
+
55
+ /**
56
+ * Entry settings and metadata.
57
+ *
58
+ * @var Genesis_Simple_Sidebars_Entry
59
+ */
60
+ public $entry;
61
+
62
+ /**
63
+ * Constructor.
64
+ *
65
+ * @since 2.1.0
66
+ */
67
+ public function __construct() {
68
+
69
+ // For backward compatibility.
70
+ define( 'SS_PLUGIN_DIR', GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR );
71
+
72
+ }
73
+
74
+ /**
75
+ * Initialize.
76
+ *
77
+ * @since 2.1.0
78
+ */
79
+ public function init() {
80
+
81
+ $this->load_plugin_textdomain();
82
+
83
+ add_action( 'admin_notices', array( $this, 'requirements_notice' ) );
84
+
85
+ $this->includes();
86
+ $this->instantiate();
87
+
88
+ }
89
+
90
+ /**
91
+ * Show admin notice if minimum requirements aren't met.
92
+ *
93
+ * @since 2.1.0
94
+ */
95
+ public function requirements_notice() {
96
+
97
+ if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, $this->min_genesis_version, '>=' ) ) {
98
+
99
+ $action = defined( 'PARENT_THEME_VERSION' ) ? __( 'upgrade to', 'genesis-simple-sidebars' ) : __( 'install and activate', 'genesis-simple-sidebars' );
100
+
101
+ // translators: %1$s is WordPress minimum version, %2$s is Genesis minimum version, %3$s is action and %4$s is link.
102
+ $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' );
103
+ echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . '</p></div>';
104
+
105
+ }
106
+
107
+ }
108
+
109
+ /**
110
+ * Load the plugin textdomain, for translation.
111
+ *
112
+ * @since 2.1.0
113
+ */
114
+ public function load_plugin_textdomain() {
115
+ load_plugin_textdomain( $this->plugin_textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
116
+ }
117
+
118
+ /**
119
+ * All general includes.
120
+ *
121
+ * @since 2.1.0
122
+ */
123
+ public function includes() {
124
+
125
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/functions.php';
126
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/deprecated.php';
127
+
128
+ }
129
+
130
+ /**
131
+ * Include the class file, instantiate the classes, create objects.
132
+ *
133
+ * @since 2.1.0
134
+ */
135
+ public function instantiate() {
136
+
137
+ add_action( 'genesis_setup', array( $this, 'genesis_dependencies' ) );
138
+
139
+ }
140
+
141
+ /**
142
+ * Load and instantiate any Genesis dependencies.
143
+ *
144
+ * @since 2.1.0
145
+ */
146
+ public function genesis_dependencies() {
147
+
148
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-core.php';
149
+ $this->core = new Genesis_Simple_Sidebars_Core();
150
+ $this->core->init();
151
+
152
+ // Anything beyond this point should only be loaded if in the admin.
153
+ if ( ! is_admin() ) {
154
+ return;
155
+ }
156
+
157
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-entry.php';
158
+ $this->entry = new Genesis_Simple_Sidebars_Entry();
159
+ $this->entry->init();
160
+
161
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-term.php';
162
+ $this->term = new Genesis_Simple_Sidebars_Term();
163
+ $this->term->init();
164
+
165
+ require_once GENESIS_SIMPLE_SIDEBARS_PLUGIN_DIR . '/includes/class-genesis-simple-sidebars-admin.php';
166
+ $this->admin = new Genesis_Simple_Sidebars_Admin();
167
+ $this->admin->admin_menu();
168
+
169
+ // For backward compatibility.
170
+ global $_genesis_simple_sidebars;
171
+ $_genesis_simple_sidebars = $this->admin;
172
+
173
+ }
174
+
175
+ }
includes/deprecated.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
 
3
  /**
4
  * Deprecated.
@@ -53,19 +58,21 @@ function ss_sidebars_init() {
53
  /**
54
  * Deprecated.
55
  *
 
 
56
  * @since 0.9.0
57
  * @deprecated 2.1.0
58
  */
59
  function ss_do_one_sidebar( $sidebar_key = '' ) {
60
 
61
- _deprecated_function( __FUNCTION__, '2.1.0', __( 'dynamic_sidebar() with sidebars_widget filter', 'genesis-simple-sidebars' ) );
62
 
63
- if ( '_ss_sidebar' == $sidebar_key ) {
64
  genesis_do_sidebar();
65
  return true;
66
  }
67
 
68
- if ( '_ss_sidebar_alt' == $sidebar_key ) {
69
  genesis_do_sidebar_alt();
70
  return true;
71
  }
1
  <?php
2
+ /**
3
+ * Deprecated functions file.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
 
8
  /**
9
  * Deprecated.
58
  /**
59
  * Deprecated.
60
  *
61
+ * @param string $sidebar_key Sidebar Key.
62
+ *
63
  * @since 0.9.0
64
  * @deprecated 2.1.0
65
  */
66
  function ss_do_one_sidebar( $sidebar_key = '' ) {
67
 
68
+ _deprecated_function( __FUNCTION__, '2.1.0', esc_html__( 'dynamic_sidebar() with sidebars_widget filter', 'genesis-simple-sidebars' ) );
69
 
70
+ if ( '_ss_sidebar' === $sidebar_key ) {
71
  genesis_do_sidebar();
72
  return true;
73
  }
74
 
75
+ if ( '_ss_sidebar_alt' === $sidebar_key ) {
76
  genesis_do_sidebar_alt();
77
  return true;
78
  }
includes/functions.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
 
3
  /**
4
  * Dummy function for backward compatibility. Outputs the primary sidebar.
1
  <?php
2
+ /**
3
+ * Functions file.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
 
8
  /**
9
  * Dummy function for backward compatibility. Outputs the primary sidebar.
includes/views/admin-edit.php CHANGED
@@ -1,40 +1,49 @@
1
  <?php
 
 
 
 
 
 
2
  $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
3
 
4
- if ( array_key_exists( $_REQUEST['id'], (array) $sidebars ) ) {
5
- $sidebar = stripslashes_deep( $sidebars[ $_REQUEST['id'] ] );
 
6
  } else {
7
- wp_die( __( 'Nice try, partner. But that sidebar doesn\'t exist. Click back and try again.', 'genesis-simple-sidebars' ) );
8
  }
 
9
  ?>
10
- <h1><?php _e( 'Edit Sidebar', 'genesis-simple-sidebars' ); ?></h1>
11
 
12
- <form method="post" action="<?php echo admin_url( 'admin.php?page=simple-sidebars&amp;action=edit' ); ?>">
13
  <?php wp_nonce_field( 'simple-sidebars-action_edit-sidebar' ); ?>
14
 
15
  <table class="form-table">
16
 
17
  <tr class="form-field">
18
- <th scope="row" valign="top"><label for="edit_sidebar[name]"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></label></th>
19
  <td><input name="edit_sidebar[name]" id="edit_sidebar[name]" type="text" value="<?php echo esc_html( $sidebar['name'] ); ?>" size="40" />
20
- <p class="description"><?php _e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p></td>
21
  </tr>
22
 
23
  <tr class="form-field">
24
- <th scope="row" valign="top"><label for="edit_sidebar[id]"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></label></th>
25
  <td>
26
- <input type="text" value="<?php echo esc_html( $_REQUEST['id'] ); ?>" size="40" readonly />
27
- <input name="edit_sidebar[id]" id="edit_sidebar[id]" type="hidden" value="<?php echo esc_html( $_REQUEST['id'] ); ?>" size="40" />
28
- <p class="description"><?php _e( 'The unique ID is used to register the sidebar widget area (cannot be changed)', 'genesis-simple-sidebars' ); ?></p></td>
 
29
  </tr>
30
 
31
  <tr class="form-field">
32
- <th scope="row" valign="top"><label for="edit_sidebar[description]"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></label></th>
33
  <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>
34
  </tr>
35
 
36
  </table>
37
 
38
- <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e( 'Update', 'genesis-simple-sidebars' ); ?>" /></p>
39
 
40
  </form>
1
  <?php
2
+ /**
3
+ * Admin edit.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
+
8
  $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
9
 
10
+ // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
11
+ if ( isset( $_REQUEST['id'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ), (array) $sidebars ) ) {
12
+ $sidebar = stripslashes_deep( $sidebars[ sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ] );
13
  } else {
14
+ wp_die( esc_html__( 'Nice try, partner. But that sidebar doesn\'t exist. Click back and try again.', 'genesis-simple-sidebars' ) );
15
  }
16
+ // phpcs:enable
17
  ?>
18
+ <h1><?php esc_html_e( 'Edit Sidebar', 'genesis-simple-sidebars' ); ?></h1>
19
 
20
+ <form method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=edit' ) ); ?>">
21
  <?php wp_nonce_field( 'simple-sidebars-action_edit-sidebar' ); ?>
22
 
23
  <table class="form-table">
24
 
25
  <tr class="form-field">
26
+ <th scope="row" valign="top"><label for="edit_sidebar[name]"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></label></th>
27
  <td><input name="edit_sidebar[name]" id="edit_sidebar[name]" type="text" value="<?php echo esc_html( $sidebar['name'] ); ?>" size="40" />
28
+ <p class="description"><?php esc_html_e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p></td>
29
  </tr>
30
 
31
  <tr class="form-field">
32
+ <th scope="row" valign="top"><label for="edit_sidebar[id]"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></label></th>
33
  <td>
34
+ <?php // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification ?>
35
+ <input type="text" value="<?php echo esc_html( sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) ); ?>" size="40" readonly />
36
+ <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" />
37
+ <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>
38
  </tr>
39
 
40
  <tr class="form-field">
41
+ <th scope="row" valign="top"><label for="edit_sidebar[description]"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></label></th>
42
  <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>
43
  </tr>
44
 
45
  </table>
46
 
47
+ <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e( 'Update', 'genesis-simple-sidebars' ); ?>" /></p>
48
 
49
  </form>
includes/views/admin-main.php CHANGED
@@ -1,25 +1,34 @@
1
- <h1><?php _e( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ); ?></h1>
 
 
 
 
 
 
 
 
 
2
 
3
  <div id="col-container">
4
 
5
  <div id="col-right">
6
  <div class="col-wrap">
7
 
8
- <h3><?php _e( 'Current Sidebars', 'genesis-simple-sidebars' ); ?></h3>
9
  <table class="widefat tag fixed" cellspacing="0">
10
  <thead>
11
  <tr>
12
- <th scope="col" id="name" class="manage-column column-name"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></th>
13
- <th scope="col" class="manage-column column-slug"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></th>
14
- <th scope="col" id="description" class="manage-column column-description"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></th>
15
  </tr>
16
  </thead>
17
 
18
  <tfoot>
19
  <tr>
20
- <th scope="col" class="manage-column column-name"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></th>
21
- <th scope="col" class="manage-column column-slug"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></th>
22
- <th scope="col" class="manage-column column-description"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></th>
23
  </tr>
24
  </tfoot>
25
 
@@ -38,29 +47,29 @@
38
 
39
 
40
  <div class="form-wrap">
41
- <h3><?php _e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?></h3>
42
 
43
- <form method="post" action="<?php echo admin_url( 'admin.php?page=simple-sidebars&amp;action=create' ); ?>">
44
  <?php wp_nonce_field( 'simple-sidebars-action_create-sidebar' ); ?>
45
 
46
  <div class="form-field form-required">
47
- <label for="sidebar-name"><?php _e( 'Name', 'genesis-simple-sidebars' ); ?></label>
48
  <input name="new_sidebar[name]" id="sidebar-name" type="text" value="" size="40" aria-required="true" />
49
- <p><?php _e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p>
50
  </div>
51
 
52
  <div class="form-field">
53
- <label for="sidebar-id"><?php _e( 'ID', 'genesis-simple-sidebars' ); ?></label>
54
  <input name="new_sidebar[id]" id="sidebar-id" type="text" value="" size="40" />
55
- <p><?php _e( 'The unique ID is used to register the sidebar widget area', 'genesis-simple-sidebars' ); ?></p>
56
  </div>
57
 
58
  <div class="form-field">
59
- <label for="sidebar-description"><?php _e( 'Description', 'genesis-simple-sidebars' ); ?></label>
60
  <textarea name="new_sidebar[description]" id="sidebar-description" rows="5" cols="40"></textarea>
61
  </div>
62
 
63
- <p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php _e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?>" /></p>
64
  </form></div>
65
 
66
  </div>
1
+ <?php
2
+ /**
3
+ * Main Admin View.
4
+ *
5
+ * @package genesis-simple-sidebar
6
+ */
7
+
8
+ ?>
9
+
10
+ <h1><?php esc_html_e( 'Genesis - Simple Sidebars', 'genesis-simple-sidebars' ); ?></h1>
11
 
12
  <div id="col-container">
13
 
14
  <div id="col-right">
15
  <div class="col-wrap">
16
 
17
+ <h3><?php esc_html_e( 'Current Sidebars', 'genesis-simple-sidebars' ); ?></h3>
18
  <table class="widefat tag fixed" cellspacing="0">
19
  <thead>
20
  <tr>
21
+ <th scope="col" id="name" class="manage-column column-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></th>
22
+ <th scope="col" class="manage-column column-slug"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></th>
23
+ <th scope="col" id="description" class="manage-column column-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></th>
24
  </tr>
25
  </thead>
26
 
27
  <tfoot>
28
  <tr>
29
+ <th scope="col" class="manage-column column-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></th>
30
+ <th scope="col" class="manage-column column-slug"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></th>
31
+ <th scope="col" class="manage-column column-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></th>
32
  </tr>
33
  </tfoot>
34
 
47
 
48
 
49
  <div class="form-wrap">
50
+ <h3><?php esc_html_e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?></h3>
51
 
52
+ <form method="post" action="<?php echo esc_attr( esc_url( admin_url( 'admin.php?page=simple-sidebars&amp;action=create' ) ) ); ?>">
53
  <?php wp_nonce_field( 'simple-sidebars-action_create-sidebar' ); ?>
54
 
55
  <div class="form-field form-required">
56
+ <label for="sidebar-name"><?php esc_html_e( 'Name', 'genesis-simple-sidebars' ); ?></label>
57
  <input name="new_sidebar[name]" id="sidebar-name" type="text" value="" size="40" aria-required="true" />
58
+ <p><?php esc_html_e( 'A recognizable name for your new sidebar widget area', 'genesis-simple-sidebars' ); ?></p>
59
  </div>
60
 
61
  <div class="form-field">
62
+ <label for="sidebar-id"><?php esc_html_e( 'ID', 'genesis-simple-sidebars' ); ?></label>
63
  <input name="new_sidebar[id]" id="sidebar-id" type="text" value="" size="40" />
64
+ <p><?php esc_html_e( 'The unique ID is used to register the sidebar widget area', 'genesis-simple-sidebars' ); ?></p>
65
  </div>
66
 
67
  <div class="form-field">
68
+ <label for="sidebar-description"><?php esc_html_e( 'Description', 'genesis-simple-sidebars' ); ?></label>
69
  <textarea name="new_sidebar[description]" id="sidebar-description" rows="5" cols="40"></textarea>
70
  </div>
71
 
72
+ <p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php esc_attr_e( 'Add New Sidebar', 'genesis-simple-sidebars' ); ?>" /></p>
73
  </form></div>
74
 
75
  </div>
includes/views/entry-metabox-content.php CHANGED
@@ -1,4 +1,10 @@
1
  <?php
 
 
 
 
 
 
2
  $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
3
  global $wp_registered_sidebars;
4
  wp_nonce_field( 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce' );
@@ -7,40 +13,45 @@ if ( is_registered_sidebar( 'header-right' ) ) : ?>
7
  <p>
8
  <label class="howto" for="genesis_simple_sidebars[_ss_header]"><span><?php echo esc_attr( $wp_registered_sidebars['header-right']['name'] ); ?><span></label>
9
  <select name="genesis_simple_sidebars[_ss_header]" id="genesis_simple_sidebars[_ss_header]" style="width: 99%">
10
- <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
11
  <?php
12
- foreach ( (array) $sidebars as $id => $info ) {
13
- printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_header' ), false), esc_html( $info['name'] ) );
14
  }
15
  ?>
16
  </select>
17
  </p>
18
- <?php endif;
 
19
 
20
- if ( is_registered_sidebar( 'sidebar' ) ) : ?>
 
21
  <p>
22
  <label class="howto" for="genesis_simple_sidebars[_ss_sidebar]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar']['name'] ); ?><span></label>
23
  <select name="genesis_simple_sidebars[_ss_sidebar]" id="genesis_simple_sidebars[_ss_sidebar]" style="width: 99%">
24
- <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
25
  <?php
26
- foreach ( (array) $sidebars as $id => $info ) {
27
- printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_sidebar' ), false), esc_html( $info['name'] ) );
28
  }
29
  ?>
30
  </select>
31
  </p>
32
- <?php endif;
 
33
 
34
- if ( is_registered_sidebar( 'sidebar-alt' ) ) : ?>
 
35
  <p>
36
  <label class="howto" for="genesis_simple_sidebars[_ss_sidebar_alt]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar-alt']['name'] ); ?><span></label>
37
  <select name="genesis_simple_sidebars[_ss_sidebar_alt]" id="genesis_simple_sidebars[_ss_sidebar_alt]" style="width: 99%">
38
- <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
39
  <?php
40
- foreach ( (array) $sidebars as $id => $info ) {
41
- printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, genesis_get_custom_field( '_ss_sidebar_alt' ), false ), esc_html( $info['name'] ) );
42
  }
43
  ?>
44
  </select>
45
  </p>
46
- <?php endif;
 
1
  <?php
2
+ /**
3
+ * Genesis view for metabox content.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
+
8
  $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
9
  global $wp_registered_sidebars;
10
  wp_nonce_field( 'genesis-simple-sidebars-save-entry', 'genesis-simple-sidebars-save-entry-nonce' );
13
  <p>
14
  <label class="howto" for="genesis_simple_sidebars[_ss_header]"><span><?php echo esc_attr( $wp_registered_sidebars['header-right']['name'] ); ?><span></label>
15
  <select name="genesis_simple_sidebars[_ss_header]" id="genesis_simple_sidebars[_ss_header]" style="width: 99%">
16
+ <option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
17
  <?php
18
+ foreach ( (array) $sidebars as $sidebar_id => $info ) {
19
+ 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'] ) );
20
  }
21
  ?>
22
  </select>
23
  </p>
24
+ <?php
25
+ endif;
26
 
27
+ if ( is_registered_sidebar( 'sidebar' ) ) :
28
+ ?>
29
  <p>
30
  <label class="howto" for="genesis_simple_sidebars[_ss_sidebar]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar']['name'] ); ?><span></label>
31
  <select name="genesis_simple_sidebars[_ss_sidebar]" id="genesis_simple_sidebars[_ss_sidebar]" style="width: 99%">
32
+ <option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
33
  <?php
34
+ foreach ( (array) $sidebars as $sidebar_id => $info ) {
35
+ 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'] ) );
36
  }
37
  ?>
38
  </select>
39
  </p>
40
+ <?php
41
+ endif;
42
 
43
+ if ( is_registered_sidebar( 'sidebar-alt' ) ) :
44
+ ?>
45
  <p>
46
  <label class="howto" for="genesis_simple_sidebars[_ss_sidebar_alt]"><span><?php echo esc_attr( $wp_registered_sidebars['sidebar-alt']['name'] ); ?><span></label>
47
  <select name="genesis_simple_sidebars[_ss_sidebar_alt]" id="genesis_simple_sidebars[_ss_sidebar_alt]" style="width: 99%">
48
+ <option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
49
  <?php
50
+ foreach ( (array) $sidebars as $sidebar_id => $info ) {
51
+ 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'] ) );
52
  }
53
  ?>
54
  </select>
55
  </p>
56
+ <?php
57
+ endif;
includes/views/term-edit-sidebar-form.php CHANGED
@@ -1,17 +1,25 @@
1
- <?php $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars(); ?>
 
 
 
 
 
2
 
3
- <h3><?php _e( 'Sidebar Options', 'genesis-simple-sidebars' ); ?></h3>
 
 
 
4
  <table class="form-table">
5
 
6
  <?php if ( is_registered_sidebar( 'header-right' ) ) : ?>
7
  <tr class="form-field">
8
- <th scope="row" valign="top"><label for="genesis-meta[_ss_header]"><?php _e( 'Header Right', 'genesis-simple-sidebars' ); ?></label></th>
9
  <td>
10
  <select name="genesis-meta[_ss_header]" id="genesis-meta[_ss_header]" style="padding-right: 10px;">
11
- <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
12
  <?php
13
- foreach ( (array) $sidebars as $id => $info ) {
14
- printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_header', true ), false), esc_html( $info['name'] ) );
15
  }
16
  ?>
17
  </select>
@@ -20,13 +28,13 @@
20
  <?php endif; ?>
21
 
22
  <tr class="form-field">
23
- <th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar]"><?php _e( 'Primary Sidebar', 'genesis-simple-sidebars' ); ?></label></th>
24
  <td>
25
  <select name="genesis-meta[_ss_sidebar]" id="genesis-meta[_ss_sidebar]" style="padding-right: 10px;">
26
- <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
27
  <?php
28
- foreach ( (array) $sidebars as $id => $info ) {
29
- printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar', true ), false), esc_html( $info['name'] ) );
30
  }
31
  ?>
32
  </select>
@@ -35,13 +43,13 @@
35
 
36
  <?php if ( Genesis_Simple_Sidebars()->core->has_3_column_layout() ) : ?>
37
  <tr class="form-field">
38
- <th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar_alt]"><?php _e( 'Secondary Sidebar', 'genesis-simple-sidebars' ); ?></label></th>
39
  <td>
40
  <select name="genesis-meta[_ss_sidebar_alt]" id="genesis-meta[_ss_sidebar_alt]" style="padding-right: 10px;">
41
- <option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
42
  <?php
43
- foreach ( (array) $sidebars as $id => $info ) {
44
- printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar_alt', true ) , false), esc_html( $info['name'] ) );
45
  }
46
  ?>
47
  </select>
1
+ <?php
2
+ /**
3
+ * Term Edit Form View.
4
+ *
5
+ * @package genesis-simple-sidebars
6
+ */
7
 
8
+ $sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
9
+ ?>
10
+
11
+ <h3><?php esc_html_e( 'Sidebar Options', 'genesis-simple-sidebars' ); ?></h3>
12
  <table class="form-table">
13
 
14
  <?php if ( is_registered_sidebar( 'header-right' ) ) : ?>
15
  <tr class="form-field">
16
+ <th scope="row" valign="top"><label for="genesis-meta[_ss_header]"><?php esc_html_e( 'Header Right', 'genesis-simple-sidebars' ); ?></label></th>
17
  <td>
18
  <select name="genesis-meta[_ss_header]" id="genesis-meta[_ss_header]" style="padding-right: 10px;">
19
+ <option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
20
  <?php
21
+ foreach ( (array) $sidebars as $sidebar_id => $info ) {
22
+ 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'] ) );
23
  }
24
  ?>
25
  </select>
28
  <?php endif; ?>
29
 
30
  <tr class="form-field">
31
+ <th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar]"><?php esc_html_e( 'Primary Sidebar', 'genesis-simple-sidebars' ); ?></label></th>
32
  <td>
33
  <select name="genesis-meta[_ss_sidebar]" id="genesis-meta[_ss_sidebar]" style="padding-right: 10px;">
34
+ <option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
35
  <?php
36
+ foreach ( (array) $sidebars as $sidebar_id => $info ) {
37
+ 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'] ) );
38
  }
39
  ?>
40
  </select>
43
 
44
  <?php if ( Genesis_Simple_Sidebars()->core->has_3_column_layout() ) : ?>
45
  <tr class="form-field">
46
+ <th scope="row" valign="top"><label for="genesis-meta[_ss_sidebar_alt]"><?php esc_html_e( 'Secondary Sidebar', 'genesis-simple-sidebars' ); ?></label></th>
47
  <td>
48
  <select name="genesis-meta[_ss_sidebar_alt]" id="genesis-meta[_ss_sidebar_alt]" style="padding-right: 10px;">
49
+ <option value=""><?php esc_html_e( 'Default', 'genesis-simple-sidebars' ); ?></option>
50
  <?php
51
+ foreach ( (array) $sidebars as $sidebar_id => $info ) {
52
+ 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'] ) );
53
  }
54
  ?>
55
  </select>
plugin.php CHANGED
@@ -1,20 +1,26 @@
1
  <?php
2
- /*
3
- Plugin Name: Genesis Simple Sidebars
4
- Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
 
 
7
 
8
- Author: StudioPress
9
- Author URI: http://www.studiopress.com/
 
10
 
11
- Version: 2.1.0
12
-
13
- Text Domain: genesis-simple-sidebars
14
- Domain Path: /languages/
15
-
16
- License: GNU General Public License v2.0 (or later)
17
- License URI: http://www.opensource.org/licenses/gpl-license.php
18
- */
19
-
20
- require_once( plugin_dir_path( __FILE__ ) . 'genesis-simple-sidebars.php' );
1
  <?php
2
+ /**
3
+ * Plugin Name: Genesis Simple Sidebars
4
+ * Plugin URI: https://github.com/copyblogger/genesis-simple-sidebars
5
+ * Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
6
+ * Version: 2.2.0
7
+ * Author: StudioPress
8
+ * Author URI: http://www.studiopress.com/
9
+ * License: GNU General Public License v2.0 (or later)
10
+ * License URI: https://www.opensource.org/licenses/gpl-license.php
11
+ *
12
+ * Text Domain: genesis-simple-sidebars
13
+ * Domain Path: /languages
14
+ *
15
+ * @package genesis-simple-sidebars
16
+ */
17
 
18
+ /**
19
+ * Load the plugin file.
20
+ */
21
 
22
+ if ( ! defined( 'ABSPATH' ) ) {
23
+ exit;
24
+ }
25
 
26
+ require_once plugin_dir_path( __FILE__ ) . 'genesis-simple-sidebars.php';
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
- Contributors: nathanrice, wpmuguru
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: hooks, genesis, genesiswp, studiopress
5
  Requires at least: 4.7.3
6
- Tested up to: 4.7.3
7
- Stable tag: 2.1.0
8
 
9
  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.
10
 
@@ -37,6 +37,10 @@ Not in the way you're probably thinking. The markup surrounding the widget area
37
 
38
  == Changelog ==
39
 
 
 
 
 
40
  = 2.1.0 =
41
  * Rewrite based on new plugin boilerplate.
42
  * Make ID field readonly, rather than disabled.
@@ -85,5 +89,3 @@ Not in the way you're probably thinking. The markup surrounding the widget area
85
 
86
  = 0.1 =
87
  * Initial Alpha Release.
88
-
89
-
1
  === Plugin Name ===
2
+ Contributors: nathanrice, wpmuguru, marksabbath
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: hooks, genesis, genesiswp, studiopress
5
  Requires at least: 4.7.3
6
+ Tested up to: 5.1.1
7
+ Stable tag: 2.2.0
8
 
9
  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.
10
 
37
 
38
  == Changelog ==
39
 
40
+ = 2.2.0 =
41
+ * Fixed coding standards errors.
42
+ * Introduced coding standards validation.
43
+
44
  = 2.1.0 =
45
  * Rewrite based on new plugin boilerplate.
46
  * Make ID field readonly, rather than disabled.
89
 
90
  = 0.1 =
91
  * Initial Alpha Release.