Capability Manager Enhanced - Version 1.9.6

Version Description

  • 23 Apr 2020 =
    • Change : Add New Role retains capitalization as entered for role title (otherwise applies proper case)
    • Feature : Rename Role sidebar box on Capabilities screen
    • Fixed : Fatal error on plugin load if Administrator role does not exist
Download this release

Release Info

Developer kevinB
Plugin Icon 128x128 Capability Manager Enhanced
Version 1.9.6
Comparing to
See all releases

Code changes from version 1.9.5 to 1.9.6

Files changed (51) hide show
  1. capsman-enhanced.php +6 -6
  2. includes/admin.php +11 -0
  3. includes/functions-admin.php +3 -2
  4. includes/handler.php +22 -2
  5. includes/manager.php +3 -2
  6. lang/capsman.mo +0 -0
  7. lang/capsman.po +62 -45
  8. readme.txt +6 -1
  9. vendor/composer/installed.json +6 -6
  10. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php +0 -38
  11. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php +0 -34
  12. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php +0 -54
  13. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php +0 -35
  14. vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php +0 -77
  15. vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +0 -610
  16. vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php +0 -76
  17. vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php +0 -131
  18. vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php +0 -52
  19. vendor/publishpress/wordpress-version-notices/bin/update-code-for-tests.sh +0 -13
  20. vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php +44 -20
  21. vendor/publishpress/wordpress-version-notices/src/Template/TemplateLoader.php +1 -2
  22. vendor/publishpress/wordpress-version-notices/tests/_data/.gitkeep +0 -0
  23. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/dumb-plugin-one.php +0 -37
  24. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/vendor/publishpress/wordpress-version-notices/.gitkeep +0 -0
  25. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/version-notice.php +0 -45
  26. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/dumb-plugin-two.php +0 -37
  27. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/vendor/publishpress/wordpress-version-notices/.gitkeep +0 -0
  28. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/version-notice.php +0 -45
  29. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-templates/Dumb/test1.php +0 -1
  30. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-templates/Dumb/test2.php +0 -1
  31. vendor/publishpress/wordpress-version-notices/tests/_data/dump.sql +0 -524
  32. vendor/publishpress/wordpress-version-notices/tests/_output/.gitignore +0 -2
  33. vendor/publishpress/wordpress-version-notices/tests/_support/AcceptanceTester.php +0 -26
  34. vendor/publishpress/wordpress-version-notices/tests/_support/FunctionalTester.php +0 -26
  35. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Acceptance.php +0 -10
  36. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Functional.php +0 -10
  37. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Unit.php +0 -10
  38. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Wpunit.php +0 -10
  39. vendor/publishpress/wordpress-version-notices/tests/_support/UnitTester.php +0 -26
  40. vendor/publishpress/wordpress-version-notices/tests/_support/WpunitTester.php +0 -26
  41. vendor/publishpress/wordpress-version-notices/tests/_support/_generated/.gitignore +0 -2
  42. vendor/publishpress/wordpress-version-notices/tests/acceptance.suite.yml +0 -36
  43. vendor/publishpress/wordpress-version-notices/tests/acceptance/ActivatePluginsCest.php +0 -17
  44. vendor/publishpress/wordpress-version-notices/tests/acceptance/TopNoticeCest.php +0 -38
  45. vendor/publishpress/wordpress-version-notices/tests/functional.suite.yml +0 -40
  46. vendor/publishpress/wordpress-version-notices/tests/unit.suite.yml +0 -10
  47. vendor/publishpress/wordpress-version-notices/tests/wpunit.suite.yml +0 -25
  48. vendor/publishpress/wordpress-version-notices/tests/wpunit/IncludesTest.php +0 -31
  49. vendor/publishpress/wordpress-version-notices/tests/wpunit/Module/TopNotice/ModuleTest.php +0 -174
  50. vendor/publishpress/wordpress-version-notices/tests/wpunit/ServicesProviderTest.php +0 -55
  51. vendor/publishpress/wordpress-version-notices/tests/wpunit/Template/TemplateLoaderTest.php +0 -98
