Version Description
- 2020/09/21
- Cleaned up code
- Added counter for number of times the pingback method was blocked.
- Tested with WP 5.5.1
- 28,595 downloads
Download this release
Release Info
Developer | cleverplugins |
Plugin | Remove XMLRPC Pingback Ping |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.3
- README.txt +13 -6
- composer.json +5 -0
- remove-xmlrpc-pingback-ping.php +80 -23
- vendor/autoload.php +7 -0
- vendor/collizo4sky/persist-admin-notices-dismissal/CHANGES.md +18 -0
- vendor/collizo4sky/persist-admin-notices-dismissal/README.md +128 -0
- vendor/collizo4sky/persist-admin-notices-dismissal/composer.json +15 -0
- vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js +33 -0
- vendor/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php +190 -0
- vendor/composer/ClassLoader.php +445 -0
- vendor/composer/LICENSE +21 -0
- vendor/composer/autoload_classmap.php +10 -0
- vendor/composer/autoload_namespaces.php +9 -0
- vendor/composer/autoload_psr4.php +9 -0
- vendor/composer/autoload_real.php +55 -0
- vendor/composer/autoload_static.php +20 -0
- vendor/composer/installed.json +34 -0
README.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Remove & Disable XML-RPC Pingback ===
|
2 |
-
Contributors:
|
3 |
Tags: xmlrpc, xml-rpc, ping, pingback, disable ping, disable xmlrpc, disable pingback, disable xml-rpc
|
4 |
Requires at least: 4.0
|
5 |
-
Requires PHP: 5.
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -35,7 +35,7 @@ Use [Sucuri's WordPress DDOS Scanner](http://labs.sucuri.net/?is-my-wordpress-dd
|
|
35 |
|
36 |
= Why Not Just Disable XMLRPC Altogether? =
|
37 |
|
38 |
-
Yes, you can choose to do that
|
39 |
|
40 |
== Installation ==
|
41 |
|
@@ -70,10 +70,17 @@ Yes, you can choose to do that using the plugin [Disable XML-RPC](http://wordpre
|
|
70 |
|
71 |
= Is My Site Attacking Others? =
|
72 |
|
73 |
-
It could be! Use [Sucuri's WordPress DDOS Scanner](
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
= 1.1 =
|
78 |
* 2019/04/09
|
79 |
* version bump
|
1 |
=== Remove & Disable XML-RPC Pingback ===
|
2 |
+
Contributors: cleverplugins, lkoudal
|
3 |
Tags: xmlrpc, xml-rpc, ping, pingback, disable ping, disable xmlrpc, disable pingback, disable xml-rpc
|
4 |
Requires at least: 4.0
|
5 |
+
Requires PHP: 5.6
|
6 |
+
Tested up to: 5.5.1
|
7 |
+
Stable tag: 1.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
35 |
|
36 |
= Why Not Just Disable XMLRPC Altogether? =
|
37 |
|
38 |
+
Yes, you can choose to do that, but if you use popular plugins like JetPack (that use XMLRPC) then those plugins will stop working 100%. That is why this small plugin exists.
|
39 |
|
40 |
== Installation ==
|
41 |
|
70 |
|
71 |
= Is My Site Attacking Others? =
|
72 |
|
73 |
+
It could be! Use [Sucuri's WordPress DDOS Scanner](https://labs.sucuri.net/?is-my-wordpress-ddosing) to check if your site is DDOS’ing other websites
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.3 =
|
78 |
+
* 2020/09/21
|
79 |
+
* Cleaned up code
|
80 |
+
* Added counter for number of times the pingback method was blocked.
|
81 |
+
* Tested with WP 5.5.1
|
82 |
+
* 28,595 downloads
|
83 |
+
|
84 |
= 1.1 =
|
85 |
* 2019/04/09
|
86 |
* version bump
|
composer.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"require": {
|
3 |
+
"collizo4sky/persist-admin-notices-dismissal": "^1.4"
|
4 |
+
}
|
5 |
+
}
|
remove-xmlrpc-pingback-ping.php
CHANGED
@@ -3,37 +3,94 @@
|
|
3 |
Plugin Name: Remove XMLRPC Pingback Ping
|
4 |
Plugin URI: http://wordpress.org/plugins/remove-xmlrpc-pingback-ping
|
5 |
Description: Prevent WordPress from participating in and being a victim of pingback denial of service attacks.
|
6 |
-
Version: 1.
|
7 |
-
Author:
|
8 |
-
Author URI: https://
|
9 |
License: GPL-2.0+
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
11 |
-
|
12 |
Copyright 2014 - 2019 Web factory Ltd (email: support@webfactoryltd.com)
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
*/
|
27 |
|
28 |
-
|
29 |
// If this file is called directly, abort.
|
30 |
-
if ( ! defined( 'WPINC' ) ) {
|
31 |
-
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
add_filter( 'xmlrpc_methods', 'remove_xmlrpc_pingback_ping' );
|
35 |
|
36 |
-
function remove_xmlrpc_pingback_ping( $methods ) {
|
37 |
-
unset( $methods['pingback.ping'] );
|
38 |
-
return $methods;
|
39 |
-
}
|
3 |
Plugin Name: Remove XMLRPC Pingback Ping
|
4 |
Plugin URI: http://wordpress.org/plugins/remove-xmlrpc-pingback-ping
|
5 |
Description: Prevent WordPress from participating in and being a victim of pingback denial of service attacks.
|
6 |
+
Version: 1.3
|
7 |
+
Author: WP Security Ninja
|
8 |
+
Author URI: https://wpsecurityninja.com/
|
9 |
License: GPL-2.0+
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
11 |
+
|
12 |
Copyright 2014 - 2019 Web factory Ltd (email: support@webfactoryltd.com)
|
13 |
+
Copyright 2019 - WP Security Ninja (email: support@wpsecurityninja.com)
|
14 |
|
15 |
+
This program is free software; you can redistribute it and/or modify
|
16 |
+
it under the terms of the GNU General Public License, version 2, as
|
17 |
+
published by the Free Software Foundation.
|
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, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
|
|
29 |
// If this file is called directly, abort.
|
30 |
+
if ( ! defined( 'WPINC' ) ) {
|
31 |
+
die;
|
32 |
+
}
|
33 |
+
|
34 |
+
define('RXPP_PLUGIN_URL', plugin_dir_path(__FILE__));
|
35 |
+
|
36 |
+
require RXPP_PLUGIN_URL . 'vendor/autoload.php';
|
37 |
+
//require RXPP_PLUGIN_URL . 'vendor/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php'
|
38 |
+
add_action( 'admin_init', array( 'PAnD', 'init' ) );
|
39 |
+
|
40 |
+
add_action( 'admin_notices', 'xrpp_admin_notice_blocked_attempts' );
|
41 |
+
|
42 |
+
function xrpp_admin_notice_blocked_attempts() {
|
43 |
+
if ( ! PAnD::is_admin_notice_active( 'xrpp-admin-notice-14' ) ) {
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
$rxpp_blocked_methods_count = get_option('rxpp_blocked_methods_count', false);
|
47 |
+
?>
|
48 |
+
<div data-dismissible="xrpp-admin-notice-14" class="updated notice notice-success is-dismissible">
|
49 |
+
<h2>Protected from XML-RPC pingback DOS attacks!</h2>
|
50 |
+
<p>You are preventing denial of service attacks on your website.</p>
|
51 |
+
<?php
|
52 |
+
if ( $rxpp_blocked_methods_count ) {
|
53 |
+
?>
|
54 |
+
<p><strong><?php printf( esc_html__( '%s blocked attempts so far!', 'remove-xmlrpc-pingback-ping' ), number_format_i18n($rxpp_blocked_methods_count ) ); ?></strong></p>
|
55 |
+
<?php
|
56 |
+
}
|
57 |
+
?>
|
58 |
+
|
59 |
+
|
60 |
+
<p>Serious about security? Try out our Security Ninja plugin that protects you for many more problems.</p>
|
61 |
+
<table>
|
62 |
+
<th>
|
63 |
+
<td>
|
64 |
+
<a class="button button-secondary" href="https://wpsecurityninja.com/?utm_source=remove_xmlrpc_plugin&utm_medium=plugin&utm_content=notice" aria-label="Visit wpsecurityninja.com now" data-name="WP Security Ninja" target="_blank" rel="noopener">Visit wpsecurityninja.com</a>
|
65 |
+
</td>
|
66 |
+
<td>or</td>
|
67 |
+
<td>
|
68 |
+
<a class="button button-primary" href="<?php echo esc_url( admin_url('plugin-install.php?s="Security+Ninja+–+Secure+Firewall+%26+Secure+Malware+Scanner"+"WP+Security+Ninja"&tab=search&type=term') ); ?>" aria-label="Install WP Security Ninja free" data-name="WP Security Ninja">Install for free</a>
|
69 |
+
</td>
|
70 |
+
</th>
|
71 |
+
</table>
|
72 |
+
<p></p>
|
73 |
+
|
74 |
+
</div>
|
75 |
+
<?php
|
76 |
+
}
|
77 |
+
|
78 |
+
add_filter( 'xmlrpc_methods', 'rxpp_remove_xmlrpc_pingback_ping' );
|
79 |
+
function rxpp_remove_xmlrpc_pingback_ping( $methods ) {
|
80 |
+
unset( $methods['pingback.ping'] );
|
81 |
+
$rxpp_blocked_methods_count = get_option('rxpp_blocked_methods_count', 0);
|
82 |
+
$rxpp_blocked_methods_count++;
|
83 |
+
update_option( 'rxpp_blocked_methods_count', $rxpp_blocked_methods_count, false );
|
84 |
+
return $methods;
|
85 |
+
}
|
86 |
+
|
87 |
+
register_uninstall_hook(__FILE__, 'do_rxpp_uninstall_function');
|
88 |
+
function do_rxpp_uninstall_function() {
|
89 |
+
delete_option( 'rxpp_blocked_methods_count' );
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
|
|
|
96 |
|
|
|
|
|
|
|
|
vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitc69f9e022a7575f97fc2ef8db9826a94::getLoader();
|
vendor/collizo4sky/persist-admin-notices-dismissal/CHANGES.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#### 1.4.3
|
2 |
+
* added filter hook `pand_dismiss_notice_js_url` in case you're using this in a theme or a local environment that doesn't quite find the correct URL.
|
3 |
+
* added filter hook `pand_theme_loader` that returns a boolean for simpler usage of the `pand_dismiss_notice_js_url` hook
|
4 |
+
|
5 |
+
#### 1.4.2
|
6 |
+
* No changes to `class PAnD`
|
7 |
+
* updated `.gitignore` and `.gitattributes`
|
8 |
+
* now use classmap in composer's autoloader, should be more efficient
|
9 |
+
|
10 |
+
#### 1.4.1
|
11 |
+
* fixed the `forever` setting with options
|
12 |
+
|
13 |
+
#### 1.4.0
|
14 |
+
* WPCS 1.1.0 linting done
|
15 |
+
* switched from storing timeout in transients to storing in the options table, this should play much better with object caching
|
16 |
+
|
17 |
+
#### 1.3.x
|
18 |
+
* uses transients to store timeout
|
vendor/collizo4sky/persist-admin-notices-dismissal/README.md
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Persist Admin notice Dismissals
|
2 |
+
[![Latest Stable Version](https://poser.pugx.org/collizo4sky/persist-admin-notices-dismissal/v/stable)](https://packagist.org/packages/collizo4sky/persist-admin-notices-dismissal)
|
3 |
+
[![Total Downloads](https://poser.pugx.org/collizo4sky/persist-admin-notices-dismissal/downloads)](https://packagist.org/packages/collizo4sky/persist-admin-notices-dismissal)
|
4 |
+
|
5 |
+
Simple framework library that persists the dismissal of admin notices across pages in WordPress dashboard.
|
6 |
+
|
7 |
+
## Installation
|
8 |
+
|
9 |
+
Run `composer require collizo4sky/persist-admin-notices-dismissal`
|
10 |
+
|
11 |
+
Alternatively, clone or download this repo into the `vendor/` folder in your plugin, and include/require the `persist-admin-notices-dismissal.php` file like so
|
12 |
+
|
13 |
+
```php
|
14 |
+
require __DIR__ . '/vendor/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php';
|
15 |
+
add_action( 'admin_init', array( 'PAnD', 'init' ) );
|
16 |
+
```
|
17 |
+
|
18 |
+
or let Composer's autoloader do the work.
|
19 |
+
|
20 |
+
## How to Use
|
21 |
+
Firstly, install and activate this library within a plugin.
|
22 |
+
|
23 |
+
Say you have the following markup as your admin notice,
|
24 |
+
|
25 |
+
|
26 |
+
```php
|
27 |
+
function sample_admin_notice__success() {
|
28 |
+
?>
|
29 |
+
<div class="updated notice notice-success is-dismissible">
|
30 |
+
<p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
|
31 |
+
</div>
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
add_action( 'admin_notices', 'sample_admin_notice__success' );
|
35 |
+
```
|
36 |
+
|
37 |
+
To make it hidden forever when dismissed, add the following data attribute `data-dismissible="disable-done-notice-forever"` to the div markup like so:
|
38 |
+
|
39 |
+
|
40 |
+
```php
|
41 |
+
function sample_admin_notice__success() {
|
42 |
+
if ( ! PAnD::is_admin_notice_active( 'disable-done-notice-forever' ) ) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
?>
|
47 |
+
<div data-dismissible="disable-done-notice-forever" class="updated notice notice-success is-dismissible">
|
48 |
+
<p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
|
49 |
+
</div>
|
50 |
+
<?php
|
51 |
+
}
|
52 |
+
add_action( 'admin_init', array( 'PAnD', 'init' ) );
|
53 |
+
add_action( 'admin_notices', 'sample_admin_notice__success' );
|
54 |
+
```
|
55 |
+
|
56 |
+
## Autoloaders
|
57 |
+
When using the framework with an autoloader you **must** also load the class outside of the `admin_notices` or `network_admin_notices` hooks. The reason is that these hooks come after the `admin_enqueue_script` hook that loads the javascript.
|
58 |
+
|
59 |
+
Just add the following in your main plugin file.
|
60 |
+
|
61 |
+
```php
|
62 |
+
add_action( 'admin_init', array( 'PAnD', 'init' ) );
|
63 |
+
```
|
64 |
+
|
65 |
+
#### Usage Instructions and Examples
|
66 |
+
If you have two notices displayed when certain actions are triggered; firstly, choose a string to uniquely identify them, e.g. `notice-one` and `notice-two`
|
67 |
+
|
68 |
+
To make the first notice never appear once dismissed, its `data-dismissible` attribute will be `data-dismissible="notice-one-forever"` where `notice-one` is its unique identifier and `forever` is the dismissal time period.
|
69 |
+
|
70 |
+
To make the second notice only hidden for 2 days, its `data-dismissible` attribute will be `data-dismissible="notice-two-2"` where `notice-two` is its unique identifier and the `2`, the number of days it will be hidden is the dismissal time period.
|
71 |
+
|
72 |
+
You **must** append the dismissal time period to the end of your unique identifier with a hyphen (`-`) and this value must be an integer. The only exception is the string `forever`.
|
73 |
+
|
74 |
+
To actually make the dismissed admin notice not to appear, use the `is_admin_notice_active()` function like so:
|
75 |
+
|
76 |
+
|
77 |
+
```php
|
78 |
+
function sample_admin_notice__success1() {
|
79 |
+
if ( ! PAnD::is_admin_notice_active( 'notice-one-forever' ) ) {
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
|
83 |
+
?>
|
84 |
+
<div data-dismissible="notice-one-forever" class="updated notice notice-success is-dismissible">
|
85 |
+
<p><?php _e( 'Done 1!', 'sample-text-domain' ); ?></p>
|
86 |
+
</div>
|
87 |
+
<?php
|
88 |
+
}
|
89 |
+
|
90 |
+
function sample_admin_notice__success2() {
|
91 |
+
if ( ! PAnD::is_admin_notice_active( 'notice-two-2' ) ) {
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
|
95 |
+
?>
|
96 |
+
<div data-dismissible="notice-two-2" class="updated notice notice-success is-dismissible">
|
97 |
+
<p><?php _e( 'Done 2!', 'sample-text-domain' ); ?></p>
|
98 |
+
</div>
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
|
102 |
+
add_action( 'admin_init', array( 'PAnD', 'init' ) );
|
103 |
+
add_action( 'admin_notices', 'sample_admin_notice__success1' );
|
104 |
+
add_action( 'admin_notices', 'sample_admin_notice__success2' );
|
105 |
+
```
|
106 |
+
|
107 |
+
Please note that if you cleanup after your plugin deletion please try to make the removal of stored options as specific as possible. Otherwise you may end up deleting the stored options from other projects.
|
108 |
+
|
109 |
+
A filter hook is available to return the proper URL to the Javascript file. An example usage is as follows, especially if this is being used in a theme.
|
110 |
+
|
111 |
+
```php
|
112 |
+
add_filter( 'pand_theme_loader', '__return_true' );
|
113 |
+
```
|
114 |
+
|
115 |
+
The `pand_theme_loader` runs the following hook if `true`. You can directly change the URL to the Javascript file by using another hook in the following manner by changing the return value.
|
116 |
+
|
117 |
+
```php
|
118 |
+
add_filter(
|
119 |
+
'pand_dismiss_notice_js_url',
|
120 |
+
function( $js_url, $composer_path ) {
|
121 |
+
return get_stylesheet_directory_uri() . $composer_path;
|
122 |
+
},
|
123 |
+
10,
|
124 |
+
2
|
125 |
+
);
|
126 |
+
```
|
127 |
+
|
128 |
+
Cool beans. Isn't it?
|
vendor/collizo4sky/persist-admin-notices-dismissal/composer.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "collizo4sky/persist-admin-notices-dismissal",
|
3 |
+
"description": "Simple library to persist dismissal of admin notices across pages in WordPress dashboard.",
|
4 |
+
"authors": [
|
5 |
+
{
|
6 |
+
"name": "Collins Agbonghama",
|
7 |
+
"email": "me@w3guy.com"
|
8 |
+
}
|
9 |
+
],
|
10 |
+
"autoload": {
|
11 |
+
"classmap": [
|
12 |
+
"persist-admin-notices-dismissal.php"
|
13 |
+
]
|
14 |
+
}
|
15 |
+
}
|
vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
//shorthand for ready event.
|
3 |
+
$(
|
4 |
+
function () {
|
5 |
+
$( 'div[data-dismissible] button.notice-dismiss' ).click(
|
6 |
+
function (event) {
|
7 |
+
event.preventDefault();
|
8 |
+
var $this = $( this );
|
9 |
+
|
10 |
+
var attr_value, option_name, dismissible_length, data;
|
11 |
+
|
12 |
+
attr_value = $this.parent().attr( 'data-dismissible' ).split( '-' );
|
13 |
+
|
14 |
+
// remove the dismissible length from the attribute value and rejoin the array.
|
15 |
+
dismissible_length = attr_value.pop();
|
16 |
+
|
17 |
+
option_name = attr_value.join( '-' );
|
18 |
+
|
19 |
+
data = {
|
20 |
+
'action': 'dismiss_admin_notice',
|
21 |
+
'option_name': option_name,
|
22 |
+
'dismissible_length': dismissible_length,
|
23 |
+
'nonce': dismissible_notice.nonce
|
24 |
+
};
|
25 |
+
|
26 |
+
// We can also pass the url value separately from ajaxurl for front end AJAX implementations
|
27 |
+
$.post( ajaxurl, data );
|
28 |
+
}
|
29 |
+
);
|
30 |
+
}
|
31 |
+
)
|
32 |
+
|
33 |
+
}(jQuery));
|
vendor/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Persist Admin notices Dismissal
|
5 |
+
*
|
6 |
+
* Copyright (C) 2016 Collins Agbonghama <http://w3guy.com>
|
7 |
+
*
|
8 |
+
* This program is free software: you can redistribute it and/or modify
|
9 |
+
* it under the terms of the GNU General Public License as published by
|
10 |
+
* the Free Software Foundation, either version 3 of the License, or
|
11 |
+
* (at your option) any later version.
|
12 |
+
*
|
13 |
+
* This program is distributed in the hope that it will be useful,
|
14 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
* GNU General Public License for more details.
|
17 |
+
*
|
18 |
+
* You should have received a copy of the GNU General Public License
|
19 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
+
*
|
21 |
+
* @package Persist Admin notices Dismissal
|
22 |
+
* @author Collins Agbonghama
|
23 |
+
* @author Andy Fragen
|
24 |
+
* @license http://www.gnu.org/licenses GNU General Public License
|
25 |
+
* @version 1.4.3
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Exit if called directly.
|
30 |
+
*/
|
31 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
+
die;
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! class_exists( 'PAnD' ) ) {
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Class PAnD
|
39 |
+
*/
|
40 |
+
class PAnD {
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Init hooks.
|
44 |
+
*/
|
45 |
+
public static function init() {
|
46 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) );
|
47 |
+
add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) );
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Filter to activate another filter providing a simpler use case.
|
51 |
+
*
|
52 |
+
* @since 1.4.3
|
53 |
+
*
|
54 |
+
* @param bool
|
55 |
+
*/
|
56 |
+
if ( apply_filters( 'pand_theme_loader', false ) ) {
|
57 |
+
add_filter(
|
58 |
+
'pand_dismiss_notice_js_url',
|
59 |
+
function( $js_url, $composer_path ) {
|
60 |
+
return get_stylesheet_directory_uri() . $composer_path;
|
61 |
+
},
|
62 |
+
10,
|
63 |
+
2
|
64 |
+
);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Enqueue javascript and variables.
|
70 |
+
*/
|
71 |
+
public static function load_script() {
|
72 |
+
|
73 |
+
if ( is_customize_preview() ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
$js_url = plugins_url( 'dismiss-notice.js', __FILE__ );
|
78 |
+
$composer_path = '/vendor/collizo4sky/persist-admin-notices-dismissal/dismiss-notice.js';
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Filter dismiss-notice.js URL.
|
82 |
+
*
|
83 |
+
* @since 1.4.3
|
84 |
+
*
|
85 |
+
* @param string $js_url URL to the Javascript file.
|
86 |
+
* @param string $composer_path Relative path of Javascript file from composer install.
|
87 |
+
*/
|
88 |
+
$js_url = apply_filters( 'pand_dismiss_notice_js_url', $js_url, $composer_path );
|
89 |
+
wp_enqueue_script(
|
90 |
+
'dismissible-notices',
|
91 |
+
$js_url,
|
92 |
+
array( 'jquery', 'common' ),
|
93 |
+
false,
|
94 |
+
true
|
95 |
+
);
|
96 |
+
|
97 |
+
wp_localize_script(
|
98 |
+
'dismissible-notices',
|
99 |
+
'dismissible_notice',
|
100 |
+
array(
|
101 |
+
'nonce' => wp_create_nonce( 'dismissible-notice' ),
|
102 |
+
)
|
103 |
+
);
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Handles Ajax request to persist notices dismissal.
|
108 |
+
* Uses check_ajax_referer to verify nonce.
|
109 |
+
*/
|
110 |
+
public static function dismiss_admin_notice() {
|
111 |
+
$option_name = sanitize_text_field( $_POST['option_name'] );
|
112 |
+
$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
|
113 |
+
|
114 |
+
if ( 'forever' != $dismissible_length ) {
|
115 |
+
// If $dismissible_length is not an integer default to 1
|
116 |
+
$dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
|
117 |
+
$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
|
118 |
+
}
|
119 |
+
|
120 |
+
check_ajax_referer( 'dismissible-notice', 'nonce' );
|
121 |
+
self::set_admin_notice_cache( $option_name, $dismissible_length );
|
122 |
+
wp_die();
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Is admin notice active?
|
127 |
+
*
|
128 |
+
* @param string $arg data-dismissible content of notice.
|
129 |
+
*
|
130 |
+
* @return bool
|
131 |
+
*/
|
132 |
+
public static function is_admin_notice_active( $arg ) {
|
133 |
+
$array = explode( '-', $arg );
|
134 |
+
$length = array_pop( $array );
|
135 |
+
$option_name = implode( '-', $array );
|
136 |
+
$db_record = self::get_admin_notice_cache( $option_name );
|
137 |
+
|
138 |
+
if ( 'forever' == $db_record ) {
|
139 |
+
return false;
|
140 |
+
} elseif ( absint( $db_record ) >= time() ) {
|
141 |
+
return false;
|
142 |
+
} else {
|
143 |
+
return true;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Returns admin notice cached timeout.
|
149 |
+
*
|
150 |
+
* @access public
|
151 |
+
*
|
152 |
+
* @param string|bool $id admin notice name or false.
|
153 |
+
*
|
154 |
+
* @return array|bool The timeout. False if expired.
|
155 |
+
*/
|
156 |
+
public static function get_admin_notice_cache( $id = false ) {
|
157 |
+
if ( ! $id ) {
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
$cache_key = 'pand-' . md5( $id );
|
161 |
+
$timeout = get_site_option( $cache_key );
|
162 |
+
$timeout = 'forever' === $timeout ? time() + 60 : $timeout;
|
163 |
+
|
164 |
+
if ( empty( $timeout ) || time() > $timeout ) {
|
165 |
+
return false;
|
166 |
+
}
|
167 |
+
|
168 |
+
return $timeout;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Sets admin notice timeout in site option.
|
173 |
+
*
|
174 |
+
* @access public
|
175 |
+
*
|
176 |
+
* @param string $id Data Identifier.
|
177 |
+
* @param string|bool $timeout Timeout for admin notice.
|
178 |
+
*
|
179 |
+
* @return bool
|
180 |
+
*/
|
181 |
+
public static function set_admin_notice_cache( $id, $timeout ) {
|
182 |
+
$cache_key = 'pand-' . md5( $id );
|
183 |
+
update_site_option( $cache_key, $timeout );
|
184 |
+
|
185 |
+
return true;
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
}
|
vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
private $classMapAuthoritative = false;
|
57 |
+
private $missingClasses = array();
|
58 |
+
private $apcuPrefix;
|
59 |
+
|
60 |
+
public function getPrefixes()
|
61 |
+
{
|
62 |
+
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
+
}
|
65 |
+
|
66 |
+
return array();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixesPsr4()
|
70 |
+
{
|
71 |
+
return $this->prefixDirsPsr4;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFallbackDirs()
|
75 |
+
{
|
76 |
+
return $this->fallbackDirsPsr0;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getFallbackDirsPsr4()
|
80 |
+
{
|
81 |
+
return $this->fallbackDirsPsr4;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getClassMap()
|
85 |
+
{
|
86 |
+
return $this->classMap;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $classMap Class to filename map
|
91 |
+
*/
|
92 |
+
public function addClassMap(array $classMap)
|
93 |
+
{
|
94 |
+
if ($this->classMap) {
|
95 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
+
} else {
|
97 |
+
$this->classMap = $classMap;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
+
* appending or prepending to the ones previously set for this prefix.
|
104 |
+
*
|
105 |
+
* @param string $prefix The prefix
|
106 |
+
* @param array|string $paths The PSR-0 root directories
|
107 |
+
* @param bool $prepend Whether to prepend the directories
|
108 |
+
*/
|
109 |
+
public function add($prefix, $paths, $prepend = false)
|
110 |
+
{
|
111 |
+
if (!$prefix) {
|
112 |
+
if ($prepend) {
|
113 |
+
$this->fallbackDirsPsr0 = array_merge(
|
114 |
+
(array) $paths,
|
115 |
+
$this->fallbackDirsPsr0
|
116 |
+
);
|
117 |
+
} else {
|
118 |
+
$this->fallbackDirsPsr0 = array_merge(
|
119 |
+
$this->fallbackDirsPsr0,
|
120 |
+
(array) $paths
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$first = $prefix[0];
|
128 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
+
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
if ($prepend) {
|
134 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
+
(array) $paths,
|
136 |
+
$this->prefixesPsr0[$first][$prefix]
|
137 |
+
);
|
138 |
+
} else {
|
139 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
+
$this->prefixesPsr0[$first][$prefix],
|
141 |
+
(array) $paths
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
+
* appending or prepending to the ones previously set for this namespace.
|
149 |
+
*
|
150 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
+
* @param array|string $paths The PSR-4 base directories
|
152 |
+
* @param bool $prepend Whether to prepend the directories
|
153 |
+
*
|
154 |
+
* @throws \InvalidArgumentException
|
155 |
+
*/
|
156 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
+
{
|
158 |
+
if (!$prefix) {
|
159 |
+
// Register directories for the root namespace.
|
160 |
+
if ($prepend) {
|
161 |
+
$this->fallbackDirsPsr4 = array_merge(
|
162 |
+
(array) $paths,
|
163 |
+
$this->fallbackDirsPsr4
|
164 |
+
);
|
165 |
+
} else {
|
166 |
+
$this->fallbackDirsPsr4 = array_merge(
|
167 |
+
$this->fallbackDirsPsr4,
|
168 |
+
(array) $paths
|
169 |
+
);
|
170 |
+
}
|
171 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
+
// Register directories for a new namespace.
|
173 |
+
$length = strlen($prefix);
|
174 |
+
if ('\\' !== $prefix[$length - 1]) {
|
175 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
+
}
|
177 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
+
} elseif ($prepend) {
|
180 |
+
// Prepend directories for an already registered namespace.
|
181 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
+
(array) $paths,
|
183 |
+
$this->prefixDirsPsr4[$prefix]
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
// Append directories for an already registered namespace.
|
187 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
+
$this->prefixDirsPsr4[$prefix],
|
189 |
+
(array) $paths
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
+
* replacing any others previously set for this prefix.
|
197 |
+
*
|
198 |
+
* @param string $prefix The prefix
|
199 |
+
* @param array|string $paths The PSR-0 base directories
|
200 |
+
*/
|
201 |
+
public function set($prefix, $paths)
|
202 |
+
{
|
203 |
+
if (!$prefix) {
|
204 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
+
} else {
|
206 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
+
* replacing any others previously set for this namespace.
|
213 |
+
*
|
214 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
+
* @param array|string $paths The PSR-4 base directories
|
216 |
+
*
|
217 |
+
* @throws \InvalidArgumentException
|
218 |
+
*/
|
219 |
+
public function setPsr4($prefix, $paths)
|
220 |
+
{
|
221 |
+
if (!$prefix) {
|
222 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
+
} else {
|
224 |
+
$length = strlen($prefix);
|
225 |
+
if ('\\' !== $prefix[$length - 1]) {
|
226 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
+
}
|
228 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Turns on searching the include path for class files.
|
235 |
+
*
|
236 |
+
* @param bool $useIncludePath
|
237 |
+
*/
|
238 |
+
public function setUseIncludePath($useIncludePath)
|
239 |
+
{
|
240 |
+
$this->useIncludePath = $useIncludePath;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Can be used to check if the autoloader uses the include path to check
|
245 |
+
* for classes.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function getUseIncludePath()
|
250 |
+
{
|
251 |
+
return $this->useIncludePath;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Turns off searching the prefix and fallback directories for classes
|
256 |
+
* that have not been registered with the class map.
|
257 |
+
*
|
258 |
+
* @param bool $classMapAuthoritative
|
259 |
+
*/
|
260 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
+
{
|
262 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Should class lookup fail if not found in the current class map?
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
public function isClassMapAuthoritative()
|
271 |
+
{
|
272 |
+
return $this->classMapAuthoritative;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
+
*
|
278 |
+
* @param string|null $apcuPrefix
|
279 |
+
*/
|
280 |
+
public function setApcuPrefix($apcuPrefix)
|
281 |
+
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
+
*
|
288 |
+
* @return string|null
|
289 |
+
*/
|
290 |
+
public function getApcuPrefix()
|
291 |
+
{
|
292 |
+
return $this->apcuPrefix;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Registers this instance as an autoloader.
|
297 |
+
*
|
298 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
+
*/
|
300 |
+
public function register($prepend = false)
|
301 |
+
{
|
302 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Unregisters this instance as an autoloader.
|
307 |
+
*/
|
308 |
+
public function unregister()
|
309 |
+
{
|
310 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads the given class or interface.
|
315 |
+
*
|
316 |
+
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
+
*/
|
319 |
+
public function loadClass($class)
|
320 |
+
{
|
321 |
+
if ($file = $this->findFile($class)) {
|
322 |
+
includeFile($file);
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Finds the path to the file where the class is defined.
|
330 |
+
*
|
331 |
+
* @param string $class The name of the class
|
332 |
+
*
|
333 |
+
* @return string|false The path if found, false otherwise
|
334 |
+
*/
|
335 |
+
public function findFile($class)
|
336 |
+
{
|
337 |
+
// class map lookup
|
338 |
+
if (isset($this->classMap[$class])) {
|
339 |
+
return $this->classMap[$class];
|
340 |
+
}
|
341 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (null !== $this->apcuPrefix) {
|
345 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
+
if ($hit) {
|
347 |
+
return $file;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
$file = $this->findFileWithExtension($class, '.php');
|
352 |
+
|
353 |
+
// Search for Hack files if we are running on HHVM
|
354 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
+
}
|
357 |
+
|
358 |
+
if (null !== $this->apcuPrefix) {
|
359 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
+
}
|
361 |
+
|
362 |
+
if (false === $file) {
|
363 |
+
// Remember that this class does not exist.
|
364 |
+
$this->missingClasses[$class] = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
return $file;
|
368 |
+
}
|
369 |
+
|
370 |
+
private function findFileWithExtension($class, $ext)
|
371 |
+
{
|
372 |
+
// PSR-4 lookup
|
373 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
+
|
375 |
+
$first = $class[0];
|
376 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
+
$subPath = $class;
|
378 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
+
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath . '\\';
|
381 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
384 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
385 |
+
return $file;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// PSR-4 fallback dirs
|
393 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
+
return $file;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// PSR-0 lookup
|
400 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
+
// namespaced class name
|
402 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
+
} else {
|
405 |
+
// PEAR-like class name
|
406 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (isset($this->prefixesPsr0[$first])) {
|
410 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
+
if (0 === strpos($class, $prefix)) {
|
412 |
+
foreach ($dirs as $dir) {
|
413 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
+
return $file;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
// PSR-0 fallback dirs
|
422 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
+
return $file;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-0 include paths.
|
429 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
+
return $file;
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Scope isolated include.
|
439 |
+
*
|
440 |
+
* Prevents access to $this/self from included files.
|
441 |
+
*/
|
442 |
+
function includeFile($file)
|
443 |
+
{
|
444 |
+
include $file;
|
445 |
+
}
|
vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'PAnD' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
|
10 |
+
);
|
vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitc69f9e022a7575f97fc2ef8db9826a94
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
+
public static function getLoader()
|
20 |
+
{
|
21 |
+
if (null !== self::$loader) {
|
22 |
+
return self::$loader;
|
23 |
+
}
|
24 |
+
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitc69f9e022a7575f97fc2ef8db9826a94', 'loadClassLoader'), true, true);
|
26 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitc69f9e022a7575f97fc2ef8db9826a94', 'loadClassLoader'));
|
28 |
+
|
29 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
+
if ($useStaticLoader) {
|
31 |
+
require_once __DIR__ . '/autoload_static.php';
|
32 |
+
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitc69f9e022a7575f97fc2ef8db9826a94::getInitializer($loader));
|
34 |
+
} else {
|
35 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
+
foreach ($map as $namespace => $path) {
|
37 |
+
$loader->set($namespace, $path);
|
38 |
+
}
|
39 |
+
|
40 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
41 |
+
foreach ($map as $namespace => $path) {
|
42 |
+
$loader->setPsr4($namespace, $path);
|
43 |
+
}
|
44 |
+
|
45 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
46 |
+
if ($classMap) {
|
47 |
+
$loader->addClassMap($classMap);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$loader->register(true);
|
52 |
+
|
53 |
+
return $loader;
|
54 |
+
}
|
55 |
+
}
|
vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInitc69f9e022a7575f97fc2ef8db9826a94
|
8 |
+
{
|
9 |
+
public static $classMap = array (
|
10 |
+
'PAnD' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
|
11 |
+
);
|
12 |
+
|
13 |
+
public static function getInitializer(ClassLoader $loader)
|
14 |
+
{
|
15 |
+
return \Closure::bind(function () use ($loader) {
|
16 |
+
$loader->classMap = ComposerStaticInitc69f9e022a7575f97fc2ef8db9826a94::$classMap;
|
17 |
+
|
18 |
+
}, null, ClassLoader::class);
|
19 |
+
}
|
20 |
+
}
|
vendor/composer/installed.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "collizo4sky/persist-admin-notices-dismissal",
|
4 |
+
"version": "1.4.3",
|
5 |
+
"version_normalized": "1.4.3.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/w3guy/persist-admin-notices-dismissal.git",
|
9 |
+
"reference": "2d7d8bb3cba631ad227c92296a4b675d7cbc71d7"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/w3guy/persist-admin-notices-dismissal/zipball/2d7d8bb3cba631ad227c92296a4b675d7cbc71d7",
|
14 |
+
"reference": "2d7d8bb3cba631ad227c92296a4b675d7cbc71d7",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"time": "2019-03-12T05:19:51+00:00",
|
18 |
+
"type": "library",
|
19 |
+
"installation-source": "dist",
|
20 |
+
"autoload": {
|
21 |
+
"classmap": [
|
22 |
+
"persist-admin-notices-dismissal.php"
|
23 |
+
]
|
24 |
+
},
|
25 |
+
"notification-url": "https://packagist.org/downloads/",
|
26 |
+
"authors": [
|
27 |
+
{
|
28 |
+
"name": "Collins Agbonghama",
|
29 |
+
"email": "me@w3guy.com"
|
30 |
+
}
|
31 |
+
],
|
32 |
+
"description": "Simple library to persist dismissal of admin notices across pages in WordPress dashboard."
|
33 |
+
}
|
34 |
+
]
|