Version Description
- Enhancement code with composer, namespace and autoload
Download this release
Release Info
Developer | NicolasKulka |
Plugin | WPS Hide Login |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3.4.2 to 1.4
- autoload.php +205 -0
- classes/plugin.php +391 -412
- classes/singleton.php +63 -0
- composer.json +33 -0
- composer.lock +101 -0
- readme.txt +6 -2
- vendor/NicolasKulka/wp-review-me/.gitignore +99 -0
- vendor/NicolasKulka/wp-review-me/README.md +41 -0
- vendor/NicolasKulka/wp-review-me/composer.json +21 -0
- vendor/NicolasKulka/wp-review-me/composer.lock +60 -0
- {classes → vendor/NicolasKulka/wp-review-me}/review.php +96 -54
- vendor/autoload.php +7 -0
- vendor/composer/ClassLoader.php +445 -0
- vendor/composer/LICENSE +21 -0
- vendor/composer/autoload_classmap.php +9 -0
- vendor/composer/autoload_files.php +11 -0
- vendor/composer/autoload_namespaces.php +9 -0
- vendor/composer/autoload_psr4.php +9 -0
- vendor/composer/autoload_real.php +70 -0
- vendor/composer/autoload_static.php +20 -0
- vendor/composer/installed.json +87 -0
- {classes/lib → vendor/julien731}/wp-dismissible-notices-handler/assets/js/main.js +0 -0
- {classes/lib → vendor/julien731}/wp-dismissible-notices-handler/composer.json +0 -0
- {classes/lib → vendor/julien731}/wp-dismissible-notices-handler/handler.php +3 -3
- {classes/lib → vendor/julien731}/wp-dismissible-notices-handler/includes/helper-functions.php +0 -0
- wps-hide-login.php +24 -19
autoload.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace WPS\WPS_Hide_Login;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* An example of a general-purpose implementation that includes the optional
|
6 |
+
* functionality of allowing multiple base directories for a single namespace
|
7 |
+
* prefix.
|
8 |
+
*
|
9 |
+
* Given a foo-bar package of classes in the file system at the following
|
10 |
+
* paths ...
|
11 |
+
*
|
12 |
+
* /path/to/packages/foo-bar/
|
13 |
+
* src/
|
14 |
+
* Baz.php # Foo\Bar\Baz
|
15 |
+
* Qux/
|
16 |
+
* Quux.php # Foo\Bar\Qux\Quux
|
17 |
+
* tests/
|
18 |
+
* BazTest.php # Foo\Bar\BazTest
|
19 |
+
* Qux/
|
20 |
+
* QuuxTest.php # Foo\Bar\Qux\QuuxTest
|
21 |
+
*
|
22 |
+
* ... add the path to the class files for the \Foo\Bar\ namespace prefix
|
23 |
+
* as follows:
|
24 |
+
*
|
25 |
+
* <?php
|
26 |
+
* // instantiate the loader
|
27 |
+
* $loader = new \Example\Psr4AutoloaderClass;
|
28 |
+
*
|
29 |
+
* // register the autoloader
|
30 |
+
* $loader->register();
|
31 |
+
*
|
32 |
+
* // register the base directories for the namespace prefix
|
33 |
+
* $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src');
|
34 |
+
* $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests');
|
35 |
+
*
|
36 |
+
* The following line would cause the autoloader to attempt to load the
|
37 |
+
* \Foo\Bar\Qux\Quux class from /path/to/packages/foo-bar/src/Qux/Quux.php:
|
38 |
+
*
|
39 |
+
* <?php
|
40 |
+
* new \Foo\Bar\Qux\Quux;
|
41 |
+
*
|
42 |
+
* The following line would cause the autoloader to attempt to load the
|
43 |
+
* \Foo\Bar\Qux\QuuxTest class from /path/to/packages/foo-bar/tests/Qux/QuuxTest.php:
|
44 |
+
*
|
45 |
+
* <?php
|
46 |
+
* new \Foo\Bar\Qux\QuuxTest;
|
47 |
+
*/
|
48 |
+
class Autoloader {
|
49 |
+
/**
|
50 |
+
* An associative array where the key is a namespace prefix and the value
|
51 |
+
* is an array of base directories for classes in that namespace.
|
52 |
+
*
|
53 |
+
* @var array
|
54 |
+
*/
|
55 |
+
protected $prefixes = array();
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Register loader with SPL autoloader stack.
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function register() {
|
63 |
+
spl_autoload_register( array( $this, 'loadClass' ) );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Adds a base directory for a namespace prefix.
|
68 |
+
*
|
69 |
+
* @param string $prefix The namespace prefix.
|
70 |
+
* @param string $base_dir A base directory for class files in the
|
71 |
+
* namespace.
|
72 |
+
* @param bool $prepend If true, prepend the base directory to the stack
|
73 |
+
* instead of appending it; this causes it to be searched first rather
|
74 |
+
* than last.
|
75 |
+
*
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
public function addNamespace( $prefix, $base_dir, $prepend = false ) {
|
79 |
+
// normalize namespace prefix
|
80 |
+
$prefix = trim( $prefix, '\\' ) . '\\';
|
81 |
+
|
82 |
+
// normalize the base directory with a trailing separator
|
83 |
+
$base_dir = rtrim( $base_dir, DIRECTORY_SEPARATOR ) . '/';
|
84 |
+
|
85 |
+
// initialize the namespace prefix array
|
86 |
+
if ( isset( $this->prefixes[ $prefix ] ) === false ) {
|
87 |
+
$this->prefixes[ $prefix ] = array();
|
88 |
+
}
|
89 |
+
|
90 |
+
// retain the base directory for the namespace prefix
|
91 |
+
if ( $prepend ) {
|
92 |
+
array_unshift( $this->prefixes[ $prefix ], $base_dir );
|
93 |
+
} else {
|
94 |
+
array_push( $this->prefixes[ $prefix ], $base_dir );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Loads the class file for a given class name.
|
100 |
+
*
|
101 |
+
* @param string $class The fully-qualified class name.
|
102 |
+
*
|
103 |
+
* @return mixed The mapped file name on success, or boolean false on
|
104 |
+
* failure.
|
105 |
+
*/
|
106 |
+
public function loadClass( $class ) {
|
107 |
+
// the current namespace prefix
|
108 |
+
$prefix = $class;
|
109 |
+
|
110 |
+
// work backwards through the namespace names of the fully-qualified
|
111 |
+
// class name to find a mapped file name
|
112 |
+
while( false !== $pos = strrpos( $prefix, '\\' ) ) {
|
113 |
+
|
114 |
+
// retain the trailing namespace separator in the prefix
|
115 |
+
$prefix = substr( $class, 0, $pos + 1 );
|
116 |
+
|
117 |
+
// the rest is the relative class name
|
118 |
+
$relative_class = substr( $class, $pos + 1 );
|
119 |
+
|
120 |
+
// try to load a mapped file for the prefix and relative class
|
121 |
+
$mapped_file = $this->loadMappedFile( $prefix, $relative_class );
|
122 |
+
if ( $mapped_file ) {
|
123 |
+
return $mapped_file;
|
124 |
+
}
|
125 |
+
|
126 |
+
// remove the trailing namespace separator for the next iteration
|
127 |
+
// of strrpos()
|
128 |
+
$prefix = rtrim( $prefix, '\\' );
|
129 |
+
}
|
130 |
+
|
131 |
+
// never found a mapped file
|
132 |
+
return false;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Load the mapped file for a namespace prefix and relative class.
|
137 |
+
*
|
138 |
+
* @param string $prefix The namespace prefix.
|
139 |
+
* @param string $relative_class The relative class name.
|
140 |
+
*
|
141 |
+
* @return mixed Boolean false if no mapped file can be loaded, or the
|
142 |
+
* name of the mapped file that was loaded.
|
143 |
+
*/
|
144 |
+
protected function loadMappedFile( $prefix, $relative_class ) {
|
145 |
+
// are there any base directories for this namespace prefix?
|
146 |
+
if ( isset( $this->prefixes[ $prefix ] ) === false ) {
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
// look through base directories for this namespace prefix
|
151 |
+
foreach ( $this->prefixes[ $prefix ] as $base_dir ) {
|
152 |
+
|
153 |
+
// replace the namespace prefix with the base directory,
|
154 |
+
// replace namespace separators with directory separators
|
155 |
+
// in the relative class name, append with .php
|
156 |
+
$file = $base_dir . strtolower( str_replace( array( '\\', '_' ), array(
|
157 |
+
'/',
|
158 |
+
'-'
|
159 |
+
), $relative_class ) ) . '.php';
|
160 |
+
|
161 |
+
// if the mapped file exists, require it
|
162 |
+
if ( $this->requireFile( $file ) ) {
|
163 |
+
// yes, we're done
|
164 |
+
return $file;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
// never found it
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* If a file exists, require it from the file system.
|
174 |
+
*
|
175 |
+
* @param string $file The file to require.
|
176 |
+
*
|
177 |
+
* @return bool True if the file exists, false if not.
|
178 |
+
*/
|
179 |
+
protected function requireFile( $file ) {
|
180 |
+
if ( file_exists( $file ) ) {
|
181 |
+
require $file;
|
182 |
+
|
183 |
+
return true;
|
184 |
+
}
|
185 |
+
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
// instantiate the loader
|
191 |
+
$loader = new \WPS\WPS_Hide_Login\Autoloader;
|
192 |
+
|
193 |
+
// register the autoloader
|
194 |
+
$loader->register();
|
195 |
+
|
196 |
+
// register the base directories for the namespace prefix
|
197 |
+
$loader->addNamespace( 'WPS\WPS_Hide_Login', WPS_HIDE_LOGIN_DIR . 'classes' );
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Vendor autoload
|
201 |
+
* @since 2.1.0
|
202 |
+
*/
|
203 |
+
if ( file_exists( WPS_HIDE_LOGIN_DIR . 'vendor/autoload.php' ) ) {
|
204 |
+
require WPS_HIDE_LOGIN_DIR . 'vendor/autoload.php';
|
205 |
+
}
|
classes/plugin.php
CHANGED
@@ -1,630 +1,609 @@
|
|
1 |
<?php
|
2 |
-
if ( ! class_exists( 'WPS_Hide_Login' ) ) {
|
3 |
|
4 |
-
|
5 |
|
6 |
-
private $wp_login_php;
|
7 |
|
8 |
-
|
9 |
-
* Instance of this class.
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*
|
13 |
-
* @var object
|
14 |
-
*/
|
15 |
-
protected static $instance = null;
|
16 |
|
17 |
-
|
18 |
-
global $wp_version;
|
19 |
|
20 |
-
|
21 |
-
add_action( 'admin_notices', array( $this, 'admin_notices_incompatible' ) );
|
22 |
-
add_action( 'network_admin_notices', array( $this, 'admin_notices_incompatible' ) );
|
23 |
-
|
24 |
-
return;
|
25 |
-
}
|
26 |
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
|
|
|
32 |
|
33 |
-
if ( is_plugin_active_for_network( 'rename-wp-login/rename-wp-login.php' ) ) {
|
34 |
-
deactivate_plugins( WPS_HIDE_LOGIN_BASENAME );
|
35 |
-
add_action( 'network_admin_notices', array( $this, 'admin_notices_plugin_conflict' ) );
|
36 |
-
if ( isset( $_GET['activate'] ) ) {
|
37 |
-
unset( $_GET['activate'] );
|
38 |
-
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
deactivate_plugins( WPS_HIDE_LOGIN_BASENAME );
|
45 |
-
add_action( 'admin_notices', array( $this, 'admin_notices_plugin_conflict' ) );
|
46 |
-
if ( isset( $_GET['activate'] ) ) {
|
47 |
-
unset( $_GET['activate'] );
|
48 |
-
}
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
add_action( 'update_wpmu_options', array( $this, 'update_wpmu_options' ) );
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
66 |
-
add_action( 'network_admin_notices', array( $this, 'admin_notices' ) );
|
67 |
-
add_action( 'wp_loaded', array( $this, 'wp_loaded' ) );
|
68 |
-
add_action( 'setup_theme', array( $this, 'setup_theme' ), 1 );
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
add_filter( 'wp_redirect', array( $this, 'wp_redirect' ), 10, 2 );
|
74 |
-
add_filter( 'site_option_welcome_email', array( $this, 'welcome_email' ) );
|
75 |
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
|
86 |
-
|
|
|
87 |
|
88 |
-
|
|
|
89 |
|
90 |
-
|
|
|
|
|
91 |
|
92 |
-
|
93 |
|
94 |
-
|
95 |
|
96 |
-
|
97 |
|
98 |
-
|
99 |
|
100 |
-
|
101 |
|
102 |
-
|
103 |
|
104 |
-
|
105 |
|
106 |
-
|
107 |
|
108 |
-
|
109 |
|
110 |
-
|
111 |
|
112 |
-
|
113 |
|
114 |
-
|
115 |
|
116 |
-
|
117 |
|
118 |
-
|
119 |
|
120 |
-
|
121 |
|
122 |
}
|
123 |
|
124 |
-
|
125 |
-
if ( $slug = get_option( 'whl_page' ) ) {
|
126 |
-
return $slug;
|
127 |
-
} else if ( ( is_multisite() && is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) && ( $slug = get_site_option( 'whl_page', 'login' ) ) ) ) {
|
128 |
-
return $slug;
|
129 |
-
} else if ( $slug = 'login' ) {
|
130 |
-
return $slug;
|
131 |
-
}
|
132 |
-
}
|
133 |
|
134 |
-
|
135 |
|
136 |
-
|
137 |
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
-
|
141 |
|
142 |
-
|
143 |
|
144 |
-
|
145 |
|
146 |
-
}
|
147 |
|
148 |
-
|
149 |
-
* Return an instance of this class.
|
150 |
-
*
|
151 |
-
* @since 1.0.0
|
152 |
-
*
|
153 |
-
* @return object A single instance of this class.
|
154 |
-
*/
|
155 |
-
public static function get_instance() {
|
156 |
-
|
157 |
-
// If the single instance hasn't been set, set it now.
|
158 |
-
if ( null == self::$instance ) {
|
159 |
-
self::$instance = new self;
|
160 |
-
}
|
161 |
|
162 |
-
return self::$instance;
|
163 |
}
|
164 |
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
|
175 |
-
|
176 |
|
177 |
-
|
178 |
-
//add_option( 'whl_redirect', '1' );
|
179 |
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
182 |
|
183 |
-
|
|
|
184 |
|
185 |
-
|
186 |
|
187 |
-
|
188 |
-
$out .= '<p>' . __( 'This option allows you to set a networkwide default, which can be overridden by individual sites. Simply go to to the site’s permalink settings to change the url.', 'wpserveur-hide-login' ) . '</p>';
|
189 |
-
$out .= '<p>' . sprintf( __( 'Need help? Try the <a href="%1$s" target="_blank">support forum</a>. This plugin is kindly brought to you by <a href="%2$s" target="_blank">WPServeur</a>', 'wpserveur-hide-login' ), 'http://wordpress.org/support/plugin/wps-hide-login/', 'https://www.wpserveur.net/?refwps=14&campaign=wpshidelogin' ) . '</p>';
|
190 |
-
$out .= '<table class="form-table">';
|
191 |
-
$out .= '<tr valign="top">';
|
192 |
-
$out .= '<th scope="row"><label for="whl_page">' . __( 'Networkwide default', 'wpserveur-hide-login' ) . '</label></th>';
|
193 |
-
$out .= '<td><input id="whl_page" type="text" name="whl_page" value="' . esc_attr( get_site_option( 'whl_page', 'login' ) ) . '"></td>';
|
194 |
-
$out .= '</tr>';
|
195 |
-
$out .= '</table>';
|
196 |
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
-
|
200 |
|
201 |
-
|
202 |
-
if ( check_admin_referer( 'siteoptions' ) ) {
|
203 |
-
if ( ( $whl_page = sanitize_title_with_dashes( $_POST['whl_page'] ) )
|
204 |
-
&& strpos( $whl_page, 'wp-login' ) === false
|
205 |
-
&& ! in_array( $whl_page, $this->forbidden_slugs() ) ) {
|
206 |
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
-
}
|
210 |
}
|
211 |
}
|
|
|
212 |
|
213 |
-
|
214 |
|
215 |
-
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
|
232 |
-
|
233 |
|
234 |
-
|
235 |
|
236 |
-
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
|
242 |
-
|
243 |
|
244 |
-
|
245 |
|
246 |
-
|
247 |
|
248 |
-
|
249 |
|
250 |
-
|
|
|
251 |
|
252 |
-
|
253 |
|
254 |
-
|
255 |
|
256 |
-
|
257 |
|
258 |
-
|
259 |
-
|
260 |
-
$out = '';
|
261 |
-
|
262 |
-
if ( ! is_multisite()
|
263 |
-
|| is_super_admin() ) {
|
264 |
-
|
265 |
-
$details_url_wpsbidouille = add_query_arg(
|
266 |
-
array(
|
267 |
-
'tab' => 'plugin-information',
|
268 |
-
'plugin' => 'wps-bidouille',
|
269 |
-
'TB_iframe' => true,
|
270 |
-
'width' => 722,
|
271 |
-
'height' => 949,
|
272 |
-
),
|
273 |
-
admin_url( 'plugin-install.php' )
|
274 |
-
);
|
275 |
-
|
276 |
-
$details_url_wpscleaner = add_query_arg(
|
277 |
-
array(
|
278 |
-
'tab' => 'plugin-information',
|
279 |
-
'plugin' => 'wps-cleaner',
|
280 |
-
'TB_iframe' => true,
|
281 |
-
'width' => 722,
|
282 |
-
'height' => 949,
|
283 |
-
),
|
284 |
-
admin_url( 'plugin-install.php' )
|
285 |
-
);
|
286 |
-
|
287 |
-
$details_url_wpslimitlogin = add_query_arg(
|
288 |
-
array(
|
289 |
-
'tab' => 'plugin-information',
|
290 |
-
'plugin' => 'wps-limit-login',
|
291 |
-
'TB_iframe' => true,
|
292 |
-
'width' => 722,
|
293 |
-
'height' => 949,
|
294 |
-
),
|
295 |
-
admin_url( 'plugin-install.php' )
|
296 |
-
);
|
297 |
-
|
298 |
-
$out .= '<div id="whl_settings">';
|
299 |
-
$out .= sprintf( __( 'Need help? Try the <a href="%1$s" target="_blank">support forum</a>. This plugin is kindly brought to you by <a href="%2$s" target="_blank">WPServeur</a>', 'wpserveur-hide-login' ), 'http://wordpress.org/support/plugin/wps-hide-login/', 'https://www.wpserveur.net/?refwps=14&campaign=wpshidelogin' ) . ' (' . __( 'WordPress specialized hosting', 'wpserveur-hide-login' ) . ')';
|
300 |
-
$out .= '<br>' . __( 'Discover our other plugins:', 'wpserveur-hide-login' ) . ' ';
|
301 |
-
$out .= __( 'the plugin', 'wpserveur-hide-login' ) . ' <a href="' . $details_url_wpsbidouille . '" class="thickbox open-plugin-details-modal">' . __( 'WPS Bidouille', 'wpserveur-hide-login' ) . '</a>';
|
302 |
-
$out .= ', ' . __( 'the plugin', 'wpserveur-hide-login' ) . ' <a href="' . $details_url_wpscleaner . '" class="thickbox open-plugin-details-modal">' . __( 'WPS Cleaner', 'wpserveur-hide-login' ) . '</a>';
|
303 |
-
$out .= ' ' . __( 'and', 'wpserveur-hide-login' ) . ' <a href="' . $details_url_wpslimitlogin . '" class="thickbox open-plugin-details-modal">' . __( 'WPS Limit Login', 'wpserveur-hide-login' ) . '</a>';
|
304 |
-
$out .= '</div>';
|
305 |
|
306 |
-
|
|
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
}
|
319 |
|
320 |
-
|
|
|
|
|
321 |
|
322 |
-
|
323 |
|
324 |
-
|
325 |
|
326 |
-
|
327 |
|
328 |
-
|
329 |
|
330 |
-
|
331 |
|
332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
|
334 |
}
|
335 |
|
336 |
-
|
337 |
|
338 |
-
|
339 |
|
340 |
-
|
341 |
|
342 |
-
|
343 |
-
&& $pagenow === 'options-general.php'
|
344 |
-
&& isset( $_GET['settings-updated'] )
|
345 |
-
&& ! isset( $_GET['page'] ) ) {
|
346 |
|
347 |
-
|
348 |
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
350 |
|
351 |
}
|
352 |
|
353 |
-
|
354 |
|
355 |
-
|
356 |
-
&& is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) ) {
|
357 |
|
358 |
-
|
|
|
359 |
|
360 |
-
|
361 |
|
362 |
-
|
363 |
|
364 |
-
|
365 |
-
|
366 |
-
return $links;
|
367 |
|
368 |
}
|
369 |
|
370 |
-
|
|
|
|
|
371 |
|
372 |
-
|
373 |
|
374 |
-
|
375 |
-
&& ( strpos( $_SERVER['REQUEST_URI'], 'wp-signup' ) !== false
|
376 |
-
|| strpos( $_SERVER['REQUEST_URI'], 'wp-activate' ) !== false ) && apply_filters( 'wps_hide_login_signup_enable', false ) === false ) {
|
377 |
|
378 |
-
|
|
|
|
|
379 |
|
380 |
-
|
381 |
|
382 |
-
|
383 |
|
384 |
-
|
385 |
-
|| untrailingslashit( $request['path'] ) === site_url( 'wp-login', 'relative' ) )
|
386 |
-
&& ! is_admin() ) {
|
387 |
|
388 |
-
|
|
|
|
|
389 |
|
390 |
-
|
391 |
|
392 |
-
|
393 |
|
394 |
-
|
395 |
-
|| ( ! get_option( 'permalink_structure' )
|
396 |
-
&& isset( $_GET[ $this->new_login_slug() ] )
|
397 |
-
&& empty( $_GET[ $this->new_login_slug() ] ) ) ) {
|
398 |
|
399 |
-
|
|
|
|
|
|
|
400 |
|
401 |
-
|
402 |
-
|| untrailingslashit( $request['path'] ) === site_url( 'wp-register', 'relative' ) )
|
403 |
-
&& ! is_admin() ) {
|
404 |
|
405 |
-
|
|
|
|
|
406 |
|
407 |
-
|
408 |
|
409 |
-
|
410 |
-
}
|
411 |
|
|
|
412 |
}
|
413 |
|
414 |
-
|
415 |
-
global $pagenow;
|
416 |
|
417 |
-
|
418 |
-
|
419 |
-
}
|
420 |
-
}
|
421 |
|
422 |
-
|
|
|
|
|
|
|
423 |
|
424 |
-
|
425 |
|
426 |
-
|
427 |
|
428 |
-
|
429 |
-
wp_safe_redirect( home_url( '/404' ) );
|
430 |
-
die();
|
431 |
-
}
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
|
|
436 |
|
437 |
-
|
438 |
-
|
|
|
439 |
|
440 |
-
|
|
|
441 |
|
442 |
-
|
443 |
|
444 |
-
|
445 |
-
&& strpos( $referer, 'wp-activate.php' ) !== false
|
446 |
-
&& ( $referer = parse_url( $referer ) )
|
447 |
-
&& ! empty( $referer['query'] ) ) {
|
448 |
|
449 |
-
|
|
|
|
|
|
|
450 |
|
451 |
-
|
452 |
-
&& ( $result = wpmu_activate_signup( $referer['key'] ) )
|
453 |
-
&& is_wp_error( $result )
|
454 |
-
&& ( $result->get_error_code() === 'already_active'
|
455 |
-
|| $result->get_error_code() === 'blog_taken' ) ) {
|
456 |
|
457 |
-
|
458 |
-
|
|
|
|
|
|
|
459 |
|
460 |
-
|
|
|
461 |
|
462 |
-
|
463 |
|
464 |
}
|
465 |
|
466 |
-
|
467 |
|
468 |
-
|
469 |
-
global $error, $interim_login, $action, $user_login;
|
470 |
|
471 |
-
|
472 |
-
|
473 |
-
die();
|
474 |
-
}
|
475 |
|
476 |
-
|
|
|
|
|
|
|
477 |
|
478 |
-
|
479 |
|
480 |
-
|
481 |
|
482 |
}
|
483 |
|
484 |
-
|
485 |
|
486 |
-
|
487 |
|
488 |
-
|
489 |
|
490 |
-
|
491 |
|
492 |
-
|
493 |
|
494 |
-
|
495 |
|
496 |
-
|
497 |
|
498 |
-
|
499 |
|
500 |
-
|
501 |
|
502 |
-
|
503 |
|
504 |
-
|
505 |
|
506 |
-
|
507 |
|
508 |
-
|
509 |
|
510 |
-
|
511 |
|
512 |
-
|
513 |
|
514 |
-
|
515 |
|
516 |
-
|
517 |
|
518 |
-
|
519 |
-
$args['login'] = rawurlencode( $args['login'] );
|
520 |
-
}
|
521 |
|
522 |
-
|
|
|
|
|
523 |
|
524 |
-
|
525 |
|
526 |
-
|
527 |
|
528 |
-
|
529 |
|
530 |
}
|
531 |
|
532 |
-
return $url;
|
533 |
-
|
534 |
}
|
535 |
|
536 |
-
|
537 |
|
538 |
-
|
539 |
|
540 |
-
|
541 |
|
542 |
-
|
543 |
|
544 |
-
|
545 |
|
546 |
-
|
547 |
|
548 |
-
|
549 |
|
550 |
-
|
551 |
-
* Load scripts
|
552 |
-
*/
|
553 |
-
public function admin_enqueue_scripts( $hook ) {
|
554 |
-
if ( 'options-general.php' != $hook ) {
|
555 |
-
return false;
|
556 |
-
}
|
557 |
|
558 |
-
|
559 |
|
560 |
-
|
561 |
-
|
562 |
-
|
|
|
|
|
|
|
563 |
}
|
564 |
|
565 |
-
|
566 |
-
$title = __( 'WPS Hide Login' );
|
567 |
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
}
|
573 |
-
|
574 |
-
public function settings_page() {
|
575 |
-
_e( 'WPS Hide Login' );
|
576 |
-
}
|
577 |
|
578 |
-
|
579 |
-
|
580 |
-
wp_redirect( admin_url( 'options-general.php#whl_settings' ) );
|
581 |
-
exit();
|
582 |
-
}
|
583 |
-
}
|
584 |
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
|
|
589 |
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
}
|
|
|
599 |
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
* @param $login_url
|
605 |
-
* @param $redirect
|
606 |
-
* @param $force_reauth
|
607 |
-
*
|
608 |
-
* @return string
|
609 |
-
*/
|
610 |
-
public function login_url( $login_url, $redirect, $force_reauth ) {
|
611 |
-
|
612 |
-
if ( $force_reauth === false ) {
|
613 |
-
return $login_url;
|
614 |
-
}
|
615 |
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
|
620 |
-
|
|
|
|
|
|
|
|
|
621 |
|
622 |
-
|
623 |
-
|
624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
|
|
|
626 |
return $login_url;
|
627 |
}
|
628 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
}
|
|
|
630 |
}
|
1 |
<?php
|
|
|
2 |
|
3 |
+
namespace WPS\WPS_Hide_Login;
|
4 |
|
|
|
5 |
|
6 |
+
class Plugin {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
use Singleton;
|
|
|
9 |
|
10 |
+
private $wp_login_php;
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
protected function init() {
|
13 |
+
global $wp_version;
|
14 |
|
15 |
+
if ( version_compare( $wp_version, '4.0-RC1-src', '<' ) ) {
|
16 |
+
add_action( 'admin_notices', array( $this, 'admin_notices_incompatible' ) );
|
17 |
+
add_action( 'network_admin_notices', array( $this, 'admin_notices_incompatible' ) );
|
18 |
|
19 |
+
return;
|
20 |
+
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
if ( is_multisite() && ! function_exists( 'is_plugin_active_for_network' ) || ! function_exists( 'is_plugin_active' ) ) {
|
24 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
25 |
|
26 |
+
}
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
if ( is_plugin_active_for_network( 'rename-wp-login/rename-wp-login.php' ) ) {
|
29 |
+
deactivate_plugins( WPS_HIDE_LOGIN_BASENAME );
|
30 |
+
add_action( 'network_admin_notices', array( $this, 'admin_notices_plugin_conflict' ) );
|
31 |
+
if ( isset( $_GET['activate'] ) ) {
|
32 |
+
unset( $_GET['activate'] );
|
33 |
}
|
34 |
|
35 |
+
return;
|
36 |
+
}
|
|
|
37 |
|
38 |
+
if ( is_plugin_active( 'rename-wp-login/rename-wp-login.php' ) ) {
|
39 |
+
deactivate_plugins( WPS_HIDE_LOGIN_BASENAME );
|
40 |
+
add_action( 'admin_notices', array( $this, 'admin_notices_plugin_conflict' ) );
|
41 |
+
if ( isset( $_GET['activate'] ) ) {
|
42 |
+
unset( $_GET['activate'] );
|
43 |
}
|
44 |
|
45 |
+
return;
|
46 |
+
}
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
if ( is_multisite() && is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) ) {
|
49 |
+
add_action( 'wpmu_options', array( $this, 'wpmu_options' ) );
|
50 |
+
add_action( 'update_wpmu_options', array( $this, 'update_wpmu_options' ) );
|
|
|
|
|
51 |
|
52 |
+
add_filter( 'network_admin_plugin_action_links_' . WPS_HIDE_LOGIN_BASENAME, array(
|
53 |
+
$this,
|
54 |
+
'plugin_action_links'
|
55 |
+
) );
|
56 |
+
}
|
57 |
|
58 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
59 |
+
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 9999 );
|
60 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
61 |
+
add_action( 'network_admin_notices', array( $this, 'admin_notices' ) );
|
62 |
+
add_action( 'wp_loaded', array( $this, 'wp_loaded' ) );
|
63 |
+
add_action( 'setup_theme', array( $this, 'setup_theme' ), 1 );
|
64 |
|
65 |
+
add_filter( 'plugin_action_links_' . WPS_HIDE_LOGIN_BASENAME, array( $this, 'plugin_action_links' ) );
|
66 |
+
add_filter( 'site_url', array( $this, 'site_url' ), 10, 4 );
|
67 |
+
add_filter( 'network_site_url', array( $this, 'network_site_url' ), 10, 3 );
|
68 |
+
add_filter( 'wp_redirect', array( $this, 'wp_redirect' ), 10, 2 );
|
69 |
+
add_filter( 'site_option_welcome_email', array( $this, 'welcome_email' ) );
|
70 |
|
71 |
+
remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
|
72 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
73 |
|
74 |
+
add_action( 'admin_menu', array( $this, 'wps_hide_login_menu_page' ) );
|
75 |
+
add_action( 'admin_init', array( $this, 'whl_template_redirect' ) );
|
76 |
|
77 |
+
add_action( 'template_redirect', array( $this, 'wps_hide_login_redirect_page_email_notif_woocommerce' ) );
|
78 |
+
add_filter( 'login_url', array( $this, 'login_url' ), 10, 3 );
|
79 |
+
}
|
80 |
|
81 |
+
private function use_trailing_slashes() {
|
82 |
|
83 |
+
return ( '/' === substr( get_option( 'permalink_structure' ), - 1, 1 ) );
|
84 |
|
85 |
+
}
|
86 |
|
87 |
+
private function user_trailingslashit( $string ) {
|
88 |
|
89 |
+
return $this->use_trailing_slashes() ? trailingslashit( $string ) : untrailingslashit( $string );
|
90 |
|
91 |
+
}
|
92 |
|
93 |
+
private function wp_template_loader() {
|
94 |
|
95 |
+
global $pagenow;
|
96 |
|
97 |
+
$pagenow = 'index.php';
|
98 |
|
99 |
+
if ( ! defined( 'WP_USE_THEMES' ) ) {
|
100 |
|
101 |
+
define( 'WP_USE_THEMES', true );
|
102 |
|
103 |
+
}
|
104 |
|
105 |
+
wp();
|
106 |
|
107 |
+
if ( $_SERVER['REQUEST_URI'] === $this->user_trailingslashit( str_repeat( '-/', 10 ) ) ) {
|
108 |
|
109 |
+
$_SERVER['REQUEST_URI'] = $this->user_trailingslashit( '/wp-login-php/' );
|
110 |
|
111 |
}
|
112 |
|
113 |
+
require_once( ABSPATH . WPINC . '/template-loader.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
die;
|
116 |
|
117 |
+
}
|
118 |
|
119 |
+
private function new_login_slug() {
|
120 |
+
if ( $slug = get_option( 'whl_page' ) ) {
|
121 |
+
return $slug;
|
122 |
+
} else if ( ( is_multisite() && is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) && ( $slug = get_site_option( 'whl_page', 'login' ) ) ) ) {
|
123 |
+
return $slug;
|
124 |
+
} else if ( $slug = 'login' ) {
|
125 |
+
return $slug;
|
126 |
+
}
|
127 |
+
}
|
128 |
|
129 |
+
public function new_login_url( $scheme = null ) {
|
130 |
|
131 |
+
if ( get_option( 'permalink_structure' ) ) {
|
132 |
|
133 |
+
return $this->user_trailingslashit( home_url( '/', $scheme ) . $this->new_login_slug() );
|
134 |
|
135 |
+
} else {
|
136 |
|
137 |
+
return home_url( '/', $scheme ) . '?' . $this->new_login_slug();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
|
|
139 |
}
|
140 |
|
141 |
+
}
|
142 |
|
143 |
+
public function admin_notices_incompatible() {
|
144 |
|
145 |
+
echo '<div class="error notice is-dismissible"><p>' . __( 'Please upgrade to the latest version of WordPress to activate', 'wpserveur-hide-login' ) . ' <strong>' . __( 'WPS Hide Login', 'wpserveur-hide-login' ) . '</strong>.</p></div>';
|
146 |
|
147 |
+
}
|
148 |
|
149 |
+
public function admin_notices_plugin_conflict() {
|
150 |
|
151 |
+
echo '<div class="error notice is-dismissible"><p>' . __( 'WPS Hide Login could not be activated because you already have Rename wp-login.php active. Please uninstall rename wp-login.php to use WPS Hide Login', 'wpserveur-hide-login' ) . '</p></div>';
|
152 |
|
153 |
+
}
|
|
|
154 |
|
155 |
+
/**
|
156 |
+
* Plugin activation
|
157 |
+
*/
|
158 |
+
public static function activate() {
|
159 |
+
//add_option( 'whl_redirect', '1' );
|
160 |
|
161 |
+
do_action( 'wps_hide_login_activate' );
|
162 |
+
}
|
163 |
|
164 |
+
public function wpmu_options() {
|
165 |
|
166 |
+
$out = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
+
$out .= '<h3>' . __( 'WPS Hide Login', 'wpserveur-hide-login' ) . '</h3>';
|
169 |
+
$out .= '<p>' . __( 'This option allows you to set a networkwide default, which can be overridden by individual sites. Simply go to to the site’s permalink settings to change the url.', 'wpserveur-hide-login' ) . '</p>';
|
170 |
+
$out .= '<p>' . sprintf( __( 'Need help? Try the <a href="%1$s" target="_blank">support forum</a>. This plugin is kindly brought to you by <a href="%2$s" target="_blank">WPServeur</a>', 'wpserveur-hide-login' ), 'http://wordpress.org/support/plugin/wps-hide-login/', 'https://www.wpserveur.net/?refwps=14&campaign=wpshidelogin' ) . '</p>';
|
171 |
+
$out .= '<table class="form-table">';
|
172 |
+
$out .= '<tr valign="top">';
|
173 |
+
$out .= '<th scope="row"><label for="whl_page">' . __( 'Networkwide default', 'wpserveur-hide-login' ) . '</label></th>';
|
174 |
+
$out .= '<td><input id="whl_page" type="text" name="whl_page" value="' . esc_attr( get_site_option( 'whl_page', 'login' ) ) . '"></td>';
|
175 |
+
$out .= '</tr>';
|
176 |
+
$out .= '</table>';
|
177 |
|
178 |
+
echo $out;
|
179 |
|
180 |
+
}
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
public function update_wpmu_options() {
|
183 |
+
if ( check_admin_referer( 'siteoptions' ) ) {
|
184 |
+
if ( ( $whl_page = sanitize_title_with_dashes( $_POST['whl_page'] ) )
|
185 |
+
&& strpos( $whl_page, 'wp-login' ) === false
|
186 |
+
&& ! in_array( $whl_page, $this->forbidden_slugs() ) ) {
|
187 |
+
|
188 |
+
update_site_option( 'whl_page', $whl_page );
|
189 |
|
|
|
190 |
}
|
191 |
}
|
192 |
+
}
|
193 |
|
194 |
+
public function admin_init() {
|
195 |
|
196 |
+
global $pagenow;
|
197 |
|
198 |
+
add_settings_section(
|
199 |
+
'wps-hide-login-section',
|
200 |
+
'WPS Hide Login',
|
201 |
+
array( $this, 'whl_section_desc' ),
|
202 |
+
'general'
|
203 |
+
);
|
204 |
|
205 |
+
add_settings_field(
|
206 |
+
'whl_page',
|
207 |
+
'<label for="whl_page">' . __( 'Login url', 'wpserveur-hide-login' ) . '</label>',
|
208 |
+
array( $this, 'whl_page_input' ),
|
209 |
+
'general',
|
210 |
+
'wps-hide-login-section'
|
211 |
+
);
|
212 |
|
213 |
+
register_setting( 'general', 'whl_page', 'sanitize_title_with_dashes' );
|
214 |
|
215 |
+
if ( get_option( 'whl_redirect' ) ) {
|
216 |
|
217 |
+
delete_option( 'whl_redirect' );
|
218 |
|
219 |
+
if ( is_multisite()
|
220 |
+
&& is_super_admin()
|
221 |
+
&& is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) ) {
|
222 |
|
223 |
+
$redirect = network_admin_url( 'settings.php#whl_settings' );
|
224 |
|
225 |
+
} else {
|
226 |
|
227 |
+
$redirect = admin_url( 'options-general.php#whl_settings' );
|
228 |
|
229 |
+
}
|
230 |
|
231 |
+
wp_safe_redirect( $redirect );
|
232 |
+
die();
|
233 |
|
234 |
+
}
|
235 |
|
236 |
+
}
|
237 |
|
238 |
+
public function whl_section_desc() {
|
239 |
|
240 |
+
$out = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
+
if ( ! is_multisite()
|
243 |
+
|| is_super_admin() ) {
|
244 |
|
245 |
+
$details_url_wpsbidouille = add_query_arg(
|
246 |
+
array(
|
247 |
+
'tab' => 'plugin-information',
|
248 |
+
'plugin' => 'wps-bidouille',
|
249 |
+
'TB_iframe' => true,
|
250 |
+
'width' => 722,
|
251 |
+
'height' => 949,
|
252 |
+
),
|
253 |
+
admin_url( 'plugin-install.php' )
|
254 |
+
);
|
255 |
|
256 |
+
$details_url_wpscleaner = add_query_arg(
|
257 |
+
array(
|
258 |
+
'tab' => 'plugin-information',
|
259 |
+
'plugin' => 'wps-cleaner',
|
260 |
+
'TB_iframe' => true,
|
261 |
+
'width' => 722,
|
262 |
+
'height' => 949,
|
263 |
+
),
|
264 |
+
admin_url( 'plugin-install.php' )
|
265 |
+
);
|
266 |
|
267 |
+
$details_url_wpslimitlogin = add_query_arg(
|
268 |
+
array(
|
269 |
+
'tab' => 'plugin-information',
|
270 |
+
'plugin' => 'wps-limit-login',
|
271 |
+
'TB_iframe' => true,
|
272 |
+
'width' => 722,
|
273 |
+
'height' => 949,
|
274 |
+
),
|
275 |
+
admin_url( 'plugin-install.php' )
|
276 |
+
);
|
277 |
|
278 |
+
$out .= '<div id="whl_settings">';
|
279 |
+
$out .= sprintf( __( 'Need help? Try the <a href="%1$s" target="_blank">support forum</a>. This plugin is kindly brought to you by <a href="%2$s" target="_blank">WPServeur</a>', 'wpserveur-hide-login' ), 'http://wordpress.org/support/plugin/wps-hide-login/', 'https://www.wpserveur.net/?refwps=14&campaign=wpshidelogin' ) . ' (' . __( 'WordPress specialized hosting', 'wpserveur-hide-login' ) . ')';
|
280 |
+
$out .= '<br>' . __( 'Discover our other plugins:', 'wpserveur-hide-login' ) . ' ';
|
281 |
+
$out .= __( 'the plugin', 'wpserveur-hide-login' ) . ' <a href="' . $details_url_wpsbidouille . '" class="thickbox open-plugin-details-modal">' . __( 'WPS Bidouille', 'wpserveur-hide-login' ) . '</a>';
|
282 |
+
$out .= ', ' . __( 'the plugin', 'wpserveur-hide-login' ) . ' <a href="' . $details_url_wpscleaner . '" class="thickbox open-plugin-details-modal">' . __( 'WPS Cleaner', 'wpserveur-hide-login' ) . '</a>';
|
283 |
+
$out .= ' ' . __( 'and', 'wpserveur-hide-login' ) . ' <a href="' . $details_url_wpslimitlogin . '" class="thickbox open-plugin-details-modal">' . __( 'WPS Limit Login', 'wpserveur-hide-login' ) . '</a>';
|
284 |
+
$out .= '</div>';
|
285 |
|
286 |
}
|
287 |
|
288 |
+
if ( is_multisite()
|
289 |
+
&& is_super_admin()
|
290 |
+
&& is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) ) {
|
291 |
|
292 |
+
$out .= '<p>' . sprintf( __( 'To set a networkwide default, go to <a href="%s">Network Settings</a>.', 'wpserveur-hide-login' ), network_admin_url( 'settings.php#whl_settings' ) ) . '</p>';
|
293 |
|
294 |
+
}
|
295 |
|
296 |
+
echo $out;
|
297 |
|
298 |
+
}
|
299 |
|
300 |
+
public function whl_page_input() {
|
301 |
|
302 |
+
if ( get_option( 'permalink_structure' ) ) {
|
303 |
+
|
304 |
+
echo '<code>' . trailingslashit( home_url() ) . '</code> <input id="whl_page" type="text" name="whl_page" value="' . $this->new_login_slug() . '">' . ( $this->use_trailing_slashes() ? ' <code>/</code>' : '' );
|
305 |
+
|
306 |
+
} else {
|
307 |
+
|
308 |
+
echo '<code>' . trailingslashit( home_url() ) . '?</code> <input id="whl_page" type="text" name="whl_page" value="' . $this->new_login_slug() . '">';
|
309 |
|
310 |
}
|
311 |
|
312 |
+
echo '<p class="description">' . __( 'Protect your website by changing the login URL and preventing access to the wp-login.php page and the wp-admin directory to non-connected people.', 'wpserveur-hide-login' ) . '</p>';
|
313 |
|
314 |
+
}
|
315 |
|
316 |
+
public function admin_notices() {
|
317 |
|
318 |
+
global $pagenow;
|
|
|
|
|
|
|
319 |
|
320 |
+
$out = '';
|
321 |
|
322 |
+
if ( ! is_network_admin()
|
323 |
+
&& $pagenow === 'options-general.php'
|
324 |
+
&& isset( $_GET['settings-updated'] )
|
325 |
+
&& ! isset( $_GET['page'] ) ) {
|
326 |
+
|
327 |
+
echo '<div class="updated notice is-dismissible"><p>' . sprintf( __( 'Your login page is now here: <strong><a href="%1$s">%2$s</a></strong>. Bookmark this page!', 'wpserveur-hide-login' ), $this->new_login_url(), $this->new_login_url() ) . '</p></div>';
|
328 |
|
329 |
}
|
330 |
|
331 |
+
}
|
332 |
|
333 |
+
public function plugin_action_links( $links ) {
|
|
|
334 |
|
335 |
+
if ( is_network_admin()
|
336 |
+
&& is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) ) {
|
337 |
|
338 |
+
array_unshift( $links, '<a href="' . network_admin_url( 'settings.php#whl_settings' ) . '">' . __( 'Settings', 'wpserveur-hide-login' ) . '</a>' );
|
339 |
|
340 |
+
} elseif ( ! is_network_admin() ) {
|
341 |
|
342 |
+
array_unshift( $links, '<a href="' . admin_url( 'options-general.php#whl_settings' ) . '">' . __( 'Settings', 'wpserveur-hide-login' ) . '</a>' );
|
|
|
|
|
343 |
|
344 |
}
|
345 |
|
346 |
+
return $links;
|
347 |
+
|
348 |
+
}
|
349 |
|
350 |
+
public function plugins_loaded() {
|
351 |
|
352 |
+
global $pagenow;
|
|
|
|
|
353 |
|
354 |
+
if ( ! is_multisite()
|
355 |
+
&& ( strpos( $_SERVER['REQUEST_URI'], 'wp-signup' ) !== false
|
356 |
+
|| strpos( $_SERVER['REQUEST_URI'], 'wp-activate' ) !== false ) && apply_filters( 'wps_hide_login_signup_enable', false ) === false ) {
|
357 |
|
358 |
+
wp_die( __( 'This feature is not enabled.', 'wpserveur-hide-login' ) );
|
359 |
|
360 |
+
}
|
361 |
|
362 |
+
$request = parse_url( $_SERVER['REQUEST_URI'] );
|
|
|
|
|
363 |
|
364 |
+
if ( ( strpos( rawurldecode( $_SERVER['REQUEST_URI'] ), 'wp-login.php' ) !== false
|
365 |
+
|| untrailingslashit( $request['path'] ) === site_url( 'wp-login', 'relative' ) )
|
366 |
+
&& ! is_admin() ) {
|
367 |
|
368 |
+
$this->wp_login_php = true;
|
369 |
|
370 |
+
$_SERVER['REQUEST_URI'] = $this->user_trailingslashit( '/' . str_repeat( '-/', 10 ) );
|
371 |
|
372 |
+
$pagenow = 'index.php';
|
|
|
|
|
|
|
373 |
|
374 |
+
} elseif ( untrailingslashit( $request['path'] ) === home_url( $this->new_login_slug(), 'relative' )
|
375 |
+
|| ( ! get_option( 'permalink_structure' )
|
376 |
+
&& isset( $_GET[ $this->new_login_slug() ] )
|
377 |
+
&& empty( $_GET[ $this->new_login_slug() ] ) ) ) {
|
378 |
|
379 |
+
$pagenow = 'wp-login.php';
|
|
|
|
|
380 |
|
381 |
+
} elseif ( ( strpos( rawurldecode( $_SERVER['REQUEST_URI'] ), 'wp-register.php' ) !== false
|
382 |
+
|| untrailingslashit( $request['path'] ) === site_url( 'wp-register', 'relative' ) )
|
383 |
+
&& ! is_admin() ) {
|
384 |
|
385 |
+
$this->wp_login_php = true;
|
386 |
|
387 |
+
$_SERVER['REQUEST_URI'] = $this->user_trailingslashit( '/' . str_repeat( '-/', 10 ) );
|
|
|
388 |
|
389 |
+
$pagenow = 'index.php';
|
390 |
}
|
391 |
|
392 |
+
}
|
|
|
393 |
|
394 |
+
public function setup_theme() {
|
395 |
+
global $pagenow;
|
|
|
|
|
396 |
|
397 |
+
if ( ! is_user_logged_in() && 'customize.php' === $pagenow ) {
|
398 |
+
wp_die( __( 'This has been disabled', 'wpserveur-hide-login' ), 403 );
|
399 |
+
}
|
400 |
+
}
|
401 |
|
402 |
+
public function wp_loaded() {
|
403 |
|
404 |
+
global $pagenow;
|
405 |
|
406 |
+
$request = parse_url( $_SERVER['REQUEST_URI'] );
|
|
|
|
|
|
|
407 |
|
408 |
+
if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && $pagenow !== 'admin-post.php' && ( isset( $_GET ) && empty( $_GET['adminhash'] ) && $request['path'] !== '/wp-admin/options.php' ) ) {
|
409 |
+
wp_safe_redirect( home_url( '/404' ) );
|
410 |
+
die();
|
411 |
+
}
|
412 |
|
413 |
+
if ( $pagenow === 'wp-login.php'
|
414 |
+
&& $request['path'] !== $this->user_trailingslashit( $request['path'] )
|
415 |
+
&& get_option( 'permalink_structure' ) ) {
|
416 |
|
417 |
+
wp_safe_redirect( $this->user_trailingslashit( $this->new_login_url() )
|
418 |
+
. ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
|
419 |
|
420 |
+
die;
|
421 |
|
422 |
+
} elseif ( $this->wp_login_php ) {
|
|
|
|
|
|
|
423 |
|
424 |
+
if ( ( $referer = wp_get_referer() )
|
425 |
+
&& strpos( $referer, 'wp-activate.php' ) !== false
|
426 |
+
&& ( $referer = parse_url( $referer ) )
|
427 |
+
&& ! empty( $referer['query'] ) ) {
|
428 |
|
429 |
+
parse_str( $referer['query'], $referer );
|
|
|
|
|
|
|
|
|
430 |
|
431 |
+
if ( ! empty( $referer['key'] )
|
432 |
+
&& ( $result = wpmu_activate_signup( $referer['key'] ) )
|
433 |
+
&& is_wp_error( $result )
|
434 |
+
&& ( $result->get_error_code() === 'already_active'
|
435 |
+
|| $result->get_error_code() === 'blog_taken' ) ) {
|
436 |
|
437 |
+
wp_safe_redirect( $this->new_login_url()
|
438 |
+
. ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
|
439 |
|
440 |
+
die;
|
441 |
|
442 |
}
|
443 |
|
444 |
+
}
|
445 |
|
446 |
+
$this->wp_template_loader();
|
|
|
447 |
|
448 |
+
} elseif ( $pagenow === 'wp-login.php' ) {
|
449 |
+
global $error, $interim_login, $action, $user_login;
|
|
|
|
|
450 |
|
451 |
+
if ( is_user_logged_in() && ! isset( $_REQUEST['action'] ) ) {
|
452 |
+
wp_safe_redirect( admin_url() );
|
453 |
+
die();
|
454 |
+
}
|
455 |
|
456 |
+
@require_once ABSPATH . 'wp-login.php';
|
457 |
|
458 |
+
die;
|
459 |
|
460 |
}
|
461 |
|
462 |
+
}
|
463 |
|
464 |
+
public function site_url( $url, $path, $scheme, $blog_id ) {
|
465 |
|
466 |
+
return $this->filter_wp_login_php( $url, $scheme );
|
467 |
|
468 |
+
}
|
469 |
|
470 |
+
public function network_site_url( $url, $path, $scheme ) {
|
471 |
|
472 |
+
return $this->filter_wp_login_php( $url, $scheme );
|
473 |
|
474 |
+
}
|
475 |
|
476 |
+
public function wp_redirect( $location, $status ) {
|
477 |
|
478 |
+
return $this->filter_wp_login_php( $location );
|
479 |
|
480 |
+
}
|
481 |
|
482 |
+
public function filter_wp_login_php( $url, $scheme = null ) {
|
483 |
|
484 |
+
if ( strpos( $url, 'wp-login.php' ) !== false ) {
|
485 |
|
486 |
+
if ( is_ssl() ) {
|
487 |
|
488 |
+
$scheme = 'https';
|
489 |
|
490 |
+
}
|
491 |
|
492 |
+
$args = explode( '?', $url );
|
493 |
|
494 |
+
if ( isset( $args[1] ) ) {
|
495 |
|
496 |
+
parse_str( $args[1], $args );
|
|
|
|
|
497 |
|
498 |
+
if ( isset( $args['login'] ) ) {
|
499 |
+
$args['login'] = rawurlencode( $args['login'] );
|
500 |
+
}
|
501 |
|
502 |
+
$url = add_query_arg( $args, $this->new_login_url( $scheme ) );
|
503 |
|
504 |
+
} else {
|
505 |
|
506 |
+
$url = $this->new_login_url( $scheme );
|
507 |
|
508 |
}
|
509 |
|
|
|
|
|
510 |
}
|
511 |
|
512 |
+
return $url;
|
513 |
|
514 |
+
}
|
515 |
|
516 |
+
public function welcome_email( $value ) {
|
517 |
|
518 |
+
return $value = str_replace( 'wp-login.php', trailingslashit( get_site_option( 'whl_page', 'login' ) ), $value );
|
519 |
|
520 |
+
}
|
521 |
|
522 |
+
public function forbidden_slugs() {
|
523 |
|
524 |
+
$wp = new WP;
|
525 |
|
526 |
+
return array_merge( $wp->public_query_vars, $wp->private_query_vars );
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
|
528 |
+
}
|
529 |
|
530 |
+
/**
|
531 |
+
* Load scripts
|
532 |
+
*/
|
533 |
+
public function admin_enqueue_scripts( $hook ) {
|
534 |
+
if ( 'options-general.php' != $hook ) {
|
535 |
+
return false;
|
536 |
}
|
537 |
|
538 |
+
wp_enqueue_style( 'plugin-install' );
|
|
|
539 |
|
540 |
+
wp_enqueue_script( 'plugin-install' );
|
541 |
+
wp_enqueue_script( 'updates' );
|
542 |
+
add_thickbox();
|
543 |
+
}
|
|
|
|
|
|
|
|
|
|
|
544 |
|
545 |
+
public function wps_hide_login_menu_page() {
|
546 |
+
$title = __( 'WPS Hide Login' );
|
|
|
|
|
|
|
|
|
547 |
|
548 |
+
add_options_page( $title, $title, 'manage_options', 'whl_settings', array(
|
549 |
+
$this,
|
550 |
+
'settings_page'
|
551 |
+
) );
|
552 |
+
}
|
553 |
|
554 |
+
public function settings_page() {
|
555 |
+
_e( 'WPS Hide Login' );
|
556 |
+
}
|
557 |
|
558 |
+
public function whl_template_redirect() {
|
559 |
+
if ( ! empty( $_GET ) && isset( $_GET['page'] ) && 'whl_settings' === $_GET['page'] ) {
|
560 |
+
wp_redirect( admin_url( 'options-general.php#whl_settings' ) );
|
561 |
+
exit();
|
562 |
}
|
563 |
+
}
|
564 |
|
565 |
+
/**
|
566 |
+
* Update redirect for Woocommerce email notification
|
567 |
+
*/
|
568 |
+
public function wps_hide_login_redirect_page_email_notif_woocommerce() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
|
570 |
+
if ( ! class_exists( 'WC_Form_Handler' ) ) {
|
571 |
+
return false;
|
572 |
+
}
|
573 |
|
574 |
+
if ( ! empty( $_GET ) && isset( $_GET['action'] ) && 'rp' === $_GET['action'] && isset( $_GET['key'] ) && isset( $_GET['login'] ) ) {
|
575 |
+
wp_redirect( $this->new_login_url() );
|
576 |
+
exit();
|
577 |
+
}
|
578 |
+
}
|
579 |
|
580 |
+
/**
|
581 |
+
*
|
582 |
+
* Update url redirect : wp-admin/options.php
|
583 |
+
*
|
584 |
+
* @param $login_url
|
585 |
+
* @param $redirect
|
586 |
+
* @param $force_reauth
|
587 |
+
*
|
588 |
+
* @return string
|
589 |
+
*/
|
590 |
+
public function login_url( $login_url, $redirect, $force_reauth ) {
|
591 |
+
|
592 |
+
if ( $force_reauth === false ) {
|
593 |
+
return $login_url;
|
594 |
+
}
|
595 |
|
596 |
+
if ( empty( $redirect ) ) {
|
597 |
return $login_url;
|
598 |
}
|
599 |
|
600 |
+
$redirect = explode( '?', $redirect );
|
601 |
+
|
602 |
+
if ( $redirect[0] === admin_url( 'options.php' ) ) {
|
603 |
+
$login_url = admin_url();
|
604 |
+
}
|
605 |
+
|
606 |
+
return $login_url;
|
607 |
}
|
608 |
+
|
609 |
}
|
classes/singleton.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPS\WPS_Hide_Login;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Singleton base class for having singleton implementation
|
7 |
+
* This allows you to have only one instance of the needed object
|
8 |
+
* You can get the instance with
|
9 |
+
* $class = My_Class::get_instance();
|
10 |
+
*
|
11 |
+
* /!\ The get_instance method have to be implemented !
|
12 |
+
*
|
13 |
+
* Class Singleton
|
14 |
+
* @package WPS\WPS_Hide_Login
|
15 |
+
*/
|
16 |
+
trait Singleton {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var self
|
20 |
+
*/
|
21 |
+
protected static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return self
|
25 |
+
*/
|
26 |
+
final public static function get_instance() {
|
27 |
+
if ( is_null( self::$instance ) ) {
|
28 |
+
self::$instance = new static;
|
29 |
+
}
|
30 |
+
|
31 |
+
return self::$instance;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor protected from the outside
|
36 |
+
*/
|
37 |
+
final private function __construct() {
|
38 |
+
$this->init();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Add init function by default
|
43 |
+
* Implement this method in your child class
|
44 |
+
* If you want to have actions send at construct
|
45 |
+
*/
|
46 |
+
protected function init() {}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* prevent the instance from being cloned
|
50 |
+
*
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
final private function __clone() {
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* prevent from being unserialized
|
58 |
+
*
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
final private function __wakeup() {
|
62 |
+
}
|
63 |
+
}
|
composer.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name":"wpserveur/wps-hide-login",
|
3 |
+
"description":"Protect your website by changing the login URL and preventing access to wp-login.php page and wp-admin directory while not logged-in.",
|
4 |
+
"keywords":[
|
5 |
+
"rename",
|
6 |
+
"login",
|
7 |
+
"wp-login",
|
8 |
+
"wp-login.php",
|
9 |
+
"custom login url"
|
10 |
+
],
|
11 |
+
"homepage":"https://github.com/Tabrisrp/wps-hide-login",
|
12 |
+
"authors":[
|
13 |
+
{
|
14 |
+
"name":"WPServeur",
|
15 |
+
"email":"nicolas@wpserveur.net",
|
16 |
+
"homepage":"https://www.wpserveur.net/",
|
17 |
+
"role": "Lead Developer"
|
18 |
+
}
|
19 |
+
],
|
20 |
+
"type":"wordpress-plugin",
|
21 |
+
"minimum-stability":"stable",
|
22 |
+
"license":"GPL-3.0+",
|
23 |
+
"repositories": [
|
24 |
+
{
|
25 |
+
"type": "vcs",
|
26 |
+
"url": "https://github.com/NicolasKulka/WP-Review-Me"
|
27 |
+
}
|
28 |
+
],
|
29 |
+
"require":{
|
30 |
+
"php":">=5.6.0",
|
31 |
+
"NicolasKulka/wp-review-me":"2.2"
|
32 |
+
}
|
33 |
+
}
|
composer.lock
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"content-hash": "6a8b3b4f1f3b674d44cc9d920edfcb46",
|
8 |
+
"packages": [
|
9 |
+
{
|
10 |
+
"name": "NicolasKulka/wp-review-me",
|
11 |
+
"version": "2.2",
|
12 |
+
"source": {
|
13 |
+
"type": "git",
|
14 |
+
"url": "https://github.com/NicolasKulka/WP-Review-Me.git",
|
15 |
+
"reference": "0d5958af5fb37f7db0b1fb7e3219a83c4730c508"
|
16 |
+
},
|
17 |
+
"dist": {
|
18 |
+
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/NicolasKulka/WP-Review-Me/zipball/0d5958af5fb37f7db0b1fb7e3219a83c4730c508",
|
20 |
+
"reference": "0d5958af5fb37f7db0b1fb7e3219a83c4730c508",
|
21 |
+
"shasum": ""
|
22 |
+
},
|
23 |
+
"require": {
|
24 |
+
"julien731/wp-dismissible-notices-handler": "1.*",
|
25 |
+
"php": ">=5.5.0"
|
26 |
+
},
|
27 |
+
"type": "library",
|
28 |
+
"autoload": {
|
29 |
+
"files": [
|
30 |
+
"review.php"
|
31 |
+
]
|
32 |
+
},
|
33 |
+
"license": [
|
34 |
+
"GNU GPL"
|
35 |
+
],
|
36 |
+
"authors": [
|
37 |
+
{
|
38 |
+
"name": "Julien Liabeuf",
|
39 |
+
"email": "julien@liabeuf.fr",
|
40 |
+
"homepage": "https://julienliabeuf.com",
|
41 |
+
"role": "Lead Developer"
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"description": "A lightweight library to help you get more reviews for your WordPress theme/plugin",
|
45 |
+
"homepage": "https://github.com/julien731/WP-Review-Me",
|
46 |
+
"support": {
|
47 |
+
"source": "https://github.com/NicolasKulka/WP-Review-Me/tree/2.2"
|
48 |
+
},
|
49 |
+
"time": "2018-07-17T07:25:09+00:00"
|
50 |
+
},
|
51 |
+
{
|
52 |
+
"name": "julien731/wp-dismissible-notices-handler",
|
53 |
+
"version": "1.1.0",
|
54 |
+
"source": {
|
55 |
+
"type": "git",
|
56 |
+
"url": "https://github.com/julien731/WP-Dismissible-Notices-Handler.git",
|
57 |
+
"reference": "5b17d82f3b21f6d0a2dc7459adfe81d813fd94e4"
|
58 |
+
},
|
59 |
+
"dist": {
|
60 |
+
"type": "zip",
|
61 |
+
"url": "https://api.github.com/repos/julien731/WP-Dismissible-Notices-Handler/zipball/5b17d82f3b21f6d0a2dc7459adfe81d813fd94e4",
|
62 |
+
"reference": "5b17d82f3b21f6d0a2dc7459adfe81d813fd94e4",
|
63 |
+
"shasum": ""
|
64 |
+
},
|
65 |
+
"require": {
|
66 |
+
"php": ">=5.5.0"
|
67 |
+
},
|
68 |
+
"type": "library",
|
69 |
+
"autoload": {
|
70 |
+
"files": [
|
71 |
+
"handler.php"
|
72 |
+
]
|
73 |
+
},
|
74 |
+
"notification-url": "https://packagist.org/downloads/",
|
75 |
+
"license": [
|
76 |
+
"GNU GPL"
|
77 |
+
],
|
78 |
+
"authors": [
|
79 |
+
{
|
80 |
+
"name": "Julien Liabeuf",
|
81 |
+
"email": "julien@liabeuf.fr",
|
82 |
+
"homepage": "https://julienliabeuf.com",
|
83 |
+
"role": "Lead Developer"
|
84 |
+
}
|
85 |
+
],
|
86 |
+
"description": "A simple library to handle Ajax-dismissible admin notices for WordPress",
|
87 |
+
"homepage": "https://github.com/julien731/WP-Dismissible-Notices-Handler",
|
88 |
+
"time": "2018-04-20T16:00:15+00:00"
|
89 |
+
}
|
90 |
+
],
|
91 |
+
"packages-dev": [],
|
92 |
+
"aliases": [],
|
93 |
+
"minimum-stability": "stable",
|
94 |
+
"stability-flags": [],
|
95 |
+
"prefer-stable": false,
|
96 |
+
"prefer-lowest": false,
|
97 |
+
"platform": {
|
98 |
+
"php": ">=5.6.0"
|
99 |
+
},
|
100 |
+
"platform-dev": []
|
101 |
+
}
|
readme.txt
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
=== WPS Hide Login ===
|
2 |
|
3 |
Contributors: tabrisrp, WPServeur, nicolaskulka
|
|
|
4 |
Tags: rename, login, wp-login, wp-login.php, custom login url
|
5 |
-
Requires at least: 4.
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -142,6 +143,9 @@ First step is to check your .htaccess file and compare it to a regular one, to s
|
|
142 |
|
143 |
== Changelog ==
|
144 |
|
|
|
|
|
|
|
145 |
= 1.3.4.2 =
|
146 |
* Fix : Remove message review if PHP is too old
|
147 |
|
1 |
=== WPS Hide Login ===
|
2 |
|
3 |
Contributors: tabrisrp, WPServeur, nicolaskulka
|
4 |
+
Donate link : https://www.paypal.me/donateWPServeur
|
5 |
Tags: rename, login, wp-login, wp-login.php, custom login url
|
6 |
+
Requires at least: 4.2
|
7 |
Tested up to: 4.9
|
8 |
+
Stable tag: 1.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
143 |
|
144 |
== Changelog ==
|
145 |
|
146 |
+
= 1.4 =
|
147 |
+
* Enhancement code with composer, namespace and autoload
|
148 |
+
|
149 |
= 1.3.4.2 =
|
150 |
* Fix : Remove message review if PHP is too old
|
151 |
|
vendor/NicolasKulka/wp-review-me/.gitignore
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Created by .ignore support plugin (hsz.mobi)
|
2 |
+
### JetBrains template
|
3 |
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
|
4 |
+
|
5 |
+
*.iml
|
6 |
+
|
7 |
+
## Directory-based project format:
|
8 |
+
.idea/
|
9 |
+
# if you remove the above rule, at least ignore the following:
|
10 |
+
|
11 |
+
# User-specific stuff:
|
12 |
+
# .idea/workspace.xml
|
13 |
+
# .idea/tasks.xml
|
14 |
+
# .idea/dictionaries
|
15 |
+
|
16 |
+
# Sensitive or high-churn files:
|
17 |
+
# .idea/dataSources.ids
|
18 |
+
# .idea/dataSources.xml
|
19 |
+
# .idea/sqlDataSources.xml
|
20 |
+
# .idea/dynamic.xml
|
21 |
+
# .idea/uiDesigner.xml
|
22 |
+
|
23 |
+
# Gradle:
|
24 |
+
# .idea/gradle.xml
|
25 |
+
# .idea/libraries
|
26 |
+
|
27 |
+
# Mongo Explorer plugin:
|
28 |
+
# .idea/mongoSettings.xml
|
29 |
+
|
30 |
+
## File-based project format:
|
31 |
+
*.ipr
|
32 |
+
*.iws
|
33 |
+
|
34 |
+
## Plugin-specific files:
|
35 |
+
|
36 |
+
# IntelliJ
|
37 |
+
/out/
|
38 |
+
|
39 |
+
# mpeltonen/sbt-idea plugin
|
40 |
+
.idea_modules/
|
41 |
+
|
42 |
+
# JIRA plugin
|
43 |
+
atlassian-ide-plugin.xml
|
44 |
+
|
45 |
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
46 |
+
com_crashlytics_export_strings.xml
|
47 |
+
crashlytics.properties
|
48 |
+
crashlytics-build.properties
|
49 |
+
### Linux template
|
50 |
+
*~
|
51 |
+
|
52 |
+
# KDE directory preferences
|
53 |
+
.directory
|
54 |
+
|
55 |
+
# Linux trash folder which might appear on any partition or disk
|
56 |
+
.Trash-*
|
57 |
+
### SublimeText template
|
58 |
+
# cache files for sublime text
|
59 |
+
*.tmlanguage.cache
|
60 |
+
*.tmPreferences.cache
|
61 |
+
*.stTheme.cache
|
62 |
+
|
63 |
+
# workspace files are user-specific
|
64 |
+
*.sublime-workspace
|
65 |
+
|
66 |
+
# project files should be checked into the repository, unless a significant
|
67 |
+
# proportion of contributors will probably not be using SublimeText
|
68 |
+
# *.sublime-project
|
69 |
+
|
70 |
+
# sftp configuration file
|
71 |
+
sftp-config.json
|
72 |
+
### Windows template
|
73 |
+
# Windows image file caches
|
74 |
+
Thumbs.db
|
75 |
+
ehthumbs.db
|
76 |
+
|
77 |
+
# Folder config file
|
78 |
+
Desktop.ini
|
79 |
+
|
80 |
+
# Recycle Bin used on file shares
|
81 |
+
$RECYCLE.BIN/
|
82 |
+
|
83 |
+
# Windows Installer files
|
84 |
+
*.cab
|
85 |
+
*.msi
|
86 |
+
*.msm
|
87 |
+
*.msp
|
88 |
+
|
89 |
+
# Windows shortcuts
|
90 |
+
*.lnk
|
91 |
+
|
92 |
+
### Composer template
|
93 |
+
composer.phar
|
94 |
+
vendor/
|
95 |
+
|
96 |
+
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
|
97 |
+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
98 |
+
# composer.lock
|
99 |
+
|
vendor/NicolasKulka/wp-review-me/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# WP Review Me
|
2 |
+
|
3 |
+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/julien731/WP-Review-Me/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/julien731/WP-Review-Me/?branch=develop)
|
4 |
+
|
5 |
+
*In order to comply with the WordPress.org guidelines, the EDD integration has been removed and the WooCommerce integration has been dropped.*
|
6 |
+
|
7 |
+
Are you distributing WordPress themes or plugins on WordPress.org? Then you know how important reviews are.
|
8 |
+
|
9 |
+
The bad thing with reviews is that, while unhappy users love to let the world know, happy users tend to forget reviewing your product.
|
10 |
+
|
11 |
+
How can you get more good reviews? Simply ask your users.
|
12 |
+
|
13 |
+
![WP Review Me](http://i.imgur.com/9oNGvm2.png)
|
14 |
+
|
15 |
+
## How It Works
|
16 |
+
|
17 |
+
Once instantiated, the library will leave an initial timestamp in the user's database.
|
18 |
+
|
19 |
+
When the admin is loaded, the current time is compared to the initial timestamp and, when it is time, an admin notice will kindly ask the user to review your product.
|
20 |
+
|
21 |
+
The admin notices can, of course, be dismissed by the user. It uses the [WP Dismissible Notices Handler library](https://github.com/julien731/WP-Dismissible-Notices-Handler) for handling notices.
|
22 |
+
|
23 |
+
#### Installation
|
24 |
+
|
25 |
+
The simplest way to use WP Review Me is to add it as a Composer dependency:
|
26 |
+
|
27 |
+
```
|
28 |
+
composer require julien731/wp-review-me
|
29 |
+
```
|
30 |
+
|
31 |
+
### Example
|
32 |
+
|
33 |
+
Creating a new review prompt would look like that:
|
34 |
+
|
35 |
+
```
|
36 |
+
new WP_Review_Me( array( 'days_after' => 10, 'type' => 'plugin', 'slug' => 'my-plugin' ) );
|
37 |
+
```
|
38 |
+
|
39 |
+
This is the simplest way of creating a review prompt. If you want to customize it further, a few advanced parameters are available.
|
40 |
+
|
41 |
+
You can see the documentation on the wiki page: https://github.com/julien731/WP-Review-Me/wiki
|
vendor/NicolasKulka/wp-review-me/composer.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "NicolasKulka/wp-review-me",
|
3 |
+
"description": "A lightweight library to help you get more reviews for your WordPress theme/plugin",
|
4 |
+
"homepage": "https://github.com/julien731/WP-Review-Me",
|
5 |
+
"license": "GNU GPL",
|
6 |
+
"authors": [
|
7 |
+
{
|
8 |
+
"name": "Julien Liabeuf",
|
9 |
+
"email": "julien@liabeuf.fr",
|
10 |
+
"homepage": "https://julienliabeuf.com",
|
11 |
+
"role": "Lead Developer"
|
12 |
+
}
|
13 |
+
],
|
14 |
+
"require": {
|
15 |
+
"php": ">=5.5.0",
|
16 |
+
"julien731/wp-dismissible-notices-handler": "1.*"
|
17 |
+
},
|
18 |
+
"autoload": {
|
19 |
+
"files": ["review.php"]
|
20 |
+
}
|
21 |
+
}
|
vendor/NicolasKulka/wp-review-me/composer.lock
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"hash": "0d1622f036a475e98f58e5527abcf7e0",
|
8 |
+
"content-hash": "5db72a2a7c0fc85ea28316b1b3a30f5d",
|
9 |
+
"packages": [
|
10 |
+
{
|
11 |
+
"name": "julien731/wp-dismissible-notices-handler",
|
12 |
+
"version": "1.0.0",
|
13 |
+
"source": {
|
14 |
+
"type": "git",
|
15 |
+
"url": "https://github.com/julien731/WP-Dismissible-Notices-Handler.git",
|
16 |
+
"reference": "85ce1debbdfd4543e5b835dfe6670b9de99ddf6b"
|
17 |
+
},
|
18 |
+
"dist": {
|
19 |
+
"type": "zip",
|
20 |
+
"url": "https://api.github.com/repos/julien731/WP-Dismissible-Notices-Handler/zipball/85ce1debbdfd4543e5b835dfe6670b9de99ddf6b",
|
21 |
+
"reference": "85ce1debbdfd4543e5b835dfe6670b9de99ddf6b",
|
22 |
+
"shasum": ""
|
23 |
+
},
|
24 |
+
"require": {
|
25 |
+
"php": ">=5.5.0"
|
26 |
+
},
|
27 |
+
"type": "library",
|
28 |
+
"autoload": {
|
29 |
+
"files": [
|
30 |
+
"handler.php"
|
31 |
+
]
|
32 |
+
},
|
33 |
+
"notification-url": "https://packagist.org/downloads/",
|
34 |
+
"license": [
|
35 |
+
"GNU GPL"
|
36 |
+
],
|
37 |
+
"authors": [
|
38 |
+
{
|
39 |
+
"name": "Julien Liabeuf",
|
40 |
+
"email": "julien@liabeuf.fr",
|
41 |
+
"homepage": "https://julienliabeuf.com",
|
42 |
+
"role": "Lead Developer"
|
43 |
+
}
|
44 |
+
],
|
45 |
+
"description": "A simple library to handle Ajax-dismissible admin notices for WordPress",
|
46 |
+
"homepage": "https://github.com/julien731/WP-Dismissible-Notices-Handler",
|
47 |
+
"time": "2016-04-03 05:12:27"
|
48 |
+
}
|
49 |
+
],
|
50 |
+
"packages-dev": [],
|
51 |
+
"aliases": [],
|
52 |
+
"minimum-stability": "stable",
|
53 |
+
"stability-flags": [],
|
54 |
+
"prefer-stable": false,
|
55 |
+
"prefer-lowest": false,
|
56 |
+
"platform": {
|
57 |
+
"php": ">=5.5.0"
|
58 |
+
},
|
59 |
+
"platform-dev": []
|
60 |
+
}
|
{classes → vendor/NicolasKulka/wp-review-me}/review.php
RENAMED
@@ -18,12 +18,16 @@
|
|
18 |
* @link https://julienliabeuf.com
|
19 |
* @copyright 2016 Julien Liabeuf
|
20 |
*/
|
|
|
21 |
// If this file is called directly, abort.
|
22 |
if ( ! defined( 'WPINC' ) ) {
|
23 |
die;
|
24 |
}
|
|
|
25 |
if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
|
26 |
class WP_Review_Me {
|
|
|
27 |
/**
|
28 |
* Library version
|
29 |
*
|
@@ -31,6 +35,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
31 |
* @var string
|
32 |
*/
|
33 |
public $version = '2.0.1';
|
|
|
34 |
/**
|
35 |
* Required version of PHP.
|
36 |
*
|
@@ -38,6 +43,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
38 |
* @var string
|
39 |
*/
|
40 |
public $php_version_required = '5.5';
|
|
|
41 |
/**
|
42 |
* Minimum version of WordPress required to use the library
|
43 |
*
|
@@ -45,6 +51,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
45 |
* @var string
|
46 |
*/
|
47 |
public $wordpress_version_required = '4.2';
|
|
|
48 |
/**
|
49 |
* Holds the unique identifying key for this particular instance
|
50 |
*
|
@@ -52,6 +59,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
52 |
* @var string
|
53 |
*/
|
54 |
protected $key;
|
|
|
55 |
/**
|
56 |
* Link unique ID
|
57 |
*
|
@@ -68,6 +76,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
68 |
* @param array $args Object settings
|
69 |
*/
|
70 |
public function __construct( $args ) {
|
|
|
71 |
$args = wp_parse_args( $args, $this->get_defaults() );
|
72 |
$this->days = $args['days_after'];
|
73 |
$this->type = $args['type'];
|
@@ -77,11 +86,14 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
77 |
$this->link_label = $args['link_label'];
|
78 |
$this->cap = $args['cap'];
|
79 |
$this->scope = $args['scope'];
|
|
|
80 |
// Set the unique identifying key for this instance
|
81 |
$this->key = 'wrm_' . substr( md5( plugin_basename( __FILE__ ) . $args['slug'] ), 0, 20 );
|
82 |
$this->link_id = 'wrm-review-link-' . $this->key;
|
|
|
83 |
// Instantiate
|
84 |
$this->init();
|
|
|
85 |
}
|
86 |
|
87 |
/**
|
@@ -91,6 +103,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
91 |
* @return array
|
92 |
*/
|
93 |
protected function get_defaults() {
|
|
|
94 |
$defaults = array(
|
95 |
'days_after' => 10,
|
96 |
'type' => '',
|
@@ -104,6 +117,7 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
104 |
);
|
105 |
|
106 |
return $defaults;
|
|
|
107 |
}
|
108 |
|
109 |
/**
|
@@ -113,8 +127,9 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
113 |
* @return void
|
114 |
*/
|
115 |
private function init() {
|
|
|
116 |
// Make sure WordPress is compatible
|
117 |
-
if ( ! $this->is_wp_compatible() ) {
|
118 |
$this->spit_error(
|
119 |
sprintf(
|
120 |
esc_html__( 'The library can not be used because your version of WordPress is too old. You need version %s at least.', 'wp-review-me' ),
|
@@ -123,29 +138,47 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
123 |
);
|
124 |
|
125 |
return;
|
126 |
-
}
|
|
|
127 |
// Make sure PHP is compatible
|
128 |
-
if ( ! $this->is_php_compatible() ) {
|
129 |
-
|
130 |
sprintf(
|
131 |
esc_html__( 'The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-review-me' ),
|
132 |
$this->php_version_required
|
133 |
)
|
134 |
-
)
|
135 |
|
136 |
return;
|
137 |
-
}
|
|
|
138 |
// Make sure the dependencies are loaded
|
139 |
if ( ! function_exists( 'dnh_register_notice' ) ) {
|
140 |
-
|
|
|
|
|
141 |
if ( file_exists( $dnh_file ) ) {
|
142 |
require( $dnh_file );
|
143 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
|
|
145 |
add_action( 'admin_footer', array( $this, 'script' ) );
|
146 |
add_action( 'wp_ajax_wrm_clicked_review', array( $this, 'dismiss_notice' ) );
|
|
|
147 |
// And let's roll... maybe.
|
148 |
$this->maybe_prompt();
|
|
|
149 |
}
|
150 |
|
151 |
/**
|
@@ -155,11 +188,13 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
155 |
* @return boolean
|
156 |
*/
|
157 |
private function is_wp_compatible() {
|
|
|
158 |
if ( version_compare( get_bloginfo( 'version' ), $this->wordpress_version_required, '<' ) ) {
|
159 |
return false;
|
160 |
}
|
161 |
|
162 |
return true;
|
|
|
163 |
}
|
164 |
|
165 |
/**
|
@@ -169,11 +204,13 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
169 |
* @return boolean
|
170 |
*/
|
171 |
private function is_php_compatible() {
|
|
|
172 |
if ( version_compare( phpversion(), $this->php_version_required, '<' ) ) {
|
173 |
return false;
|
174 |
}
|
175 |
|
176 |
return true;
|
|
|
177 |
}
|
178 |
|
179 |
/**
|
@@ -200,16 +237,20 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
200 |
* @return bool
|
201 |
*/
|
202 |
public function is_time() {
|
|
|
203 |
$installed = (int) get_option( $this->key, false );
|
204 |
-
|
|
|
205 |
$this->setup_date();
|
206 |
$installed = time();
|
207 |
}
|
|
|
208 |
if ( $installed + ( $this->days * 86400 ) > time() ) {
|
209 |
return false;
|
210 |
}
|
211 |
|
212 |
return true;
|
|
|
213 |
}
|
214 |
|
215 |
/**
|
@@ -229,20 +270,27 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
229 |
* @return string
|
230 |
*/
|
231 |
protected function get_review_link() {
|
|
|
232 |
$link = 'https://wordpress.org/support/';
|
|
|
233 |
switch ( $this->type ) {
|
|
|
234 |
case 'theme':
|
235 |
$link .= 'theme/';
|
236 |
break;
|
|
|
237 |
case 'plugin':
|
238 |
$link .= 'plugin/';
|
239 |
break;
|
|
|
240 |
}
|
|
|
241 |
$link .= $this->slug . '/reviews';
|
242 |
$link = add_query_arg( 'rate', $this->rating, $link );
|
243 |
$link = esc_url( $link . '#new-post' );
|
244 |
|
245 |
return $link;
|
|
|
246 |
}
|
247 |
|
248 |
/**
|
@@ -252,9 +300,11 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
252 |
* @return string
|
253 |
*/
|
254 |
protected function get_review_link_tag() {
|
|
|
255 |
$link = $this->get_review_link();
|
256 |
|
257 |
return "<a href='$link' target='_blank' id='$this->link_id'>$this->link_label</a>";
|
|
|
258 |
}
|
259 |
|
260 |
/**
|
@@ -264,13 +314,16 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
264 |
* @return void
|
265 |
*/
|
266 |
protected function maybe_prompt() {
|
|
|
267 |
if ( ! $this->is_time() ) {
|
268 |
return;
|
269 |
}
|
|
|
270 |
dnh_register_notice( $this->key, 'updated', $this->get_message(), array(
|
271 |
'scope' => $this->scope,
|
272 |
'cap' => $this->cap
|
273 |
) );
|
|
|
274 |
}
|
275 |
|
276 |
/**
|
@@ -281,26 +334,28 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
281 |
*/
|
282 |
public function script() { ?>
|
283 |
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
|
|
|
|
304 |
|
305 |
<?php }
|
306 |
|
@@ -311,35 +366,43 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
311 |
* @return void
|
312 |
*/
|
313 |
public function dismiss_notice() {
|
|
|
314 |
if ( empty( $_POST ) ) {
|
315 |
echo 'missing POST';
|
316 |
die();
|
317 |
}
|
|
|
318 |
if ( ! isset( $_POST['id'] ) ) {
|
319 |
echo 'missing ID';
|
320 |
die();
|
321 |
}
|
|
|
322 |
$id = sanitize_text_field( $_POST['id'] );
|
|
|
323 |
if ( $id !== $this->link_id ) {
|
324 |
echo "not this instance's job";
|
325 |
die();
|
326 |
}
|
|
|
327 |
// Get the DNH notice ID ready
|
328 |
$notice_id = DNH()->get_id( str_replace( 'wrm-review-link-', '', $id ) );
|
329 |
$dismissed = DNH()->dismiss_notice( $notice_id );
|
330 |
-
|
331 |
echo $dismissed;
|
|
|
332 |
/**
|
333 |
* Fires right after the notice has been dismissed. This allows for various integrations to perform additional tasks.
|
334 |
*
|
335 |
* @since 1.0
|
336 |
*
|
337 |
-
* @param string $id
|
338 |
* @param string $notice_id The notice ID as defined by the DNH class
|
339 |
*/
|
340 |
do_action( 'wrm_after_notice_dismissed', $id, $notice_id );
|
|
|
341 |
// Stop execution here
|
342 |
die();
|
|
|
343 |
}
|
344 |
|
345 |
/**
|
@@ -349,36 +412,15 @@ if ( ! class_exists( 'WP_Review_Me' ) ) {
|
|
349 |
* @return string
|
350 |
*/
|
351 |
protected function get_message() {
|
|
|
352 |
$message = $this->message;
|
353 |
$link = $this->get_review_link_tag();
|
354 |
$message = $message . ' ' . $link;
|
355 |
|
356 |
-
|
357 |
|
358 |
-
return wp_kses_post( $message ) . $reviews;
|
359 |
}
|
|
|
360 |
}
|
361 |
-
}
|
362 |
|
363 |
-
if( 'fr_FR' === get_locale() ) {
|
364 |
-
new WP_Review_Me(
|
365 |
-
array(
|
366 |
-
'days_after' => 10,
|
367 |
-
'type' => 'plugin',
|
368 |
-
'slug' => 'wps-hide-login',
|
369 |
-
'message' => 'Vous aimez l\'extension WPS Hide Login ?<br>Merci de prendre quelques secondes pour nous noter sur',
|
370 |
-
'link_label' => 'WordPress.org'
|
371 |
-
)
|
372 |
-
);
|
373 |
-
} else {
|
374 |
-
new WP_Review_Me(
|
375 |
-
array(
|
376 |
-
'days_after' => 10,
|
377 |
-
'type' => 'plugin',
|
378 |
-
'slug' => 'wps-hide-login',
|
379 |
-
'message' => __( 'Do you like plugin WPS Hide Login? <br> Thank you for taking a few seconds to note us on', 'wps-hide-login' ),
|
380 |
-
'link_label' => 'WordPress.org'
|
381 |
-
)
|
382 |
-
);
|
383 |
}
|
384 |
-
|
18 |
* @link https://julienliabeuf.com
|
19 |
* @copyright 2016 Julien Liabeuf
|
20 |
*/
|
21 |
+
|
22 |
// If this file is called directly, abort.
|
23 |
if ( ! defined( 'WPINC' ) ) {
|
24 |
die;
|
25 |
}
|
26 |
+
|
27 |
if ( ! class_exists( 'WP_Review_Me' ) ) {
|
28 |
+
|
29 |
class WP_Review_Me {
|
30 |
+
|
31 |
/**
|
32 |
* Library version
|
33 |
*
|
35 |
* @var string
|
36 |
*/
|
37 |
public $version = '2.0.1';
|
38 |
+
|
39 |
/**
|
40 |
* Required version of PHP.
|
41 |
*
|
43 |
* @var string
|
44 |
*/
|
45 |
public $php_version_required = '5.5';
|
46 |
+
|
47 |
/**
|
48 |
* Minimum version of WordPress required to use the library
|
49 |
*
|
51 |
* @var string
|
52 |
*/
|
53 |
public $wordpress_version_required = '4.2';
|
54 |
+
|
55 |
/**
|
56 |
* Holds the unique identifying key for this particular instance
|
57 |
*
|
59 |
* @var string
|
60 |
*/
|
61 |
protected $key;
|
62 |
+
|
63 |
/**
|
64 |
* Link unique ID
|
65 |
*
|
76 |
* @param array $args Object settings
|
77 |
*/
|
78 |
public function __construct( $args ) {
|
79 |
+
|
80 |
$args = wp_parse_args( $args, $this->get_defaults() );
|
81 |
$this->days = $args['days_after'];
|
82 |
$this->type = $args['type'];
|
86 |
$this->link_label = $args['link_label'];
|
87 |
$this->cap = $args['cap'];
|
88 |
$this->scope = $args['scope'];
|
89 |
+
|
90 |
// Set the unique identifying key for this instance
|
91 |
$this->key = 'wrm_' . substr( md5( plugin_basename( __FILE__ ) . $args['slug'] ), 0, 20 );
|
92 |
$this->link_id = 'wrm-review-link-' . $this->key;
|
93 |
+
|
94 |
// Instantiate
|
95 |
$this->init();
|
96 |
+
|
97 |
}
|
98 |
|
99 |
/**
|
103 |
* @return array
|
104 |
*/
|
105 |
protected function get_defaults() {
|
106 |
+
|
107 |
$defaults = array(
|
108 |
'days_after' => 10,
|
109 |
'type' => '',
|
117 |
);
|
118 |
|
119 |
return $defaults;
|
120 |
+
|
121 |
}
|
122 |
|
123 |
/**
|
127 |
* @return void
|
128 |
*/
|
129 |
private function init() {
|
130 |
+
|
131 |
// Make sure WordPress is compatible
|
132 |
+
/*if ( ! $this->is_wp_compatible() ) {
|
133 |
$this->spit_error(
|
134 |
sprintf(
|
135 |
esc_html__( 'The library can not be used because your version of WordPress is too old. You need version %s at least.', 'wp-review-me' ),
|
138 |
);
|
139 |
|
140 |
return;
|
141 |
+
}*/
|
142 |
+
|
143 |
// Make sure PHP is compatible
|
144 |
+
/*if ( ! $this->is_php_compatible() ) {
|
145 |
+
$this->spit_error(
|
146 |
sprintf(
|
147 |
esc_html__( 'The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-review-me' ),
|
148 |
$this->php_version_required
|
149 |
)
|
150 |
+
);
|
151 |
|
152 |
return;
|
153 |
+
}*/
|
154 |
+
|
155 |
// Make sure the dependencies are loaded
|
156 |
if ( ! function_exists( 'dnh_register_notice' ) ) {
|
157 |
+
|
158 |
+
$dnh_file = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'vendor/julien731/wp-dismissible-notices-handler/handler.php';
|
159 |
+
|
160 |
if ( file_exists( $dnh_file ) ) {
|
161 |
require( $dnh_file );
|
162 |
}
|
163 |
+
|
164 |
+
if ( ! function_exists( 'dnh_register_notice' ) ) {
|
165 |
+
$this->spit_error(
|
166 |
+
sprintf(
|
167 |
+
esc_html__( 'Dependencies are missing. Please run a %s.', 'wp-review-me' ),
|
168 |
+
'<code>composer install</code>'
|
169 |
+
)
|
170 |
+
);
|
171 |
+
|
172 |
+
return;
|
173 |
+
}
|
174 |
}
|
175 |
+
|
176 |
add_action( 'admin_footer', array( $this, 'script' ) );
|
177 |
add_action( 'wp_ajax_wrm_clicked_review', array( $this, 'dismiss_notice' ) );
|
178 |
+
|
179 |
// And let's roll... maybe.
|
180 |
$this->maybe_prompt();
|
181 |
+
|
182 |
}
|
183 |
|
184 |
/**
|
188 |
* @return boolean
|
189 |
*/
|
190 |
private function is_wp_compatible() {
|
191 |
+
|
192 |
if ( version_compare( get_bloginfo( 'version' ), $this->wordpress_version_required, '<' ) ) {
|
193 |
return false;
|
194 |
}
|
195 |
|
196 |
return true;
|
197 |
+
|
198 |
}
|
199 |
|
200 |
/**
|
204 |
* @return boolean
|
205 |
*/
|
206 |
private function is_php_compatible() {
|
207 |
+
|
208 |
if ( version_compare( phpversion(), $this->php_version_required, '<' ) ) {
|
209 |
return false;
|
210 |
}
|
211 |
|
212 |
return true;
|
213 |
+
|
214 |
}
|
215 |
|
216 |
/**
|
237 |
* @return bool
|
238 |
*/
|
239 |
public function is_time() {
|
240 |
+
|
241 |
$installed = (int) get_option( $this->key, false );
|
242 |
+
|
243 |
+
if ( false === $installed ) {
|
244 |
$this->setup_date();
|
245 |
$installed = time();
|
246 |
}
|
247 |
+
|
248 |
if ( $installed + ( $this->days * 86400 ) > time() ) {
|
249 |
return false;
|
250 |
}
|
251 |
|
252 |
return true;
|
253 |
+
|
254 |
}
|
255 |
|
256 |
/**
|
270 |
* @return string
|
271 |
*/
|
272 |
protected function get_review_link() {
|
273 |
+
|
274 |
$link = 'https://wordpress.org/support/';
|
275 |
+
|
276 |
switch ( $this->type ) {
|
277 |
+
|
278 |
case 'theme':
|
279 |
$link .= 'theme/';
|
280 |
break;
|
281 |
+
|
282 |
case 'plugin':
|
283 |
$link .= 'plugin/';
|
284 |
break;
|
285 |
+
|
286 |
}
|
287 |
+
|
288 |
$link .= $this->slug . '/reviews';
|
289 |
$link = add_query_arg( 'rate', $this->rating, $link );
|
290 |
$link = esc_url( $link . '#new-post' );
|
291 |
|
292 |
return $link;
|
293 |
+
|
294 |
}
|
295 |
|
296 |
/**
|
300 |
* @return string
|
301 |
*/
|
302 |
protected function get_review_link_tag() {
|
303 |
+
|
304 |
$link = $this->get_review_link();
|
305 |
|
306 |
return "<a href='$link' target='_blank' id='$this->link_id'>$this->link_label</a>";
|
307 |
+
|
308 |
}
|
309 |
|
310 |
/**
|
314 |
* @return void
|
315 |
*/
|
316 |
protected function maybe_prompt() {
|
317 |
+
|
318 |
if ( ! $this->is_time() ) {
|
319 |
return;
|
320 |
}
|
321 |
+
|
322 |
dnh_register_notice( $this->key, 'updated', $this->get_message(), array(
|
323 |
'scope' => $this->scope,
|
324 |
'cap' => $this->cap
|
325 |
) );
|
326 |
+
|
327 |
}
|
328 |
|
329 |
/**
|
334 |
*/
|
335 |
public function script() { ?>
|
336 |
|
337 |
+
<script>
|
338 |
+
jQuery(document).ready(function($) {
|
339 |
+
$('#<?php echo $this->link_id; ?>').on('click', wrmDismiss);
|
340 |
+
function wrmDismiss() {
|
341 |
+
|
342 |
+
var data = {
|
343 |
+
action: 'wrm_clicked_review',
|
344 |
+
id: '<?php echo $this->link_id; ?>'
|
345 |
+
};
|
346 |
+
|
347 |
+
jQuery.ajax({
|
348 |
+
type:'POST',
|
349 |
+
url: ajaxurl,
|
350 |
+
data: data,
|
351 |
+
success:function( data ){
|
352 |
+
console.log(data);
|
353 |
+
}
|
354 |
+
});
|
355 |
+
|
356 |
+
}
|
357 |
+
});
|
358 |
+
</script>
|
359 |
|
360 |
<?php }
|
361 |
|
366 |
* @return void
|
367 |
*/
|
368 |
public function dismiss_notice() {
|
369 |
+
|
370 |
if ( empty( $_POST ) ) {
|
371 |
echo 'missing POST';
|
372 |
die();
|
373 |
}
|
374 |
+
|
375 |
if ( ! isset( $_POST['id'] ) ) {
|
376 |
echo 'missing ID';
|
377 |
die();
|
378 |
}
|
379 |
+
|
380 |
$id = sanitize_text_field( $_POST['id'] );
|
381 |
+
|
382 |
if ( $id !== $this->link_id ) {
|
383 |
echo "not this instance's job";
|
384 |
die();
|
385 |
}
|
386 |
+
|
387 |
// Get the DNH notice ID ready
|
388 |
$notice_id = DNH()->get_id( str_replace( 'wrm-review-link-', '', $id ) );
|
389 |
$dismissed = DNH()->dismiss_notice( $notice_id );
|
390 |
+
|
391 |
echo $dismissed;
|
392 |
+
|
393 |
/**
|
394 |
* Fires right after the notice has been dismissed. This allows for various integrations to perform additional tasks.
|
395 |
*
|
396 |
* @since 1.0
|
397 |
*
|
398 |
+
* @param string $id The notice ID
|
399 |
* @param string $notice_id The notice ID as defined by the DNH class
|
400 |
*/
|
401 |
do_action( 'wrm_after_notice_dismissed', $id, $notice_id );
|
402 |
+
|
403 |
// Stop execution here
|
404 |
die();
|
405 |
+
|
406 |
}
|
407 |
|
408 |
/**
|
412 |
* @return string
|
413 |
*/
|
414 |
protected function get_message() {
|
415 |
+
|
416 |
$message = $this->message;
|
417 |
$link = $this->get_review_link_tag();
|
418 |
$message = $message . ' ' . $link;
|
419 |
|
420 |
+
return wp_kses_post( $message );
|
421 |
|
|
|
422 |
}
|
423 |
+
|
424 |
}
|
|
|
425 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
}
|
|
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 ComposerAutoloaderInit71244fc19bd731ff2404f3641ca151d8::getLoader();
|
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') && ini_get('apc.enabled') ? $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,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
);
|
vendor/composer/autoload_files.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_files.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'c14057a02afc95b84dc5bf85d98c5b66' => $vendorDir . '/julien731/wp-dismissible-notices-handler/handler.php',
|
10 |
+
'642f204a71b38c9724089b10b2126d4f' => $vendorDir . '/NicolasKulka/wp-review-me/review.php',
|
11 |
+
);
|
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,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit71244fc19bd731ff2404f3641ca151d8
|
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 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit71244fc19bd731ff2404f3641ca151d8', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit71244fc19bd731ff2404f3641ca151d8', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
+
if ($useStaticLoader) {
|
28 |
+
require_once __DIR__ . '/autoload_static.php';
|
29 |
+
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit71244fc19bd731ff2404f3641ca151d8::getInitializer($loader));
|
31 |
+
} else {
|
32 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
+
foreach ($map as $namespace => $path) {
|
34 |
+
$loader->set($namespace, $path);
|
35 |
+
}
|
36 |
+
|
37 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
+
foreach ($map as $namespace => $path) {
|
39 |
+
$loader->setPsr4($namespace, $path);
|
40 |
+
}
|
41 |
+
|
42 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
+
if ($classMap) {
|
44 |
+
$loader->addClassMap($classMap);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$loader->register(true);
|
49 |
+
|
50 |
+
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit71244fc19bd731ff2404f3641ca151d8::$files;
|
52 |
+
} else {
|
53 |
+
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
+
}
|
55 |
+
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire71244fc19bd731ff2404f3641ca151d8($fileIdentifier, $file);
|
57 |
+
}
|
58 |
+
|
59 |
+
return $loader;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
function composerRequire71244fc19bd731ff2404f3641ca151d8($fileIdentifier, $file)
|
64 |
+
{
|
65 |
+
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
+
require $file;
|
67 |
+
|
68 |
+
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
69 |
+
}
|
70 |
+
}
|
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 ComposerStaticInit71244fc19bd731ff2404f3641ca151d8
|
8 |
+
{
|
9 |
+
public static $files = array (
|
10 |
+
'c14057a02afc95b84dc5bf85d98c5b66' => __DIR__ . '/..' . '/julien731/wp-dismissible-notices-handler/handler.php',
|
11 |
+
'642f204a71b38c9724089b10b2126d4f' => __DIR__ . '/..' . '/NicolasKulka/wp-review-me/review.php',
|
12 |
+
);
|
13 |
+
|
14 |
+
public static function getInitializer(ClassLoader $loader)
|
15 |
+
{
|
16 |
+
return \Closure::bind(function () use ($loader) {
|
17 |
+
|
18 |
+
}, null, ClassLoader::class);
|
19 |
+
}
|
20 |
+
}
|
vendor/composer/installed.json
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "NicolasKulka/wp-review-me",
|
4 |
+
"version": "2.2",
|
5 |
+
"version_normalized": "2.2.0.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/NicolasKulka/WP-Review-Me.git",
|
9 |
+
"reference": "0d5958af5fb37f7db0b1fb7e3219a83c4730c508"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/NicolasKulka/WP-Review-Me/zipball/0d5958af5fb37f7db0b1fb7e3219a83c4730c508",
|
14 |
+
"reference": "0d5958af5fb37f7db0b1fb7e3219a83c4730c508",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"julien731/wp-dismissible-notices-handler": "1.*",
|
19 |
+
"php": ">=5.5.0"
|
20 |
+
},
|
21 |
+
"time": "2018-07-17T07:25:09+00:00",
|
22 |
+
"type": "library",
|
23 |
+
"installation-source": "dist",
|
24 |
+
"autoload": {
|
25 |
+
"files": [
|
26 |
+
"review.php"
|
27 |
+
]
|
28 |
+
},
|
29 |
+
"license": [
|
30 |
+
"GNU GPL"
|
31 |
+
],
|
32 |
+
"authors": [
|
33 |
+
{
|
34 |
+
"name": "Julien Liabeuf",
|
35 |
+
"email": "julien@liabeuf.fr",
|
36 |
+
"homepage": "https://julienliabeuf.com",
|
37 |
+
"role": "Lead Developer"
|
38 |
+
}
|
39 |
+
],
|
40 |
+
"description": "A lightweight library to help you get more reviews for your WordPress theme/plugin",
|
41 |
+
"homepage": "https://github.com/julien731/WP-Review-Me",
|
42 |
+
"support": {
|
43 |
+
"source": "https://github.com/NicolasKulka/WP-Review-Me/tree/2.2"
|
44 |
+
}
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"name": "julien731/wp-dismissible-notices-handler",
|
48 |
+
"version": "1.1.0",
|
49 |
+
"version_normalized": "1.1.0.0",
|
50 |
+
"source": {
|
51 |
+
"type": "git",
|
52 |
+
"url": "https://github.com/julien731/WP-Dismissible-Notices-Handler.git",
|
53 |
+
"reference": "5b17d82f3b21f6d0a2dc7459adfe81d813fd94e4"
|
54 |
+
},
|
55 |
+
"dist": {
|
56 |
+
"type": "zip",
|
57 |
+
"url": "https://api.github.com/repos/julien731/WP-Dismissible-Notices-Handler/zipball/5b17d82f3b21f6d0a2dc7459adfe81d813fd94e4",
|
58 |
+
"reference": "5b17d82f3b21f6d0a2dc7459adfe81d813fd94e4",
|
59 |
+
"shasum": ""
|
60 |
+
},
|
61 |
+
"require": {
|
62 |
+
"php": ">=5.5.0"
|
63 |
+
},
|
64 |
+
"time": "2018-04-20T16:00:15+00:00",
|
65 |
+
"type": "library",
|
66 |
+
"installation-source": "dist",
|
67 |
+
"autoload": {
|
68 |
+
"files": [
|
69 |
+
"handler.php"
|
70 |
+
]
|
71 |
+
},
|
72 |
+
"notification-url": "https://packagist.org/downloads/",
|
73 |
+
"license": [
|
74 |
+
"GNU GPL"
|
75 |
+
],
|
76 |
+
"authors": [
|
77 |
+
{
|
78 |
+
"name": "Julien Liabeuf",
|
79 |
+
"email": "julien@liabeuf.fr",
|
80 |
+
"homepage": "https://julienliabeuf.com",
|
81 |
+
"role": "Lead Developer"
|
82 |
+
}
|
83 |
+
],
|
84 |
+
"description": "A simple library to handle Ajax-dismissible admin notices for WordPress",
|
85 |
+
"homepage": "https://github.com/julien731/WP-Dismissible-Notices-Handler"
|
86 |
+
}
|
87 |
+
]
|
{classes/lib → vendor/julien731}/wp-dismissible-notices-handler/assets/js/main.js
RENAMED
File without changes
|
{classes/lib → vendor/julien731}/wp-dismissible-notices-handler/composer.json
RENAMED
File without changes
|
{classes/lib → vendor/julien731}/wp-dismissible-notices-handler/handler.php
RENAMED
@@ -104,13 +104,13 @@ if ( ! class_exists( 'Dismissible_Notices_Handler' ) ) {
|
|
104 |
|
105 |
// Make sure PHP is compatible
|
106 |
if ( ! self::$instance->is_php_compatible() ) {
|
107 |
-
|
108 |
sprintf(
|
109 |
-
|
110 |
esc_html__( 'The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-dismissible-notices-handler' ),
|
111 |
self::$instance->php_version_required
|
112 |
)
|
113 |
-
)
|
114 |
|
115 |
return;
|
116 |
}
|
104 |
|
105 |
// Make sure PHP is compatible
|
106 |
if ( ! self::$instance->is_php_compatible() ) {
|
107 |
+
self::$instance->spit_error(
|
108 |
sprintf(
|
109 |
+
/* translators: %s: required php version */
|
110 |
esc_html__( 'The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-dismissible-notices-handler' ),
|
111 |
self::$instance->php_version_required
|
112 |
)
|
113 |
+
);
|
114 |
|
115 |
return;
|
116 |
}
|
{classes/lib → vendor/julien731}/wp-dismissible-notices-handler/includes/helper-functions.php
RENAMED
File without changes
|
wps-hide-login.php
CHANGED
@@ -2,11 +2,14 @@
|
|
2 |
/*
|
3 |
Plugin Name: WPS Hide Login
|
4 |
Description: Protect your website by changing the login URL and preventing access to wp-login.php page and wp-admin directory while not logged-in
|
|
|
5 |
Author: WPServeur, NicolasKulka, tabrisrp
|
6 |
Author URI: https://wpserveur.net
|
7 |
-
Version: 1.
|
8 |
-
Requires at least: 4.
|
9 |
Tested up to: 4.9
|
|
|
|
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -17,33 +20,35 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
}
|
18 |
|
19 |
// Plugin constants
|
20 |
-
define( 'WPS_HIDE_LOGIN_VERSION', '1.
|
21 |
define( 'WPS_HIDE_LOGIN_FOLDER', 'wps-hide-login' );
|
22 |
|
23 |
define( 'WPS_HIDE_LOGIN_URL', plugin_dir_url( __FILE__ ) );
|
24 |
define( 'WPS_HIDE_LOGIN_DIR', plugin_dir_path( __FILE__ ) );
|
25 |
define( 'WPS_HIDE_LOGIN_BASENAME', plugin_basename( __FILE__ ) );
|
26 |
|
27 |
-
|
28 |
-
function wps_hide_login_load_files( $dir, $files, $prefix = '' ) {
|
29 |
-
foreach ( $files as $file ) {
|
30 |
-
if ( is_file( $dir . $prefix . $file . '.php' ) ) {
|
31 |
-
require_once( $dir . $prefix . $file . '.php' );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
// Plugin client classes
|
37 |
-
wps_hide_login_load_files( WPS_HIDE_LOGIN_DIR . 'classes/', array(
|
38 |
-
'plugin',
|
39 |
-
'review',
|
40 |
-
) );
|
41 |
|
42 |
-
register_activation_hook( __FILE__, array( 'WPS_Hide_Login', 'activate' ) );
|
43 |
|
44 |
add_action( 'plugins_loaded', 'plugins_loaded_wps_hide_login_plugin' );
|
45 |
function plugins_loaded_wps_hide_login_plugin() {
|
46 |
-
|
47 |
|
48 |
load_plugin_textdomain( 'wpserveur-hide-login', false, dirname( WPS_HIDE_LOGIN_BASENAME ) . '/languages' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
2 |
/*
|
3 |
Plugin Name: WPS Hide Login
|
4 |
Description: Protect your website by changing the login URL and preventing access to wp-login.php page and wp-admin directory while not logged-in
|
5 |
+
Donate link: https://www.paypal.me/donateWPServeur
|
6 |
Author: WPServeur, NicolasKulka, tabrisrp
|
7 |
Author URI: https://wpserveur.net
|
8 |
+
Version: 1.4
|
9 |
+
Requires at least: 4.2
|
10 |
Tested up to: 4.9
|
11 |
+
Domain Path: languages
|
12 |
+
Text Domain: wpserveur-hide-login
|
13 |
License: GPLv2 or later
|
14 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
15 |
*/
|
20 |
}
|
21 |
|
22 |
// Plugin constants
|
23 |
+
define( 'WPS_HIDE_LOGIN_VERSION', '1.4' );
|
24 |
define( 'WPS_HIDE_LOGIN_FOLDER', 'wps-hide-login' );
|
25 |
|
26 |
define( 'WPS_HIDE_LOGIN_URL', plugin_dir_url( __FILE__ ) );
|
27 |
define( 'WPS_HIDE_LOGIN_DIR', plugin_dir_path( __FILE__ ) );
|
28 |
define( 'WPS_HIDE_LOGIN_BASENAME', plugin_basename( __FILE__ ) );
|
29 |
|
30 |
+
require_once WPS_HIDE_LOGIN_DIR . 'autoload.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
register_activation_hook( __FILE__, array( '\WPS\WPS_Hide_Login\Plugin', 'activate' ) );
|
33 |
|
34 |
add_action( 'plugins_loaded', 'plugins_loaded_wps_hide_login_plugin' );
|
35 |
function plugins_loaded_wps_hide_login_plugin() {
|
36 |
+
\WPS\WPS_Hide_Login\Plugin::get_instance();
|
37 |
|
38 |
load_plugin_textdomain( 'wpserveur-hide-login', false, dirname( WPS_HIDE_LOGIN_BASENAME ) . '/languages' );
|
39 |
+
|
40 |
+
$message = __( 'Do you like plugin WPS Hide Login? <br> Thank you for taking a few seconds to note us on', 'wps-hide-login' );
|
41 |
+
if( 'fr_FR' === get_locale() ) {
|
42 |
+
$message = 'Vous aimez l\'extension WPS Hide Login ?<br>Merci de prendre quelques secondes pour nous noter sur';
|
43 |
+
}
|
44 |
+
|
45 |
+
new \WP_Review_Me(
|
46 |
+
array(
|
47 |
+
'days_after' => 10,
|
48 |
+
'type' => 'plugin',
|
49 |
+
'slug' => 'wps-hide-login',
|
50 |
+
'message' => $message,
|
51 |
+
'link_label' => 'WordPress.org'
|
52 |
+
)
|
53 |
+
);
|
54 |
}
|