PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
← All changes | vendor-prefixed/src/Support/Slug.php +6 -7 4.4.2 → 4.4.5 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2
3 3 namespace YayMailScoped\YayCommerce\AdminShell\Support;
4 4
5 -\defined('ABSPATH') || exit;
5 +defined('ABSPATH') || exit;
6 6 /**
7 7 * Slug utilities.
8 8 *
9 9 * Plugin slugs can contain characters that are valid in wp_options keys
@@ -9,9 +9,8 @@
9 9 * Plugin slugs can contain characters that are valid in wp_options keys
10 10 * and URL paths but invalid as JavaScript identifiers (e.g. hyphens, '&').
11 11 * This helper sanitizes a slug for use as a JS variable name while the
12 12 * original slug stays intact for option-key and REST-URL contexts.
13 - * @internal
14 13 */
15 14 class Slug
16 15 {
17 16 /**
@@ -25,17 +24,17 @@
25 24 * - Return '_' for empty / all-special input (never empty string)
26 25 *
27 26 * Idempotent: to_var_name( to_var_name( $x ) ) === to_var_name( $x ).
28 27 */
29 - public static function to_var_name(string $slug) : string
28 + public static function to_var_name(string $slug): string
30 29 {
31 - $name = \preg_replace('/[^A-Za-z0-9_]/', '_', $slug);
32 - $name = \preg_replace('/_+/', '_', (string) $name);
33 - $name = \trim((string) $name, '_');
30 + $name = preg_replace('/[^A-Za-z0-9_]/', '_', $slug);
31 + $name = preg_replace('/_+/', '_', (string) $name);
32 + $name = trim((string) $name, '_');
34 33 if ('' === $name) {
35 34 return '_';
36 35 }
37 - if (\preg_match('/^\\d/', $name)) {
36 + if (preg_match('/^\d/', $name)) {
38 37 $name = '_' . $name;
39 38 }
40 39 return $name;
41 40 }