capsman-enhanced.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: PublishPress Capabilities
4
* Plugin URI: https://publishpress.com/capability-manager/
5
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
- * Version: 1.9.5
7
* Author: PublishPress
8
* Author URI: https://publishpress.com/
9
* Text Domain: capsman-enhanced
@@ -25,13 +25,13 @@
25
* @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2020 PublishPress
26
* @license GNU General Public License version 3
27
* @link https://publishpress.com/
28
- * @version 1.9.5
29
*/
30
31
if (!defined('CAPSMAN_VERSION')) {
32
- define('CAPSMAN_VERSION', '1.9.5');
33
- define('CAPSMAN_ENH_VERSION', '1.9.5');
34
- define('PUBLISHPRESS_CAPS_VERSION', '1.9.5');
35
}
36
37
foreach (get_option('active_plugins') as $plugin_file) {
@@ -141,4 +141,4 @@ add_action( 'init', '_cme_cap_helper', 49 ); // Press Permit Cap Helper, regist
141
// @todo: do this in PP Core also
142
143
if ( is_multisite() )
144
- require_once ( dirname(__FILE__) . '/includes/network.php' );
3
* Plugin Name: PublishPress Capabilities
4
* Plugin URI: https://publishpress.com/capability-manager/
5
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
+ * Version: 1.9.6
7
* Author: PublishPress
8
* Author URI: https://publishpress.com/
9
* Text Domain: capsman-enhanced
25
* @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2020 PublishPress
26
* @license GNU General Public License version 3
27
* @link https://publishpress.com/
28
+ * @version 1.9.6
29
*/
30
31
if (!defined('CAPSMAN_VERSION')) {
32
+ define('CAPSMAN_VERSION', '1.9.6');
33
+ define('CAPSMAN_ENH_VERSION', '1.9.6');
34
+ define('PUBLISHPRESS_CAPS_VERSION', '1.9.6');
35
}
36
37
foreach (get_option('active_plugins') as $plugin_file) {
141
// @todo: do this in PP Core also
142
143
if ( is_multisite() )
144
+ require_once ( dirname(__FILE__) . '/includes/network.php' );
includes/admin.php CHANGED
@@ -1119,6 +1119,17 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1119
</dd>
1120
</dl>
1121
1122
<dl>
1123
<dt><?php _e('Add Capability', 'capsman-enhanced'); ?></dt>
1124
<dd style="text-align:center;">
1119
</dd>
1120
</dl>
1121
1122
+ <dl>
1123
+ <dt><?php _e('Rename Role', 'capsman-enhanced'); ?></dt>
1124
+ <dd style="text-align:center;">
1125
+ <p><input type="text" name="rename-name" class="regular-text" placeholder="<?php _e('New Role Name', 'capsman-enhanced') ?>" />
1126
+
1127
+ <br />
1128
+ <input type="submit" name="RenameRole" value="<?php _e('Rename', 'capsman-enhanced') ?>" class="button" />
1129
+ </p>
1130
+ </dd>
1131
+ </dl>
1132
+
1133
<dl>
1134
<dt><?php _e('Add Capability', 'capsman-enhanced'); ?></dt>
1135
<dd style="text-align:center;">
includes/functions-admin.php CHANGED
@@ -4,8 +4,9 @@
4
function cme_submenus() {
5
// First we check if user is administrator and can 'manage_capabilities'.
6
if (current_user_can('administrator') && ! current_user_can('manage_capabilities')) {
7
- $admin = get_role('administrator');
8
- $admin->add_cap('manage_capabilities');
9
}
10
11
$cap_name = (is_multisite() && is_super_admin()) ? 'read' : 'manage_capabilities';
4
function cme_submenus() {
5
// First we check if user is administrator and can 'manage_capabilities'.
6
if (current_user_can('administrator') && ! current_user_can('manage_capabilities')) {
7
+ if ($admin = get_role('administrator')) {
8
+ $admin->add_cap('manage_capabilities');
9
+ }
10
}
11
12
$cap_name = (is_multisite() && is_super_admin()) ? 'read' : 'manage_capabilities';
includes/handler.php CHANGED
@@ -24,6 +24,19 @@ class CapsmanHandler
24
ak_admin_error(__('Error: Failed creating the new role.', 'capsman-enhanced'));
25
}
26
27
// Copy current role to a new one.
28
} elseif ( ! empty($post['CopyRole']) ) {
29
$current = get_role($post['current']);
@@ -135,14 +148,21 @@ class CapsmanHandler
135
if ( preg_match($pattern, $name) ) {
136
$roles = ak_get_roles();
137
138
- $name = strtolower($name);
139
$name = str_replace(' ', '_', $name);
140
if ( in_array($name, $roles) || array_key_exists($name, $this->cm->capabilities) ) {
141
return false; // Already a role or capability with this name.
142
}
143
144
$display = explode('_', $name);
145
- $display = array_map('ucfirst', $display);
146
$display = implode(' ', $display);
147
148
return compact('name', 'display');
24
ak_admin_error(__('Error: Failed creating the new role.', 'capsman-enhanced'));
25
}
26
27
+ // rename role
28
+ } elseif (!empty($post['RenameRole']) && !empty($post['rename-name'])) {
29
+ $current = get_role($post['current']);
30
+ $new_title = sanitize_text_field($post['rename-name']);
31
+
32
+ if ($current && isset($wp_roles->roles[$current->name]) && $new_title) {
33
+ $old_title = $wp_roles->roles[$current->name]['name'];
34
+ $wp_roles->roles[$current->name]['name'] = $new_title;
35
+ update_option($wp_roles->role_key, $wp_roles->roles);
36
+
37
+ ak_admin_notify(sprintf(__('Role "%s" (id %s) renamed to "%s"', 'capsman-enhanced'), $old_title, strtolower($current->name), $new_title));
38
+ $this->cm->current = $current->name;
39
+ }
40
// Copy current role to a new one.
41
} elseif ( ! empty($post['CopyRole']) ) {
42
$current = get_role($post['current']);
148
if ( preg_match($pattern, $name) ) {
149
$roles = ak_get_roles();
150
151
$name = str_replace(' ', '_', $name);
152
if ( in_array($name, $roles) || array_key_exists($name, $this->cm->capabilities) ) {
153
return false; // Already a role or capability with this name.
154
}
155
156
$display = explode('_', $name);
157
+ $name = strtolower($name);
158
+
159
+ // Apply ucfirst proper caps unless capitalization already provided
160
+ foreach($display as $i => $word) {
161
+ if ($word === strtolower($word)) {
162
+ $display[$i] = ucfirst($word);
163
+ }
164
+ }
165
+
166
$display = implode(' ', $display);
167
168
return compact('name', 'display');
includes/manager.php CHANGED
@@ -320,8 +320,9 @@ class CapabilityManager
320
*/
321
public function setAdminCapability ()
322
{
323
- $admin = get_role('administrator');
324
- $admin->add_cap('manage_capabilities');
325
}
326
327
/**
320
*/
321
public function setAdminCapability ()
322
{
323
+ if ($admin = get_role('administrator')) {
324
+ $admin->add_cap('manage_capabilities');
325
+ }
326
}
327
328
/**
lang/capsman.mo CHANGED
Binary file
lang/capsman.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
msgstr ""
3
"Project-Id-Version: Capability Manager Enhanced\n"
4
"Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2020-03-17 18:17-0500\n"
6
- "PO-Revision-Date: 2020-03-17 18:17-0500\n"
7
"Last-Translator: Kevin Behrens <kevin@publishpress.com>\n"
8
"Language-Team: PublishPress <help@publishpress.com>\n"
9
"MIME-Version: 1.0\n"
@@ -72,7 +72,7 @@ msgid "<strong>Note:</strong> Capability changes <strong>remain in the database<
72
msgstr ""
73
74
#: F:\snapshot\capability-manager-enhanced/includes/admin.php:133
75
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1144
76
msgid "PublishPress Permissions"
77
msgstr ""
78
@@ -328,54 +328,66 @@ msgid "Copy"
328
msgstr ""
329
330
#: F:\snapshot\capability-manager-enhanced/includes/admin.php:1123
331
msgid "Add Capability"
332
msgstr ""
333
334
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1126
335
msgid "Add to role"
336
msgstr ""
337
338
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1131
339
msgid "Backup Tool"
340
msgstr ""
341
342
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1133
343
msgid "Backup / Restore Roles"
344
msgstr ""
345
346
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1138
347
msgid "Related Permissions Plugins"
348
msgstr ""
349
350
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1141
351
msgid "Multiple Authors"
352
msgstr ""
353
354
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1150
355
msgid "PublishPress"
356
msgstr ""
357
358
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1155
359
msgid "PublishPress Revisions"
360
msgstr ""
361
362
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1157
363
msgid "Help / Contact Form"
364
msgstr ""
365
366
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1195
367
msgid "Create this role definition in new (future) sites"
368
msgstr ""
369
370
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1195
371
msgid "include in new sites"
372
msgstr ""
373
374
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1198
375
msgid "Copy / update this role definition to all sites now"
376
msgstr ""
377
378
- #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1198
379
msgid "sync role to all sites now"
380
msgstr ""
381
@@ -522,122 +534,127 @@ msgstr ""
522
msgid "Add New"
523
msgstr ""
524
525
- #: F:\snapshot\capability-manager-enhanced/includes/filters.php:275
526
msgid "Edit Roles"
527
msgstr ""
528
529
- #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:13
530
msgid "Capabilities"
531
msgstr ""
532
533
- #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:35
534
msgid "Backup"
535
msgstr ""
536
537
- #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:39
538
- #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:40
539
msgid "Upgrade to Pro"
540
msgstr ""
541
542
#: F:\snapshot\capability-manager-enhanced/includes/handler.php:18
543
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:31
544
msgid "New role created."
545
msgstr ""
546
547
#: F:\snapshot\capability-manager-enhanced/includes/handler.php:24
548
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:37
549
msgid "Error: Failed creating the new role."
550
msgstr ""
551
552
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:91
553
msgid "Incorrect capability name."
554
msgstr ""
555
556
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:96
557
msgid "Type / Taxonomy settings saved."
558
msgstr ""
559
560
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:102
561
msgid "Bad form received."
562
msgstr ""
563
564
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:218
565
msgid "You cannot remove Manage Capabilities from Administrators"
566
msgstr ""
567
568
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:330
569
#, php-format
570
msgid "Cannot delete default role. You <a href=\"%s\">have to change it first</a>."
571
msgstr ""
572
573
- #: F:\snapshot\capability-manager-enhanced/includes/handler.php:377
574
#, php-format
575
msgid "Role has been deleted. %1$d users moved to default role %2$s."
576
msgstr ""
577
578
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:165
579
msgid "Explicity negate this capability by storing as disabled"
580
msgstr ""
581
582
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:166
583
msgid "Explicitly negate these capabilities by storing as disabled"
584
msgstr ""
585
586
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:167
587
msgid "Post type registration does not define this capability distinctly"
588
msgstr ""
589
590
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:168
591
msgid "This capability is explicitly negated. Click to add/remove normally."
592
msgstr ""
593
594
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:169
595
msgid "Add or remove this capability from the WordPress role"
596
msgstr ""
597
598
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:170
599
msgid "Add or remove capability from the role normally"
600
msgstr ""
601
602
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:405
603
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:446
604
msgid "You do not have permission to manage capabilities."
605
msgstr ""
606
607
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:460
608
msgid "New capability added to role."
609
msgstr ""
610
611
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:499
612
msgid "Bad form Received"
613
msgstr ""
614
615
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:645
616
#, php-format
617
msgid "If you like %s, please leave us a %s rating. Thank you!"
618
msgstr ""
619
620
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:656
621
msgid "About PublishPress Capabilities"
622
msgstr ""
623
624
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:656
625
msgid "About"
626
msgstr ""
627
628
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:658
629
msgid "Capabilites Documentation"
630
msgstr ""
631
632
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:658
633
msgid "Documentation"
634
msgstr ""
635
636
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:660
637
msgid "Contact the PublishPress team"
638
msgstr ""
639
640
- #: F:\snapshot\capability-manager-enhanced/includes/manager.php:660
641
msgid "Contact"
642
msgstr ""
643
2
msgstr ""
3
"Project-Id-Version: Capability Manager Enhanced\n"
4
"Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2020-04-20 16:39-0500\n"
6
+ "PO-Revision-Date: 2020-04-20 16:39-0500\n"
7
"Last-Translator: Kevin Behrens <kevin@publishpress.com>\n"
8
"Language-Team: PublishPress <help@publishpress.com>\n"
9
"MIME-Version: 1.0\n"
72
msgstr ""
73
74
#: F:\snapshot\capability-manager-enhanced/includes/admin.php:133
75
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1155
76
msgid "PublishPress Permissions"
77
msgstr ""
78
328
msgstr ""
329
330
#: F:\snapshot\capability-manager-enhanced/includes/admin.php:1123
331
+ msgid "Rename Role"
332
+ msgstr ""
333
+
334
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1125
335
+ msgid "New Role Name"
336
+ msgstr ""
337
+
338
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1128
339
+ msgid "Rename"
340
+ msgstr ""
341
+
342
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1134
343
msgid "Add Capability"
344
msgstr ""
345
346
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1137
347
msgid "Add to role"
348
msgstr ""
349
350
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1142
351
msgid "Backup Tool"
352
msgstr ""
353
354
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1144
355
msgid "Backup / Restore Roles"
356
msgstr ""
357
358
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1149
359
msgid "Related Permissions Plugins"
360
msgstr ""
361
362
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1152
363
msgid "Multiple Authors"
364
msgstr ""
365
366
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1161
367
msgid "PublishPress"
368
msgstr ""
369
370
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1166
371
msgid "PublishPress Revisions"
372
msgstr ""
373
374
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1168
375
msgid "Help / Contact Form"
376
msgstr ""
377
378
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1206
379
msgid "Create this role definition in new (future) sites"
380
msgstr ""
381
382
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1206
383
msgid "include in new sites"
384
msgstr ""
385
386
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1209
387
msgid "Copy / update this role definition to all sites now"
388
msgstr ""
389
390
+ #: F:\snapshot\capability-manager-enhanced/includes/admin.php:1209
391
msgid "sync role to all sites now"
392
msgstr ""
393
534
msgid "Add New"
535
msgstr ""
536
537
+ #: F:\snapshot\capability-manager-enhanced/includes/filters.php:276
538
msgid "Edit Roles"
539
msgstr ""
540
541
+ #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:14
542
msgid "Capabilities"
543
msgstr ""
544
545
+ #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:36
546
msgid "Backup"
547
msgstr ""
548
549
+ #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:41
550
+ #: F:\snapshot\capability-manager-enhanced/includes/functions-admin.php:42
551
msgid "Upgrade to Pro"
552
msgstr ""
553
554
#: F:\snapshot\capability-manager-enhanced/includes/handler.php:18
555
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:44
556
msgid "New role created."
557
msgstr ""
558
559
#: F:\snapshot\capability-manager-enhanced/includes/handler.php:24
560
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:50
561
msgid "Error: Failed creating the new role."
562
msgstr ""
563
564
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:37
565
+ #, php-format
566
+ msgid "Role \"%s\" (id %s) renamed to \"%s\""
567
+ msgstr ""
568
+
569
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:104
570
msgid "Incorrect capability name."
571
msgstr ""
572
573
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:109
574
msgid "Type / Taxonomy settings saved."
575
msgstr ""
576
577
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:115
578
msgid "Bad form received."
579
msgstr ""
580
581
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:238
582
msgid "You cannot remove Manage Capabilities from Administrators"
583
msgstr ""
584
585
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:350
586
#, php-format
587
msgid "Cannot delete default role. You <a href=\"%s\">have to change it first</a>."
588
msgstr ""
589
590
+ #: F:\snapshot\capability-manager-enhanced/includes/handler.php:397
591
#, php-format
592
msgid "Role has been deleted. %1$d users moved to default role %2$s."
593
msgstr ""
594
595
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:172
596
msgid "Explicity negate this capability by storing as disabled"
597
msgstr ""
598
599
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:173
600
msgid "Explicitly negate these capabilities by storing as disabled"
601
msgstr ""
602
603
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:174
604
msgid "Post type registration does not define this capability distinctly"
605
msgstr ""
606
607
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:175
608
msgid "This capability is explicitly negated. Click to add/remove normally."
609
msgstr ""
610
611
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:176
612
msgid "Add or remove this capability from the WordPress role"
613
msgstr ""
614
615
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:177
616
msgid "Add or remove capability from the role normally"
617
msgstr ""
618
619
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:415
620
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:456
621
msgid "You do not have permission to manage capabilities."
622
msgstr ""
623
624
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:470
625
msgid "New capability added to role."
626
msgstr ""
627
628
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:509
629
msgid "Bad form Received"
630
msgstr ""
631
632
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:655
633
#, php-format
634
msgid "If you like %s, please leave us a %s rating. Thank you!"
635
msgstr ""
636
637
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:666
638
msgid "About PublishPress Capabilities"
639
msgstr ""
640
641
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:666
642
msgid "About"
643
msgstr ""
644
645
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:668
646
msgid "Capabilites Documentation"
647
msgstr ""
648
649
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:668
650
msgid "Documentation"
651
msgstr ""
652
653
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:670
654
msgid "Contact the PublishPress team"
655
msgstr ""
656
657
+ #: F:\snapshot\capability-manager-enhanced/includes/manager.php:670
658
msgid "Contact"
659
msgstr ""
660
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: user roles, capabilities, permissions, authors, editors, post types, taxon
7
Requires at least: 4.9.7
8
Tested up to: 5.4
9
Requires PHP: 5.6.20
10
- Stable tag: 1.9.5
11
License: GPLv3
12
License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
@@ -114,6 +114,11 @@ Fixed : Non-administrators with user editing capabilities could add new Administ
114
115
== Changelog ==
116
117
= 1.9.5 - 6 Apr 2020 =
118
* Fixed : Fatal error loading Capabilities screen on a small percentage of installations
119
* Compat : PublishPress Permissions - Post Type selections for "Type-Specific Capabilities" were not synchronized with PublishPress Permissions under some conditions
7
Requires at least: 4.9.7
8
Tested up to: 5.4
9
Requires PHP: 5.6.20
10
+ Stable tag: 1.9.6
11
License: GPLv3
12
License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
114
115
== Changelog ==
116
117
+ = 1.9.6 - 23 Apr 2020 =
118
+ * Change : Add New Role retains capitalization as entered for role title (otherwise applies proper case)
119
+ * Feature : Rename Role sidebar box on Capabilities screen
120
+ * Fixed : Fatal error on plugin load if Administrator role does not exist
121
+
122
= 1.9.5 - 6 Apr 2020 =
123
* Fixed : Fatal error loading Capabilities screen on a small percentage of installations
124
* Compat : PublishPress Permissions - Post Type selections for "Type-Specific Capabilities" were not synchronized with PublishPress Permissions under some conditions
vendor/composer/installed.json CHANGED
@@ -104,17 +104,17 @@
104
},
105
{
106
"name": "publishpress/wordpress-version-notices",
107
- "version": "dev-master",
108
- "version_normalized": "9999999-dev",
109
"source": {
110
"type": "git",
111
"url": "https://github.com/publishpress/WordPress-Version-Notices.git",
112
- "reference": "a86b0c364d973cd27d2bf5e73ef5afc131430e86"
113
},
114
"dist": {
115
"type": "zip",
116
- "url": "https://api.github.com/repos/publishpress/WordPress-Version-Notices/zipball/a86b0c364d973cd27d2bf5e73ef5afc131430e86",
117
- "reference": "a86b0c364d973cd27d2bf5e73ef5afc131430e86",
118
"shasum": ""
119
},
120
"require": {
@@ -124,7 +124,7 @@
124
"require-dev": {
125
"lucatume/wp-browser": "^2.2"
126
},
127
- "time": "2020-04-02T16:14:09+00:00",
128
"type": "library",
129
"installation-source": "dist",
130
"autoload": {
104
},
105
{
106
"name": "publishpress/wordpress-version-notices",
107
+ "version": "dev-hotfix/issue-1",
108
+ "version_normalized": "dev-hotfix/issue-1",
109
"source": {
110
"type": "git",
111
"url": "https://github.com/publishpress/WordPress-Version-Notices.git",
112
+ "reference": "6454e094e26b0b70ee9fbd4bdf189f99aa0389e2"
113
},
114
"dist": {
115
"type": "zip",
116
+ "url": "https://api.github.com/repos/publishpress/WordPress-Version-Notices/zipball/6454e094e26b0b70ee9fbd4bdf189f99aa0389e2",
117
+ "reference": "6454e094e26b0b70ee9fbd4bdf189f99aa0389e2",
118
"shasum": ""
119
},
120
"require": {
124
"require-dev": {
125
"lucatume/wp-browser": "^2.2"
126
},
127
+ "time": "2020-04-06T19:14:20+00:00",
128
"type": "library",
129
"installation-source": "dist",
130
"autoload": {
vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- class Invokable
30
- {
31
- public function __invoke($value = null)
32
- {
33
- $service = new Service();
34
- $service->value = $value;
35
-
36
- return $service;
37
- }
38
- }
vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- class NonInvokable
30
- {
31
- public function __call($a, $b)
32
- {
33
- }
34
- }
vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- use Pimple\Container;
30
- use Pimple\ServiceProviderInterface;
31
-
32
- class PimpleServiceProvider implements ServiceProviderInterface
33
- {
34
- /**
35
- * Registers services on the given container.
36
- *
37
- * This method should only be used to configure services and parameters.
38
- * It should not get services.
39
- *
40
- * @param Container $pimple An Container instance
41
- */
42
- public function register(Container $pimple)
43
- {
44
- $pimple['param'] = 'value';
45
-
46
- $pimple['service'] = function () {
47
- return new Service();
48
- };
49
-
50
- $pimple['factory'] = $pimple->factory(function () {
51
- return new Service();
52
- });
53
- }
54
- }
vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- /**
30
- * @author Igor Wiedler <igor@wiedler.ch>
31
- */
32
- class Service
33
- {
34
- public $value;
35
- }
vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
-
32
- /**
33
- * @author Dominik Zogg <dominik.zogg@gmail.com>
34
- */
35
- class PimpleServiceProviderInterfaceTest extends TestCase
36
- {
37
- public function testProvider()
38
- {
39
- $pimple = new Container();
40
-
41
- $pimpleServiceProvider = new Fixtures\PimpleServiceProvider();
42
- $pimpleServiceProvider->register($pimple);
43
-
44
- $this->assertEquals('value', $pimple['param']);
45
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
46
-
47
- $serviceOne = $pimple['factory'];
48
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
49
-
50
- $serviceTwo = $pimple['factory'];
51
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
52
-
53
- $this->assertNotSame($serviceOne, $serviceTwo);
54
- }
55
-
56
- public function testProviderWithRegisterMethod()
57
- {
58
- $pimple = new Container();
59
-
60
- $pimple->register(new Fixtures\PimpleServiceProvider(), [
61
- 'anotherParameter' => 'anotherValue',
62
- ]);
63
-
64
- $this->assertEquals('value', $pimple['param']);
65
- $this->assertEquals('anotherValue', $pimple['anotherParameter']);
66
-
67
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
68
-
69
- $serviceOne = $pimple['factory'];
70
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
71
-
72
- $serviceTwo = $pimple['factory'];
73
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
74
-
75
- $this->assertNotSame($serviceOne, $serviceTwo);
76
- }
77
- }
vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php DELETED
@@ -1,610 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
-
32
- /**
33
- * @author Igor Wiedler <igor@wiedler.ch>
34
- */
35
- class PimpleTest extends TestCase
36
- {
37
- public function testWithString()
38
- {
39
- $pimple = new Container();
40
- $pimple['param'] = 'value';
41
-
42
- $this->assertEquals('value', $pimple['param']);
43
- }
44
-
45
- public function testWithClosure()
46
- {
47
- $pimple = new Container();
48
- $pimple['service'] = function () {
49
- return new Fixtures\Service();
50
- };
51
-
52
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
53
- }
54
-
55
- public function testServicesShouldBeDifferent()
56
- {
57
- $pimple = new Container();
58
- $pimple['service'] = $pimple->factory(function () {
59
- return new Fixtures\Service();
60
- });
61
-
62
- $serviceOne = $pimple['service'];
63
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
64
-
65
- $serviceTwo = $pimple['service'];
66
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
67
-
68
- $this->assertNotSame($serviceOne, $serviceTwo);
69
- }
70
-
71
- public function testShouldPassContainerAsParameter()
72
- {
73
- $pimple = new Container();
74
- $pimple['service'] = function () {
75
- return new Fixtures\Service();
76
- };
77
- $pimple['container'] = function ($container) {
78
- return $container;
79
- };
80
-
81
- $this->assertNotSame($pimple, $pimple['service']);
82
- $this->assertSame($pimple, $pimple['container']);
83
- }
84
-
85
- public function testIsset()
86
- {
87
- $pimple = new Container();
88
- $pimple['param'] = 'value';
89
- $pimple['service'] = function () {
90
- return new Fixtures\Service();
91
- };
92
-
93
- $pimple['null'] = null;
94
-
95
- $this->assertTrue(isset($pimple['param']));
96
- $this->assertTrue(isset($pimple['service']));
97
- $this->assertTrue(isset($pimple['null']));
98
- $this->assertFalse(isset($pimple['non_existent']));
99
- }
100
-
101
- public function testConstructorInjection()
102
- {
103
- $params = ['param' => 'value'];
104
- $pimple = new Container($params);
105
-
106
- $this->assertSame($params['param'], $pimple['param']);
107
- }
108
-
109
- public function testOffsetGetValidatesKeyIsPresent()
110
- {
111
- $this->expectException(\Pimple\Exception\UnknownIdentifierException::class);
112
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
113
-
114
- $pimple = new Container();
115
- echo $pimple['foo'];
116
- }
117
-
118
- /**
119
- * @group legacy
120
- */
121
- public function testLegacyOffsetGetValidatesKeyIsPresent()
122
- {
123
- $this->expectException(\InvalidArgumentException::class);
124
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
125
-
126
- $pimple = new Container();
127
- echo $pimple['foo'];
128
- }
129
-
130
- public function testOffsetGetHonorsNullValues()
131
- {
132
- $pimple = new Container();
133
- $pimple['foo'] = null;
134
- $this->assertNull($pimple['foo']);
135
- }
136
-
137
- public function testUnset()
138
- {
139
- $pimple = new Container();
140
- $pimple['param'] = 'value';
141
- $pimple['service'] = function () {
142
- return new Fixtures\Service();
143
- };
144
-
145
- unset($pimple['param'], $pimple['service']);
146
- $this->assertFalse(isset($pimple['param']));
147
- $this->assertFalse(isset($pimple['service']));
148
- }
149
-
150
- /**
151
- * @dataProvider serviceDefinitionProvider
152
- */
153
- public function testShare($service)
154
- {
155
- $pimple = new Container();
156
- $pimple['shared_service'] = $service;
157
-
158
- $serviceOne = $pimple['shared_service'];
159
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
160
-
161
- $serviceTwo = $pimple['shared_service'];
162
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
163
-
164
- $this->assertSame($serviceOne, $serviceTwo);
165
- }
166
-
167
- /**
168
- * @dataProvider serviceDefinitionProvider
169
- */
170
- public function testProtect($service)
171
- {
172
- $pimple = new Container();
173
- $pimple['protected'] = $pimple->protect($service);
174
-
175
- $this->assertSame($service, $pimple['protected']);
176
- }
177
-
178
- public function testGlobalFunctionNameAsParameterValue()
179
- {
180
- $pimple = new Container();
181
- $pimple['global_function'] = 'strlen';
182
- $this->assertSame('strlen', $pimple['global_function']);
183
- }
184
-
185
- public function testRaw()
186
- {
187
- $pimple = new Container();
188
- $pimple['service'] = $definition = $pimple->factory(function () {
189
- return 'foo';
190
- });
191
- $this->assertSame($definition, $pimple->raw('service'));
192
- }
193
-
194
- public function testRawHonorsNullValues()
195
- {
196
- $pimple = new Container();
197
- $pimple['foo'] = null;
198
- $this->assertNull($pimple->raw('foo'));
199
- }
200
-
201
- public function testFluentRegister()
202
- {
203
- $pimple = new Container();
204
- $this->assertSame($pimple, $pimple->register($this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock()));
205
- }
206
-
207
- public function testRawValidatesKeyIsPresent()
208
- {
209
- $this->expectException(\Pimple\Exception\UnknownIdentifierException::class);
210
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
211
-
212
- $pimple = new Container();
213
- $pimple->raw('foo');
214
- }
215
-
216
- /**
217
- * @group legacy
218
- */
219
- public function testLegacyRawValidatesKeyIsPresent()
220
- {
221
- $this->expectException(\InvalidArgumentException::class);
222
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
223
-
224
- $pimple = new Container();
225
- $pimple->raw('foo');
226
- }
227
-
228
- /**
229
- * @dataProvider serviceDefinitionProvider
230
- */
231
- public function testExtend($service)
232
- {
233
- $pimple = new Container();
234
- $pimple['shared_service'] = function () {
235
- return new Fixtures\Service();
236
- };
237
- $pimple['factory_service'] = $pimple->factory(function () {
238
- return new Fixtures\Service();
239
- });
240
-
241
- $pimple->extend('shared_service', $service);
242
- $serviceOne = $pimple['shared_service'];
243
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
244
- $serviceTwo = $pimple['shared_service'];
245
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
246
- $this->assertSame($serviceOne, $serviceTwo);
247
- $this->assertSame($serviceOne->value, $serviceTwo->value);
248
-
249
- $pimple->extend('factory_service', $service);
250
- $serviceOne = $pimple['factory_service'];
251
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
252
- $serviceTwo = $pimple['factory_service'];
253
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
254
- $this->assertNotSame($serviceOne, $serviceTwo);
255
- $this->assertNotSame($serviceOne->value, $serviceTwo->value);
256
- }
257
-
258
- public function testExtendDoesNotLeakWithFactories()
259
- {
260
- if (\extension_loaded('pimple')) {
261
- $this->markTestSkipped('Pimple extension does not support this test');
262
- }
263
- $pimple = new Container();
264
-
265
- $pimple['foo'] = $pimple->factory(function () {
266
- return;
267
- });
268
- $pimple['foo'] = $pimple->extend('foo', function ($foo, $pimple) {
269
- return;
270
- });
271
- unset($pimple['foo']);
272
-
273
- $p = new \ReflectionProperty($pimple, 'values');
274
- $p->setAccessible(true);
275
- $this->assertEmpty($p->getValue($pimple));
276
-
277
- $p = new \ReflectionProperty($pimple, 'factories');
278
- $p->setAccessible(true);
279
- $this->assertCount(0, $p->getValue($pimple));
280
- }
281
-
282
- public function testExtendValidatesKeyIsPresent()
283
- {
284
- $this->expectException(\Pimple\Exception\UnknownIdentifierException::class);
285
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
286
-
287
- $pimple = new Container();
288
- $pimple->extend('foo', function () {
289
- });
290
- }
291
-
292
- /**
293
- * @group legacy
294
- */
295
- public function testLegacyExtendValidatesKeyIsPresent()
296
- {
297
- $this->expectException(\InvalidArgumentException::class);
298
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
299
-
300
- $pimple = new Container();
301
- $pimple->extend('foo', function () {
302
- });
303
- }
304
-
305
- public function testKeys()
306
- {
307
- $pimple = new Container();
308
- $pimple['foo'] = 123;
309
- $pimple['bar'] = 123;
310
-
311
- $this->assertEquals(['foo', 'bar'], $pimple->keys());
312
- }
313
-
314
- /** @test */
315
- public function settingAnInvokableObjectShouldTreatItAsFactory()
316
- {
317
- $pimple = new Container();
318
- $pimple['invokable'] = new Fixtures\Invokable();
319
-
320
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['invokable']);
321
- }
322
-
323
- /** @test */
324
- public function settingNonInvokableObjectShouldTreatItAsParameter()
325
- {
326
- $pimple = new Container();
327
- $pimple['non_invokable'] = new Fixtures\NonInvokable();
328
-
329
- $this->assertInstanceOf('Pimple\Tests\Fixtures\NonInvokable', $pimple['non_invokable']);
330
- }
331
-
332
- /**
333
- * @dataProvider badServiceDefinitionProvider
334
- */
335
- public function testFactoryFailsForInvalidServiceDefinitions($service)
336
- {
337
- $this->expectException(\Pimple\Exception\ExpectedInvokableException::class);
338
- $this->expectExceptionMessage('Service definition is not a Closure or invokable object.');
339
-
340
- $pimple = new Container();
341
- $pimple->factory($service);
342
- }
343
-
344
- /**
345
- * @group legacy
346
- * @dataProvider badServiceDefinitionProvider
347
- */
348
- public function testLegacyFactoryFailsForInvalidServiceDefinitions($service)
349
- {
350
- $this->expectException(\InvalidArgumentException::class);
351
- $this->expectExceptionMessage('Service definition is not a Closure or invokable object.');
352
-
353
- $pimple = new Container();
354
- $pimple->factory($service);
355
- }
356
-
357
- /**
358
- * @dataProvider badServiceDefinitionProvider
359
- */
360
- public function testProtectFailsForInvalidServiceDefinitions($service)
361
- {
362
- $this->expectException(\Pimple\Exception\ExpectedInvokableException::class);
363
- $this->expectExceptionMessage('Callable is not a Closure or invokable object.');
364
-
365
- $pimple = new Container();
366
- $pimple->protect($service);
367
- }
368
-
369
- /**
370
- * @group legacy
371
- * @dataProvider badServiceDefinitionProvider
372
- */
373
- public function testLegacyProtectFailsForInvalidServiceDefinitions($service)
374
- {
375
- $this->expectException(\InvalidArgumentException::class);
376
- $this->expectExceptionMessage('Callable is not a Closure or invokable object.');
377
-
378
- $pimple = new Container();
379
- $pimple->protect($service);
380
- }
381
-
382
- /**
383
- * @dataProvider badServiceDefinitionProvider
384
- */
385
- public function testExtendFailsForKeysNotContainingServiceDefinitions($service)
386
- {
387
- $this->expectException(\Pimple\Exception\InvalidServiceIdentifierException::class);
388
- $this->expectExceptionMessage('Identifier "foo" does not contain an object definition.');
389
-
390
- $pimple = new Container();
391
- $pimple['foo'] = $service;
392
- $pimple->extend('foo', function () {
393
- });
394
- }
395
-
396
- /**
397
- * @group legacy
398
- * @dataProvider badServiceDefinitionProvider
399
- */
400
- public function testLegacyExtendFailsForKeysNotContainingServiceDefinitions($service)
401
- {
402
- $this->expectException(\InvalidArgumentException::class);
403
- $this->expectExceptionMessage('Identifier "foo" does not contain an object definition.');
404
-
405
- $pimple = new Container();
406
- $pimple['foo'] = $service;
407
- $pimple->extend('foo', function () {
408
- });
409
- }
410
-
411
- /**
412
- * @group legacy
413
- * @expectedDeprecation How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "foo" should be protected?
414
- */
415
- public function testExtendingProtectedClosureDeprecation()
416
- {
417
- $pimple = new Container();
418
- $pimple['foo'] = $pimple->protect(function () {
419
- return 'bar';
420
- });
421
-
422
- $pimple->extend('foo', function ($value) {
423
- return $value.'-baz';
424
- });
425
-
426
- $this->assertSame('bar-baz', $pimple['foo']);
427
- }
428
-
429
- /**
430
- * @dataProvider badServiceDefinitionProvider
431
- */
432
- public function testExtendFailsForInvalidServiceDefinitions($service)
433
- {
434
- $this->expectException(\Pimple\Exception\ExpectedInvokableException::class);
435
- $this->expectExceptionMessage('Extension service definition is not a Closure or invokable object.');
436
-
437
- $pimple = new Container();
438
- $pimple['foo'] = function () {
439
- };
440
- $pimple->extend('foo', $service);
441
- }
442
-
443
- /**
444
- * @group legacy
445
- * @dataProvider badServiceDefinitionProvider
446
- */
447
- public function testLegacyExtendFailsForInvalidServiceDefinitions($service)
448
- {
449
- $this->expectException(\InvalidArgumentException::class);
450
- $this->expectExceptionMessage('Extension service definition is not a Closure or invokable object.');
451
-
452
- $pimple = new Container();
453
- $pimple['foo'] = function () {
454
- };
455
- $pimple->extend('foo', $service);
456
- }
457
-
458
- public function testExtendFailsIfFrozenServiceIsNonInvokable()
459
- {
460
- $this->expectException(\Pimple\Exception\FrozenServiceException::class);
461
- $this->expectExceptionMessage('Cannot override frozen service "foo".');
462
-
463
- $pimple = new Container();
464
- $pimple['foo'] = function () {
465
- return new Fixtures\NonInvokable();
466
- };
467
- $foo = $pimple['foo'];
468
-
469
- $pimple->extend('foo', function () {
470
- });
471
- }
472
-
473
- public function testExtendFailsIfFrozenServiceIsInvokable()
474
- {
475
- $this->expectException(\Pimple\Exception\FrozenServiceException::class);
476
- $this->expectExceptionMessage('Cannot override frozen service "foo".');
477
-
478
- $pimple = new Container();
479
- $pimple['foo'] = function () {
480
- return new Fixtures\Invokable();
481
- };
482
- $foo = $pimple['foo'];
483
-
484
- $pimple->extend('foo', function () {
485
- });
486
- }
487
-
488
- /**
489
- * Provider for invalid service definitions.
490
- */
491
- public function badServiceDefinitionProvider()
492
- {
493
- return [
494
- [123],
495
- [new Fixtures\NonInvokable()],
496
- ];
497
- }
498
-
499
- /**
500
- * Provider for service definitions.
501
- */
502
- public function serviceDefinitionProvider()
503
- {
504
- return [
505
- [function ($value) {
506
- $service = new Fixtures\Service();
507
- $service->value = $value;
508
-
509
- return $service;
510
- }],
511
- [new Fixtures\Invokable()],
512
- ];
513
- }
514
-
515
- public function testDefiningNewServiceAfterFreeze()
516
- {
517
- $pimple = new Container();
518
- $pimple['foo'] = function () {
519
- return 'foo';
520
- };
521
- $foo = $pimple['foo'];
522
-
523
- $pimple['bar'] = function () {
524
- return 'bar';
525
- };
526
- $this->assertSame('bar', $pimple['bar']);
527
- }
528
-
529
- public function testOverridingServiceAfterFreeze()
530
- {
531
- $this->expectException(\Pimple\Exception\FrozenServiceException::class);
532
- $this->expectExceptionMessage('Cannot override frozen service "foo".');
533
-
534
- $pimple = new Container();
535
- $pimple['foo'] = function () {
536
- return 'foo';
537
- };
538
- $foo = $pimple['foo'];
539
-
540
- $pimple['foo'] = function () {
541
- return 'bar';
542
- };
543
- }
544
-
545
- /**
546
- * @group legacy
547
- */
548
- public function testLegacyOverridingServiceAfterFreeze()
549
- {
550
- $this->expectException(\RuntimeException::class);
551
- $this->expectExceptionMessage('Cannot override frozen service "foo".');
552
-
553
- $pimple = new Container();
554
- $pimple['foo'] = function () {
555
- return 'foo';
556
- };
557
- $foo = $pimple['foo'];
558
-
559
- $pimple['foo'] = function () {
560
- return 'bar';
561
- };
562
- }
563
-
564
- public function testRemovingServiceAfterFreeze()
565
- {
566
- $pimple = new Container();
567
- $pimple['foo'] = function () {
568
- return 'foo';
569
- };
570
- $foo = $pimple['foo'];
571
-
572
- unset($pimple['foo']);
573
- $pimple['foo'] = function () {
574
- return 'bar';
575
- };
576
- $this->assertSame('bar', $pimple['foo']);
577
- }
578
-
579
- public function testExtendingService()
580
- {
581
- $pimple = new Container();
582
- $pimple['foo'] = function () {
583
- return 'foo';
584
- };
585
- $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) {
586
- return "$foo.bar";
587
- });
588
- $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) {
589
- return "$foo.baz";
590
- });
591
- $this->assertSame('foo.bar.baz', $pimple['foo']);
592
- }
593
-
594
- public function testExtendingServiceAfterOtherServiceFreeze()
595
- {
596
- $pimple = new Container();
597
- $pimple['foo'] = function () {
598
- return 'foo';
599
- };
600
- $pimple['bar'] = function () {
601
- return 'bar';
602
- };
603
- $foo = $pimple['foo'];
604
-
605
- $pimple['bar'] = $pimple->extend('bar', function ($bar, $app) {
606
- return "$bar.baz";
607
- });
608
- $this->assertSame('bar.baz', $pimple['bar']);
609
- }
610
- }
vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php DELETED
@@ -1,76 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009-2017 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Psr11;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
- use Pimple\Psr11\Container as PsrContainer;
32
- use Pimple\Tests\Fixtures\Service;
33
-
34
- class ContainerTest extends TestCase
35
- {
36
- public function testGetReturnsExistingService()
37
- {
38
- $pimple = new Container();
39
- $pimple['service'] = function () {
40
- return new Service();
41
- };
42
- $psr = new PsrContainer($pimple);
43
-
44
- $this->assertSame($pimple['service'], $psr->get('service'));
45
- }
46
-
47
- public function testGetThrowsExceptionIfServiceIsNotFound()
48
- {
49
- $this->expectException(\Psr\Container\NotFoundExceptionInterface::class);
50
- $this->expectExceptionMessage('Identifier "service" is not defined.');
51
-
52
- $pimple = new Container();
53
- $psr = new PsrContainer($pimple);
54
-
55
- $psr->get('service');
56
- }
57
-
58
- public function testHasReturnsTrueIfServiceExists()
59
- {
60
- $pimple = new Container();
61
- $pimple['service'] = function () {
62
- return new Service();
63
- };
64
- $psr = new PsrContainer($pimple);
65
-
66
- $this->assertTrue($psr->has('service'));
67
- }
68
-
69
- public function testHasReturnsFalseIfServiceDoesNotExist()
70
- {
71
- $pimple = new Container();
72
- $psr = new PsrContainer($pimple);
73
-
74
- $this->assertFalse($psr->has('service'));
75
- }
76
- }
vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php DELETED
@@ -1,131 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Psr11;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
- use Pimple\Psr11\ServiceLocator;
32
- use Pimple\Tests\Fixtures;
33
-
34
- /**
35
- * ServiceLocator test case.
36
- *
37
- * @author Pascal Luna <skalpa@zetareticuli.org>
38
- */
39
- class ServiceLocatorTest extends TestCase
40
- {
41
- public function testCanAccessServices()
42
- {
43
- $pimple = new Container();
44
- $pimple['service'] = function () {
45
- return new Fixtures\Service();
46
- };
47
- $locator = new ServiceLocator($pimple, ['service']);
48
-
49
- $this->assertSame($pimple['service'], $locator->get('service'));
50
- }
51
-
52
- public function testCanAccessAliasedServices()
53
- {
54
- $pimple = new Container();
55
- $pimple['service'] = function () {
56
- return new Fixtures\Service();
57
- };
58
- $locator = new ServiceLocator($pimple, ['alias' => 'service']);
59
-
60
- $this->assertSame($pimple['service'], $locator->get('alias'));
61
- }
62
-
63
- public function testCannotAccessAliasedServiceUsingRealIdentifier()
64
- {
65
- $this->expectException(\Pimple\Exception\UnknownIdentifierException::class);
66
- $this->expectExceptionMessage('Identifier "service" is not defined.');
67
-
68
- $pimple = new Container();
69
- $pimple['service'] = function () {
70
- return new Fixtures\Service();
71
- };
72
- $locator = new ServiceLocator($pimple, ['alias' => 'service']);
73
-
74
- $service = $locator->get('service');
75
- }
76
-
77
- public function testGetValidatesServiceCanBeLocated()
78
- {
79
- $this->expectException(\Pimple\Exception\UnknownIdentifierException::class);
80
- $this->expectExceptionMessage('Identifier "foo" is not defined.');
81
-
82
- $pimple = new Container();
83
- $pimple['service'] = function () {
84
- return new Fixtures\Service();
85
- };
86
- $locator = new ServiceLocator($pimple, ['alias' => 'service']);
87
-
88
- $service = $locator->get('foo');
89
- }
90
-
91
- public function testGetValidatesTargetServiceExists()
92
- {
93
- $this->expectException(\Pimple\Exception\UnknownIdentifierException::class);
94
- $this->expectExceptionMessage('Identifier "invalid" is not defined.');
95
-
96
- $pimple = new Container();
97
- $pimple['service'] = function () {
98
- return new Fixtures\Service();
99
- };
100
- $locator = new ServiceLocator($pimple, ['alias' => 'invalid']);
101
-
102
- $service = $locator->get('alias');
103
- }
104
-
105
- public function testHasValidatesServiceCanBeLocated()
106
- {
107
- $pimple = new Container();
108
- $pimple['service1'] = function () {
109
- return new Fixtures\Service();
110
- };
111
- $pimple['service2'] = function () {
112
- return new Fixtures\Service();
113
- };
114
- $locator = new ServiceLocator($pimple, ['service1']);
115
-
116
- $this->assertTrue($locator->has('service1'));
117
- $this->assertFalse($locator->has('service2'));
118
- }
119
-
120
- public function testHasChecksIfTargetServiceExists()
121
- {
122
- $pimple = new Container();
123
- $pimple['service'] = function () {
124
- return new Fixtures\Service();
125
- };
126
- $locator = new ServiceLocator($pimple, ['foo' => 'service', 'bar' => 'invalid']);
127
-
128
- $this->assertTrue($locator->has('foo'));
129
- $this->assertFalse($locator->has('bar'));
130
- }
131
- }
vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
- use Pimple\ServiceIterator;
32
- use Pimple\Tests\Fixtures\Service;
33
-
34
- class ServiceIteratorTest extends TestCase
35
- {
36
- public function testIsIterable()
37
- {
38
- $pimple = new Container();
39
- $pimple['service1'] = function () {
40
- return new Service();
41
- };
42
- $pimple['service2'] = function () {
43
- return new Service();
44
- };
45
- $pimple['service3'] = function () {
46
- return new Service();
47
- };
48
- $iterator = new ServiceIterator($pimple, ['service1', 'service2']);
49
-
50
- $this->assertSame(['service1' => $pimple['service1'], 'service2' => $pimple['service2']], iterator_to_array($iterator));
51
- }
52
- }
vendor/publishpress/wordpress-version-notices/bin/update-code-for-tests.sh DELETED
@@ -1,13 +0,0 @@
1
- #!/bin/sh
2
-
3
- # Copy the dumb plugin into the test site
4
- echo 'Copying the dumb plugin one'
5
- rsync -a tests/_data/dumb-plugin-one ~/Volumes/wordpress_tests/wp-content/plugins/
6
- echo 'Copying the dumb plugin two'
7
- rsync -a tests/_data/dumb-plugin-two ~/Volumes/wordpress_tests/wp-content/plugins/
8
-
9
- # Copy the library into the dumb plugin
10
- echo 'Copying the library into the dumb plugin one'
11
- rsync -a ./ ~/Volumes/wordpress_tests/wp-content/plugins/dumb-plugin-one/vendor/publishpress/wordpress-version-notices/ --exclude .git
12
- echo 'Copying the library into the dumb plugin two'
13
- rsync -a ./ ~/Volumes/wordpress_tests/wp-content/plugins/dumb-plugin-two/vendor/publishpress/wordpress-version-notices/ --exclude .git
vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php CHANGED
@@ -28,6 +28,7 @@ namespace PPVersionNotices\Module\TopNotice;
28
use PPVersionNotices\Module\AdInterface;
29
use PPVersionNotices\Template\TemplateLoaderInterface;
30
use PPVersionNotices\Template\TemplateInvalidArgumentsException;
31
32
/**
33
* Class Module
@@ -45,6 +46,11 @@ class Module implements AdInterface
45
*/
46
private $templateLoader;
47
48
/**
49
* @var array
50
*/
@@ -74,16 +80,24 @@ class Module implements AdInterface
74
*/
75
public function display($message = '', $linkURL = '')
76
{
77
- if (empty($message) || empty($linkURL)) {
78
- throw new TemplateInvalidArgumentsException();
79
- }
80
81
- $context = [
82
- 'message' => $message,
83
- 'linkURL' => $linkURL
84
- ];
85
86
- $this->templateLoader->displayOutput('top-notice', 'notice', $context);
87
}
88
89
/**
@@ -93,21 +107,23 @@ class Module implements AdInterface
93
{
94
$screen = get_current_screen();
95
96
- foreach ($this->settings as $pluginName => $setting) {
97
- foreach ($setting['screens'] as $screenParams) {
98
- if ($screenParams === true) {
99
- return $setting;
100
- }
101
102
- $validVars = 0;
103
- foreach ($screenParams as $var => $value) {
104
- if (isset($screen->$var) && $screen->$var === $value) {
105
- $validVars++;
106
}
107
- }
108
109
- if ($validVars === count($screenParams)) {
110
- return $setting;
111
}
112
}
113
}
@@ -133,4 +149,12 @@ class Module implements AdInterface
133
do_action(self::DISPLAY_ACTION, $settings['message'], $settings['link']);
134
}
135
}
136
}
28
use PPVersionNotices\Module\AdInterface;
29
use PPVersionNotices\Template\TemplateLoaderInterface;
30
use PPVersionNotices\Template\TemplateInvalidArgumentsException;
31
+ use PPVersionNotices\Template\TemplateNotFoundException;
32
33
/**
34
* Class Module
46
*/
47
private $templateLoader;
48
49
+ /**
50
+ * @var array
51
+ */
52
+ private $exceptions = [];
53
+
54
/**
55
* @var array
56
*/
80
*/
81
public function display($message = '', $linkURL = '')
82
{
83
+ try {
84
+ if (empty($message) || empty($linkURL)) {
85
+ throw new TemplateInvalidArgumentsException();
86
+ }
87
+
88
+ $context = [
89
+ 'message' => $message,
90
+ 'linkURL' => $linkURL
91
+ ];
92
93
+ $this->templateLoader->displayOutput('top-notice', 'notice', $context);
94
+ } catch (\Exception $e) {
95
+ if (defined('WP_DEBUG') && WP_DEBUG) {
96
+ $this->exceptions[] = $e->getMessage();
97
98
+ add_action('admin_notices', [$this, 'showNoticeWithException']);
99
+ }
100
+ }
101
}
102
103
/**
107
{
108
$screen = get_current_screen();
109
110
+ if (!empty($screen)) {
111
+ foreach ($this->settings as $pluginName => $setting) {
112
+ foreach ($setting['screens'] as $screenParams) {
113
+ if ($screenParams === true) {
114
+ return $setting;
115
+ }
116
117
+ $validVars = 0;
118
+ foreach ($screenParams as $var => $value) {
119
+ if (isset($screen->$var) && $screen->$var === $value) {
120
+ $validVars++;
121
+ }
122
}
123
124
+ if ($validVars === count($screenParams)) {
125
+ return $setting;
126
+ }
127
}
128
}
129
}
149
do_action(self::DISPLAY_ACTION, $settings['message'], $settings['link']);
150
}
151
}
152
+
153
+ public function showNoticeWithException()
154
+ {
155
+ $class = 'notice notice-error';
156
+ $message = implode("<br>", $this->exceptions);
157
+
158
+ printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), esc_html($message));
159
+ }
160
}
vendor/publishpress/wordpress-version-notices/src/Template/TemplateLoader.php CHANGED
@@ -58,8 +58,7 @@ class TemplateLoader implements TemplateLoaderInterface
58
$templatePath = $this->templatesPath . '/' . $moduleName . '/' . $templateName . '.php';
59
60
if (!file_exists($templatePath)) {
61
- //throw new TemplateNotFoundException('Template file not found');
62
- return false;
63
}
64
65
if ($return) {
58
$templatePath = $this->templatesPath . '/' . $moduleName . '/' . $templateName . '.php';
59
60
if (!file_exists($templatePath)) {
61
+ throw new TemplateNotFoundException('Template file not found: ' . $templatePath);
62
}
63
64
if ($return) {
vendor/publishpress/wordpress-version-notices/tests/_data/.gitkeep DELETED
File without changes
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/dumb-plugin-one.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin Name: Dumb Plugin One
4
- * Plugin URI: https://publishpress.com/
5
- * Description: Dumb plugin for testing the library
6
- * Author: PublishPress
7
- * Author URI: https://publishpress.com
8
- * Version: 0.1.0
9
- *
10
- * Copyright (c) 2020 PublishPress
11
- *
12
- * GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
13
- *
14
- * This program is free software: you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License as published by
16
- * the Free Software Foundation, either version 3 of the License, or
17
- * (at your option) any later version.
18
- *
19
- * This program is distributed in the hope that it will be useful,
20
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- * GNU General Public License for more details.
23
- *
24
- * You should have received a copy of the GNU General Public License
25
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
- *
27
- * @package PublishPress
28
- * @category Core
29
- * @author PublishPress
30
- * @copyright Copyright (C) 2020 PublishPress. All rights reserved.
31
- */
32
-
33
- if (!defined('DUMB_PLUGIN_ONE_LOADED')) {
34
- require_once 'version-notice.php';
35
-
36
- define('DUMB_PLUGIN_ONE_LOADED', true);
37
- }
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/vendor/publishpress/wordpress-version-notices/.gitkeep DELETED
File without changes
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/version-notice.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright (c) 2020 PublishPress
4
- *
5
- * GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
6
- *
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation, either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- *
20
- * @package PublishPress
21
- * @category Core
22
- * @author PublishPress
23
- * @copyright Copyright (C) 2020 PublishPress. All rights reserved.
24
- */
25
-
26
- // @todo: Load only in the admin
27
- if (!defined('PP_VERSION_NOTICES_LOADED')) {
28
- require_once __DIR__ . '/vendor/publishpress/wordpress-version-notices/includes.php';
29
- }
30
-
31
- add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
32
- $settings['dumb-plugin-one'] = [
33
- 'message' => 'You\'re using Dumb Plugin One Free. Please, %supgrade to pro%s.',
34
- 'link' => 'http://example.com/upgrade',
35
- 'screens' => [
36
- [
37
- 'base' => 'edit',
38
- 'id' => 'edit-post',
39
- 'post_type' => 'post',
40
- ],
41
- ]
42
- ];
43
-
44
- return $settings;
45
- });
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/dumb-plugin-two.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin Name: Dumb Plugin Two
4
- * Plugin URI: https://publishpress.com/
5
- * Description: Dumb plugin for testing the library
6
- * Author: PublishPress
7
- * Author URI: https://publishpress.com
8
- * Version: 0.1.0
9
- *
10
- * Copyright (c) 2020 PublishPress
11
- *
12
- * GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
13
- *
14
- * This program is free software: you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License as published by
16
- * the Free Software Foundation, either version 3 of the License, or
17
- * (at your option) any later version.
18
- *
19
- * This program is distributed in the hope that it will be useful,
20
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- * GNU General Public License for more details.
23
- *
24
- * You should have received a copy of the GNU General Public License
25
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
- *
27
- * @package PublishPress
28
- * @category Core
29
- * @author PublishPress
30
- * @copyright Copyright (C) 2020 PublishPress. All rights reserved.
31
- */
32
-
33
- if (!defined('DUMB_PLUGIN_TWO_LOADED')) {
34
- require_once 'version-notice.php';
35
-
36
- define('DUMB_PLUGIN_TWO_LOADED', true);
37
- }
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/vendor/publishpress/wordpress-version-notices/.gitkeep DELETED
File without changes
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/version-notice.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright (c) 2020 PublishPress
4
- *
5
- * GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
6
- *
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation, either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- *
20
- * @package PublishPress
21
- * @category Core
22
- * @author PublishPress
23
- * @copyright Copyright (C) 2020 PublishPress. All rights reserved.
24
- */
25
-
26
- // @todo: Load only in the admin
27
- if (!defined('PP_VERSION_NOTICES_LOADED')) {
28
- require_once __DIR__ . '/vendor/publishpress/wordpress-version-notices/includes.php';
29
- }
30
-
31
- add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
32
- $settings['dumb-plugin-two'] = [
33
- 'message' => 'You\'re using Dumb Plugin Two Free. Please, %supgrade to pro%s.',
34
- 'link' => 'http://example.com/upgrade',
35
- 'screens' => [
36
- [
37
- 'base' => 'edit',
38
- 'id' => 'edit-post',
39
- 'post_type' => 'page',
40
- ],
41
- ]
42
- ];
43
-
44
- return $settings;
45
- });
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-templates/Dumb/test1.php DELETED
@@ -1 +0,0 @@
1
- <h1>Test1</h1>
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-templates/Dumb/test2.php DELETED
@@ -1 +0,0 @@
1
- <h1>Test2: <?php echo $foo1; ?>, <?php echo $foo2; ?></h1>
vendor/publishpress/wordpress-version-notices/tests/_data/dump.sql DELETED
@@ -1,524 +0,0 @@
1
- # ************************************************************
2
- # Sequel Pro SQL dump
3
- # Version 4541
4
- #
5
- # http://www.sequelpro.com/
6
- # https://github.com/sequelpro/sequelpro
7
- #
8
- # Host: 127.0.0.1 (MySQL 5.7.28)
9
- # Database: wordpress
10
- # Generation Time: 2020-03-03 16:30:50 +0000
11
- # ************************************************************
12
-
13
-
14
- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
15
- /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
16
- /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
17
- /*!40101 SET NAMES utf8 */;
18
- /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
19
- /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
20
- /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
21
-
22
-
23
- # Dump of table wp_commentmeta
24
- # ------------------------------------------------------------
25
-
26
- DROP TABLE IF EXISTS `wp_commentmeta`;
27
-
28
- CREATE TABLE `wp_commentmeta` (
29
- `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
30
- `comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
31
- `meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
32
- `meta_value` longtext COLLATE utf8mb4_unicode_520_ci,
33
- PRIMARY KEY (`meta_id`),
34
- KEY `comment_id` (`comment_id`),
35
- KEY `meta_key` (`meta_key`(191))
36
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
37
-
38
-
39
-
40
- # Dump of table wp_comments
41
- # ------------------------------------------------------------
42
-
43
- DROP TABLE IF EXISTS `wp_comments`;
44
-
45
- CREATE TABLE `wp_comments` (
46
- `comment_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
47
- `comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT '0',
48
- `comment_author` tinytext COLLATE utf8mb4_unicode_520_ci NOT NULL,
49
- `comment_author_email` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
50
- `comment_author_url` varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
51
- `comment_author_IP` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
52
- `comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
53
- `comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
54
- `comment_content` text COLLATE utf8mb4_unicode_520_ci NOT NULL,
55
- `comment_karma` int(11) NOT NULL DEFAULT '0',
56
- `comment_approved` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '1',
57
- `comment_agent` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
58
-