author | Anthony Ly <anthonyly.com@gmail.com> |
Tue, 12 Mar 2013 18:21:39 +0100 | |
changeset 206 | 919b4ddb13fa |
parent 204 | 09a1c134465b |
permissions | -rw-r--r-- |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2 |
/* |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
3 |
Plugin Name: Duplicator |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
4 |
Plugin URI: http://www.lifeinthegrid.com/duplicator/ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
5 |
Description: Create a full WordPress backup of your files and database with one click. Duplicate and move an entire site from one location to another in 3 easy steps. Create full snapshot of your site at any point in time. |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
6 |
Version: 0.4.1 |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
7 |
Author: LifeInTheGrid |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
8 |
Author URI: http://www.lifeinthegrid.com |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
9 |
License: GPLv2 or later |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
10 |
*/ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
11 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
12 |
/* ================================================================================ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
13 |
Copyright 2011-2012 Cory Lamle |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
14 |
|
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
15 |
This program is free software; you can redistribute it and/or modify |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
16 |
it under the terms of the GNU General Public License, version 2, as |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
17 |
published by the Free Software Foundation. |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
18 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
19 |
This program is distributed in the hope that it will be useful, |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
22 |
GNU General Public License for more details. |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
23 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
24 |
You should have received a copy of the GNU General Public License |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
25 |
along with this program; if not, write to the Free Software |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
27 |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
28 |
SOURCE CONTRIBUTORS: |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
29 |
Gaurav Aggarwal |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
30 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
31 |
================================================================================ */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
32 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
33 |
require_once("define.php"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
34 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
35 |
if (is_admin() == true) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
36 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
37 |
$_tmpDuplicatorOptions = get_option('duplicator_options', false); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
38 |
$GLOBALS['duplicator_opts'] = ($_tmpDuplicatorOptions == false) ? array() : @unserialize($_tmpDuplicatorOptions); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
39 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
40 |
//OPTIONS |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
41 |
$GLOBALS['duplicator_opts']['dbhost'] = isset($GLOBALS['duplicator_opts']['dbhost']) ? $GLOBALS['duplicator_opts']['dbhost'] : ''; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
42 |
$GLOBALS['duplicator_opts']['dbname'] = isset($GLOBALS['duplicator_opts']['dbname']) ? $GLOBALS['duplicator_opts']['dbname'] : ''; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
43 |
$GLOBALS['duplicator_opts']['dbuser'] = isset($GLOBALS['duplicator_opts']['dbuser']) ? $GLOBALS['duplicator_opts']['dbuser'] : ''; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
44 |
$GLOBALS['duplicator_opts']['dbiconv'] = isset($GLOBALS['duplicator_opts']['dbiconv']) ? $GLOBALS['duplicator_opts']['dbiconv'] : '1'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
45 |
$GLOBALS['duplicator_opts']['dbadd_drop'] = isset($GLOBALS['duplicator_opts']['dbadd_drop']) ? $GLOBALS['duplicator_opts']['dbadd_drop'] : '0'; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
46 |
$GLOBALS['duplicator_opts']['url_new'] = isset($GLOBALS['duplicator_opts']['url_new'] ) ? $GLOBALS['duplicator_opts']['url_new'] : ''; |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
47 |
$GLOBALS['duplicator_opts']['email-me'] = isset($GLOBALS['duplicator_opts']['email-me']) ? $GLOBALS['duplicator_opts']['email-me'] : '0'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
48 |
$GLOBALS['duplicator_opts']['log_level'] = isset($GLOBALS['duplicator_opts']['log_level']) ? $GLOBALS['duplicator_opts']['log_level'] : '0'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
49 |
$GLOBALS['duplicator_opts']['max_memory'] = isset($GLOBALS['duplicator_opts']['max_memory']) ? $GLOBALS['duplicator_opts']['max_memory'] : '1000M'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
50 |
$GLOBALS['duplicator_opts']['email_others'] = isset($GLOBALS['duplicator_opts']['email_others']) ? $GLOBALS['duplicator_opts']['email_others'] : ''; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
51 |
$GLOBALS['duplicator_opts']['skip_ext'] = isset($GLOBALS['duplicator_opts']['skip_ext']) ? $GLOBALS['duplicator_opts']['skip_ext'] : ''; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
52 |
$GLOBALS['duplicator_opts']['dir_bypass'] = isset($GLOBALS['duplicator_opts']['dir_bypass']) ? $GLOBALS['duplicator_opts']['dir_bypass'] : ''; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
53 |
$GLOBALS['duplicator_opts']['rm_snapshot'] = isset($GLOBALS['duplicator_opts']['rm_snapshot']) ? $GLOBALS['duplicator_opts']['rm_snapshot'] : '1'; |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
54 |
//max_time needs to be numeric |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
55 |
if (isset($GLOBALS['duplicator_opts']['max_time'])) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
56 |
$GLOBALS['duplicator_opts']['max_time'] = is_numeric($GLOBALS['duplicator_opts']['max_time']) ? $GLOBALS['duplicator_opts']['max_time'] : 1000; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
57 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
58 |
$GLOBALS['duplicator_opts']['max_time'] = 1000; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
59 |
} |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
60 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
61 |
//Default Arrays |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
62 |
$GLOBALS['duplicator_bypass-array'] = explode(";", $GLOBALS['duplicator_opts']['dir_bypass'], -1); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
63 |
$GLOBALS['duplicator_bypass-array'] = count($GLOBALS['duplicator_bypass-array']) ? $GLOBALS['duplicator_bypass-array'] : null; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
64 |
$GLOBALS['duplicator_skip_ext-array'] = explode(";", $GLOBALS['duplicator_opts']['skip_ext']) ? explode(";", $GLOBALS['duplicator_opts']['skip_ext']) : array(); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
65 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
66 |
require_once 'inc/functions.php'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
67 |
require_once 'inc/class.zip.php'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
68 |
require_once 'inc/actions.php'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
69 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
70 |
/* ACTIVATION |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
71 |
Only called when plugin is activated */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
72 |
function duplicator_activate() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
73 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
74 |
global $wpdb; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
75 |
$table_name = $wpdb->prefix . "duplicator"; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
76 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
77 |
//PRIMARY KEY must have 2 spaces before for dbDelta |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
78 |
$sql = "CREATE TABLE `{$table_name}` ( |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
79 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
80 |
token VARCHAR(25) NOT NULL, |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
81 |
packname VARCHAR(250) NOT NULL, |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
82 |
zipname VARCHAR(250) NOT NULL, |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
83 |
zipsize INT (11), |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
84 |
created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
85 |
owner VARCHAR(60) NOT NULL, |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
86 |
settings LONGTEXT NOT NULL)" ; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
87 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
88 |
require_once(DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
89 |
@dbDelta($sql); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
90 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
91 |
$duplicator_opts = array( |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
92 |
'dbhost' =>'localhost', |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
93 |
'dbname' =>'', |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
94 |
'dbuser' =>'', |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
95 |
'url_new' =>'', |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
96 |
'email-me' =>"{$GLOBALS['duplicator_opts']['email-me']}", |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
97 |
'email_others' =>"{$GLOBALS['duplicator_opts']['email_others']}", |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
98 |
'max_time' =>$GLOBALS['duplicator_opts']['max_time'], |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
99 |
'max_memory' =>$GLOBALS['duplicator_opts']['max_memory'], |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
100 |
'dir_bypass' =>"{$GLOBALS['duplicator_opts']['dir_bypass']}", |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
101 |
'log_level' =>'0', |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
102 |
'dbiconv' =>"{$GLOBALS['duplicator_opts']['dbiconv']}", |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
103 |
'skip_ext' =>"{$GLOBALS['duplicator_opts']['skip_ext']}", |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
104 |
'rm_snapshot' =>"{$GLOBALS['duplicator_opts']['rm_snapshot']}"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
105 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
106 |
update_option('duplicator_version_plugin', DUPLICATOR_VERSION); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
107 |
update_option('duplicator_options', serialize($duplicator_opts)); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
108 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
109 |
//CLEANUP LEGACY |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
110 |
//PRE 0.2.9 |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
111 |
delete_option('duplicator_version_database'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
112 |
$wpdb->query("ALTER TABLE `{$table_name}` CHANGE bid id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
113 |
$wpdb->query("ALTER TABLE `{$table_name}` DROP COLUMN ver_db"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
114 |
$wpdb->query("ALTER TABLE `{$table_name}` DROP COLUMN ver_plug"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
115 |
$wpdb->query("ALTER TABLE `{$table_name}` DROP COLUMN status"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
116 |
$wpdb->query("ALTER TABLE `{$table_name}` DROP COLUMN type"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
117 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
118 |
//Setup All Directories |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
119 |
duplicator_init_snapshotpath(); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
120 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
121 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
122 |
/* UPDATE |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
123 |
register_activation_hook is not called when a plugin is updated |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
124 |
so we need to use the following function */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
125 |
function duplicator_update() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
126 |
if (DUPLICATOR_VERSION != get_option("duplicator_version_plugin")) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
127 |
duplicator_activate(); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
128 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
129 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
130 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
131 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
132 |
/* DEACTIVATION |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
133 |
Only called when plugin is deactivated */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
134 |
function duplicator_deactivate() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
135 |
//No actions needed yet |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
136 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
137 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
138 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
139 |
/* UNINSTALL |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
140 |
Uninstall all duplicator logic */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
141 |
function duplicator_uninstall() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
142 |
global $wpdb; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
143 |
$table_name = $wpdb->prefix . "duplicator"; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
144 |
$wpdb->query("DROP TABLE `{$table_name}`"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
145 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
146 |
delete_option('duplicator_version_plugin'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
147 |
delete_option('duplicator_options'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
148 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
149 |
if ($GLOBALS['duplicator_opts']['rm_snapshot']) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
150 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
151 |
$ssdir = duplicator_safe_path(DUPLICATOR_SSDIR_PATH); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
152 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
153 |
//Sanity check for strange setup |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
154 |
$check = glob("{$ssdir}/wp-config.php"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
155 |
if (count($check) == 0) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
156 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
157 |
//PHP is sometimes flaky so lets do a sanity check |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
158 |
foreach (glob("{$ssdir}/*_database.sql") as $file) { if (strstr($file, '_database.sql')) {@unlink("{$file}");} } |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
159 |
foreach (glob("{$ssdir}/*_installer.php") as $file) { if (strstr($file, '_installer.php')) {@unlink("{$file}");} } |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
160 |
foreach (glob("{$ssdir}/*_package.zip") as $file) { if (strstr($file, '_package.zip')) {@unlink("{$file}");} } |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
161 |
foreach (glob("{$ssdir}/*.log") as $file) { if (strstr($file, '.log')) {@unlink("{$file}");} } |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
162 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
163 |
//Check for core files and only continue removing data if the snapshots directory |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
164 |
//has not been edited by 3rd party sources, this helps to keep the system stable |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
165 |
$files = glob("{$ssdir}/*"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
166 |
if(is_array($files) && count($files) == 3) |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
167 |
{ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
168 |
$defaults = array("{$ssdir}/index.php", "{$ssdir}/robots.txt", "{$ssdir}/dtoken.php"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
169 |
$compare = array_diff($defaults, $files); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
170 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
171 |
if (count($compare) == 0) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
172 |
foreach($defaults as $file) {@unlink("{$file}");} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
173 |
@unlink("{$ssdir}/.htaccess"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
174 |
@rmdir($ssdir); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
175 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
176 |
//No packages have ever been created |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
177 |
} else if(is_array($files) && count($files) == 1) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
178 |
$defaults = array("{$ssdir}/index.php"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
179 |
$compare = array_diff($defaults, $files); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
180 |
if (count($compare) == 0) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
181 |
@unlink("{$ssdir}/index.php"); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
182 |
@rmdir($ssdir); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
183 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
184 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
185 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
186 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
187 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
188 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
189 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
190 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
191 |
/* META LINK ADDONS |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
192 |
Adds links to the plugins manager page */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
193 |
function duplicator_meta_links( $links, $file ) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
194 |
$plugin = plugin_basename(__FILE__); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
195 |
// create link |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
196 |
if ( $file == $plugin ) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
197 |
$links[] = '<a href="' . DUPLICATOR_HELPLINK . '" title="' . __( 'FAQ', 'wpduplicator' ) . '" target="_blank">' . __( 'FAQ', 'wpduplicator' ) . '</a>'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
198 |
$links[] = '<a href="' . DUPLICATOR_GIVELINK . '" title="' . __( 'Partner', 'wpduplicator' ) . '" target="_blank">' . __( 'Partner', 'wpduplicator' ) . '</a>'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
199 |
$links[] = '<a href="' . DUPLICATOR_CERTIFIED .'" title="' . __( 'Approved Hosts', 'wpduplicator' ) . '" target="_blank">' . __( 'Approved Hosts', 'wpduplicator' ) . '</a>'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
200 |
return $links; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
201 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
202 |
return $links; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
203 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
204 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
205 |
//HOOKS & ACTIONS |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
206 |
load_plugin_textdomain('wpduplicator' , FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/'); |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
207 |
register_activation_hook(__FILE__ , 'duplicator_activate'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
208 |
register_deactivation_hook(__FILE__ , 'duplicator_deactivate'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
209 |
register_uninstall_hook(__FILE__ , 'duplicator_uninstall'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
210 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
211 |
add_action('plugins_loaded', 'duplicator_update'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
212 |
add_action('admin_init', 'duplicator_init' ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
213 |
add_action('admin_menu', 'duplicator_menu'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
214 |
add_action('wp_ajax_duplicator_system_check', 'duplicator_system_check'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
215 |
add_action('wp_ajax_duplicator_system_directory', 'duplicator_system_directory'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
216 |
add_action('wp_ajax_duplicator_delete', 'duplicator_delete'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
217 |
add_action('wp_ajax_duplicator_create', 'duplicator_create'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
218 |
add_action('wp_ajax_duplicator_settings', 'duplicator_settings'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
219 |
add_filter('plugin_action_links', 'duplicator_manage_link', 10, 2 ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
220 |
add_filter('plugin_row_meta', 'duplicator_meta_links', 10, 2 ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
221 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
222 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
223 |
/** |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
224 |
* DUPLICATOR_INIT |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
225 |
* Init routines */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
226 |
function duplicator_init() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
227 |
/* Register our stylesheet. */ |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
228 |
wp_register_style('jquery-ui', DUPLICATOR_PLUGIN_URL . 'css/jquery-ui.css', null , "1.9.2" ); |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
229 |
wp_register_style('duplicator_style', DUPLICATOR_PLUGIN_URL . 'css/style.css' ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
230 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
231 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
232 |
/** |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
233 |
* DUPLICATOR_VIEWS |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
234 |
* Inlcude all visual elements */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
235 |
function duplicator_main_page() {include 'inc/page.main.php';} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
236 |
//Diagnostics Page |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
237 |
function duplicator_diag_page() {include 'inc/page.diag.php';} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
238 |
//Support Page |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
239 |
function duplicator_support_page() {include 'inc/page.support.php';} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
240 |
//All About Page |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
241 |
function duplicator_about_page() {include 'inc/page.about.php';} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
242 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
243 |
/** |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
244 |
* DUPLICATOR_MENU |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
245 |
* Loads the menu item into the WP tools section and queues the actions for only this plugin */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
246 |
function duplicator_menu() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
247 |
//Main Menu |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
248 |
$page_main = add_menu_page('Duplicator', 'Duplicator', "import", basename(__FILE__), 'duplicator_main_page', plugins_url('duplicator/img/create.png')); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
249 |
add_submenu_page(basename(__FILE__), __('Dashboard', 'wpduplicator'), __('Dashboard', 'wpduplicator'), "import" , basename(__FILE__), 'duplicator_main_page'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
250 |
//Sub Menus |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
251 |
$page_diag = add_submenu_page(basename(__FILE__), __('Diagnostics', 'wpduplicator'), __('Diagnostics', 'wpduplicator'), 'import', 'duplicator_diag_page', 'duplicator_diag_page'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
252 |
$page_support = add_submenu_page(basename(__FILE__), __('Support', 'wpduplicator'), __('Support', 'wpduplicator'), 'import', 'duplicator_support_page', 'duplicator_support_page'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
253 |
$page_about = add_submenu_page(basename(__FILE__), __('All About', 'wpduplicator'), __('All About', 'wpduplicator'), 'import', 'duplicator_about_page', 'duplicator_about_page'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
254 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
255 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
256 |
//Apply scripts and styles |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
257 |
add_action('admin_print_scripts-' . $page_main, 'duplicator_scripts'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
258 |
add_action('admin_print_styles-' . $page_main, 'duplicator_styles' ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
259 |
add_action('admin_print_styles-' . $page_diag, 'duplicator_styles' ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
260 |
add_action('admin_print_styles-' . $page_about, 'duplicator_styles' ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
261 |
add_action('admin_print_styles-' . $page_support, 'duplicator_styles' ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
262 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
263 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
264 |
/** |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
265 |
* DUPLICATOR_SCRIPTS |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
266 |
* Loads the required javascript libs only for this plugin */ |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
267 |
function duplicator_scripts() { |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
268 |
wp_enqueue_script('jquery'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
269 |
wp_enqueue_script('jquery-ui-core'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
270 |
wp_enqueue_script('jquery-ui-dialog'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
271 |
wp_enqueue_script('jquery-ui-button'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
195
diff
changeset
|
272 |
wp_enqueue_script('jquery-ui-tabs'); |
195
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
273 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
274 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
275 |
/** |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
276 |
* DUPLICATOR_STYLES |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
277 |
* Loads the required css links only for this plugin */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
278 |
function duplicator_styles() { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
279 |
wp_enqueue_style('jquery-ui'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
280 |
wp_enqueue_style('duplicator_style'); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
281 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
282 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
283 |
/** |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
284 |
* DUPLICATOR_MANAGE_LINK |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
285 |
* Adds the manage link in the plugins list */ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
286 |
function duplicator_manage_link($links, $file) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
287 |
static $this_plugin; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
288 |
if (!$this_plugin) $this_plugin = plugin_basename(__FILE__); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
289 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
290 |
if ($file == $this_plugin){ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
291 |
$settings_link = '<a href="admin.php?page=duplicator.php">'. __("Manage", 'wpduplicator') .'</a>'; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
292 |
array_unshift($links, $settings_link); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
293 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
294 |
return $links; |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
295 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
296 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
297 |
//Use WordPress Debugging log file. file is written to wp-content/debug.log |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
298 |
//trace with tail command to see real-time issues. |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
299 |
if(!function_exists('duplicator_debug')){ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
300 |
function duplicator_debug( $message ) { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
301 |
if( WP_DEBUG === true ){ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
302 |
if( is_array( $message ) || is_object( $message ) ){ |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
303 |
error_log( print_r( $message, true ) ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
304 |
} else { |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
305 |
error_log( $message ); |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
306 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
307 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
308 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
309 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
310 |
|
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
311 |
} |
c7c0fbc09788
ajout du plugin Duplicator
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
312 |
?> |