PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.3
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / vendor / wikimedia / aho-corasick / bench / check.php

check.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.3, at vendor/wikimedia/aho-corasick/bench/check.php

43 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once __DIR__ . '/../src/MultiStringMatcher.php';
3 require_once __DIR__ . '/../src/MultiStringReplacer.php';
4
5 use AhoCorasick\MultiStringReplacer;
6
7 if ( !file_exists( __DIR__ . '/23835-0.txt' ) ) {
8 die( 'Please download http://www.gutenberg.org/files/23835/23835-0.txt' );
9 }
10
11 if ( !file_exists( __DIR__ . '/ZhConversion.php' ) ) {
12 die( 'You need ZhConversion.php, from http://git.io/vIMst' );
13 }
14
15 require_once __DIR__ . '/ZhConversion.php';
16
17 $text = file_get_contents( __DIR__ . '/23835-0.txt' );
18
19 $status = 0;
20 $expected = strtr( $text, $zh2Hant );
21
22 echo "MultiStringReplacer::searchAndReplace(): ";
23 $replacer = new MultiStringReplacer( $zh2Hant );
24 if ( $replacer->searchAndReplace( $text ) !== $expected ) {
25 echo "ERROR\n";
26 $status = 1;
27 } else {
28 echo "OK\n";
29 }
30
31 if ( function_exists( 'fss_exec_replace' ) ) {
32 echo "fss_exec_replace(): ";
33 $fss = fss_prep_replace( $zh2Hant );
34 if ( fss_exec_replace( $fss, $text ) !== $expected ) {
35 echo "ERROR\n";
36 $status = 1;
37 } else {
38 echo "OK\n";
39 }
40 }
41
42 exit( $status );
43