PluginProbe ʕ •ᴥ•ʔ
Search Regex / 2.4
Search Regex v2.4
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.php
search-regex Last commit date
api 5 years ago images 6 years ago locale 5 years ago models 5 years ago source 5 years ago README.md 11 years ago license.txt 18 years ago readme.txt 5 years ago search-regex-admin.php 5 years ago search-regex-capabilities.php 5 years ago search-regex-cli.php 6 years ago search-regex-settings.php 5 years ago search-regex-strings.php 5 years ago search-regex-version.php 5 years ago search-regex.css 6 years ago search-regex.js 5 years ago search-regex.php 5 years ago
search-regex.php
112 lines
1 <?php
2
3 /*
4 Plugin Name: Search Regex
5 Plugin URI: https://searchregex.com/
6 Description: Adds search and replace functionality across posts, pages, comments, and meta-data, with full regular expression support
7 Version: 2.4
8 Author: John Godley
9 Text Domain: search-regex
10 Domain Path: /locale
11 ============================================================================================================
12 This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13 implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14 the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15 consequential damages(including, but not limited to, procurement of substitute goods or services; loss of
16 use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17 contract, strict liability, or tort(including negligence or otherwise) arising in any way out of the use of
18 this software, even if advised of the possibility of such damage.
19
20 For full license details see license.txt
21 ============================================================================================================
22 */
23
24 define( 'SEARCHREGEX_FILE', __FILE__ );
25 define( 'SEARCHREGEX_DEV_MODE', false );
26
27 // This file must support PHP < 5.6 so as not to crash
28 if ( version_compare( phpversion(), '5.6' ) < 0 ) {
29 add_action( 'plugin_action_links_' . basename( dirname( SEARCHREGEX_FILE ) ) . '/' . basename( SEARCHREGEX_FILE ), 'searchregex_deprecated_php', 10, 4 );
30
31 /**
32 * Show a deprecated PHP warning in the plugin page
33 *
34 * @param Array $links Plugin links.
35 * @return Array
36 */
37 function searchregex_deprecated_php( $links ) {
38 /* translators: 1: server PHP version. 2: required PHP version. */
39 array_unshift( $links, '<a href="https://searchregex.com/support/problems/php-version/" style="color: red; text-decoration: underline">' . sprintf( __( 'Disabled! Detected PHP %1$s, need PHP %2$s+', 'search-regex' ), phpversion(), '5.6' ) . '</a>' );
40 return $links;
41 }
42
43 return;
44 }
45
46 require_once __DIR__ . '/search-regex-version.php';
47 require_once __DIR__ . '/search-regex-settings.php';
48 require_once __DIR__ . '/search-regex-capabilities.php';
49
50 /**
51 * Is the request for WP CLI?
52 *
53 * @return Bool
54 */
55 function searchregex_is_wpcli() {
56 if ( defined( 'WP_CLI' ) && WP_CLI ) {
57 return true;
58 }
59
60 return false;
61 }
62
63 /**
64 * Is the request for Search Regex admin?
65 *
66 * @return Bool
67 */
68 function searchregex_is_admin() {
69 if ( is_admin() ) {
70 return true;
71 }
72
73 return false;
74 }
75
76 /**
77 * Start the Search Regex REST API
78 *
79 * @return void
80 */
81 function searchregex_start_rest() {
82 require_once __DIR__ . '/search-regex-admin.php';
83 require_once __DIR__ . '/api/api.php';
84
85 Search_Regex_Api::init();
86 Search_Regex_Admin::init();
87
88 remove_action( 'rest_api_init', 'searchregex_start_rest' );
89 }
90
91 /**
92 * Set the Search Regex text domain
93 *
94 * @return void
95 */
96 function searchregex_locale() {
97 /** @psalm-suppress PossiblyFalseArgument */
98 load_plugin_textdomain( 'search-regex', false, dirname( plugin_basename( SEARCHREGEX_FILE ) ) . '/locale/' );
99 }
100
101 if ( searchregex_is_admin() || searchregex_is_wpcli() ) {
102 require_once __DIR__ . '/search-regex-admin.php';
103 require_once __DIR__ . '/api/api.php';
104 }
105
106 if ( searchregex_is_wpcli() ) {
107 require_once __DIR__ . '/search-regex-cli.php';
108 }
109
110 add_action( 'rest_api_init', 'searchregex_start_rest' );
111 add_action( 'init', 'searchregex_locale' );
112