Skip to content

Commit 5fbc25f

Browse files
author
gitlost
committed
For PHP 5 performance do preliminary preg_match on isNormalized.
1 parent 29a8688 commit 5fbc25f

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

Symfony/Normalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static function isNormalized($s, $form = self::NFC)
120120
if (!unfc_is_valid_utf8($s)) {
121121
return false;
122122
}
123-
if (1 !== preg_match(UNFC_REGEX_NFC_NOES_MAYBES_REORDERS, $s)) { // If contains no characters that could possibly need normalizing...
123+
if (1 !== preg_match( '/[\xcc-\xf4]/', $s) || 1 !== preg_match(UNFC_REGEX_NFC_NOES_MAYBES_REORDERS, $s)) { // If contains no characters that could possibly need normalizing...
124124
return true;
125125
}
126126

languages/unfc-normalize-fr_FR.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: UNFC Nörmalize 1.0.2\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/unfc-normalize\n"
7-
"POT-Creation-Date: 2016-08-17 17:50+0100\n"
8-
"PO-Revision-Date: 2016-08-17 20:33+0100\n"
7+
"POT-Creation-Date: 2016-08-24 18:28+0100\n"
8+
"PO-Revision-Date: 2016-08-24 18:28+0100\n"
99
"Last-Translator: gitlost <[email protected]>\n"
1010
"Language-Team: \n"
1111
"Language: fr_FR\n"

languages/unfc-normalize.pot

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -257,213 +257,213 @@ msgid ""
257257
"been deactivated."
258258
msgstr ""
259259

260-
#: includes/class-unfc-normalize.php:848
260+
#: includes/class-unfc-normalize.php:846
261261
msgid "Please wait..."
262262
msgstr ""
263263

264-
#: includes/class-unfc-normalize.php:979 includes/class-unfc-normalize.php:1200
264+
#: includes/class-unfc-normalize.php:977 includes/class-unfc-normalize.php:1198
265265
msgid "UNFC Nörmalize Database Check"
266266
msgstr ""
267267

268-
#: includes/class-unfc-normalize.php:979
268+
#: includes/class-unfc-normalize.php:977
269269
msgid "UNFC Nörm Db Check"
270270
msgstr ""
271271

272-
#: includes/class-unfc-normalize.php:993 includes/class-unfc-normalize.php:1193
272+
#: includes/class-unfc-normalize.php:991 includes/class-unfc-normalize.php:1191
273273
msgid "Sorry, you are not allowed to access this page."
274274
msgstr ""
275275

276-
#: includes/class-unfc-normalize.php:1259
276+
#: includes/class-unfc-normalize.php:1257
277277
msgid "Rescan the Database"
278278
msgstr ""
279279

280-
#: includes/class-unfc-normalize.php:1261
280+
#: includes/class-unfc-normalize.php:1259
281281
msgid "Scan the Database"
282282
msgstr ""
283283

284-
#: includes/class-unfc-normalize.php:1269
284+
#: includes/class-unfc-normalize.php:1267
285285
msgid "You can scan the database for non-normalized data (nothing will be updated):"
286286
msgstr ""
287287

288-
#: includes/class-unfc-normalize.php:1274
288+
#: includes/class-unfc-normalize.php:1272
289289
msgid ""
290290
"Scanning the database can take a long time depending on the amount and type "
291291
"of data you have."
292292
msgstr ""
293293

294-
#: includes/class-unfc-normalize.php:1291
294+
#: includes/class-unfc-normalize.php:1289
295295
msgid ""
296296
"You can normalize the non-normalized data found in the database. The "
297297
"database <strong>will be updated</strong>."
298298
msgstr ""
299299

300-
#: includes/class-unfc-normalize.php:1294
300+
#: includes/class-unfc-normalize.php:1292
301301
msgid ""
302302
"<strong>Important:</strong> before updating, please <a "
303303
"href=\"https://codex.wordpress.org/WordPress_Backups\">back up your "
304304
"database</a>."
305305
msgstr ""
306306

307-
#: includes/class-unfc-normalize.php:1296
307+
#: includes/class-unfc-normalize.php:1294
308308
msgid "Normalize All"
309309
msgstr ""
310310

311-
#: includes/class-unfc-normalize.php:1298
311+
#: includes/class-unfc-normalize.php:1296
312312
msgid ""
313313
"Normalizing can take a long time depending on the amount and type of data "
314314
"you have."
315315
msgstr ""
316316

317-
#: includes/class-unfc-normalize.php:1314
317+
#: includes/class-unfc-normalize.php:1312
318318
#. translators: %1$s: formatted maximum number of non-normalized items listed;
319319
#. %2$s: formatted total number of non-normalized items found.
320320
msgid "First %1$s Non-Normalized Items of %2$s Found"
321321
msgstr ""
322322

323-
#: includes/class-unfc-normalize.php:1318
323+
#: includes/class-unfc-normalize.php:1316
324324
msgid "Non-Normalized Items"
325325
msgstr ""
326326

327-
#: includes/class-unfc-normalize.php:1344
327+
#: includes/class-unfc-normalize.php:1342
328328
msgid "Rescan Slugs"
329329
msgstr ""
330330

331-
#: includes/class-unfc-normalize.php:1346
331+
#: includes/class-unfc-normalize.php:1344
332332
msgid "Scan Slugs"
333333
msgstr ""
334334

335-
#: includes/class-unfc-normalize.php:1354
335+
#: includes/class-unfc-normalize.php:1352
336336
msgid ""
337337
"You can scan the database for slugs that could be percent-encoded from "
338338
"non-normalized data (nothing will be updated):"
339339
msgstr ""
340340

341-
#: includes/class-unfc-normalize.php:1357
341+
#: includes/class-unfc-normalize.php:1355
342342
msgid "A list of posts and/or terms with suspect slugs will be displayed."
343343
msgstr ""
344344

345-
#: includes/class-unfc-normalize.php:1362
345+
#: includes/class-unfc-normalize.php:1360
346346
msgid ""
347347
"Scanning the slugs can take a long time depending on the amount and type of "
348348
"data you have."
349349
msgstr ""
350350

351-
#: includes/class-unfc-normalize.php:1378
351+
#: includes/class-unfc-normalize.php:1376
352352
#. translators: %1$s: formatted maximum number of non-normalized slugs listed;
353353
#. %2$s: formatted total number of non-normalized slugs found.
354354
msgid "First %1$s Non-Normalized Slugs of %2$s Found"
355355
msgstr ""
356356

357-
#: includes/class-unfc-normalize.php:1382
357+
#: includes/class-unfc-normalize.php:1380
358358
msgid "Non-Normalized Slugs"
359359
msgstr ""
360360

361-
#: includes/class-unfc-normalize.php:1507
361+
#: includes/class-unfc-normalize.php:1505
362362
msgid "Database error."
363363
msgstr ""
364364

365-
#: includes/class-unfc-normalize.php:1508
365+
#: includes/class-unfc-normalize.php:1506
366366
msgid "Meta data error."
367367
msgstr ""
368368

369-
#: includes/class-unfc-normalize.php:1509
369+
#: includes/class-unfc-normalize.php:1507
370370
msgid "Parameters error."
371371
msgstr ""
372372

373-
#: includes/class-unfc-normalize.php:1510
373+
#: includes/class-unfc-normalize.php:1508
374374
msgid "Transient has expired. Please re-scan."
375375
msgstr ""
376376

377-
#: includes/class-unfc-normalize.php:1511
377+
#: includes/class-unfc-normalize.php:1509
378378
msgid "Data out of sync!"
379379
msgstr ""
380380

381-
#: includes/class-unfc-normalize.php:1512
381+
#: includes/class-unfc-normalize.php:1510
382382
msgid "No items selected!"
383383
msgstr ""
384384

385-
#: includes/class-unfc-normalize.php:1587
386-
#: includes/class-unfc-normalize.php:2023
385+
#: includes/class-unfc-normalize.php:1585
386+
#: includes/class-unfc-normalize.php:2021
387387
msgid "..."
388388
msgstr ""
389389

390-
#: includes/class-unfc-normalize.php:1624
390+
#: includes/class-unfc-normalize.php:1622
391391
#. translators: %s: formatted number of items detected.
392392
msgid "%s non-normalized item detected."
393393
msgid_plural "%s non-normalized items detected."
394394
msgstr[0] ""
395395
msgstr[1] ""
396396

397-
#: includes/class-unfc-normalize.php:1627
397+
#: includes/class-unfc-normalize.php:1625
398398
msgid "<strong>No</strong> non-normalized data detected!"
399399
msgstr ""
400400

401-
#: includes/class-unfc-normalize.php:1805
401+
#: includes/class-unfc-normalize.php:1803
402402
#. translators: %s: formatted number of items normalized.
403403
msgid "%s item normalized."
404404
msgid_plural "%s items normalized."
405405
msgstr[0] ""
406406
msgstr[1] ""
407407

408-
#: includes/class-unfc-normalize.php:1807
409-
#: includes/class-unfc-normalize.php:2237
408+
#: includes/class-unfc-normalize.php:1805
409+
#: includes/class-unfc-normalize.php:2235
410410
msgid "Nothing updated!"
411411
msgstr ""
412412

413-
#: includes/class-unfc-normalize.php:1812
413+
#: includes/class-unfc-normalize.php:1810
414414
#. translators: %s: formatted number of items locked.
415415
msgid "%s item not normalized, somebody is editing it."
416416
msgid_plural "%s items not normalized, somebody is editing them."
417417
msgstr[0] ""
418418
msgstr[1] ""
419419

420-
#: includes/class-unfc-normalize.php:1818
420+
#: includes/class-unfc-normalize.php:1816
421421
#. translators: %s: formatted number of items that failed to normalize.
422422
msgid "%s item not normalized, failed to normalize."
423423
msgid_plural "%s items not normalized, failed to normalize."
424424
msgstr[0] ""
425425
msgstr[1] ""
426426

427-
#: includes/class-unfc-normalize.php:2057
427+
#: includes/class-unfc-normalize.php:2055
428428
#. translators: %s: formatted number of percent-encoded items detected.
429429
msgid "%s non-normalized percent-encoded slug detected."
430430
msgid_plural "%s non-normalized percent-encoded slugs detected."
431431
msgstr[0] ""
432432
msgstr[1] ""
433433

434-
#: includes/class-unfc-normalize.php:2061
434+
#: includes/class-unfc-normalize.php:2059
435435
msgid "<strong>No</strong> non-normalized percent-encoded slugs detected!"
436436
msgstr ""
437437

438-
#: includes/class-unfc-normalize.php:2235
438+
#: includes/class-unfc-normalize.php:2233
439439
#. translators: %s: formatted number of slugs normalized.
440440
msgid "%s slug normalized."
441441
msgid_plural "%s slugs normalized."
442442
msgstr[0] ""
443443
msgstr[1] ""
444444

445-
#: includes/class-unfc-normalize.php:2242
445+
#: includes/class-unfc-normalize.php:2240
446446
#. translators: %s: formatted number of items locked.
447447
msgid "%s slug not normalized, somebody is editing it."
448448
msgid_plural "%s slugs not normalized, somebody is editing them."
449449
msgstr[0] ""
450450
msgstr[1] ""
451451

452-
#: includes/class-unfc-normalize.php:2248
452+
#: includes/class-unfc-normalize.php:2246
453453
#. translators: %s: formatted number of slugs not found.
454454
msgid "%s slug not normalized, no longer exists."
455455
msgid_plural "%s slugs not normalized, no longer exist."
456456
msgstr[0] ""
457457
msgstr[1] ""
458458

459-
#: includes/class-unfc-normalize.php:2254
459+
#: includes/class-unfc-normalize.php:2252
460460
#. translators: %s: formatted number of slugs not non-normalized.
461461
msgid "%s slug not normalized, no longer non-normalized."
462462
msgid_plural "%s slugs not normalized, no longer non-normalized."
463463
msgstr[0] ""
464464
msgstr[1] ""
465465

466-
#: includes/class-unfc-normalize.php:2260
466+
#: includes/class-unfc-normalize.php:2258
467467
#. translators: %s: formatted number of slugs that failed to normalize.
468468
msgid "%s slug not normalized, failed to normalize."
469469
msgid_plural "%s slugs not normalized, failed to normalize."

0 commit comments

Comments
 (0)