PluginProbe ʕ •ᴥ•ʔ
Search Regex / 3.4.4
Search Regex v3.4.4
3.4.4 3.4.3 trunk 1.4.12 1.4.13 1.4.14 1.4.15 1.4.16 2.0 2.0.1 2.1 2.2 2.2.1 2.3 2.3.1 2.3.2 2.3.3 2.4 2.4.1 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1 3.1.1 3.1.2 3.2 3.3 3.3.0 3.3.1 3.4 3.4.1 3.4.2
search-regex / search-regex-loader.php
search-regex Last commit date
build 1 week ago includes 1 week ago changelog.txt 2 years ago license.txt 18 years ago readme.txt 1 week ago search-regex-loader.php 7 months ago search-regex.php 1 week ago
search-regex-loader.php
53 lines
1 <?php
2 /**
3 * Legacy autoloader - retained for backward compatibility.
4 *
5 * This file was used in version 3.3.0 to load the plugin, but in retrospect it is better
6 * to have it in the main plugin file.
7 *
8 * This file can safely be removed in a future major version (3.5+) after sufficient time
9 * has passed for caches to be cleared.
10 *
11 * @deprecated 3.5.0 Use the autoloader in search-regex.php instead.
12 * @package Search_Regex
13 */
14
15 spl_autoload_register(
16 function ( $requested_class ) {
17 $prefix = 'SearchRegex\\';
18
19 if ( strncmp( $prefix, $requested_class, strlen( $prefix ) ) !== 0 ) {
20 return;
21 }
22
23 $relative_class = substr( $requested_class, strlen( $prefix ) );
24 if ( $relative_class === '' ) {
25 return;
26 }
27
28 $normalize = static function ( string $value ): string {
29 return str_replace( '_', '-', strtolower( $value ) );
30 };
31
32 $segments = explode( '\\', $relative_class );
33 $class_name = array_pop( $segments );
34 $normalized_segments = array_filter(
35 array_map( $normalize, $segments ),
36 static fn ( $value ) => $value !== ''
37 );
38
39 $base_dir = __DIR__ . '/includes/';
40 if ( count( $normalized_segments ) > 0 ) {
41 $base_dir .= implode( '/', $normalized_segments ) . '/';
42 }
43
44 $path = $base_dir . 'class-' . $normalize( $class_name ) . '.php';
45
46 if ( file_exists( $path ) ) {
47 require_once $path;
48 }
49 }
50 );
51
52 require_once __DIR__ . '/build/search-regex-version.php';
53