forked from deliciousbrains/better-search-replace
-
Notifications
You must be signed in to change notification settings - Fork 2
/
better-search-replace.php
executable file
·91 lines (79 loc) · 3.02 KB
/
better-search-replace.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Better Search Replace
*
* This plugin improves upon the database search/replace functionality offered
* by some other plugins- offering serialization support, the ability to
* select specific tables, and the ability to run a dry run.
*
* @since 1.0.0
* @package Better_Search_Replace
*
* @wordpress-plugin
* Plugin Name: Better Search Replace
* Plugin URI: https://bettersearchreplace.com
* Description: A small plugin for running a search/replace on your WordPress database.
* Version: 1.3.4
* Author: Delicious Brains
* Author URI: https://bettersearchreplace.com
* License: GPL-3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
* Text Domain: better-search-replace
* Domain Path: /languages
* Network: true
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// If this file was called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_better_search_replace() {
// Check the plugin install state and user permissions to determine the best capability to use for filtering
if( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS && current_user_can( apply_filters( 'bsr_capability', 'manage_options' ) ) ) {
$capability = 'manage_options';
} else {
$capability = 'install_plugins';
}
// Allows for overriding the capability required to run the plugin.
$cap = apply_filters( 'bsr_capability', $capability );
// Only load for admins.
if ( current_user_can( $cap ) ) {
// Defines the path to the main plugin file.
define( 'BSR_FILE', __FILE__ );
// Defines the path to be used for includes.
define( 'BSR_PATH', plugin_dir_path( BSR_FILE ) );
// Defines the URL to the plugin.
define( 'BSR_URL', plugin_dir_url( BSR_FILE ) );
// Defines the current version of the plugin.
define( 'BSR_VERSION', '1.3.4' );
/**
* The core plugin class that is used to define internationalization,
* dashboard-specific hooks, and public-facing site hooks.
*/
require BSR_PATH . 'includes/class-bsr-main.php';
$plugin = new Better_Search_Replace();
$plugin->run();
}
}
add_action( 'after_setup_theme', 'run_better_search_replace' );