Version Description
- 2017/06/05
- New: preview your URLs while typing.
- New: you can leave a field empty to set its default value.
- Improved URL duplicates detection.
- Fixed the "Lost Password" redirection (and others).
- Dev stuff: fixed the filters in
sfml_is_apache()
,sfml_is_iis7()
, andsfml_is_nginx()
. - Nerd stuff: improved the whole plugin code quality by updating the Coding Standard rules and applying new ones. Changed a few things in the class
SFML_Options
.
Download this release
Release Info
Developer | GregLone |
Plugin | Move Login |
Version | 2.5.3 |
Comparing to | |
See all releases |
Code changes from version 2.5.2 to 2.5.3
- assets/js/settings.js +379 -0
- assets/js/settings.min.js +1 -0
- inc/activate.php +7 -9
- inc/admin.php +2 -3
- inc/ajax.php +29 -0
- inc/classes/class-sfml-options.php +197 -102
- inc/classes/class-sfml-singleton.php +1 -1
- inc/functions/compat.php +3 -5
- inc/functions/deprecated.php +2 -4
- inc/functions/rewrite.php +18 -15
- inc/functions/settings-page.php +81 -34
- inc/functions/utilities.php +14 -7
- inc/redirections-and-dies.php +23 -3
- inc/url-filters.php +2 -4
- languages/sf-move-login-fr_FR.mo +0 -0
- languages/sf-move-login-fr_FR.po +59 -54
- languages/sf-move-login.pot +59 -53
- phpcs.xml +0 -41
- readme.txt +14 -3
- sf-move-login.php +9 -11
- uninstall.php +1 -3
assets/js/settings.js
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* globals jQuery: false, ajaxurl: false, sfml: true */
|
2 |
+
(function($, d, w, undefined) {
|
3 |
+
'use strict';
|
4 |
+
|
5 |
+
$.extend( sfml, {
|
6 |
+
/**
|
7 |
+
* Tha action used for the ajax call.
|
8 |
+
*
|
9 |
+
* @var string
|
10 |
+
*/
|
11 |
+
ajaxAction: 'sfml_sanitize_slug',
|
12 |
+
/**
|
13 |
+
* Used to cache ajax results.
|
14 |
+
*
|
15 |
+
* @var object
|
16 |
+
*/
|
17 |
+
cache: {},
|
18 |
+
/**
|
19 |
+
* Stores the last "cacheKey" used: it prevents displaying a late ajax result while a newer (cached) one is already displaying.
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
lastCacheKey: '',
|
24 |
+
/**
|
25 |
+
* Timeout used when typing in slug inputs.
|
26 |
+
*
|
27 |
+
* @var object
|
28 |
+
*/
|
29 |
+
timeout: {},
|
30 |
+
/**
|
31 |
+
* Duration for the timeout.
|
32 |
+
*
|
33 |
+
* @var int
|
34 |
+
*/
|
35 |
+
timeoutDuration: 500,
|
36 |
+
/**
|
37 |
+
* The HTML class used for the "dynamic URL".
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
dynSlugClass: 'dynamic-login-url-slug',
|
42 |
+
/**
|
43 |
+
* The HTML class used for the "dynamic URL".
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
dynErrorClass: 'dynamic-login-url-slug-error',
|
48 |
+
/**
|
49 |
+
* The slug fields.
|
50 |
+
*
|
51 |
+
* @var object A jQuery object.
|
52 |
+
*/
|
53 |
+
fields: $( '.slug-field' ),
|
54 |
+
/**
|
55 |
+
* Get an element by its id attribute.
|
56 |
+
*
|
57 |
+
* @return object An Element object.
|
58 |
+
*/
|
59 |
+
getElem: function( id ) {
|
60 |
+
return d.getElementById( id );
|
61 |
+
},
|
62 |
+
/**
|
63 |
+
* Get elements by their class attribute.
|
64 |
+
*
|
65 |
+
* @return object A list of Element objects.
|
66 |
+
*/
|
67 |
+
getElems: function( className ) {
|
68 |
+
return d.getElementsByClassName( className );
|
69 |
+
},
|
70 |
+
/**
|
71 |
+
* Sanitize a class.
|
72 |
+
*
|
73 |
+
* @param string className The class(es) to sanitize.
|
74 |
+
* @param string glue String used to separate each class. Default is a space character.
|
75 |
+
* @return string The sanitized class(es).
|
76 |
+
*/
|
77 |
+
sanitizeClass: function( className, glue ) {
|
78 |
+
if ( undefined === glue ) {
|
79 |
+
glue = ' ';
|
80 |
+
}
|
81 |
+
return className.replace( /^\s+|\s+$/g, '' ).replace( /\s+/, glue );
|
82 |
+
},
|
83 |
+
/**
|
84 |
+
* Tell if an element has a specific class.
|
85 |
+
*
|
86 |
+
* @param object elem The element. Can be a jQuery object or an Element object.
|
87 |
+
* @param string className The class to test against.
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
hasClass: function( elem, className ) {
|
91 |
+
if ( ! elem ) {
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
if ( elem instanceof jQuery ) {
|
95 |
+
return elem.hasClass( className );
|
96 |
+
}
|
97 |
+
if ( elem.classList ) {
|
98 |
+
return elem.classList.contains( className );
|
99 |
+
}
|
100 |
+
className = sfml.sanitizeClass( className );
|
101 |
+
return new RegExp( '(^| )' + className + '( |$)', 'gi' ).test( elem.className );
|
102 |
+
},
|
103 |
+
/**
|
104 |
+
* Add classes) to elements.
|
105 |
+
*
|
106 |
+
* @param object elems A list of elements. Can be a jQuery object, a list of Element objects, or a single Element object.
|
107 |
+
* @param string className The class(es) to add.
|
108 |
+
* @return object The elements.
|
109 |
+
*/
|
110 |
+
addClass: function( elems, className ) {
|
111 |
+
if ( elems instanceof jQuery ) {
|
112 |
+
elems.addClass( className );
|
113 |
+
return elems;
|
114 |
+
}
|
115 |
+
if ( ! elems ) {
|
116 |
+
return elems;
|
117 |
+
}
|
118 |
+
if ( elems instanceof Element ) {
|
119 |
+
elems = [ elems ];
|
120 |
+
}
|
121 |
+
$.each( elems, function( i, elem ) {
|
122 |
+
if ( elem.classList ) {
|
123 |
+
elems[ i ].classList.add( className );
|
124 |
+
} else if ( ! sfml.hasClass( elem, className ) ) {
|
125 |
+
elems[ i ].className = sfml.sanitizeClass( elem.className + ' ' + className );
|
126 |
+
}
|
127 |
+
} );
|
128 |
+
return elems;
|
129 |
+
},
|
130 |
+
/**
|
131 |
+
* Remove class(es) from elements.
|
132 |
+
*
|
133 |
+
* @param object elems A list of elements. Can be a jQuery object, a list of Element objects, or a single Element object.
|
134 |
+
* @param string className The class(es) to remove.
|
135 |
+
* @return object The elements.
|
136 |
+
*/
|
137 |
+
removeClass: function( elems, className ) {
|
138 |
+
if ( elems instanceof jQuery ) {
|
139 |
+
elems.removeClass( className );
|
140 |
+
return elems;
|
141 |
+
}
|
142 |
+
if ( ! elems ) {
|
143 |
+
return elems;
|
144 |
+
}
|
145 |
+
if ( elems instanceof Element ) {
|
146 |
+
elems = [ elems ];
|
147 |
+
}
|
148 |
+
$.each( elems, function( i, elem ) {
|
149 |
+
if ( elem.classList ) {
|
150 |
+
elems[ i ].classList.remove( className );
|
151 |
+
} else {
|
152 |
+
className = sfml.sanitizeClass( className, '|' );
|
153 |
+
elems[ i ].className = sfml.sanitizeClass( elem.className.replace( new RegExp( '(^|\\b)' + className + '(\\b|$)', 'gi' ), ' ' ) );
|
154 |
+
}
|
155 |
+
} );
|
156 |
+
return elems;
|
157 |
+
},
|
158 |
+
/**
|
159 |
+
* Add some text into an element.
|
160 |
+
*
|
161 |
+
* @param object elem The element. Can be a jQuery object or an Element object.
|
162 |
+
* @param string text The text.
|
163 |
+
* @return object The element.
|
164 |
+
*/
|
165 |
+
text: function( elem, text ) {
|
166 |
+
if ( ! elem ) {
|
167 |
+
return elem;
|
168 |
+
}
|
169 |
+
if ( elem instanceof jQuery ) {
|
170 |
+
elem.text( text );
|
171 |
+
} else if ( undefined !== elem.textContent ) {
|
172 |
+
elem.textContent = text;
|
173 |
+
} else {
|
174 |
+
elem.innerText = text;
|
175 |
+
}
|
176 |
+
return elem;
|
177 |
+
},
|
178 |
+
/**
|
179 |
+
* Add some html into an element.
|
180 |
+
*
|
181 |
+
* @param object elem The element. Can be a jQuery object or an Element object.
|
182 |
+
* @param string html The html.
|
183 |
+
* @return object The element.
|
184 |
+
*/
|
185 |
+
html: function( elem, html ) {
|
186 |
+
if ( ! elem ) {
|
187 |
+
return elem;
|
188 |
+
}
|
189 |
+
if ( elem instanceof jQuery ) {
|
190 |
+
elem.html( html );
|
191 |
+
} else {
|
192 |
+
elem.innerHTML = html;
|
193 |
+
}
|
194 |
+
return elem;
|
195 |
+
},
|
196 |
+
/**
|
197 |
+
* Get the login action from a text input.
|
198 |
+
*
|
199 |
+
* @param object elem Text input. Can be a jQuery object or a single Element object.
|
200 |
+
* @return string The login action.
|
201 |
+
*/
|
202 |
+
getActionFromInput: function( elem ) {
|
203 |
+
if ( elem instanceof jQuery ) {
|
204 |
+
return elem.attr( 'id' ).replace( 'slugs-', '' );
|
205 |
+
}
|
206 |
+
if ( ! elem ) {
|
207 |
+
return '';
|
208 |
+
}
|
209 |
+
return elem.id.replace( 'slugs-', '' );
|
210 |
+
},
|
211 |
+
/**
|
212 |
+
* Update a slug in a "dynamic URL" element.
|
213 |
+
*
|
214 |
+
* @param string action The login action.
|
215 |
+
* @param string slug The slug.
|
216 |
+
* @return object The element.
|
217 |
+
*/
|
218 |
+
updateSlug: function( action, slug ) {
|
219 |
+
var elem = sfml.getElem( sfml.dynSlugClass + '-' + action );
|
220 |
+
return sfml.text( elem, slug );
|
221 |
+
},
|
222 |
+
/**
|
223 |
+
* Add an error message next to a "dynamic URL" element.
|
224 |
+
*
|
225 |
+
* @param string action The login action.
|
226 |
+
* @param string message The slug.
|
227 |
+
* @return object The element.
|
228 |
+
*/
|
229 |
+
addError: function( action, message ) {
|
230 |
+
var elem = sfml.getElem( sfml.dynErrorClass + '-' + action );
|
231 |
+
sfml.lastCacheKey = '';
|
232 |
+
return sfml.html( elem, message );
|
233 |
+
},
|
234 |
+
/**
|
235 |
+
* Display the results.
|
236 |
+
*
|
237 |
+
* @param string action The login action.
|
238 |
+
* @param object result The results (like they are returned by the ajax call).
|
239 |
+
*/
|
240 |
+
displayResult: function( action, result ) {
|
241 |
+
sfml.updateSlug( action, result.slugs['slugs.' + action ] );
|
242 |
+
|
243 |
+
$.each( sfml.getElems( sfml.dynErrorClass ), function( i, elem ) {
|
244 |
+
var fieldAction = elem.id.replace( sfml.dynErrorClass + '-' , '' );
|
245 |
+
|
246 |
+
if ( undefined !== result.errors.forbidden[ fieldAction ] ) {
|
247 |
+
sfml.updateSlug( fieldAction, result.slugs['slugs.' + fieldAction ] );
|
248 |
+
sfml.html( elem, sfml.forbidden.replace( '%s', '<code>' + result.errors.forbidden[ fieldAction ] + '</code>' ) );
|
249 |
+
} else if ( undefined !== result.errors.duplicates[ fieldAction ] ) {
|
250 |
+
sfml.updateSlug( fieldAction, result.slugs['slugs.' + fieldAction ] );
|
251 |
+
sfml.text( elem, sfml.duplicate );
|
252 |
+
} else {
|
253 |
+
sfml.text( elem, '' );
|
254 |
+
}
|
255 |
+
} );
|
256 |
+
},
|
257 |
+
/**
|
258 |
+
* A simple setTimeout() shorthand.
|
259 |
+
*
|
260 |
+
* @param string callback The callback to perform.
|
261 |
+
* @param string id The setTimeout() ID.
|
262 |
+
*/
|
263 |
+
delay: function( callback, id ) {
|
264 |
+
sfml.resetDelay( id );
|
265 |
+
sfml.timeout[ id ] = w.setTimeout( callback, sfml.timeoutDuration );
|
266 |
+
},
|
267 |
+
/**
|
268 |
+
* A simple shorthand to reset a setTimeout().
|
269 |
+
*
|
270 |
+
* @param string id The setTimeout() ID.
|
271 |
+
*/
|
272 |
+
resetDelay: function( id ) {
|
273 |
+
if ( undefined !== sfml.timeout[ id ] ) {
|
274 |
+
w.clearTimeout( sfml.timeout[ id ] );
|
275 |
+
sfml.timeout[ id ] = undefined;
|
276 |
+
}
|
277 |
+
},
|
278 |
+
/**
|
279 |
+
* Tell if a keybord key is "forbidden".
|
280 |
+
*
|
281 |
+
* @param object e The event object.
|
282 |
+
* @return bool
|
283 |
+
*/
|
284 |
+
isForbiddenKey: function( e ) {
|
285 |
+
// Enter, Alt, Escape, Left Arrow, Top Arrow, Right Arrow, Bottom Arrow.
|
286 |
+
var keys = [ 13, 18, 27, 37, 38, 39, 40 ];
|
287 |
+
return 'keyup' === e.type && $.inArray( e.which, keys ) !== -1;
|
288 |
+
},
|
289 |
+
/**
|
290 |
+
* Callback used when the user defines new slugs.
|
291 |
+
*
|
292 |
+
* @param object e The event object.
|
293 |
+
*/
|
294 |
+
sanitizeSlugs: function( e ) {
|
295 |
+
var elem = this,
|
296 |
+
data = {},
|
297 |
+
cacheKey = '',
|
298 |
+
action;
|
299 |
+
|
300 |
+
if ( sfml.isForbiddenKey( e ) ) {
|
301 |
+
return false;
|
302 |
+
}
|
303 |
+
|
304 |
+
sfml.resetDelay( elem.id );
|
305 |
+
|
306 |
+
action = sfml.getActionFromInput( elem );
|
307 |
+
|
308 |
+
$.each( sfml.fields.serializeArray(), function( index, obj ) {
|
309 |
+
var name = obj.name.replace( /^sfml\[(.+)\]$/, '$1' );
|
310 |
+
cacheKey += name + ':' + obj.value + '|';
|
311 |
+
data[ name ] = obj.value;
|
312 |
+
} );
|
313 |
+
|
314 |
+
sfml.lastCacheKey = cacheKey;
|
315 |
+
|
316 |
+
if ( undefined !== sfml.cache[ cacheKey ] ) {
|
317 |
+
sfml.displayResult( action, sfml.cache[ cacheKey ] );
|
318 |
+
return true;
|
319 |
+
}
|
320 |
+
|
321 |
+
sfml.delay( function() {
|
322 |
+
var params = {
|
323 |
+
'action': sfml.ajaxAction,
|
324 |
+
'_wpnonce': sfml.nonce,
|
325 |
+
'slugs': data
|
326 |
+
};
|
327 |
+
|
328 |
+
if ( 'keyup' === e.type ) {
|
329 |
+
// No need to display the spinner on the init event.
|
330 |
+
sfml.addClass( elem, 'ui-autocomplete-loading' );
|
331 |
+
}
|
332 |
+
|
333 |
+
$.ajax( {
|
334 |
+
type: 'POST',
|
335 |
+
dataType: 'json',
|
336 |
+
url: ajaxurl,
|
337 |
+
data: params
|
338 |
+
} )
|
339 |
+
.done( function( r ) {
|
340 |
+
if ( ! $.isPlainObject( r ) ) {
|
341 |
+
sfml.addError( action, sfml.error );
|
342 |
+
return;
|
343 |
+
}
|
344 |
+
if ( ! r.success ) {
|
345 |
+
if ( 'nonce' === r.data ) {
|
346 |
+
sfml.addError( action, sfml.errorReload );
|
347 |
+
} else {
|
348 |
+
sfml.addError( action, sfml.error );
|
349 |
+
}
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
|
353 |
+
if ( undefined === sfml.cache[ cacheKey ] ) {
|
354 |
+
sfml.cache[ cacheKey ] = r.data;
|
355 |
+
}
|
356 |
+
|
357 |
+
if ( sfml.lastCacheKey === cacheKey ) {
|
358 |
+
sfml.displayResult( action, r.data );
|
359 |
+
}
|
360 |
+
} )
|
361 |
+
.fail( function() {
|
362 |
+
sfml.addError( action, sfml.error );
|
363 |
+
} )
|
364 |
+
.always( function() {
|
365 |
+
sfml.removeClass( elem, 'ui-autocomplete-loading' );
|
366 |
+
} );
|
367 |
+
}, elem.id );
|
368 |
+
},
|
369 |
+
/**
|
370 |
+
* Init (because I'm sure you couldn't guess with the function name).
|
371 |
+
*/
|
372 |
+
init: function() {
|
373 |
+
sfml.fields.on( 'keyup.sfml init.sfml', sfml.sanitizeSlugs ).first().trigger( 'init.sfml' );
|
374 |
+
}
|
375 |
+
} );
|
376 |
+
|
377 |
+
sfml.init();
|
378 |
+
|
379 |
+
} )(jQuery, document, window);
|
assets/js/settings.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(a,b,c,d){"use strict";a.extend(sfml,{ajaxAction:"sfml_sanitize_slug",cache:{},lastCacheKey:"",timeout:{},timeoutDuration:500,dynSlugClass:"dynamic-login-url-slug",dynErrorClass:"dynamic-login-url-slug-error",fields:a(".slug-field"),getElem:function(a){return b.getElementById(a)},getElems:function(a){return b.getElementsByClassName(a)},sanitizeClass:function(a,b){return void 0===b&&(b=" "),a.replace(/^\s+|\s+$/g,"").replace(/\s+/,b)},hasClass:function(a,b){return!!a&&(a instanceof jQuery?a.hasClass(b):a.classList?a.classList.contains(b):(b=sfml.sanitizeClass(b),new RegExp("(^| )"+b+"( |$)","gi").test(a.className)))},addClass:function(b,c){return b instanceof jQuery?(b.addClass(c),b):b?(b instanceof Element&&(b=[b]),a.each(b,function(a,d){d.classList?b[a].classList.add(c):sfml.hasClass(d,c)||(b[a].className=sfml.sanitizeClass(d.className+" "+c))}),b):b},removeClass:function(b,c){return b instanceof jQuery?(b.removeClass(c),b):b?(b instanceof Element&&(b=[b]),a.each(b,function(a,d){d.classList?b[a].classList.remove(c):(c=sfml.sanitizeClass(c,"|"),b[a].className=sfml.sanitizeClass(d.className.replace(new RegExp("(^|\\b)"+c+"(\\b|$)","gi")," ")))}),b):b},text:function(a,b){return a?(a instanceof jQuery?a.text(b):void 0!==a.textContent?a.textContent=b:a.innerText=b,a):a},html:function(a,b){return a?(a instanceof jQuery?a.html(b):a.innerHTML=b,a):a},getActionFromInput:function(a){return a instanceof jQuery?a.attr("id").replace("slugs-",""):a?a.id.replace("slugs-",""):""},updateSlug:function(a,b){var c=sfml.getElem(sfml.dynSlugClass+"-"+a);return sfml.text(c,b)},addError:function(a,b){var c=sfml.getElem(sfml.dynErrorClass+"-"+a);return sfml.lastCacheKey="",sfml.html(c,b)},displayResult:function(b,c){sfml.updateSlug(b,c.slugs["slugs."+b]),a.each(sfml.getElems(sfml.dynErrorClass),function(a,b){var d=b.id.replace(sfml.dynErrorClass+"-","");void 0!==c.errors.forbidden[d]?(sfml.updateSlug(d,c.slugs["slugs."+d]),sfml.html(b,sfml.forbidden.replace("%s","<code>"+c.errors.forbidden[d]+"</code>"))):void 0!==c.errors.duplicates[d]?(sfml.updateSlug(d,c.slugs["slugs."+d]),sfml.text(b,sfml.duplicate)):sfml.text(b,"")})},delay:function(a,b){sfml.resetDelay(b),sfml.timeout[b]=c.setTimeout(a,sfml.timeoutDuration)},resetDelay:function(a){void 0!==sfml.timeout[a]&&(c.clearTimeout(sfml.timeout[a]),sfml.timeout[a]=void 0)},isForbiddenKey:function(b){var c=[13,18,27,37,38,39,40];return"keyup"===b.type&&-1!==a.inArray(b.which,c)},sanitizeSlugs:function(b){var c,d=this,e={},f="";return!sfml.isForbiddenKey(b)&&(sfml.resetDelay(d.id),c=sfml.getActionFromInput(d),a.each(sfml.fields.serializeArray(),function(a,b){var c=b.name.replace(/^sfml\[(.+)\]$/,"$1");f+=c+":"+b.value+"|",e[c]=b.value}),sfml.lastCacheKey=f,void 0!==sfml.cache[f]?(sfml.displayResult(c,sfml.cache[f]),!0):void sfml.delay(function(){var g={action:sfml.ajaxAction,_wpnonce:sfml.nonce,slugs:e};"keyup"===b.type&&sfml.addClass(d,"ui-autocomplete-loading"),a.ajax({type:"POST",dataType:"json",url:ajaxurl,data:g}).done(function(b){return a.isPlainObject(b)?b.success?(void 0===sfml.cache[f]&&(sfml.cache[f]=b.data),void(sfml.lastCacheKey===f&&sfml.displayResult(c,b.data))):void("nonce"===b.data?sfml.addError(c,sfml.errorReload):sfml.addError(c,sfml.error)):void sfml.addError(c,sfml.error)}).fail(function(){sfml.addError(c,sfml.error)}).always(function(){sfml.removeClass(d,"ui-autocomplete-loading")})},d.id))},init:function(){sfml.fields.on("keyup.sfml init.sfml",sfml.sanitizeSlugs).first().trigger("init.sfml")}}),sfml.init()}(jQuery,document,window);
|
inc/activate.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !ACTIVATION ================================================================================== */
|
@@ -46,7 +44,7 @@ function sfml_activate() {
|
|
46 |
sfml_lang_init();
|
47 |
|
48 |
$dies = array_filter( array_map( 'sfml_notice_message', $dies ) );
|
49 |
-
|
50 |
$dies = sprintf( __( '%s has not been activated.', 'sf-move-login' ), '<strong>Move Login</strong>' ) . '<br/>' . implode( '<br/>', $dies );
|
51 |
|
52 |
wp_die( $dies, __( 'Error', 'sf-move-login' ), array( 'back_link' => true ) );
|
@@ -111,15 +109,15 @@ function sfml_notice_message( $message_id ) {
|
|
111 |
$link = '<a href="' . esc_url( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">Move Login</a>';
|
112 |
|
113 |
$messages = array(
|
114 |
-
|
115 |
'error_no_request_uri' => sprintf( __( 'It seems your server configuration prevents the plugin to work properly. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
116 |
-
|
117 |
'error_no_mod_rewrite' => sprintf( __( 'It seems the url rewrite module is not activated on your server. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
118 |
-
|
119 |
'error_unknown_server_conf' => sprintf( __( 'It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won\'t work.', 'sf-move-login' ), '<i>Apache</i>', '<i>Nginx</i>', '<i>IIS7</i>', '<strong>Move Login</strong>' ),
|
120 |
-
|
121 |
'error_file_not_writable' => sprintf( __( '%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file.', 'sf-move-login' ), '<strong>Move Login</strong>', $file, $link ),
|
122 |
-
|
123 |
'updated_is_nginx' => sprintf( __( 'It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won\'t work correctly until you deal with those rewrite rules.', 'sf-move-login' ), '<i>Nginx</i>', $link, '<strong>Move Login</strong>' ),
|
124 |
);
|
125 |
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/*------------------------------------------------------------------------------------------------*/
|
5 |
/* !ACTIVATION ================================================================================== */
|
44 |
sfml_lang_init();
|
45 |
|
46 |
$dies = array_filter( array_map( 'sfml_notice_message', $dies ) );
|
47 |
+
/* translators: 1 is the plugin name. */
|
48 |
$dies = sprintf( __( '%s has not been activated.', 'sf-move-login' ), '<strong>Move Login</strong>' ) . '<br/>' . implode( '<br/>', $dies );
|
49 |
|
50 |
wp_die( $dies, __( 'Error', 'sf-move-login' ), array( 'back_link' => true ) );
|
109 |
$link = '<a href="' . esc_url( is_multisite() ? network_admin_url( 'settings.php?page=move-login' ) : admin_url( 'options-general.php?page=move-login' ) ) . '">Move Login</a>';
|
110 |
|
111 |
$messages = array(
|
112 |
+
/* translators: 1 is the plugin name. */
|
113 |
'error_no_request_uri' => sprintf( __( 'It seems your server configuration prevents the plugin to work properly. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
114 |
+
/* translators: 1 is the plugin name. */
|
115 |
'error_no_mod_rewrite' => sprintf( __( 'It seems the url rewrite module is not activated on your server. %s won\'t work.', 'sf-move-login' ), '<strong>Move Login</strong>' ),
|
116 |
+
/* translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name. */
|
117 |
'error_unknown_server_conf' => sprintf( __( 'It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won\'t work.', 'sf-move-login' ), '<i>Apache</i>', '<i>Nginx</i>', '<i>IIS7</i>', '<strong>Move Login</strong>' ),
|
118 |
+
/* translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link. */
|
119 |
'error_file_not_writable' => sprintf( __( '%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file.', 'sf-move-login' ), '<strong>Move Login</strong>', $file, $link ),
|
120 |
+
/* translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name. */
|
121 |
'updated_is_nginx' => sprintf( __( 'It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won\'t work correctly until you deal with those rewrite rules.', 'sf-move-login' ), '<i>Nginx</i>', $link, '<strong>Move Login</strong>' ),
|
122 |
);
|
123 |
|
inc/admin.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !LINKS IN THE PLUGIN ROW ===================================================================== */
|
@@ -62,6 +60,7 @@ function sfml_plugin_row_meta( $plugin_meta, $plugin_file ) {
|
|
62 |
$links[] = sprintf( '<a href="%s">%s</a>', $author['url'], $author['name'] );
|
63 |
}
|
64 |
|
|
|
65 |
$links = sprintf( __( 'By %s' ), wp_sprintf( '%l', $links ) );
|
66 |
|
67 |
if ( false !== $pos ) {
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/*------------------------------------------------------------------------------------------------*/
|
5 |
/* !LINKS IN THE PLUGIN ROW ===================================================================== */
|
60 |
$links[] = sprintf( '<a href="%s">%s</a>', $author['url'], $author['name'] );
|
61 |
}
|
62 |
|
63 |
+
/* translators: %s is a person name. But you don't care, you don't have to translate it. */
|
64 |
$links = sprintf( __( 'By %s' ), wp_sprintf( '%l', $links ) );
|
65 |
|
66 |
if ( false !== $pos ) {
|
inc/ajax.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
3 |
+
|
4 |
+
add_action( 'wp_ajax_sfml_sanitize_slug', 'sfml_sanitize_slug_ajax_post_cb' );
|
5 |
+
/**
|
6 |
+
* Sanitize all slugs via ajax.
|
7 |
+
*
|
8 |
+
* @since 2.5.3
|
9 |
+
*/
|
10 |
+
function sfml_sanitize_slug_ajax_post_cb() {
|
11 |
+
// Make all security tests.
|
12 |
+
if ( false === check_ajax_referer( 'sfml_sanitize_slug', false, false ) ) {
|
13 |
+
wp_send_json_error( 'nonce' );
|
14 |
+
}
|
15 |
+
|
16 |
+
$capacity = is_multisite() ? 'manage_network_options' : 'manage_options';
|
17 |
+
|
18 |
+
if ( ! current_user_can( $capacity ) ) {
|
19 |
+
wp_send_json_error( 'capacity' );
|
20 |
+
}
|
21 |
+
|
22 |
+
if ( empty( $_POST['slugs'] ) || ! is_array( $_POST['slugs'] ) ) {
|
23 |
+
wp_send_json_error( 'entry' );
|
24 |
+
}
|
25 |
+
|
26 |
+
$slugs = SFML_Options::get_instance()->sanitize_slugs( $_POST['slugs'] );
|
27 |
+
|
28 |
+
wp_send_json_success( $slugs );
|
29 |
+
}
|
inc/classes/class-sfml-options.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/**
|
7 |
* Singleton class.
|
@@ -73,8 +71,8 @@ class SFML_Options extends SFML_Singleton {
|
|
73 |
}
|
74 |
|
75 |
$new_whitelist_options = isset( $new_whitelist_options ) && is_array( $new_whitelist_options ) ? $new_whitelist_options : array(); // WPCS: override ok.
|
76 |
-
$new_whitelist_options[ static::OPTION_GROUP ] = isset( $new_whitelist_options[ static::OPTION_GROUP ] ) && is_array( $new_whitelist_options[ static::OPTION_GROUP ] ) ? $new_whitelist_options[ static::OPTION_GROUP ] : array();
|
77 |
-
$new_whitelist_options[ static::OPTION_GROUP ][] = static::OPTION_NAME;
|
78 |
} elseif ( is_admin() ) {
|
79 |
$whitelist = sfml_cache_data( 'new_whitelist_network_options' );
|
80 |
$whitelist = is_array( $whitelist ) ? $whitelist : array();
|
@@ -107,7 +105,6 @@ class SFML_Options extends SFML_Singleton {
|
|
107 |
|
108 |
// Default slugs.
|
109 |
$this->options_default = array(
|
110 |
-
'slugs.postpass' => 'postpass',
|
111 |
'slugs.logout' => 'logout',
|
112 |
'slugs.lostpassword' => 'lostpassword',
|
113 |
'slugs.resetpass' => 'resetpass',
|
@@ -230,73 +227,34 @@ class SFML_Options extends SFML_Singleton {
|
|
230 |
|
231 |
|
232 |
/**
|
233 |
-
* Get the slugs.
|
234 |
*
|
235 |
* @return (array)
|
236 |
*/
|
237 |
public function get_slugs() {
|
238 |
$this->maybe_clear_options_cache();
|
239 |
|
240 |
-
if (
|
241 |
-
$this->slugs
|
242 |
}
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Get sub-options.
|
250 |
-
*
|
251 |
-
* For example:
|
252 |
-
* static::get_sub_options( 'foo', array(
|
253 |
-
* 'option1' => 'value1',
|
254 |
-
* 'foo.option2' => 'value2',
|
255 |
-
* 'foo.option3' => 'value3',
|
256 |
-
* ) );
|
257 |
-
* Will return:
|
258 |
-
* array(
|
259 |
-
* 'option2' => 'value2',
|
260 |
-
* 'option3' => 'value3',
|
261 |
-
* )
|
262 |
-
*
|
263 |
-
* @param (string) $name The sub-option name.
|
264 |
-
* @param (array) $options Array of options.
|
265 |
-
*
|
266 |
-
* @return (array)
|
267 |
-
*/
|
268 |
-
public static function get_sub_options( $name, $options ) {
|
269 |
-
if ( ! $options || ! $name ) {
|
270 |
-
return array();
|
271 |
-
}
|
272 |
-
|
273 |
-
$options = (array) $options;
|
274 |
-
|
275 |
-
if ( isset( $options[ $name ] ) ) {
|
276 |
-
return $options[ $name ];
|
277 |
-
}
|
278 |
-
|
279 |
-
$group = array();
|
280 |
-
$name = rtrim( $name, '.' ) . '.';
|
281 |
-
|
282 |
-
foreach ( $options as $k => $v ) {
|
283 |
-
if ( 0 === strpos( $k, $name ) ) {
|
284 |
-
$group[ substr( $k, strlen( $name ) ) ] = $v;
|
285 |
-
}
|
286 |
-
}
|
287 |
|
288 |
-
return
|
289 |
}
|
290 |
|
291 |
|
292 |
/*--------------------------------------------------------------------------------------------*/
|
293 |
-
/* !FIELD LABELS
|
294 |
/*--------------------------------------------------------------------------------------------*/
|
295 |
|
296 |
/**
|
297 |
* Get the possible choices for a specific option.
|
298 |
*
|
299 |
-
* @since
|
300 |
*
|
301 |
* @param (string) $option The option name.
|
302 |
*
|
@@ -396,61 +354,25 @@ class SFML_Options extends SFML_Singleton {
|
|
396 |
* @return (array)
|
397 |
*/
|
398 |
public function sanitize_options( $options = array() ) {
|
399 |
-
$
|
400 |
-
$old_options = get_site_option( static::OPTION_NAME );
|
401 |
-
$errors = array( 'forbidden' => array(), 'duplicates' => array() );
|
402 |
|
403 |
// Add and sanitize slugs.
|
404 |
-
$
|
405 |
-
$
|
406 |
-
$
|
407 |
-
|
408 |
-
foreach ( $default_slugs as $slug_key => $default_slug ) {
|
409 |
-
|
410 |
-
if ( isset( $exclude[ $slug_key ] ) ) {
|
411 |
-
$sanitized_options[ 'slugs.' . $slug_key ] = $exclude[ $slug_key ];
|
412 |
-
continue;
|
413 |
-
}
|
414 |
-
|
415 |
-
$sanitized_options[ 'slugs.' . $slug_key ] = false;
|
416 |
-
|
417 |
-
if ( ! empty( $options[ 'slugs.' . $slug_key ] ) ) {
|
418 |
-
$tmp_slug = sanitize_title( $options[ 'slugs.' . $slug_key ], $default_slug );
|
419 |
-
|
420 |
-
// 'postpass', 'retrievepassword' and 'rp' are forbidden.
|
421 |
-
if ( in_array( $tmp_slug, $exclude, true ) ) {
|
422 |
-
$errors['forbidden'][] = $tmp_slug;
|
423 |
-
}
|
424 |
-
// Make sure the slug is not already set for another action.
|
425 |
-
elseif ( in_array( $tmp_slug, $sanitized_options, true ) ) {
|
426 |
-
$errors['duplicates'][] = $tmp_slug;
|
427 |
-
}
|
428 |
-
// Yay!
|
429 |
-
else {
|
430 |
-
$sanitized_options[ 'slugs.' . $slug_key ] = $tmp_slug;
|
431 |
-
}
|
432 |
-
}
|
433 |
-
|
434 |
-
// Fallback to old value or default value.
|
435 |
-
if ( ! $sanitized_options[ 'slugs.' . $slug_key ] ) {
|
436 |
-
if ( ! isset( $exclude[ $slug_key ] ) && ! empty( $old_options[ 'slugs.' . $slug_key ] ) ) {
|
437 |
-
$sanitized_options[ 'slugs.' . $slug_key ] = sanitize_title( $old_options[ 'slugs.' . $slug_key ], $default_slug );
|
438 |
-
} else {
|
439 |
-
$sanitized_options[ 'slugs.' . $slug_key ] = $default_slug;
|
440 |
-
}
|
441 |
-
}
|
442 |
-
}
|
443 |
|
444 |
// Add and sanitize other options.
|
445 |
$default_options = $this->get_other_default_options();
|
446 |
|
447 |
foreach ( $default_options as $option_name => $default_value ) {
|
448 |
-
|
449 |
if ( isset( $options[ $option_name ] ) ) {
|
|
|
450 |
$sanitized_options[ $option_name ] = (int) $options[ $option_name ];
|
451 |
} elseif ( isset( $old_options[ $option_name ] ) ) {
|
|
|
452 |
$sanitized_options[ $option_name ] = (int) $old_options[ $option_name ];
|
453 |
} else {
|
|
|
454 |
$sanitized_options[ $option_name ] = $default_value;
|
455 |
continue;
|
456 |
}
|
@@ -458,6 +380,7 @@ class SFML_Options extends SFML_Singleton {
|
|
458 |
$choices = $this->get_field_labels( $option_name );
|
459 |
|
460 |
if ( ! isset( $choices[ $sanitized_options[ $option_name ] ] ) ) {
|
|
|
461 |
$sanitized_options[ $option_name ] = $default_value;
|
462 |
}
|
463 |
}
|
@@ -493,7 +416,7 @@ class SFML_Options extends SFML_Singleton {
|
|
493 |
$errors['duplicates'] = array_unique( $errors['duplicates'] );
|
494 |
|
495 |
if ( $nbr_forbidden = count( $errors['forbidden'] ) ) {
|
496 |
-
|
497 |
add_settings_error( 'sfml_settings', 'forbidden-slugs', sprintf( _n( 'The slug %s is forbidden.', 'The slugs %s are forbidden.', $nbr_forbidden, 'sf-move-login' ), wp_sprintf( '<code>%l</code>', $errors['forbidden'] ) ) );
|
498 |
}
|
499 |
if ( ! empty( $errors['duplicates'] ) ) {
|
@@ -505,19 +428,147 @@ class SFML_Options extends SFML_Singleton {
|
|
505 |
}
|
506 |
|
507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
/*--------------------------------------------------------------------------------------------*/
|
509 |
/* !VARIOUS ================================================================================= */
|
510 |
/*--------------------------------------------------------------------------------------------*/
|
511 |
|
512 |
/**
|
513 |
-
*
|
|
|
514 |
*
|
515 |
* @return (array)
|
516 |
*/
|
517 |
public function get_other_actions() {
|
518 |
return array_diff_key( array(
|
519 |
-
'
|
520 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
), $this->get_slug_field_labels() );
|
522 |
}
|
523 |
|
@@ -542,4 +593,48 @@ class SFML_Options extends SFML_Singleton {
|
|
542 |
remove_all_filters( static::OPTION_NAME . '_clear_options_cache' );
|
543 |
}
|
544 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
}
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/**
|
5 |
* Singleton class.
|
71 |
}
|
72 |
|
73 |
$new_whitelist_options = isset( $new_whitelist_options ) && is_array( $new_whitelist_options ) ? $new_whitelist_options : array(); // WPCS: override ok.
|
74 |
+
$new_whitelist_options[ static::OPTION_GROUP ] = isset( $new_whitelist_options[ static::OPTION_GROUP ] ) && is_array( $new_whitelist_options[ static::OPTION_GROUP ] ) ? $new_whitelist_options[ static::OPTION_GROUP ] : array(); // WPCS: override ok.
|
75 |
+
$new_whitelist_options[ static::OPTION_GROUP ][] = static::OPTION_NAME; // WPCS: override ok.
|
76 |
} elseif ( is_admin() ) {
|
77 |
$whitelist = sfml_cache_data( 'new_whitelist_network_options' );
|
78 |
$whitelist = is_array( $whitelist ) ? $whitelist : array();
|
105 |
|
106 |
// Default slugs.
|
107 |
$this->options_default = array(
|
|
|
108 |
'slugs.logout' => 'logout',
|
109 |
'slugs.lostpassword' => 'lostpassword',
|
110 |
'slugs.resetpass' => 'resetpass',
|
227 |
|
228 |
|
229 |
/**
|
230 |
+
* Get the slugs that will be rewritten.
|
231 |
*
|
232 |
* @return (array)
|
233 |
*/
|
234 |
public function get_slugs() {
|
235 |
$this->maybe_clear_options_cache();
|
236 |
|
237 |
+
if ( isset( $this->slugs ) ) {
|
238 |
+
return $this->slugs;
|
239 |
}
|
240 |
|
241 |
+
$this->slugs = array_merge(
|
242 |
+
$this->get_non_customizable_actions(),
|
243 |
+
static::get_sub_options( 'slugs', $this->get_options() )
|
244 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
+
return $this->slugs;
|
247 |
}
|
248 |
|
249 |
|
250 |
/*--------------------------------------------------------------------------------------------*/
|
251 |
+
/* !FIELD LABELS ============================================================================ */
|
252 |
/*--------------------------------------------------------------------------------------------*/
|
253 |
|
254 |
/**
|
255 |
* Get the possible choices for a specific option.
|
256 |
*
|
257 |
+
* @since 2.5.2
|
258 |
*
|
259 |
* @param (string) $option The option name.
|
260 |
*
|
354 |
* @return (array)
|
355 |
*/
|
356 |
public function sanitize_options( $options = array() ) {
|
357 |
+
$old_options = get_site_option( static::OPTION_NAME );
|
|
|
|
|
358 |
|
359 |
// Add and sanitize slugs.
|
360 |
+
$sanitized_options = $this->sanitize_slugs( $options );
|
361 |
+
$errors = $sanitized_options['errors'];
|
362 |
+
$sanitized_options = $sanitized_options['slugs'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
// Add and sanitize other options.
|
365 |
$default_options = $this->get_other_default_options();
|
366 |
|
367 |
foreach ( $default_options as $option_name => $default_value ) {
|
|
|
368 |
if ( isset( $options[ $option_name ] ) ) {
|
369 |
+
// Yay!
|
370 |
$sanitized_options[ $option_name ] = (int) $options[ $option_name ];
|
371 |
} elseif ( isset( $old_options[ $option_name ] ) ) {
|
372 |
+
// Old value.
|
373 |
$sanitized_options[ $option_name ] = (int) $old_options[ $option_name ];
|
374 |
} else {
|
375 |
+
// Default value.
|
376 |
$sanitized_options[ $option_name ] = $default_value;
|
377 |
continue;
|
378 |
}
|
380 |
$choices = $this->get_field_labels( $option_name );
|
381 |
|
382 |
if ( ! isset( $choices[ $sanitized_options[ $option_name ] ] ) ) {
|
383 |
+
// Oh no.
|
384 |
$sanitized_options[ $option_name ] = $default_value;
|
385 |
}
|
386 |
}
|
416 |
$errors['duplicates'] = array_unique( $errors['duplicates'] );
|
417 |
|
418 |
if ( $nbr_forbidden = count( $errors['forbidden'] ) ) {
|
419 |
+
/* translators: %s is an URL slug name. */
|
420 |
add_settings_error( 'sfml_settings', 'forbidden-slugs', sprintf( _n( 'The slug %s is forbidden.', 'The slugs %s are forbidden.', $nbr_forbidden, 'sf-move-login' ), wp_sprintf( '<code>%l</code>', $errors['forbidden'] ) ) );
|
421 |
}
|
422 |
if ( ! empty( $errors['duplicates'] ) ) {
|
428 |
}
|
429 |
|
430 |
|
431 |
+
/**
|
432 |
+
* Sanitize slugs.
|
433 |
+
*
|
434 |
+
* @param (array) $raw_slugs Slugs to sanitize.
|
435 |
+
*
|
436 |
+
* @return (array) An array containing the sanitized slugs and possible errors.
|
437 |
+
*/
|
438 |
+
public function sanitize_slugs( $raw_slugs = array() ) {
|
439 |
+
$default_slugs = static::get_sub_options( 'slugs', $this->get_default_options() );
|
440 |
+
$old_slugs = get_site_option( static::OPTION_NAME );
|
441 |
+
$old_slugs = is_array( $old_slugs ) && $old_slugs ? static::get_sub_options( 'slugs', $old_slugs ) : array();
|
442 |
+
$old_slugs = array_merge( $default_slugs, $old_slugs );
|
443 |
+
$exclude = $this->get_other_actions();
|
444 |
+
$raw_slugs = $raw_slugs && is_array( $raw_slugs ) ? array_map( 'trim', $raw_slugs ) : array();
|
445 |
+
$output = array(
|
446 |
+
'slugs' => array(),
|
447 |
+
'errors' => array(
|
448 |
+
'forbidden' => array(),
|
449 |
+
'duplicates' => array(),
|
450 |
+
),
|
451 |
+
);
|
452 |
+
|
453 |
+
// First, sanitize the old slugs.
|
454 |
+
foreach ( $old_slugs as $action => $old_slug ) {
|
455 |
+
$old_slug = sanitize_title( $old_slug );
|
456 |
+
$old_slugs[ $action ] = $old_slug ? $old_slug : $default_slugs[ $action ];
|
457 |
+
}
|
458 |
+
|
459 |
+
// Then, make sure there are no duplicates within the old slugs.
|
460 |
+
$slugs_count = count( $old_slugs );
|
461 |
+
$unique_slugs_count = count( array_unique( $old_slugs ) );
|
462 |
+
|
463 |
+
while ( $unique_slugs_count < $slugs_count ) {
|
464 |
+
$tmp_old_slugs = $old_slugs;
|
465 |
+
|
466 |
+
foreach ( $old_slugs as $action => $old_slug ) {
|
467 |
+
$other_slugs = $old_slugs;
|
468 |
+
unset( $other_slugs[ $action ] );
|
469 |
+
|
470 |
+
if ( ! in_array( $slug, $other_slugs, true ) ) {
|
471 |
+
// Not a duplicate.
|
472 |
+
$tmp_old_slugs[ $action ] = $old_slug;
|
473 |
+
} else {
|
474 |
+
// Use the default slug (we know it is unique within the default slugs).
|
475 |
+
$tmp_old_slugs[ $action ] = $default_slugs[ $action ];
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
$old_slugs = $tmp_old_slugs;
|
480 |
+
$slugs_count = count( $old_slugs );
|
481 |
+
$unique_slugs_count = count( array_unique( $old_slugs ) );
|
482 |
+
}
|
483 |
+
|
484 |
+
// Sanitize the new slugs and make sure they are not forbidden.
|
485 |
+
foreach ( $default_slugs as $action => $default_slug ) {
|
486 |
+
$input_name = 'slugs.' . $action;
|
487 |
+
|
488 |
+
// First, determinate a fallback.
|
489 |
+
if ( empty( $raw_slugs[ $input_name ] ) ) {
|
490 |
+
// If the field was left empty, fallback to the default slug.
|
491 |
+
$fallback = $default_slug;
|
492 |
+
} else {
|
493 |
+
// Use the previous slug (or the default one).
|
494 |
+
$fallback = $old_slugs[ $action ];
|
495 |
+
}
|
496 |
+
|
497 |
+
$new_slug = sanitize_title( $raw_slugs[ 'slugs.' . $action ], $fallback );
|
498 |
+
|
499 |
+
$output['slugs'][ 'slugs.' . $action ] = $new_slug ? $new_slug : $fallback;
|
500 |
+
|
501 |
+
// 'postpass', 'retrievepassword' and 'rp' are forbidden by default.
|
502 |
+
if ( isset( $exclude[ $new_slug ] ) ) {
|
503 |
+
$output['errors']['forbidden'][ $action ] = $new_slug;
|
504 |
+
$output['slugs'][ 'slugs.' . $action ] = $fallback;
|
505 |
+
}
|
506 |
+
}
|
507 |
+
|
508 |
+
// Look for duplicates.
|
509 |
+
$slugs_count = count( $output['slugs'] );
|
510 |
+
$unique_slugs_count = count( array_unique( $output['slugs'] ) );
|
511 |
+
|
512 |
+
while ( $unique_slugs_count < $slugs_count ) {
|
513 |
+
$new_slugs = $output['slugs'];
|
514 |
+
|
515 |
+
foreach ( $output['slugs'] as $input_name => $slug ) {
|
516 |
+
$other_slugs = $output['slugs'];
|
517 |
+
unset( $other_slugs[ $input_name ] );
|
518 |
+
|
519 |
+
if ( ! in_array( $slug, $other_slugs, true ) ) {
|
520 |
+
// Not a duplicate.
|
521 |
+
$new_slugs[ $input_name ] = $slug;
|
522 |
+
continue;
|
523 |
+
}
|
524 |
+
|
525 |
+
$action = str_replace( 'slugs.', '', $input_name );
|
526 |
+
|
527 |
+
// Use the previous slug (we know it is unique within the old slugs).
|
528 |
+
$new_slugs[ $input_name ] = $old_slugs[ $action ];
|
529 |
+
$output['errors']['duplicates'][ $action ] = $old_slugs[ $action ];
|
530 |
+
}
|
531 |
+
|
532 |
+
$output['slugs'] = $new_slugs;
|
533 |
+
$slugs_count = count( $output['slugs'] );
|
534 |
+
$unique_slugs_count = count( array_unique( $output['slugs'] ) );
|
535 |
+
}
|
536 |
+
|
537 |
+
return $output;
|
538 |
+
}
|
539 |
+
|
540 |
+
|
541 |
/*--------------------------------------------------------------------------------------------*/
|
542 |
/* !VARIOUS ================================================================================= */
|
543 |
/*--------------------------------------------------------------------------------------------*/
|
544 |
|
545 |
/**
|
546 |
+
* Get the original login actions that are not listed in the settings page.
|
547 |
+
* Plugins can add them to the settings page though.
|
548 |
*
|
549 |
* @return (array)
|
550 |
*/
|
551 |
public function get_other_actions() {
|
552 |
return array_diff_key( array(
|
553 |
+
'postpass' => 'postpass', // Not customizable.
|
554 |
+
'retrievepassword' => 'retrievepassword', // Alias for lostpassword, not used by WP.
|
555 |
+
'rp' => 'rp', // Alias for resetpass, not used by WP.
|
556 |
+
), $this->get_slug_field_labels() );
|
557 |
+
}
|
558 |
+
|
559 |
+
|
560 |
+
/**
|
561 |
+
* Get the original login actions that will be rewritten but are not listed in the settings page.
|
562 |
+
* Those actions don't redirect to other login actions (and the visitors don't see them), so there's no need to bother the user with a useless setting.
|
563 |
+
* Plugins can add them to the settings page though.
|
564 |
+
*
|
565 |
+
* @since 2.5.3
|
566 |
+
*
|
567 |
+
* @return (array)
|
568 |
+
*/
|
569 |
+
public function get_non_customizable_actions() {
|
570 |
+
return array_diff_key( array(
|
571 |
+
'postpass' => 'postpass',
|
572 |
), $this->get_slug_field_labels() );
|
573 |
}
|
574 |
|
593 |
remove_all_filters( static::OPTION_NAME . '_clear_options_cache' );
|
594 |
}
|
595 |
}
|
596 |
+
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Get sub-options.
|
600 |
+
*
|
601 |
+
* For example:
|
602 |
+
* static::get_sub_options( 'foo', array(
|
603 |
+
* 'option1' => 'value1',
|
604 |
+
* 'foo.option2' => 'value2',
|
605 |
+
* 'foo.option3' => 'value3',
|
606 |
+
* ) );
|
607 |
+
* Will return:
|
608 |
+
* array(
|
609 |
+
* 'option2' => 'value2',
|
610 |
+
* 'option3' => 'value3',
|
611 |
+
* )
|
612 |
+
*
|
613 |
+
* @param (string) $name The sub-option name.
|
614 |
+
* @param (array) $options Array of options.
|
615 |
+
*
|
616 |
+
* @return (array)
|
617 |
+
*/
|
618 |
+
public static function get_sub_options( $name, $options ) {
|
619 |
+
if ( ! $options || ! $name ) {
|
620 |
+
return array();
|
621 |
+
}
|
622 |
+
|
623 |
+
$options = (array) $options;
|
624 |
+
|
625 |
+
if ( isset( $options[ $name ] ) ) {
|
626 |
+
return $options[ $name ];
|
627 |
+
}
|
628 |
+
|
629 |
+
$group = array();
|
630 |
+
$name = rtrim( $name, '.' ) . '.';
|
631 |
+
|
632 |
+
foreach ( $options as $k => $v ) {
|
633 |
+
if ( 0 === strpos( $k, $name ) ) {
|
634 |
+
$group[ substr( $k, strlen( $name ) ) ] = $v;
|
635 |
+
}
|
636 |
+
}
|
637 |
+
|
638 |
+
return ! empty( $group ) ? $group : null;
|
639 |
+
}
|
640 |
}
|
inc/classes/class-sfml-singleton.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
defined( 'ABSPATH' )
|
3 |
|
4 |
/**
|
5 |
* Singleton class.
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
3 |
|
4 |
/**
|
5 |
* Singleton class.
|
inc/functions/compat.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
if ( ! function_exists( 'set_url_scheme' ) ) :
|
7 |
/**
|
@@ -74,7 +72,7 @@ if ( ! function_exists( 'wp_is_writable' ) ) :
|
|
74 |
if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
|
75 |
return win_is_writable( $path );
|
76 |
}
|
77 |
-
return @
|
78 |
}
|
79 |
endif;
|
80 |
|
@@ -123,7 +121,7 @@ if ( ! function_exists( 'wp_parse_url' ) ) :
|
|
123 |
$url = 'placeholder://placeholder' . $url;
|
124 |
}
|
125 |
|
126 |
-
$parts = @
|
127 |
|
128 |
if ( false === $parts ) {
|
129 |
// Parsing failure.
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
if ( ! function_exists( 'set_url_scheme' ) ) :
|
5 |
/**
|
72 |
if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
|
73 |
return win_is_writable( $path );
|
74 |
}
|
75 |
+
return @call_user_func( 'is_writable', $path );
|
76 |
}
|
77 |
endif;
|
78 |
|
121 |
$url = 'placeholder://placeholder' . $url;
|
122 |
}
|
123 |
|
124 |
+
$parts = @call_user_func( 'parse_url', $url );
|
125 |
|
126 |
if ( false === $parts ) {
|
127 |
// Parsing failure.
|
inc/functions/deprecated.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
|
7 |
/**
|
@@ -17,7 +15,7 @@ function sfml_maybe_deny_admin_redirect() {
|
|
17 |
_deprecated_function( __FUNCTION__, '2.5', 'sfml_maybe_deny_login_redirect' );
|
18 |
|
19 |
// If it's not the administration area, or if it's an ajax call, no need to go further.
|
20 |
-
if ( ! ( is_admin() && ! ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( 'admin-post.php' === $pagenow && ! empty( $_REQUEST['action'] ) ) ) ) ) {
|
21 |
return;
|
22 |
}
|
23 |
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
|
5 |
/**
|
15 |
_deprecated_function( __FUNCTION__, '2.5', 'sfml_maybe_deny_login_redirect' );
|
16 |
|
17 |
// If it's not the administration area, or if it's an ajax call, no need to go further.
|
18 |
+
if ( ! ( is_admin() && ! ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( 'admin-post.php' === $pagenow && ! empty( $_REQUEST['action'] ) ) ) ) ) { // WPCS: CSRF ok.
|
19 |
return;
|
20 |
}
|
21 |
|
inc/functions/rewrite.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !INCLUDES ==================================================================================== */
|
@@ -25,6 +23,8 @@ require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
|
25 |
function sfml_rules( $actions = null ) {
|
26 |
if ( ! $actions || ! is_array( $actions ) ) {
|
27 |
$actions = sfml_get_slugs();
|
|
|
|
|
28 |
}
|
29 |
|
30 |
$rules = array();
|
@@ -102,16 +102,17 @@ function sfml_get_rewrite_bases() {
|
|
102 |
return $bases;
|
103 |
}
|
104 |
|
105 |
-
$base =
|
|
|
106 |
$wp_dir = sfml_get_wp_directory(); // WP in its own directory.
|
107 |
$is_sub = sfml_is_subfolder_install(); // MultiSite by sub-folders.
|
108 |
$site_dir = $base . ltrim( $wp_dir, '/' );
|
109 |
|
110 |
$bases = array(
|
111 |
-
'base' => $base, // '/' or '/sub-dir/'.
|
112 |
-
'wp_dir' => $wp_dir, // '' or '/wp-dir/'.
|
113 |
-
'site_dir' => $site_dir, // '/', '/wp-dir/', '/sub-dir/', or '/sub-dir/wp-dir/'.
|
114 |
-
'is_sub' => $is_sub, //
|
115 |
);
|
116 |
|
117 |
// Apache.
|
@@ -302,8 +303,9 @@ function sfml_insert_apache_rewrite_rules( $rules = array() ) {
|
|
302 |
$rules = '';
|
303 |
}
|
304 |
|
|
|
305 |
$htaccess_file = sfml_get_home_path() . '.htaccess';
|
306 |
-
$has_htaccess =
|
307 |
|
308 |
if ( ! $rules ) {
|
309 |
// We want to remove the rules.
|
@@ -326,7 +328,7 @@ function sfml_insert_apache_rewrite_rules( $rules = array() ) {
|
|
326 |
|
327 |
$marker = 'SF Move Login';
|
328 |
// Current htaccess content.
|
329 |
-
$content = $has_htaccess ?
|
330 |
// Remove the SF Move Login marker.
|
331 |
$content = preg_replace( "/# BEGIN $marker.*# END $marker\n*/is", '', $content );
|
332 |
|
@@ -336,7 +338,6 @@ function sfml_insert_apache_rewrite_rules( $rules = array() ) {
|
|
336 |
}
|
337 |
|
338 |
// Update the `.htaccess` file.
|
339 |
-
$filesystem = sfml_get_filesystem();
|
340 |
return (bool) $filesystem->put_contents( $htaccess_file , $content );
|
341 |
}
|
342 |
|
@@ -363,10 +364,12 @@ function sfml_iis7_rewrite_rules( $rules = array() ) {
|
|
363 |
$out = array();
|
364 |
|
365 |
foreach ( $rules as $slug => $rule ) {
|
366 |
-
$
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
|
|
370 |
$rule_i++;
|
371 |
}
|
372 |
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/*------------------------------------------------------------------------------------------------*/
|
5 |
/* !INCLUDES ==================================================================================== */
|
23 |
function sfml_rules( $actions = null ) {
|
24 |
if ( ! $actions || ! is_array( $actions ) ) {
|
25 |
$actions = sfml_get_slugs();
|
26 |
+
} else {
|
27 |
+
$actions = array_merge( SFML_Options::get_instance()->get_non_customizable_actions(), $actions );
|
28 |
}
|
29 |
|
30 |
$rules = array();
|
102 |
return $bases;
|
103 |
}
|
104 |
|
105 |
+
$base = wp_parse_url( trailingslashit( get_option( 'home' ) ) );
|
106 |
+
$base = $base['path'];
|
107 |
$wp_dir = sfml_get_wp_directory(); // WP in its own directory.
|
108 |
$is_sub = sfml_is_subfolder_install(); // MultiSite by sub-folders.
|
109 |
$site_dir = $base . ltrim( $wp_dir, '/' );
|
110 |
|
111 |
$bases = array(
|
112 |
+
'base' => $base, // Possible values: '/' or '/sub-dir/'.
|
113 |
+
'wp_dir' => $wp_dir, // Possible values: '' or '/wp-dir/'.
|
114 |
+
'site_dir' => $site_dir, // Possible values: '/', '/wp-dir/', '/sub-dir/', or '/sub-dir/wp-dir/'.
|
115 |
+
'is_sub' => $is_sub, // Possible values: true or false.
|
116 |
);
|
117 |
|
118 |
// Apache.
|
303 |
$rules = '';
|
304 |
}
|
305 |
|
306 |
+
$filesystem = sfml_get_filesystem();
|
307 |
$htaccess_file = sfml_get_home_path() . '.htaccess';
|
308 |
+
$has_htaccess = $filesystem->exists( $htaccess_file );
|
309 |
|
310 |
if ( ! $rules ) {
|
311 |
// We want to remove the rules.
|
328 |
|
329 |
$marker = 'SF Move Login';
|
330 |
// Current htaccess content.
|
331 |
+
$content = $has_htaccess ? $filesystem->get_contents( $htaccess_file ) : '';
|
332 |
// Remove the SF Move Login marker.
|
333 |
$content = preg_replace( "/# BEGIN $marker.*# END $marker\n*/is", '', $content );
|
334 |
|
338 |
}
|
339 |
|
340 |
// Update the `.htaccess` file.
|
|
|
341 |
return (bool) $filesystem->put_contents( $htaccess_file , $content );
|
342 |
}
|
343 |
|
364 |
$out = array();
|
365 |
|
366 |
foreach ( $rules as $slug => $rule ) {
|
367 |
+
$full_rule = $space . '<rule name="SF Move Login Rule ' . $rule_i . '" stopProcessing="true">' . "\n";
|
368 |
+
$full_rule .= $space . ' <match url="^' . $bases['site_from'] . $slug . '/?$" ignoreCase="false" />' . "\n";
|
369 |
+
$full_rule .= $space . ' <action type="Redirect" url="' . $bases['site_dir'] . $rule . '" redirectType="Permanent" />' . "\n";
|
370 |
+
$full_rule .= $space . '</rule>';
|
371 |
+
|
372 |
+
$out[] = $full_rule;
|
373 |
$rule_i++;
|
374 |
}
|
375 |
|
inc/functions/settings-page.php
CHANGED
@@ -1,8 +1,44 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !SETTINGS PAGE =============================================================================== */
|
8 |
/*------------------------------------------------------------------------------------------------*/
|
@@ -11,10 +47,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
* Add settings fields and sections.
|
12 |
*/
|
13 |
function sfml_settings_fields() {
|
14 |
-
$instance
|
15 |
-
$labels
|
16 |
-
$defaults
|
17 |
-
$options
|
|
|
18 |
|
19 |
// Sections.
|
20 |
add_settings_section( 'slugs', __( 'Choose your new URLs', 'sf-move-login' ), false, SFML_Options::OPTION_PAGE );
|
@@ -34,13 +71,16 @@ function sfml_settings_fields() {
|
|
34 |
SFML_Options::OPTION_PAGE,
|
35 |
'slugs',
|
36 |
array(
|
37 |
-
'label_for'
|
38 |
-
'name'
|
39 |
-
'value'
|
40 |
-
'default'
|
41 |
-
'
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
44 |
),
|
45 |
)
|
46 |
);
|
@@ -90,7 +130,7 @@ function sfml_settings_fields() {
|
|
90 |
function sfml_shunt_options_settings_errors() {
|
91 |
global $parent_file;
|
92 |
// Prevent wp-admin/options-head.php to be included.
|
93 |
-
$parent_file .= '#sfml';
|
94 |
}
|
95 |
|
96 |
|
@@ -106,7 +146,7 @@ function sfml_settings_page() {
|
|
106 |
if ( version_compare( $wp_version, '4.3-RC1' ) >= 0 ) {
|
107 |
echo '<h1>Move Login</h1>';
|
108 |
} else {
|
109 |
-
|
110 |
echo '<h2>Move Login</h2>';
|
111 |
}
|
112 |
|
@@ -136,11 +176,12 @@ function sfml_settings_page() {
|
|
136 |
* @param (array) $args Arguments.
|
137 |
*/
|
138 |
function sfml_text_field( $args ) {
|
139 |
-
$name = ! empty( $args['name'] ) ? esc_attr( $args['name'] ) : ( ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false );
|
140 |
$id = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false;
|
|
|
141 |
$value = isset( $args['value'] ) ? esc_attr( $args['value'] ) : '';
|
142 |
$default = isset( $args['default'] ) ? esc_attr( $args['default'] ) : null;
|
143 |
$atts = ! empty( $args['attributes'] ) ? sfml_build_html_atts( $args['attributes'] ) : '';
|
|
|
144 |
|
145 |
if ( ! $name ) {
|
146 |
return;
|
@@ -155,9 +196,12 @@ function sfml_text_field( $args ) {
|
|
155 |
);
|
156 |
|
157 |
if ( isset( $default ) ) {
|
158 |
-
|
159 |
-
|
|
|
160 |
}
|
|
|
|
|
161 |
}
|
162 |
|
163 |
|
@@ -167,12 +211,13 @@ function sfml_text_field( $args ) {
|
|
167 |
* @param (array) $args Arguments.
|
168 |
*/
|
169 |
function sfml_radio_field( $args ) {
|
170 |
-
$
|
171 |
-
$
|
172 |
-
$
|
173 |
-
$
|
174 |
-
$
|
175 |
-
$
|
|
|
176 |
|
177 |
if ( ! $name || ! $values || ! is_array( $values ) ) {
|
178 |
return;
|
@@ -198,8 +243,9 @@ function sfml_radio_field( $args ) {
|
|
198 |
}
|
199 |
|
200 |
if ( isset( $default ) && isset( $values[ $default ] ) ) {
|
201 |
-
|
202 |
-
|
|
|
203 |
}
|
204 |
}
|
205 |
|
@@ -213,7 +259,8 @@ function sfml_rewrite_rules_textarea() {
|
|
213 |
$rules = sfml_rules();
|
214 |
|
215 |
// Message.
|
216 |
-
$base =
|
|
|
217 |
$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
|
218 |
$abspath_fix = str_replace( '\\', '/', ABSPATH );
|
219 |
$home_path = strpos( $abspath_fix, $document_root_fix ) === 0 ? $document_root_fix . $base : sfml_get_home_path();
|
@@ -225,7 +272,7 @@ function sfml_rewrite_rules_textarea() {
|
|
225 |
|
226 |
$height = 20;
|
227 |
$content = sprintf(
|
228 |
-
|
229 |
__( 'If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:', 'sf-move-login' ),
|
230 |
"<code>$file</code>",
|
231 |
"<code>$home_path</code>",
|
@@ -239,8 +286,8 @@ function sfml_rewrite_rules_textarea() {
|
|
239 |
$file_content = implode( "\n", sfml_nginx_rewrite_rules( $rules ) );
|
240 |
|
241 |
$height = substr_count( $file_content, "\n" );
|
242 |
-
$content = '<span
|
243 |
-
|
244 |
__( 'The plugin can\'t add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block.', 'sf-move-login' ),
|
245 |
"<code>$file</code>",
|
246 |
'<code>server</code>'
|
@@ -257,7 +304,7 @@ function sfml_rewrite_rules_textarea() {
|
|
257 |
|
258 |
$height = substr_count( $file_content, "\n" );
|
259 |
$content = sprintf(
|
260 |
-
|
261 |
__( 'If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:', 'sf-move-login' ),
|
262 |
"<code>$file</code>",
|
263 |
"<code>$home_path</code>",
|
@@ -272,8 +319,8 @@ function sfml_rewrite_rules_textarea() {
|
|
272 |
|
273 |
// Add a warning if the file is not writable.
|
274 |
if ( $home_path && $file && ! wp_is_writable( $home_path . $file ) ) {
|
275 |
-
$content .= '</p><p
|
276 |
-
|
277 |
__( 'Your %s file is not writable.', 'sf-move-login' ),
|
278 |
"<code>$file</code>"
|
279 |
);
|
@@ -281,7 +328,7 @@ function sfml_rewrite_rules_textarea() {
|
|
281 |
|
282 |
// Add a warning if the plugin is bypassed.
|
283 |
if ( defined( 'SFML_ALLOW_LOGIN_ACCESS' ) && SFML_ALLOW_LOGIN_ACCESS ) {
|
284 |
-
|
285 |
$content .= '</p><p class="description">' . sprintf( __( 'The constant %1$s is defined to %2$s, the settings below won\'t take effect.', 'sf-move-login' ), '<code>SFML_ALLOW_LOGIN_ACCESS</code>', '<code>true</code>' );
|
286 |
}
|
287 |
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
3 |
+
|
4 |
+
/*------------------------------------------------------------------------------------------------*/
|
5 |
+
/* !ASSETS ====================================================================================== */
|
6 |
+
/*------------------------------------------------------------------------------------------------*/
|
7 |
+
|
8 |
+
add_action( 'admin_enqueue_scripts', 'sfml_enqueue_settings_assets' );
|
9 |
+
/**
|
10 |
+
* Enqueue assets for the settings page.
|
11 |
+
*
|
12 |
+
* @since 2.5.3
|
13 |
+
*/
|
14 |
+
function sfml_enqueue_settings_assets() {
|
15 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
16 |
+
$version = $suffix ? SFML_VERSION : time();
|
17 |
+
|
18 |
+
wp_enqueue_script( 'move-login-settings', plugin_dir_url( SFML_FILE ) . 'assets/js/settings' . $suffix . '.js', array( 'jquery' ), $version, true );
|
19 |
+
|
20 |
+
wp_localize_script( 'move-login-settings', 'sfml', array(
|
21 |
+
'nonce' => wp_create_nonce( 'sfml_sanitize_slug' ),
|
22 |
+
'error' => __( 'Error', 'sf-move-login' ),
|
23 |
+
'errorReload' => __( 'Error. Please reload the page.', 'sf-move-login' ),
|
24 |
+
/* translators: %s is an URL slug name. */
|
25 |
+
'forbidden' => _n( 'The slug %s is forbidden.', 'The slugs %s are forbidden.', 1, 'sf-move-login' ),
|
26 |
+
'duplicate' => _x( 'Duplicate.', 'adjective', 'sf-move-login' ),
|
27 |
+
) );
|
28 |
}
|
29 |
|
30 |
+
|
31 |
+
add_action( 'admin_print_scripts-settings_page_move-login', 'sfml_print_settings_css' );
|
32 |
+
/**
|
33 |
+
* Print some CSS on the settings page.
|
34 |
+
*
|
35 |
+
* @since 2.5.3
|
36 |
+
*/
|
37 |
+
function sfml_print_settings_css() {
|
38 |
+
echo '<style>.dynamic-login-url-slug-error, .sfml-warning { color: red; }</style>';
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
/*------------------------------------------------------------------------------------------------*/
|
43 |
/* !SETTINGS PAGE =============================================================================== */
|
44 |
/*------------------------------------------------------------------------------------------------*/
|
47 |
* Add settings fields and sections.
|
48 |
*/
|
49 |
function sfml_settings_fields() {
|
50 |
+
$instance = SFML_Options::get_instance();
|
51 |
+
$labels = $instance->get_field_labels( 'slugs' );
|
52 |
+
$defaults = sfml_get_default_options();
|
53 |
+
$options = sfml_get_options();
|
54 |
+
$login_url = site_url( '%%slug%%', 'login' );
|
55 |
|
56 |
// Sections.
|
57 |
add_settings_section( 'slugs', __( 'Choose your new URLs', 'sf-move-login' ), false, SFML_Options::OPTION_PAGE );
|
71 |
SFML_Options::OPTION_PAGE,
|
72 |
'slugs',
|
73 |
array(
|
74 |
+
'label_for' => 'slugs-' . $slug,
|
75 |
+
'name' => 'slugs.' . $slug,
|
76 |
+
'value' => $options[ 'slugs.' . $slug ],
|
77 |
+
'default' => $slug,
|
78 |
+
'default_hidden' => true,
|
79 |
+
'after' => " \n" . '<em class="hide-if-no-js">' . str_replace( '%%slug%%', '<strong id="dynamic-login-url-slug-' . $slug . '" class="dynamic-login-url-slug">' . $options[ 'slugs.' . $slug ] . '</strong>', $login_url ) . '</em> <span id="dynamic-login-url-slug-error-' . $slug . '" class="dynamic-login-url-slug-error"></span>',
|
80 |
+
'attributes' => array(
|
81 |
+
'class' => 'slug-field',
|
82 |
+
'title' => __( 'Only lowercase letters, digits, - and _', 'sf-move-login' ),
|
83 |
+
'placeholder' => $slug,
|
84 |
),
|
85 |
)
|
86 |
);
|
130 |
function sfml_shunt_options_settings_errors() {
|
131 |
global $parent_file;
|
132 |
// Prevent wp-admin/options-head.php to be included.
|
133 |
+
$parent_file .= '#sfml'; // WPCS: override ok.
|
134 |
}
|
135 |
|
136 |
|
146 |
if ( version_compare( $wp_version, '4.3-RC1' ) >= 0 ) {
|
147 |
echo '<h1>Move Login</h1>';
|
148 |
} else {
|
149 |
+
call_user_func( 'screen_icon', 'tools' );
|
150 |
echo '<h2>Move Login</h2>';
|
151 |
}
|
152 |
|
176 |
* @param (array) $args Arguments.
|
177 |
*/
|
178 |
function sfml_text_field( $args ) {
|
|
|
179 |
$id = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false;
|
180 |
+
$name = ! empty( $args['name'] ) ? esc_attr( $args['name'] ) : $id;
|
181 |
$value = isset( $args['value'] ) ? esc_attr( $args['value'] ) : '';
|
182 |
$default = isset( $args['default'] ) ? esc_attr( $args['default'] ) : null;
|
183 |
$atts = ! empty( $args['attributes'] ) ? sfml_build_html_atts( $args['attributes'] ) : '';
|
184 |
+
$after = ! empty( $args['after'] ) ? $args['after'] : '';
|
185 |
|
186 |
if ( ! $name ) {
|
187 |
return;
|
196 |
);
|
197 |
|
198 |
if ( isset( $default ) ) {
|
199 |
+
$class = ! empty( $args['default_hidden'] ) ? 'screen-reader-text' : 'description';
|
200 |
+
/* translators: %s is a default option value. */
|
201 |
+
echo ' <span class="' . $class . '">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $default ) . '</span>';
|
202 |
}
|
203 |
+
|
204 |
+
echo $after;
|
205 |
}
|
206 |
|
207 |
|
211 |
* @param (array) $args Arguments.
|
212 |
*/
|
213 |
function sfml_radio_field( $args ) {
|
214 |
+
$label_for = ! empty( $args['label_for'] ) ? esc_attr( $args['label_for'] ) : false;
|
215 |
+
$name = ! empty( $args['name'] ) ? esc_attr( $args['name'] ) : $label_for;
|
216 |
+
$id = $label_for ? $label_for : 'radio-' . $name;
|
217 |
+
$value = isset( $args['value'] ) ? $args['value'] : '';
|
218 |
+
$values = isset( $args['values'] ) ? $args['values'] : false;
|
219 |
+
$default = isset( $args['default'] ) ? $args['default'] : null;
|
220 |
+
$label = isset( $args['label'] ) ? $args['label'] : '';
|
221 |
|
222 |
if ( ! $name || ! $values || ! is_array( $values ) ) {
|
223 |
return;
|
243 |
}
|
244 |
|
245 |
if ( isset( $default ) && isset( $values[ $default ] ) ) {
|
246 |
+
$class = ! empty( $args['default_hidden'] ) ? 'screen-reader-text' : 'description';
|
247 |
+
/* translators: %s is a default option value. */
|
248 |
+
echo ' <span class="' . $class . '">' . sprintf( _x( '(default: %s)', 'default value', 'sf-move-login' ), $values[ $default ] ) . '</span>';
|
249 |
}
|
250 |
}
|
251 |
|
259 |
$rules = sfml_rules();
|
260 |
|
261 |
// Message.
|
262 |
+
$base = wp_parse_url( trailingslashit( get_option( 'home' ) ) );
|
263 |
+
$base = $base['path'];
|
264 |
$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
|
265 |
$abspath_fix = str_replace( '\\', '/', ABSPATH );
|
266 |
$home_path = strpos( $abspath_fix, $document_root_fix ) === 0 ? $document_root_fix . $base : sfml_get_home_path();
|
272 |
|
273 |
$height = 20;
|
274 |
$content = sprintf(
|
275 |
+
/* translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code. */
|
276 |
__( 'If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:', 'sf-move-login' ),
|
277 |
"<code>$file</code>",
|
278 |
"<code>$home_path</code>",
|
286 |
$file_content = implode( "\n", sfml_nginx_rewrite_rules( $rules ) );
|
287 |
|
288 |
$height = substr_count( $file_content, "\n" );
|
289 |
+
$content = '<span class="sfml-warning">' . sprintf(
|
290 |
+
/* translators: 1 is a file name, 2 is a small part of code. */
|
291 |
__( 'The plugin can\'t add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block.', 'sf-move-login' ),
|
292 |
"<code>$file</code>",
|
293 |
'<code>server</code>'
|
304 |
|
305 |
$height = substr_count( $file_content, "\n" );
|
306 |
$content = sprintf(
|
307 |
+
/* translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code. */
|
308 |
__( 'If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:', 'sf-move-login' ),
|
309 |
"<code>$file</code>",
|
310 |
"<code>$home_path</code>",
|
319 |
|
320 |
// Add a warning if the file is not writable.
|
321 |
if ( $home_path && $file && ! wp_is_writable( $home_path . $file ) ) {
|
322 |
+
$content .= '</p><p class="sfml-warning">' . sprintf(
|
323 |
+
/* translators: %s is a file name. */
|
324 |
__( 'Your %s file is not writable.', 'sf-move-login' ),
|
325 |
"<code>$file</code>"
|
326 |
);
|
328 |
|
329 |
// Add a warning if the plugin is bypassed.
|
330 |
if ( defined( 'SFML_ALLOW_LOGIN_ACCESS' ) && SFML_ALLOW_LOGIN_ACCESS ) {
|
331 |
+
/* translators: 1 is a constant name, 2 is a constant value. */
|
332 |
$content .= '</p><p class="description">' . sprintf( __( 'The constant %1$s is defined to %2$s, the settings below won\'t take effect.', 'sf-move-login' ), '<code>SFML_ALLOW_LOGIN_ACCESS</code>', '<code>true</code>' );
|
333 |
}
|
334 |
|
inc/functions/utilities.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !OPTIONS ===================================================================================== */
|
@@ -116,7 +114,10 @@ function sfml_is_apache() {
|
|
116 |
*
|
117 |
* @param (bool) $is True if the server runs Apache. False otherwize.
|
118 |
*/
|
119 |
-
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
|
@@ -149,7 +150,10 @@ function sfml_is_iis7() {
|
|
149 |
*
|
150 |
* @param (bool) $is True if the server runs IIS7. False otherwize.
|
151 |
*/
|
152 |
-
|
|
|
|
|
|
|
153 |
}
|
154 |
|
155 |
|
@@ -179,7 +183,10 @@ function sfml_is_nginx() {
|
|
179 |
*
|
180 |
* @param (bool) $is True if the server runs Nginx. False otherwize.
|
181 |
*/
|
182 |
-
|
|
|
|
|
|
|
183 |
}
|
184 |
|
185 |
|
@@ -234,7 +241,7 @@ function sfml_get_current_url( $mode = 'base' ) {
|
|
234 |
$url = reset( $url );
|
235 |
$url = str_replace( $home, '', $url );
|
236 |
return trim( $url, '/' );
|
237 |
-
default
|
238 |
$url = explode( '?', $url, 2 );
|
239 |
return reset( $url );
|
240 |
endswitch;
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/*------------------------------------------------------------------------------------------------*/
|
5 |
/* !OPTIONS ===================================================================================== */
|
114 |
*
|
115 |
* @param (bool) $is True if the server runs Apache. False otherwize.
|
116 |
*/
|
117 |
+
$is = apply_filters( 'sfml_is_apache', $is );
|
118 |
+
|
119 |
+
// `$is` must be set before being returned (aka don't return the filter result directly or the static var won't keep the right value).
|
120 |
+
return $is;
|
121 |
}
|
122 |
|
123 |
|
150 |
*
|
151 |
* @param (bool) $is True if the server runs IIS7. False otherwize.
|
152 |
*/
|
153 |
+
$is = apply_filters( 'sfml_is_iis7', $is );
|
154 |
+
|
155 |
+
// `$is` must be set before being returned (aka don't return the filter result directly or the static var won't keep the right value).
|
156 |
+
return $is;
|
157 |
}
|
158 |
|
159 |
|
183 |
*
|
184 |
* @param (bool) $is True if the server runs Nginx. False otherwize.
|
185 |
*/
|
186 |
+
$is = apply_filters( 'sfml_is_nginx', $is );
|
187 |
+
|
188 |
+
// `$is` must be set before being returned (aka don't return the filter result directly or the static var won't keep the right value).
|
189 |
+
return $is;
|
190 |
}
|
191 |
|
192 |
|
241 |
$url = reset( $url );
|
242 |
$url = str_replace( $home, '', $url );
|
243 |
return trim( $url, '/' );
|
244 |
+
default:
|
245 |
$url = explode( '?', $url, 2 );
|
246 |
return reset( $url );
|
247 |
endswitch;
|
inc/redirections-and-dies.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !REMOVE DEFAULT WORDPRESS REDIRECTIONS TO LOGIN AND ADMIN AREAS ============================== */
|
@@ -131,10 +129,26 @@ add_filter( 'wp_redirect', 'sfml_maybe_deny_login_redirect', 1 );
|
|
131 |
* @return (string)
|
132 |
*/
|
133 |
function sfml_maybe_deny_login_redirect( $location ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
if ( is_user_logged_in() ) {
|
135 |
return $location;
|
136 |
}
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
$slugs = sfml_get_slugs();
|
139 |
$wp_dir = sfml_get_wp_directory();
|
140 |
|
@@ -193,6 +207,12 @@ function sfml_maybe_deny_login_redirect( $location ) {
|
|
193 |
}
|
194 |
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
/**
|
197 |
* Trigger a 404 error if headers have not been sent yet.
|
198 |
* Be aware that if the headers have been sent, the request won't be killed: provide a fallback!
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/*------------------------------------------------------------------------------------------------*/
|
5 |
/* !REMOVE DEFAULT WORDPRESS REDIRECTIONS TO LOGIN AND ADMIN AREAS ============================== */
|
129 |
* @return (string)
|
130 |
*/
|
131 |
function sfml_maybe_deny_login_redirect( $location ) {
|
132 |
+
global $pagenow;
|
133 |
+
|
134 |
+
if ( 'wp-login.php' === $pagenow ) {
|
135 |
+
return $location;
|
136 |
+
}
|
137 |
+
|
138 |
if ( is_user_logged_in() ) {
|
139 |
return $location;
|
140 |
}
|
141 |
|
142 |
+
if ( wp_get_referer() === $location ) {
|
143 |
+
return $location;
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( sfml_cache_data( 'allow_redirection' ) ) {
|
147 |
+
// This can be used by 3rd party plugins.
|
148 |
+
sfml_cache_data( 'allow_redirection', null );
|
149 |
+
return $location;
|
150 |
+
}
|
151 |
+
|
152 |
$slugs = sfml_get_slugs();
|
153 |
$wp_dir = sfml_get_wp_directory();
|
154 |
|
207 |
}
|
208 |
|
209 |
|
210 |
+
|
211 |
+
|
212 |
+
/*------------------------------------------------------------------------------------------------*/
|
213 |
+
/* !TOOLS ======================================================================================= */
|
214 |
+
/*------------------------------------------------------------------------------------------------*/
|
215 |
+
|
216 |
/**
|
217 |
* Trigger a 404 error if headers have not been sent yet.
|
218 |
* Be aware that if the headers have been sent, the request won't be killed: provide a fallback!
|
inc/url-filters.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die( 'Cheatin\' uh?' );
|
4 |
-
}
|
5 |
|
6 |
/*------------------------------------------------------------------------------------------------*/
|
7 |
/* !FILTER URLS ================================================================================= */
|
@@ -153,7 +151,7 @@ function sfml_set_path( $path ) {
|
|
153 |
$other = SFML_Options::get_instance()->get_other_actions();
|
154 |
|
155 |
// Get the action.
|
156 |
-
$parsed_path =
|
157 |
|
158 |
if ( ! empty( $parsed_path['query'] ) ) {
|
159 |
wp_parse_str( $parsed_path['query'], $params );
|
1 |
<?php
|
2 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
/*------------------------------------------------------------------------------------------------*/
|
5 |
/* !FILTER URLS ================================================================================= */
|
151 |
$other = SFML_Options::get_instance()->get_other_actions();
|
152 |
|
153 |
// Get the action.
|
154 |
+
$parsed_path = wp_parse_url( $path );
|
155 |
|
156 |
if ( ! empty( $parsed_path['query'] ) ) {
|
157 |
wp_parse_str( $parsed_path['query'], $params );
|
languages/sf-move-login-fr_FR.mo
CHANGED
Binary file
|
languages/sf-move-login-fr_FR.po
CHANGED
@@ -4,8 +4,8 @@ msgid ""
|
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: SF Move Login\n"
|
6 |
"Report-Msgid-Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
|
7 |
-
"POT-Creation-Date: 2017-05
|
8 |
-
"PO-Revision-Date: 2017-05
|
9 |
"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
|
10 |
"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
|
11 |
"Language: fr_FR\n"
|
@@ -22,166 +22,171 @@ msgstr ""
|
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
24 |
|
25 |
-
#.
|
26 |
-
#: inc/activate.php:
|
27 |
#, php-format
|
28 |
msgid "%s has not been activated."
|
29 |
msgstr "%s n’a pas été activé."
|
30 |
|
31 |
-
#: inc/activate.php:
|
32 |
msgid "Error"
|
33 |
msgstr "Erreur"
|
34 |
|
35 |
-
#.
|
36 |
-
#: inc/activate.php:
|
37 |
#, php-format
|
38 |
msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
|
39 |
msgstr "Il semble que votre configuration serveur empêche l’extension de fonctionner correctement. %s ne pourra pas fonctionner."
|
40 |
|
41 |
-
#.
|
42 |
-
#: inc/activate.php:
|
43 |
#, php-format
|
44 |
msgid "It seems the url rewrite module is not activated on your server. %s won't work."
|
45 |
msgstr "Il semble que le module de réécriture d’url n’est pas activé sur votre serveur. %s ne pourra pas fonctionner."
|
46 |
|
47 |
-
#.
|
48 |
-
#: inc/activate.php:
|
49 |
#, php-format
|
50 |
msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
|
51 |
msgstr "Il semble que votre serveur n’utilise ni %1$s, %2$s, ou %3$s. %4$s ne pourra pas fonctionner."
|
52 |
|
53 |
-
#.
|
54 |
-
#: inc/activate.php:
|
55 |
#, php-format
|
56 |
msgid "%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file."
|
57 |
msgstr "%1$s a besoin d’accéder au fichier %2$s. Veuillez vous rendre sur la page de réglages de %3$s et veuillez copier/coller le code fourni dans le fichier %2$s."
|
58 |
|
59 |
-
#.
|
60 |
-
#: inc/activate.php:
|
61 |
#, php-format
|
62 |
msgid "It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won't work correctly until you deal with those rewrite rules."
|
63 |
msgstr "Il semble que votre serveur utilise un système %1$s. Vous devez éditer les règles de réécriture par vous-même dans le fichier de configuration. Veuillez vous rendre sur la page de réglages de %2$s et jetez un œil aux règles de réécriture. %3$s fonctionne mais ne pourra pas le faire correctement tant que vous ne vous serez pas occupé de ces règles."
|
64 |
|
65 |
-
#: inc/admin.php:
|
66 |
-
#: inc/redirections-and-dies.php:
|
67 |
msgid "Cheatin’ uh?"
|
68 |
msgstr "Alors, on triche ?"
|
69 |
|
70 |
-
#: inc/classes/class-sfml-options.php:
|
71 |
-
#: inc/classes/class-sfml-options.php:
|
72 |
msgid "Display an error message"
|
73 |
msgstr "Afficher un message d'erreur"
|
74 |
|
75 |
-
#: inc/classes/class-sfml-options.php:
|
76 |
-
#: inc/classes/class-sfml-options.php:
|
77 |
msgid "Trigger a «Page not found» error"
|
78 |
msgstr "Déclencher une erreur « Page non trouvée »"
|
79 |
|
80 |
-
#: inc/classes/class-sfml-options.php:
|
81 |
-
#: inc/classes/class-sfml-options.php:
|
82 |
msgid "Redirect to a \"WordPress\" «Page not found» error page"
|
83 |
msgstr "Rediriger vers une page d’erreur « Page non trouvée » de WordPress"
|
84 |
|
85 |
-
#: inc/classes/class-sfml-options.php:
|
86 |
-
#: inc/classes/class-sfml-options.php:
|
87 |
msgid "Redirect to the home page"
|
88 |
msgstr "Rediriger vers la page d’accueil"
|
89 |
|
90 |
-
#: inc/classes/class-sfml-options.php:
|
91 |
msgid "Do nothing, redirect to the new login page (not recommended)"
|
92 |
msgstr "Ne rien faire, rediriger vers la nouvelle page de connexion (non recommandé)"
|
93 |
|
94 |
-
#.
|
95 |
-
#: inc/classes/class-sfml-options.php:
|
96 |
#, php-format
|
97 |
msgid "The slug %s is forbidden."
|
98 |
msgid_plural "The slugs %s are forbidden."
|
99 |
msgstr[0] "L’identifiant %s est interdit."
|
100 |
msgstr[1] "Les identifiants %s sont interdits."
|
101 |
|
102 |
-
#: inc/classes/class-sfml-options.php:
|
103 |
msgid "The links can't have the same slugs."
|
104 |
msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
|
105 |
|
106 |
-
|
107 |
-
#: inc/functions/compat.php:285
|
108 |
#, php-format
|
109 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
|
110 |
msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s ! Utilisez %3$s à la place."
|
111 |
|
112 |
-
|
113 |
-
#: inc/functions/compat.php:288
|
114 |
#, php-format
|
115 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
|
116 |
msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s, aucune alternative n’est disponible."
|
117 |
|
118 |
-
#: inc/functions/deprecated.php:
|
119 |
-
#: inc/redirections-and-dies.php:
|
120 |
msgid "Nope :)"
|
121 |
msgstr "Raté :)"
|
122 |
|
123 |
-
#: inc/functions/settings-page.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
msgid "Choose your new URLs"
|
125 |
msgstr "Choisissez vos nouvelles adresses"
|
126 |
|
127 |
-
#: inc/functions/settings-page.php:
|
128 |
msgid "Access"
|
129 |
msgstr "Accès"
|
130 |
|
131 |
-
#: inc/functions/settings-page.php:
|
132 |
msgid "Only lowercase letters, digits, - and _"
|
133 |
msgstr "Seulement des lettres minuscules, chiffres, - et _"
|
134 |
|
135 |
-
#: inc/functions/settings-page.php:
|
136 |
msgid "When a logged out user attempts to access the old login page."
|
137 |
msgstr "Quand un utilisateur non connecté tente d'accéder à l'ancienne page de connexion."
|
138 |
|
139 |
-
#: inc/functions/settings-page.php:
|
140 |
msgctxt "noun"
|
141 |
msgid "Redirects"
|
142 |
msgstr "Redirections"
|
143 |
|
144 |
-
#: inc/functions/settings-page.php:
|
145 |
msgid "Instead of redirecting a logged out user to the new login page:"
|
146 |
msgstr "Plutôt que de rediriger un utilisateur non connecté vers la nouvelle page de connexion :"
|
147 |
|
148 |
-
#.
|
149 |
-
#: inc/functions/settings-page.php:
|
150 |
#, php-format
|
151 |
msgctxt "default value"
|
152 |
msgid "(default: %s)"
|
153 |
msgstr "(défaut : %s)"
|
154 |
|
155 |
-
#.
|
156 |
-
#: inc/functions/settings-page.php:
|
157 |
#, php-format
|
158 |
msgid "If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:"
|
159 |
msgstr "Si l’extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, ajoutez les lignes suivantes à votre fichier %1$s dans %2$s, en remplacement des autres règles liées à %3$s si elles existent, <strong>au-dessus</strong> de la ligne %4$s :"
|
160 |
|
161 |
-
#.
|
162 |
-
#: inc/functions/settings-page.php:
|
163 |
#, php-format
|
164 |
msgid "The plugin can't add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block."
|
165 |
msgstr "L’extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, vous devrez les ajouter manuellement à l’intérieur du bloc %2$s."
|
166 |
|
167 |
-
#.
|
168 |
-
#: inc/functions/settings-page.php:
|
169 |
#, php-format
|
170 |
msgid "Your %s file is not writable."
|
171 |
msgstr "Votre fichier %s n’est pas inscriptible."
|
172 |
|
173 |
-
#.
|
174 |
-
#: inc/functions/settings-page.php:
|
175 |
#, php-format
|
176 |
msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
|
177 |
msgstr "La constante %1$s est définie à %2$s, les réglages ci-dessous ne prendront pas effet."
|
178 |
|
179 |
-
#: inc/redirections-and-dies.php:
|
180 |
msgid "No no no, the login form is not here."
|
181 |
msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
|
182 |
|
183 |
-
#. Translators: Description of the plugin/theme
|
184 |
#. Description of the plugin/theme
|
185 |
-
#: sf-move-login.php:93
|
186 |
msgid "Change your login URL."
|
187 |
msgstr "Changez l’url de votre page de connexion."
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: SF Move Login\n"
|
6 |
"Report-Msgid-Bugs-To: Grégory Viguier <i18n@screenfeed.fr>\n"
|
7 |
+
"POT-Creation-Date: 2017-06-05 17:13+0200\n"
|
8 |
+
"PO-Revision-Date: 2017-06-05 17:24+0200\n"
|
9 |
"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
|
10 |
"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
|
11 |
"Language: fr_FR\n"
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
24 |
|
25 |
+
#. translators: 1 is the plugin name.
|
26 |
+
#: inc/activate.php:48
|
27 |
#, php-format
|
28 |
msgid "%s has not been activated."
|
29 |
msgstr "%s n’a pas été activé."
|
30 |
|
31 |
+
#: inc/activate.php:50 inc/functions/settings-page.php:22
|
32 |
msgid "Error"
|
33 |
msgstr "Erreur"
|
34 |
|
35 |
+
#. translators: 1 is the plugin name.
|
36 |
+
#: inc/activate.php:113
|
37 |
#, php-format
|
38 |
msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
|
39 |
msgstr "Il semble que votre configuration serveur empêche l’extension de fonctionner correctement. %s ne pourra pas fonctionner."
|
40 |
|
41 |
+
#. translators: 1 is the plugin name.
|
42 |
+
#: inc/activate.php:115
|
43 |
#, php-format
|
44 |
msgid "It seems the url rewrite module is not activated on your server. %s won't work."
|
45 |
msgstr "Il semble que le module de réécriture d’url n’est pas activé sur votre serveur. %s ne pourra pas fonctionner."
|
46 |
|
47 |
+
#. translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
|
48 |
+
#: inc/activate.php:117
|
49 |
#, php-format
|
50 |
msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
|
51 |
msgstr "Il semble que votre serveur n’utilise ni %1$s, %2$s, ou %3$s. %4$s ne pourra pas fonctionner."
|
52 |
|
53 |
+
#. translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
|
54 |
+
#: inc/activate.php:119
|
55 |
#, php-format
|
56 |
msgid "%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file."
|
57 |
msgstr "%1$s a besoin d’accéder au fichier %2$s. Veuillez vous rendre sur la page de réglages de %3$s et veuillez copier/coller le code fourni dans le fichier %2$s."
|
58 |
|
59 |
+
#. translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
|
60 |
+
#: inc/activate.php:121
|
61 |
#, php-format
|
62 |
msgid "It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won't work correctly until you deal with those rewrite rules."
|
63 |
msgstr "Il semble que votre serveur utilise un système %1$s. Vous devez éditer les règles de réécriture par vous-même dans le fichier de configuration. Veuillez vous rendre sur la page de réglages de %2$s et jetez un œil aux règles de réécriture. %3$s fonctionne mais ne pourra pas le faire correctement tant que vous ne vous serez pas occupé de ces règles."
|
64 |
|
65 |
+
#: inc/admin.php:151 inc/functions/deprecated.php:85
|
66 |
+
#: inc/redirections-and-dies.php:195
|
67 |
msgid "Cheatin’ uh?"
|
68 |
msgstr "Alors, on triche ?"
|
69 |
|
70 |
+
#: inc/classes/class-sfml-options.php:270
|
71 |
+
#: inc/classes/class-sfml-options.php:277
|
72 |
msgid "Display an error message"
|
73 |
msgstr "Afficher un message d'erreur"
|
74 |
|
75 |
+
#: inc/classes/class-sfml-options.php:271
|
76 |
+
#: inc/classes/class-sfml-options.php:278
|
77 |
msgid "Trigger a «Page not found» error"
|
78 |
msgstr "Déclencher une erreur « Page non trouvée »"
|
79 |
|
80 |
+
#: inc/classes/class-sfml-options.php:272
|
81 |
+
#: inc/classes/class-sfml-options.php:279
|
82 |
msgid "Redirect to a \"WordPress\" «Page not found» error page"
|
83 |
msgstr "Rediriger vers une page d’erreur « Page non trouvée » de WordPress"
|
84 |
|
85 |
+
#: inc/classes/class-sfml-options.php:273
|
86 |
+
#: inc/classes/class-sfml-options.php:280
|
87 |
msgid "Redirect to the home page"
|
88 |
msgstr "Rediriger vers la page d’accueil"
|
89 |
|
90 |
+
#: inc/classes/class-sfml-options.php:276
|
91 |
msgid "Do nothing, redirect to the new login page (not recommended)"
|
92 |
msgstr "Ne rien faire, rediriger vers la nouvelle page de connexion (non recommandé)"
|
93 |
|
94 |
+
#. translators: %s is an URL slug name.
|
95 |
+
#: inc/classes/class-sfml-options.php:420 inc/functions/settings-page.php:25
|
96 |
#, php-format
|
97 |
msgid "The slug %s is forbidden."
|
98 |
msgid_plural "The slugs %s are forbidden."
|
99 |
msgstr[0] "L’identifiant %s est interdit."
|
100 |
msgstr[1] "Les identifiants %s sont interdits."
|
101 |
|
102 |
+
#: inc/classes/class-sfml-options.php:423
|
103 |
msgid "The links can't have the same slugs."
|
104 |
msgstr "Les liens ne peuvent pas avoir les mêmes identifiants."
|
105 |
|
106 |
+
#: inc/functions/compat.php:283
|
|
|
107 |
#, php-format
|
108 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
|
109 |
msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s ! Utilisez %3$s à la place."
|
110 |
|
111 |
+
#: inc/functions/compat.php:286
|
|
|
112 |
#, php-format
|
113 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
|
114 |
msgstr "%1$s est <strong>déprécié</strong> depuis la version %2$s, aucune alternative n’est disponible."
|
115 |
|
116 |
+
#: inc/functions/deprecated.php:85 inc/redirections-and-dies.php:110
|
117 |
+
#: inc/redirections-and-dies.php:195
|
118 |
msgid "Nope :)"
|
119 |
msgstr "Raté :)"
|
120 |
|
121 |
+
#: inc/functions/settings-page.php:23
|
122 |
+
msgid "Error. Please reload the page."
|
123 |
+
msgstr "Erreur. Veuillez recharger la page."
|
124 |
+
|
125 |
+
#: inc/functions/settings-page.php:26
|
126 |
+
msgctxt "adjective"
|
127 |
+
msgid "Duplicate."
|
128 |
+
msgstr "Doublon."
|
129 |
+
|
130 |
+
#: inc/functions/settings-page.php:57
|
131 |
msgid "Choose your new URLs"
|
132 |
msgstr "Choisissez vos nouvelles adresses"
|
133 |
|
134 |
+
#: inc/functions/settings-page.php:58
|
135 |
msgid "Access"
|
136 |
msgstr "Accès"
|
137 |
|
138 |
+
#: inc/functions/settings-page.php:82
|
139 |
msgid "Only lowercase letters, digits, - and _"
|
140 |
msgstr "Seulement des lettres minuscules, chiffres, - et _"
|
141 |
|
142 |
+
#: inc/functions/settings-page.php:101
|
143 |
msgid "When a logged out user attempts to access the old login page."
|
144 |
msgstr "Quand un utilisateur non connecté tente d'accéder à l'ancienne page de connexion."
|
145 |
|
146 |
+
#: inc/functions/settings-page.php:108
|
147 |
msgctxt "noun"
|
148 |
msgid "Redirects"
|
149 |
msgstr "Redirections"
|
150 |
|
151 |
+
#: inc/functions/settings-page.php:117
|
152 |
msgid "Instead of redirecting a logged out user to the new login page:"
|
153 |
msgstr "Plutôt que de rediriger un utilisateur non connecté vers la nouvelle page de connexion :"
|
154 |
|
155 |
+
#. translators: %s is a default option value.
|
156 |
+
#: inc/functions/settings-page.php:201 inc/functions/settings-page.php:248
|
157 |
#, php-format
|
158 |
msgctxt "default value"
|
159 |
msgid "(default: %s)"
|
160 |
msgstr "(défaut : %s)"
|
161 |
|
162 |
+
#. translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
|
163 |
+
#: inc/functions/settings-page.php:276 inc/functions/settings-page.php:308
|
164 |
#, php-format
|
165 |
msgid "If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:"
|
166 |
msgstr "Si l’extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, ajoutez les lignes suivantes à votre fichier %1$s dans %2$s, en remplacement des autres règles liées à %3$s si elles existent, <strong>au-dessus</strong> de la ligne %4$s :"
|
167 |
|
168 |
+
#. translators: 1 is a file name, 2 is a small part of code.
|
169 |
+
#: inc/functions/settings-page.php:291
|
170 |
#, php-format
|
171 |
msgid "The plugin can't add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block."
|
172 |
msgstr "L’extension ne peut ajouter les nouvelles règles de réécriture à votre fichier %1$s, vous devrez les ajouter manuellement à l’intérieur du bloc %2$s."
|
173 |
|
174 |
+
#. translators: %s is a file name.
|
175 |
+
#: inc/functions/settings-page.php:324
|
176 |
#, php-format
|
177 |
msgid "Your %s file is not writable."
|
178 |
msgstr "Votre fichier %s n’est pas inscriptible."
|
179 |
|
180 |
+
#. translators: 1 is a constant name, 2 is a constant value.
|
181 |
+
#: inc/functions/settings-page.php:332
|
182 |
#, php-format
|
183 |
msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
|
184 |
msgstr "La constante %1$s est définie à %2$s, les réglages ci-dessous ne prendront pas effet."
|
185 |
|
186 |
+
#: inc/redirections-and-dies.php:110
|
187 |
msgid "No no no, the login form is not here."
|
188 |
msgstr "Non non non, le formulaire de connexion ne se trouve pas ici."
|
189 |
|
|
|
190 |
#. Description of the plugin/theme
|
|
|
191 |
msgid "Change your login URL."
|
192 |
msgstr "Changez l’url de votre page de connexion."
|
languages/sf-move-login.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: SF Move Login\n"
|
5 |
-
"POT-Creation-Date: 2017-05
|
6 |
"PO-Revision-Date: 2017-05-25 15:27+0200\n"
|
7 |
"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
|
8 |
"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
|
@@ -14,170 +14,176 @@ msgstr ""
|
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
|
|
17 |
"X-Poedit-WPHeader: sf-move-login.php\n"
|
18 |
"X-Poedit-SearchPath-0: .\n"
|
19 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
20 |
|
21 |
-
#.
|
22 |
-
#: inc/activate.php:
|
23 |
#, php-format
|
24 |
msgid "%s has not been activated."
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: inc/activate.php:
|
28 |
msgid "Error"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#.
|
32 |
-
#: inc/activate.php:
|
33 |
#, php-format
|
34 |
msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
|
35 |
msgstr ""
|
36 |
|
37 |
-
#.
|
38 |
-
#: inc/activate.php:
|
39 |
#, php-format
|
40 |
msgid "It seems the url rewrite module is not activated on your server. %s won't work."
|
41 |
msgstr ""
|
42 |
|
43 |
-
#.
|
44 |
-
#: inc/activate.php:
|
45 |
#, php-format
|
46 |
msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
|
47 |
msgstr ""
|
48 |
|
49 |
-
#.
|
50 |
-
#: inc/activate.php:
|
51 |
#, php-format
|
52 |
msgid "%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#.
|
56 |
-
#: inc/activate.php:
|
57 |
#, php-format
|
58 |
msgid "It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won't work correctly until you deal with those rewrite rules."
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: inc/admin.php:
|
62 |
-
#: inc/redirections-and-dies.php:
|
63 |
msgid "Cheatin’ uh?"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: inc/classes/class-sfml-options.php:
|
67 |
-
#: inc/classes/class-sfml-options.php:
|
68 |
msgid "Display an error message"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: inc/classes/class-sfml-options.php:
|
72 |
-
#: inc/classes/class-sfml-options.php:
|
73 |
msgid "Trigger a «Page not found» error"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: inc/classes/class-sfml-options.php:
|
77 |
-
#: inc/classes/class-sfml-options.php:
|
78 |
msgid "Redirect to a \"WordPress\" «Page not found» error page"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: inc/classes/class-sfml-options.php:
|
82 |
-
#: inc/classes/class-sfml-options.php:
|
83 |
msgid "Redirect to the home page"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: inc/classes/class-sfml-options.php:
|
87 |
msgid "Do nothing, redirect to the new login page (not recommended)"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#.
|
91 |
-
#: inc/classes/class-sfml-options.php:
|
92 |
#, php-format
|
93 |
msgid "The slug %s is forbidden."
|
94 |
msgid_plural "The slugs %s are forbidden."
|
95 |
msgstr[0] ""
|
96 |
msgstr[1] ""
|
97 |
|
98 |
-
#: inc/classes/class-sfml-options.php:
|
99 |
msgid "The links can't have the same slugs."
|
100 |
msgstr ""
|
101 |
|
102 |
-
|
103 |
-
#: inc/functions/compat.php:285
|
104 |
#, php-format
|
105 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
|
106 |
msgstr ""
|
107 |
|
108 |
-
|
109 |
-
#: inc/functions/compat.php:288
|
110 |
#, php-format
|
111 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: inc/functions/deprecated.php:
|
115 |
-
#: inc/redirections-and-dies.php:
|
116 |
msgid "Nope :)"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: inc/functions/settings-page.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
msgid "Choose your new URLs"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: inc/functions/settings-page.php:
|
124 |
msgid "Access"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: inc/functions/settings-page.php:
|
128 |
msgid "Only lowercase letters, digits, - and _"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: inc/functions/settings-page.php:
|
132 |
msgid "When a logged out user attempts to access the old login page."
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: inc/functions/settings-page.php:
|
136 |
msgctxt "noun"
|
137 |
msgid "Redirects"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: inc/functions/settings-page.php:
|
141 |
msgid "Instead of redirecting a logged out user to the new login page:"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#.
|
145 |
-
#: inc/functions/settings-page.php:
|
146 |
#, php-format
|
147 |
msgctxt "default value"
|
148 |
msgid "(default: %s)"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#.
|
152 |
-
#: inc/functions/settings-page.php:
|
153 |
#, php-format
|
154 |
msgid "If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#.
|
158 |
-
#: inc/functions/settings-page.php:
|
159 |
#, php-format
|
160 |
msgid "The plugin can't add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block."
|
161 |
msgstr ""
|
162 |
|
163 |
-
#.
|
164 |
-
#: inc/functions/settings-page.php:
|
165 |
#, php-format
|
166 |
msgid "Your %s file is not writable."
|
167 |
msgstr ""
|
168 |
|
169 |
-
#.
|
170 |
-
#: inc/functions/settings-page.php:
|
171 |
#, php-format
|
172 |
msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: inc/redirections-and-dies.php:
|
176 |
msgid "No no no, the login form is not here."
|
177 |
msgstr ""
|
178 |
|
179 |
-
#. Translators: Description of the plugin/theme
|
180 |
#. Description of the plugin/theme
|
181 |
-
#: sf-move-login.php:93
|
182 |
msgid "Change your login URL."
|
183 |
msgstr ""
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: SF Move Login\n"
|
5 |
+
"POT-Creation-Date: 2017-06-05 17:17+0200\n"
|
6 |
"PO-Revision-Date: 2017-05-25 15:27+0200\n"
|
7 |
"Last-Translator: Grégory Viguier <i18n@screenfeed.fr>\n"
|
8 |
"Language-Team: Grégory Viguier <i18n@screenfeed.fr>\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Textdomain-Support: yes\n"
|
18 |
"X-Poedit-WPHeader: sf-move-login.php\n"
|
19 |
"X-Poedit-SearchPath-0: .\n"
|
20 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
21 |
|
22 |
+
#. translators: 1 is the plugin name.
|
23 |
+
#: inc/activate.php:48
|
24 |
#, php-format
|
25 |
msgid "%s has not been activated."
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: inc/activate.php:50 inc/functions/settings-page.php:22
|
29 |
msgid "Error"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#. translators: 1 is the plugin name.
|
33 |
+
#: inc/activate.php:113
|
34 |
#, php-format
|
35 |
msgid "It seems your server configuration prevents the plugin to work properly. %s won't work."
|
36 |
msgstr ""
|
37 |
|
38 |
+
#. translators: 1 is the plugin name.
|
39 |
+
#: inc/activate.php:115
|
40 |
#, php-format
|
41 |
msgid "It seems the url rewrite module is not activated on your server. %s won't work."
|
42 |
msgstr ""
|
43 |
|
44 |
+
#. translators: 1, 2, and 3 are server technologies (Apache, Nginx, IIS7), 4 is the plugin name.
|
45 |
+
#: inc/activate.php:117
|
46 |
#, php-format
|
47 |
msgid "It seems your server does not use %1$s, %2$s, nor %3$s. %4$s won't work."
|
48 |
msgstr ""
|
49 |
|
50 |
+
#. translators: 1 is the plugin name, 2 is a file name, 3 is a "Move Login" link.
|
51 |
+
#: inc/activate.php:119
|
52 |
#, php-format
|
53 |
msgid "%1$s needs access to the %2$s file. Please visit the %3$s settings page and copy/paste the given code into the %2$s file."
|
54 |
msgstr ""
|
55 |
|
56 |
+
#. translators: 1 is a server technology (Nginx), 2 is a "Move Login" link, 3 is the plugin name.
|
57 |
+
#: inc/activate.php:121
|
58 |
#, php-format
|
59 |
msgid "It seems your server uses a %1$ system. You have to edit the rewrite rules by yourself in the configuration file. Please visit the %2$s settings page and take a look at the rewrite rules. %3$s is running but won't work correctly until you deal with those rewrite rules."
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: inc/admin.php:151 inc/functions/deprecated.php:85
|
63 |
+
#: inc/redirections-and-dies.php:195
|
64 |
msgid "Cheatin’ uh?"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: inc/classes/class-sfml-options.php:270
|
68 |
+
#: inc/classes/class-sfml-options.php:277
|
69 |
msgid "Display an error message"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: inc/classes/class-sfml-options.php:271
|
73 |
+
#: inc/classes/class-sfml-options.php:278
|
74 |
msgid "Trigger a «Page not found» error"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: inc/classes/class-sfml-options.php:272
|
78 |
+
#: inc/classes/class-sfml-options.php:279
|
79 |
msgid "Redirect to a \"WordPress\" «Page not found» error page"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: inc/classes/class-sfml-options.php:273
|
83 |
+
#: inc/classes/class-sfml-options.php:280
|
84 |
msgid "Redirect to the home page"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: inc/classes/class-sfml-options.php:276
|
88 |
msgid "Do nothing, redirect to the new login page (not recommended)"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#. translators: %s is an URL slug name.
|
92 |
+
#: inc/classes/class-sfml-options.php:420 inc/functions/settings-page.php:25
|
93 |
#, php-format
|
94 |
msgid "The slug %s is forbidden."
|
95 |
msgid_plural "The slugs %s are forbidden."
|
96 |
msgstr[0] ""
|
97 |
msgstr[1] ""
|
98 |
|
99 |
+
#: inc/classes/class-sfml-options.php:423
|
100 |
msgid "The links can't have the same slugs."
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: inc/functions/compat.php:283
|
|
|
104 |
#, php-format
|
105 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: inc/functions/compat.php:286
|
|
|
109 |
#, php-format
|
110 |
msgid "%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: inc/functions/deprecated.php:85 inc/redirections-and-dies.php:110
|
114 |
+
#: inc/redirections-and-dies.php:195
|
115 |
msgid "Nope :)"
|
116 |
msgstr ""
|
117 |
|
118 |
+
#: inc/functions/settings-page.php:23
|
119 |
+
msgid "Error. Please reload the page."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: inc/functions/settings-page.php:26
|
123 |
+
msgctxt "adjective"
|
124 |
+
msgid "Duplicate."
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: inc/functions/settings-page.php:57
|
128 |
msgid "Choose your new URLs"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: inc/functions/settings-page.php:58
|
132 |
msgid "Access"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: inc/functions/settings-page.php:82
|
136 |
msgid "Only lowercase letters, digits, - and _"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: inc/functions/settings-page.php:101
|
140 |
msgid "When a logged out user attempts to access the old login page."
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: inc/functions/settings-page.php:108
|
144 |
msgctxt "noun"
|
145 |
msgid "Redirects"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: inc/functions/settings-page.php:117
|
149 |
msgid "Instead of redirecting a logged out user to the new login page:"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#. translators: %s is a default option value.
|
153 |
+
#: inc/functions/settings-page.php:201 inc/functions/settings-page.php:248
|
154 |
#, php-format
|
155 |
msgctxt "default value"
|
156 |
msgid "(default: %s)"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#. translators: 1 is a file name, 2 is a file path, 3 and 4 are small parts of code.
|
160 |
+
#: inc/functions/settings-page.php:276 inc/functions/settings-page.php:308
|
161 |
#, php-format
|
162 |
msgid "If the plugin fails to add the new rewrite rules to your %1$s file, add the following to your %1$s file in %2$s, replacing other %3$s rules if they exist, <strong>above</strong> the line reading %4$s:"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#. translators: 1 is a file name, 2 is a small part of code.
|
166 |
+
#: inc/functions/settings-page.php:291
|
167 |
#, php-format
|
168 |
msgid "The plugin can't add the new rewrite rules to your %1$s file by itself, you will need to add them manually inside the %2$s block."
|
169 |
msgstr ""
|
170 |
|
171 |
+
#. translators: %s is a file name.
|
172 |
+
#: inc/functions/settings-page.php:324
|
173 |
#, php-format
|
174 |
msgid "Your %s file is not writable."
|
175 |
msgstr ""
|
176 |
|
177 |
+
#. translators: 1 is a constant name, 2 is a constant value.
|
178 |
+
#: inc/functions/settings-page.php:332
|
179 |
#, php-format
|
180 |
msgid "The constant %1$s is defined to %2$s, the settings below won't take effect."
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: inc/redirections-and-dies.php:110
|
184 |
msgid "No no no, the login form is not here."
|
185 |
msgstr ""
|
186 |
|
|
|
187 |
#. Description of the plugin/theme
|
|
|
188 |
msgid "Change your login URL."
|
189 |
msgstr ""
|
phpcs.xml
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<ruleset name="Move Login">
|
3 |
-
<description>WordPress plugin that allows to change the login URL.</description>
|
4 |
-
|
5 |
-
<arg name="extensions" value="php"/>
|
6 |
-
|
7 |
-
<file>.</file>
|
8 |
-
|
9 |
-
<rule ref="WordPress">
|
10 |
-
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
|
11 |
-
<exclude name="Squiz.PHP.CommentedOutCode.Found"/>
|
12 |
-
<exclude name="Generic.PHP.NoSilencedErrors.Discouraged"/>
|
13 |
-
<exclude name="Squiz.Commenting.BlockComment.NoNewLine"/>
|
14 |
-
<exclude name="Squiz.Commenting.FileComment.Missing"/>
|
15 |
-
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/>
|
16 |
-
<exclude name="WordPress.VIP.AdminBarRemoval"/>
|
17 |
-
<exclude name="WordPress.VIP.CronInterval.ChangeDetected"/>
|
18 |
-
<exclude name="WordPress.VIP.DirectDatabaseQuery.DirectQuery"/>
|
19 |
-
<exclude name="WordPress.VIP.DirectDatabaseQuery.NoCaching"/>
|
20 |
-
<exclude name="WordPress.VIP.OrderByRand"/>
|
21 |
-
<exclude name="WordPress.VIP.PostsPerPage.posts_per_page"/>
|
22 |
-
<exclude name="WordPress.VIP.RestrictedFunctions"/>
|
23 |
-
<exclude name="WordPress.VIP.RestrictedFunctions.urlencode"/>
|
24 |
-
<exclude name="WordPress.VIP.RestrictedFunctions.wp_redirect"/>
|
25 |
-
<exclude name="WordPress.VIP.RestrictedVariables.cache_constraints"/>
|
26 |
-
<exclude name="WordPress.VIP.RestrictedVariables.user_meta"/>
|
27 |
-
<exclude name="WordPress.VIP.SlowDBQuery.slow_db_query"/>
|
28 |
-
<exclude name="WordPress.VIP.SuperGlobalInputUsage.AccessDetected"/>
|
29 |
-
<exclude name="WordPress.VIP.TimezoneChange"/>
|
30 |
-
<exclude name="WordPress.VIP.ValidatedSanitizedInput"/>
|
31 |
-
<exclude name="WordPress.XSS.EscapeOutput.OutputNotEscaped"/>
|
32 |
-
</rule>
|
33 |
-
|
34 |
-
<rule ref="Squiz.Commenting.FileComment.MissingPackageTag">
|
35 |
-
<exclude-pattern>sf-move-login.php</exclude-pattern>
|
36 |
-
</rule>
|
37 |
-
|
38 |
-
<rule ref="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar">
|
39 |
-
<exclude-pattern>inc/functions/rewrite.php</exclude-pattern>
|
40 |
-
</rule>
|
41 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Contributors: GregLone, SecuPress, juliobox
|
4 |
Tags: login, logout, url, security
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 4.7.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv3
|
9 |
License URI: https://www.screenfeed.fr/gpl-v3.txt
|
@@ -67,12 +67,23 @@ Eventually, try the [WordPress support forum](https://wordpress.org/support/plug
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
= 2.5.2 =
|
71 |
|
72 |
* 2017/05/25
|
73 |
-
* New: a new option is available. Instead of redirecting to the a "WordPress" 404 error page, you can choose to directly trigger the 404 error. Pro: the user is not directed, the URL doesn't change. Con: the user sees the browser error page, it probably is
|
74 |
* Fixed the blank page that was displaying instead of redirecting the user to the new login URL.
|
75 |
-
* Dev stuff:
|
|
|
76 |
|
77 |
= 2.5.1 =
|
78 |
|
3 |
Contributors: GregLone, SecuPress, juliobox
|
4 |
Tags: login, logout, url, security
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 4.7.5
|
7 |
Stable tag: trunk
|
8 |
License: GPLv3
|
9 |
License URI: https://www.screenfeed.fr/gpl-v3.txt
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 2.5.3 =
|
71 |
+
|
72 |
+
* 2017/06/05
|
73 |
+
* New: preview your URLs while typing.
|
74 |
+
* New: you can leave a field empty to set its default value.
|
75 |
+
* Improved URL duplicates detection.
|
76 |
+
* Fixed the "Lost Password" redirection (and others).
|
77 |
+
* Dev stuff: fixed the filters in `sfml_is_apache()`, `sfml_is_iis7()`, and `sfml_is_nginx()`.
|
78 |
+
* Nerd stuff: improved the whole plugin code quality by updating the Coding Standard rules and applying new ones. Changed a few things in the class `SFML_Options`.
|
79 |
+
|
80 |
= 2.5.2 =
|
81 |
|
82 |
* 2017/05/25
|
83 |
+
* New: a new option is available. Instead of redirecting to the a "WordPress" 404 error page, you can choose to directly trigger the 404 error. Pro: the user is not directed, the URL doesn't change. Con: the user sees the browser error page, it probably is a simple white page (but do we really care?).
|
84 |
* Fixed the blank page that was displaying instead of redirecting the user to the new login URL.
|
85 |
+
* Dev stuff: you can now add custom options to the two existing radio groups.
|
86 |
+
* Nerd stuff: in case the plugin has trouble determining your server technology, take a look at `sfml_is_apache()`, `sfml_is_iis7()`, and `sfml_is_nginx()`: returned values can be filtered with a MU plugin.
|
87 |
|
88 |
= 2.5.1 =
|
89 |
|
sf-move-login.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: SF Move Login
|
4 |
* Plugin URI: https://www.screenfeed.fr/plugin-wp/move-login/
|
5 |
* Description: Change your login URL.
|
6 |
-
* Version: 2.5.
|
7 |
* Author: Grégory Viguier
|
8 |
* Author URI: https://www.screenfeed.fr/
|
9 |
* License: GPLv3
|
@@ -13,9 +13,7 @@
|
|
13 |
* Domain Path: /languages/
|
14 |
*/
|
15 |
|
16 |
-
|
17 |
-
die( 'Cheatin\' uh?' );
|
18 |
-
}
|
19 |
|
20 |
if ( empty( $GLOBALS['wp_version'] ) || version_compare( $GLOBALS['wp_version'], '3.1' ) < 0 || version_compare( phpversion(), '5.3' ) < 0 ) {
|
21 |
return;
|
@@ -25,7 +23,7 @@ if ( empty( $GLOBALS['wp_version'] ) || version_compare( $GLOBALS['wp_version'],
|
|
25 |
/* !CONSTANTS =================================================================================== */
|
26 |
/*------------------------------------------------------------------------------------------------*/
|
27 |
|
28 |
-
define( 'SFML_VERSION', '2.5.
|
29 |
define( 'SFML_FILE', __FILE__ );
|
30 |
define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
|
31 |
define( 'SFML_PLUGIN_DIR', plugin_dir_path( SFML_FILE ) );
|
@@ -55,8 +53,12 @@ function sfml_init() {
|
|
55 |
SFML_Options::get_instance();
|
56 |
|
57 |
// Administration.
|
58 |
-
if ( is_admin()
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
// !EMERGENCY BYPASS.
|
@@ -87,8 +89,4 @@ function sfml_lang_init() {
|
|
87 |
$done = true;
|
88 |
|
89 |
load_plugin_textdomain( 'sf-move-login', false, dirname( plugin_basename( SFML_FILE ) ) . '/languages' );
|
90 |
-
|
91 |
-
// Make sure Poedit keeps our plugin headers.
|
92 |
-
/** Translators: Description of the plugin/theme */
|
93 |
-
__( 'Change your login URL.', 'sf-move-login' );
|
94 |
}
|
3 |
* Plugin Name: SF Move Login
|
4 |
* Plugin URI: https://www.screenfeed.fr/plugin-wp/move-login/
|
5 |
* Description: Change your login URL.
|
6 |
+
* Version: 2.5.3
|
7 |
* Author: Grégory Viguier
|
8 |
* Author URI: https://www.screenfeed.fr/
|
9 |
* License: GPLv3
|
13 |
* Domain Path: /languages/
|
14 |
*/
|
15 |
|
16 |
+
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
17 |
|
18 |
if ( empty( $GLOBALS['wp_version'] ) || version_compare( $GLOBALS['wp_version'], '3.1' ) < 0 || version_compare( phpversion(), '5.3' ) < 0 ) {
|
19 |
return;
|
23 |
/* !CONSTANTS =================================================================================== */
|
24 |
/*------------------------------------------------------------------------------------------------*/
|
25 |
|
26 |
+
define( 'SFML_VERSION', '2.5.3' );
|
27 |
define( 'SFML_FILE', __FILE__ );
|
28 |
define( 'SFML_PLUGIN_BASENAME', plugin_basename( SFML_FILE ) );
|
29 |
define( 'SFML_PLUGIN_DIR', plugin_dir_path( SFML_FILE ) );
|
53 |
SFML_Options::get_instance();
|
54 |
|
55 |
// Administration.
|
56 |
+
if ( is_admin() ) {
|
57 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
58 |
+
include_once( SFML_PLUGIN_DIR . 'inc/ajax.php' );
|
59 |
+
} else {
|
60 |
+
include_once( SFML_PLUGIN_DIR . 'inc/admin.php' );
|
61 |
+
}
|
62 |
}
|
63 |
|
64 |
// !EMERGENCY BYPASS.
|
89 |
$done = true;
|
90 |
|
91 |
load_plugin_textdomain( 'sf-move-login', false, dirname( plugin_basename( SFML_FILE ) ) . '/languages' );
|
|
|
|
|
|
|
|
|
92 |
}
|
uninstall.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
die();
|
4 |
-
}
|
5 |
|
6 |
|
7 |
include_once( plugin_dir_path( __FILE__ ) . 'inc/classes/class-sfml-singleton.php' );
|
1 |
<?php
|
2 |
+
defined( 'WP_UNINSTALL_PLUGIN' ) || die( 'Cheatin\' uh?' );
|
|
|
|
|
3 |
|
4 |
|
5 |
include_once( plugin_dir_path( __FILE__ ) . 'inc/classes/class-sfml-singleton.php' );
|