Version Description
Download this release
Release Info
Developer | cory@lamle.org |
Plugin | Duplicator – WordPress Migration Plugin |
Version | 0.5.34 |
Comparing to | |
See all releases |
Code changes from version 0.5.32 to 0.5.34
- classes/package.archive.php +4 -3
- classes/server.php +1 -1
- define.php +1 -1
- duplicator.php +1 -2
- installer/build/view.step1.php +2 -2
- lib/forceutf8/Encoding.php +349 -0
- lib/forceutf8/README.md +61 -0
- readme.txt +1 -1
- views/actions.php +0 -13
- views/packages/new1.base.php +1 -1
classes/package.archive.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
if ( ! defined( 'DUPLICATOR_VERSION' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.archive.zip.php');
|
|
|
5 |
|
6 |
/**
|
7 |
* The base class for all filter types Directories/Files/Extentions
|
@@ -210,7 +211,7 @@ class DUP_Archive
|
|
210 |
|
211 |
if ($invalid_test || preg_match('/[^\x20-\x7f]/', $name))
|
212 |
{
|
213 |
-
$this->FilterInfo->Dirs->Warning[] =
|
214 |
}
|
215 |
|
216 |
//Dir is not readble remove and flag
|
@@ -251,7 +252,7 @@ class DUP_Archive
|
|
251 |
|
252 |
if ($invalid_test || preg_match('/[^\x20-\x7f]/', $fileName))
|
253 |
{
|
254 |
-
$this->FilterInfo->Files->Warning[] =
|
255 |
}
|
256 |
else
|
257 |
{
|
@@ -273,7 +274,7 @@ class DUP_Archive
|
|
273 |
//Older PHP logic which is more stable on older version of PHP
|
274 |
//NOTE RecursiveIteratorIterator is problematic on some systems issues include:
|
275 |
// - error 'too many files open' for recursion
|
276 |
-
// - $file->getExtension() is not reliable as it silently fails at least in php 5.2.
|
277 |
// - issues with when a file has a permission such as 705 and trying to get info (had to fallback to pathinfo)
|
278 |
// - basic conclusion wait on the SPL libs untill after php 5.4 is a requiremnt
|
279 |
// - since we are in a tight recursive loop lets remove the utiltiy call DUP_Util::SafePath("{$path}/{$file}") and
|
2 |
if ( ! defined( 'DUPLICATOR_VERSION' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
require_once (DUPLICATOR_PLUGIN_PATH . 'classes/package.archive.zip.php');
|
5 |
+
require_once (DUPLICATOR_PLUGIN_PATH . 'lib/forceutf8/Encoding.php');
|
6 |
|
7 |
/**
|
8 |
* The base class for all filter types Directories/Files/Extentions
|
211 |
|
212 |
if ($invalid_test || preg_match('/[^\x20-\x7f]/', $name))
|
213 |
{
|
214 |
+
$this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
|
215 |
}
|
216 |
|
217 |
//Dir is not readble remove and flag
|
252 |
|
253 |
if ($invalid_test || preg_match('/[^\x20-\x7f]/', $fileName))
|
254 |
{
|
255 |
+
$this->FilterInfo->Files->Warning[] = DUP_Encoding::toUTF8($filePath);
|
256 |
}
|
257 |
else
|
258 |
{
|
274 |
//Older PHP logic which is more stable on older version of PHP
|
275 |
//NOTE RecursiveIteratorIterator is problematic on some systems issues include:
|
276 |
// - error 'too many files open' for recursion
|
277 |
+
// - $file->getExtension() is not reliable as it silently fails at least in php 5.2.9
|
278 |
// - issues with when a file has a permission such as 705 and trying to get info (had to fallback to pathinfo)
|
279 |
// - basic conclusion wait on the SPL libs untill after php 5.4 is a requiremnt
|
280 |
// - since we are in a tight recursive loop lets remove the utiltiy call DUP_Util::SafePath("{$path}/{$file}") and
|
classes/server.php
CHANGED
@@ -23,7 +23,7 @@ class DUP_Server
|
|
23 |
//PHP SUPPORT
|
24 |
$safe_ini = strtolower(ini_get('safe_mode'));
|
25 |
$dup_tests['PHP']['SAFE_MODE'] = $safe_ini != 'on' || $safe_ini != 'yes' || $safe_ini != 'true' || ini_get("safe_mode") != 1 ? 'Pass' : 'Fail';
|
26 |
-
$dup_tests['PHP']['VERSION'] = version_compare(phpversion(), '5.2.
|
27 |
$dup_tests['PHP']['ZIP'] = class_exists('ZipArchive') ? 'Pass' : 'Fail';
|
28 |
$dup_tests['PHP']['FUNC_1'] = function_exists("file_get_contents") ? 'Pass' : 'Fail';
|
29 |
$dup_tests['PHP']['FUNC_2'] = function_exists("file_put_contents") ? 'Pass' : 'Fail';
|
23 |
//PHP SUPPORT
|
24 |
$safe_ini = strtolower(ini_get('safe_mode'));
|
25 |
$dup_tests['PHP']['SAFE_MODE'] = $safe_ini != 'on' || $safe_ini != 'yes' || $safe_ini != 'true' || ini_get("safe_mode") != 1 ? 'Pass' : 'Fail';
|
26 |
+
$dup_tests['PHP']['VERSION'] = version_compare(phpversion(), '5.2.9') >= 0 ? 'Pass' : 'Fail';
|
27 |
$dup_tests['PHP']['ZIP'] = class_exists('ZipArchive') ? 'Pass' : 'Fail';
|
28 |
$dup_tests['PHP']['FUNC_1'] = function_exists("file_get_contents") ? 'Pass' : 'Fail';
|
29 |
$dup_tests['PHP']['FUNC_2'] = function_exists("file_put_contents") ? 'Pass' : 'Fail';
|
define.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if (function_exists('plugin_dir_url')) {
|
4 |
|
5 |
|
6 |
-
define('DUPLICATOR_VERSION', '0.5.
|
7 |
define("DUPLICATOR_HOMEPAGE", "http://lifeinthegrid.com/labs/duplicator");
|
8 |
define("DUPLICATOR_GIVELINK", "http://lifeinthegrid.com/partner");
|
9 |
define("DUPLICATOR_HELPLINK", "http://lifeinthegrid.com/duplicator-docs");
|
3 |
if (function_exists('plugin_dir_url')) {
|
4 |
|
5 |
|
6 |
+
define('DUPLICATOR_VERSION', '0.5.34');
|
7 |
define("DUPLICATOR_HOMEPAGE", "http://lifeinthegrid.com/labs/duplicator");
|
8 |
define("DUPLICATOR_GIVELINK", "http://lifeinthegrid.com/partner");
|
9 |
define("DUPLICATOR_HELPLINK", "http://lifeinthegrid.com/duplicator-docs");
|
duplicator.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Duplicator
|
4 |
Plugin URI: http://www.lifeinthegrid.com/duplicator/
|
5 |
Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
|
6 |
-
Version: 0.5.
|
7 |
Author: LifeInTheGrid
|
8 |
Author URI: http://www.lifeinthegrid.com
|
9 |
Text Domain: wpduplicator
|
@@ -118,7 +118,6 @@ if (is_admin() == true) {
|
|
118 |
add_action('wp_ajax_duplicator_package_scan', 'duplicator_package_scan');
|
119 |
add_action('wp_ajax_duplicator_package_build', 'duplicator_package_build');
|
120 |
add_action('wp_ajax_duplicator_package_delete', 'duplicator_package_delete');
|
121 |
-
add_action('wp_ajax_duplicator_package_report', 'duplicator_package_report');
|
122 |
add_action('wp_ajax_DUP_UI_SaveViewStateByPost', array('DUP_UI', 'SaveViewStateByPost'));
|
123 |
add_action('admin_notices', array('DUP_UI', 'ShowReservedFilesNotice'));
|
124 |
add_action('plugins_loaded', 'duplicator_wpfront_integrate');
|
3 |
Plugin Name: Duplicator
|
4 |
Plugin URI: http://www.lifeinthegrid.com/duplicator/
|
5 |
Description: Create a backup of your WordPress files and database. Duplicate and move an entire site from one location to another in a few steps. Create a full snapshot of your site at any point in time.
|
6 |
+
Version: 0.5.34
|
7 |
Author: LifeInTheGrid
|
8 |
Author URI: http://www.lifeinthegrid.com
|
9 |
Text Domain: wpduplicator
|
118 |
add_action('wp_ajax_duplicator_package_scan', 'duplicator_package_scan');
|
119 |
add_action('wp_ajax_duplicator_package_build', 'duplicator_package_build');
|
120 |
add_action('wp_ajax_duplicator_package_delete', 'duplicator_package_delete');
|
|
|
121 |
add_action('wp_ajax_DUP_UI_SaveViewStateByPost', array('DUP_UI', 'SaveViewStateByPost'));
|
122 |
add_action('admin_notices', array('DUP_UI', 'ShowReservedFilesNotice'));
|
123 |
add_action('plugins_loaded', 'duplicator_wpfront_integrate');
|
installer/build/view.step1.php
CHANGED
@@ -31,7 +31,7 @@
|
|
31 |
$safe_ini = strtolower(@ini_get('safe_mode'));
|
32 |
$req02 = $safe_ini != 'on' || $safe_ini != 'yes' || $safe_ini != 'true' || ini_get("safe_mode") != 1 ? 'Pass' : 'Fail';
|
33 |
$req03 = function_exists('mysqli_connect') ? 'Pass' : 'Fail';
|
34 |
-
$php_compare = version_compare(phpversion(), '5.2.
|
35 |
$req04 = $php_compare >= 0 ? 'Pass' : 'Fail';
|
36 |
$total_req = ($req01 == 'Pass' && $req02 == 'Pass' && $req03 == 'Pass' && $req04 == 'Pass') ? 'Pass' : 'Fail';
|
37 |
?>
|
@@ -410,7 +410,7 @@ PANEL: SERVER CHECKS -->
|
|
410 |
<tr>
|
411 |
<td valign="top">
|
412 |
PHP Version: <?php echo phpversion(); ?><br/>
|
413 |
-
<i style="font-size:10px">(PHP 5.2.
|
414 |
</td>
|
415 |
<td class="<?php echo ($req04 == 'Pass') ? 'dup-pass' : 'dup-fail' ?>"><?php echo $req04; ?> </td>
|
416 |
</tr>
|
31 |
$safe_ini = strtolower(@ini_get('safe_mode'));
|
32 |
$req02 = $safe_ini != 'on' || $safe_ini != 'yes' || $safe_ini != 'true' || ini_get("safe_mode") != 1 ? 'Pass' : 'Fail';
|
33 |
$req03 = function_exists('mysqli_connect') ? 'Pass' : 'Fail';
|
34 |
+
$php_compare = version_compare(phpversion(), '5.2.9');
|
35 |
$req04 = $php_compare >= 0 ? 'Pass' : 'Fail';
|
36 |
$total_req = ($req01 == 'Pass' && $req02 == 'Pass' && $req03 == 'Pass' && $req04 == 'Pass') ? 'Pass' : 'Fail';
|
37 |
?>
|
410 |
<tr>
|
411 |
<td valign="top">
|
412 |
PHP Version: <?php echo phpversion(); ?><br/>
|
413 |
+
<i style="font-size:10px">(PHP 5.2.9+ is required)</i>
|
414 |
</td>
|
415 |
<td class="<?php echo ($req04 == 'Pass') ? 'dup-pass' : 'dup-fail' ?>"><?php echo $req04; ?> </td>
|
416 |
</tr>
|
lib/forceutf8/Encoding.php
ADDED
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright (c) 2008 Sebastián Grignoli
|
4 |
+
All rights reserved.
|
5 |
+
|
6 |
+
Redistribution and use in source and binary forms, with or without
|
7 |
+
modification, are permitted provided that the following conditions
|
8 |
+
are met:
|
9 |
+
1. Redistributions of source code must retain the above copyright
|
10 |
+
notice, this list of conditions and the following disclaimer.
|
11 |
+
2. Redistributions in binary form must reproduce the above copyright
|
12 |
+
notice, this list of conditions and the following disclaimer in the
|
13 |
+
documentation and/or other materials provided with the distribution.
|
14 |
+
3. Neither the name of copyright holders nor the names of its
|
15 |
+
contributors may be used to endorse or promote products derived
|
16 |
+
from this software without specific prior written permission.
|
17 |
+
|
18 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
19 |
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
20 |
+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
21 |
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
|
22 |
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24 |
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25 |
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26 |
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27 |
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
+
POSSIBILITY OF SUCH DAMAGE.
|
29 |
+
*/
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @author "Sebastián Grignoli" <grignoli@gmail.com>
|
33 |
+
* @package Encoding
|
34 |
+
* @version 2.0
|
35 |
+
* @link https://github.com/neitanod/forceutf8
|
36 |
+
* @example https://github.com/neitanod/forceutf8
|
37 |
+
* @license Revised BSD
|
38 |
+
*/
|
39 |
+
|
40 |
+
//namespace ForceUTF8;
|
41 |
+
if (!class_exists('DUP_Encoding'))
|
42 |
+
{
|
43 |
+
class DUP_Encoding {
|
44 |
+
|
45 |
+
const ICONV_TRANSLIT = "TRANSLIT";
|
46 |
+
const ICONV_IGNORE = "IGNORE";
|
47 |
+
const WITHOUT_ICONV = "";
|
48 |
+
|
49 |
+
protected static $win1252ToUtf8 = array(
|
50 |
+
128 => "\xe2\x82\xac",
|
51 |
+
|
52 |
+
130 => "\xe2\x80\x9a",
|
53 |
+
131 => "\xc6\x92",
|
54 |
+
132 => "\xe2\x80\x9e",
|
55 |
+
133 => "\xe2\x80\xa6",
|
56 |
+
134 => "\xe2\x80\xa0",
|
57 |
+
135 => "\xe2\x80\xa1",
|
58 |
+
136 => "\xcb\x86",
|
59 |
+
137 => "\xe2\x80\xb0",
|
60 |
+
138 => "\xc5\xa0",
|
61 |
+
139 => "\xe2\x80\xb9",
|
62 |
+
140 => "\xc5\x92",
|
63 |
+
|
64 |
+
142 => "\xc5\xbd",
|
65 |
+
|
66 |
+
|
67 |
+
145 => "\xe2\x80\x98",
|
68 |
+
146 => "\xe2\x80\x99",
|
69 |
+
147 => "\xe2\x80\x9c",
|
70 |
+
148 => "\xe2\x80\x9d",
|
71 |
+
149 => "\xe2\x80\xa2",
|
72 |
+
150 => "\xe2\x80\x93",
|
73 |
+
151 => "\xe2\x80\x94",
|
74 |
+
152 => "\xcb\x9c",
|
75 |
+
153 => "\xe2\x84\xa2",
|
76 |
+
154 => "\xc5\xa1",
|
77 |
+
155 => "\xe2\x80\xba",
|
78 |
+
156 => "\xc5\x93",
|
79 |
+
|
80 |
+
158 => "\xc5\xbe",
|
81 |
+
159 => "\xc5\xb8"
|
82 |
+
);
|
83 |
+
|
84 |
+
protected static $brokenUtf8ToUtf8 = array(
|
85 |
+
"\xc2\x80" => "\xe2\x82\xac",
|
86 |
+
|
87 |
+
"\xc2\x82" => "\xe2\x80\x9a",
|
88 |
+
"\xc2\x83" => "\xc6\x92",
|
89 |
+
"\xc2\x84" => "\xe2\x80\x9e",
|
90 |
+
"\xc2\x85" => "\xe2\x80\xa6",
|
91 |
+
"\xc2\x86" => "\xe2\x80\xa0",
|
92 |
+
"\xc2\x87" => "\xe2\x80\xa1",
|
93 |
+
"\xc2\x88" => "\xcb\x86",
|
94 |
+
"\xc2\x89" => "\xe2\x80\xb0",
|
95 |
+
"\xc2\x8a" => "\xc5\xa0",
|
96 |
+
"\xc2\x8b" => "\xe2\x80\xb9",
|
97 |
+
"\xc2\x8c" => "\xc5\x92",
|
98 |
+
|
99 |
+
"\xc2\x8e" => "\xc5\xbd",
|
100 |
+
|
101 |
+
|
102 |
+
"\xc2\x91" => "\xe2\x80\x98",
|
103 |
+
"\xc2\x92" => "\xe2\x80\x99",
|
104 |
+
"\xc2\x93" => "\xe2\x80\x9c",
|
105 |
+
"\xc2\x94" => "\xe2\x80\x9d",
|
106 |
+
"\xc2\x95" => "\xe2\x80\xa2",
|
107 |
+
"\xc2\x96" => "\xe2\x80\x93",
|
108 |
+
"\xc2\x97" => "\xe2\x80\x94",
|
109 |
+
"\xc2\x98" => "\xcb\x9c",
|
110 |
+
"\xc2\x99" => "\xe2\x84\xa2",
|
111 |
+
"\xc2\x9a" => "\xc5\xa1",
|
112 |
+
"\xc2\x9b" => "\xe2\x80\xba",
|
113 |
+
"\xc2\x9c" => "\xc5\x93",
|
114 |
+
|
115 |
+
"\xc2\x9e" => "\xc5\xbe",
|
116 |
+
"\xc2\x9f" => "\xc5\xb8"
|
117 |
+
);
|
118 |
+
|
119 |
+
protected static $utf8ToWin1252 = array(
|
120 |
+
"\xe2\x82\xac" => "\x80",
|
121 |
+
|
122 |
+
"\xe2\x80\x9a" => "\x82",
|
123 |
+
"\xc6\x92" => "\x83",
|
124 |
+
"\xe2\x80\x9e" => "\x84",
|
125 |
+
"\xe2\x80\xa6" => "\x85",
|
126 |
+
"\xe2\x80\xa0" => "\x86",
|
127 |
+
"\xe2\x80\xa1" => "\x87",
|
128 |
+
"\xcb\x86" => "\x88",
|
129 |
+
"\xe2\x80\xb0" => "\x89",
|
130 |
+
"\xc5\xa0" => "\x8a",
|
131 |
+
"\xe2\x80\xb9" => "\x8b",
|
132 |
+
"\xc5\x92" => "\x8c",
|
133 |
+
|
134 |
+
"\xc5\xbd" => "\x8e",
|
135 |
+
|
136 |
+
|
137 |
+
"\xe2\x80\x98" => "\x91",
|
138 |
+
"\xe2\x80\x99" => "\x92",
|
139 |
+
"\xe2\x80\x9c" => "\x93",
|
140 |
+
"\xe2\x80\x9d" => "\x94",
|
141 |
+
"\xe2\x80\xa2" => "\x95",
|
142 |
+
"\xe2\x80\x93" => "\x96",
|
143 |
+
"\xe2\x80\x94" => "\x97",
|
144 |
+
"\xcb\x9c" => "\x98",
|
145 |
+
"\xe2\x84\xa2" => "\x99",
|
146 |
+
"\xc5\xa1" => "\x9a",
|
147 |
+
"\xe2\x80\xba" => "\x9b",
|
148 |
+
"\xc5\x93" => "\x9c",
|
149 |
+
|
150 |
+
"\xc5\xbe" => "\x9e",
|
151 |
+
"\xc5\xb8" => "\x9f"
|
152 |
+
);
|
153 |
+
|
154 |
+
static function toUTF8($text){
|
155 |
+
/**
|
156 |
+
* Function \ForceUTF8\Encoding::toUTF8
|
157 |
+
*
|
158 |
+
* This function leaves UTF8 characters alone, while converting almost all non-UTF8 to UTF8.
|
159 |
+
*
|
160 |
+
* It assumes that the encoding of the original string is either Windows-1252 or ISO 8859-1.
|
161 |
+
*
|
162 |
+
* It may fail to convert characters to UTF-8 if they fall into one of these scenarios:
|
163 |
+
*
|
164 |
+
* 1) when any of these characters: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß
|
165 |
+
* are followed by any of these: ("group B")
|
166 |
+
* ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶•¸¹º»¼½¾¿
|
167 |
+
* For example: %ABREPRESENT%C9%BB. «REPRESENTÉ»
|
168 |
+
* The "«" (%AB) character will be converted, but the "É" followed by "»" (%C9%BB)
|
169 |
+
* is also a valid unicode character, and will be left unchanged.
|
170 |
+
*
|
171 |
+
* 2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B,
|
172 |
+
* 3) when any of these: ðñòó are followed by THREE chars from group B.
|
173 |
+
*
|
174 |
+
* @name toUTF8
|
175 |
+
* @param string $text Any string.
|
176 |
+
* @return string The same string, UTF8 encoded
|
177 |
+
*
|
178 |
+
*/
|
179 |
+
|
180 |
+
if(is_array($text))
|
181 |
+
{
|
182 |
+
foreach($text as $k => $v)
|
183 |
+
{
|
184 |
+
$text[$k] = self::toUTF8($v);
|
185 |
+
}
|
186 |
+
return $text;
|
187 |
+
}
|
188 |
+
|
189 |
+
if(!is_string($text)) {
|
190 |
+
return $text;
|
191 |
+
}
|
192 |
+
|
193 |
+
$max = self::strlen($text);
|
194 |
+
|
195 |
+
$buf = "";
|
196 |
+
for($i = 0; $i < $max; $i++){
|
197 |
+
$c1 = $text{$i};
|
198 |
+
if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
|
199 |
+
$c2 = $i+1 >= $max? "\x00" : $text{$i+1};
|
200 |
+
$c3 = $i+2 >= $max? "\x00" : $text{$i+2};
|
201 |
+
$c4 = $i+3 >= $max? "\x00" : $text{$i+3};
|
202 |
+
if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
|
203 |
+
if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
204 |
+
$buf .= $c1 . $c2;
|
205 |
+
$i++;
|
206 |
+
} else { //not valid UTF8. Convert it.
|
207 |
+
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
208 |
+
$cc2 = ($c1 & "\x3f") | "\x80";
|
209 |
+
$buf .= $cc1 . $cc2;
|
210 |
+
}
|
211 |
+
} elseif($c1 >= "\xe0" & $c1 <= "\xef"){ //looks like 3 bytes UTF8
|
212 |
+
if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
213 |
+
$buf .= $c1 . $c2 . $c3;
|
214 |
+
$i = $i + 2;
|
215 |
+
} else { //not valid UTF8. Convert it.
|
216 |
+
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
217 |
+
$cc2 = ($c1 & "\x3f") | "\x80";
|
218 |
+
$buf .= $cc1 . $cc2;
|
219 |
+
}
|
220 |
+
} elseif($c1 >= "\xf0" & $c1 <= "\xf7"){ //looks like 4 bytes UTF8
|
221 |
+
if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf"){ //yeah, almost sure it's UTF8 already
|
222 |
+
$buf .= $c1 . $c2 . $c3 . $c4;
|
223 |
+
$i = $i + 3;
|
224 |
+
} else { //not valid UTF8. Convert it.
|
225 |
+
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
226 |
+
$cc2 = ($c1 & "\x3f") | "\x80";
|
227 |
+
$buf .= $cc1 . $cc2;
|
228 |
+
}
|
229 |
+
} else { //doesn't look like UTF8, but should be converted
|
230 |
+
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
231 |
+
$cc2 = (($c1 & "\x3f") | "\x80");
|
232 |
+
$buf .= $cc1 . $cc2;
|
233 |
+
}
|
234 |
+
} elseif(($c1 & "\xc0") == "\x80"){ // needs conversion
|
235 |
+
if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases
|
236 |
+
$buf .= self::$win1252ToUtf8[ord($c1)];
|
237 |
+
} else {
|
238 |
+
$cc1 = (chr(ord($c1) / 64) | "\xc0");
|
239 |
+
$cc2 = (($c1 & "\x3f") | "\x80");
|
240 |
+
$buf .= $cc1 . $cc2;
|
241 |
+
}
|
242 |
+
} else { // it doesn't need conversion
|
243 |
+
$buf .= $c1;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
return $buf;
|
247 |
+
}
|
248 |
+
|
249 |
+
static function toWin1252($text, $option = self::WITHOUT_ICONV) {
|
250 |
+
if(is_array($text)) {
|
251 |
+
foreach($text as $k => $v) {
|
252 |
+
$text[$k] = self::toWin1252($v, $option);
|
253 |
+
}
|
254 |
+
return $text;
|
255 |
+
} else if(is_string($text)) {
|
256 |
+
return self::utf8_decode($text, $option);
|
257 |
+
} else {
|
258 |
+
return $text;
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
static function toISO8859($text) {
|
263 |
+
return self::toWin1252($text);
|
264 |
+
}
|
265 |
+
|
266 |
+
static function toLatin1($text) {
|
267 |
+
return self::toWin1252($text);
|
268 |
+
}
|
269 |
+
|
270 |
+
static function fixUTF8($text, $option = self::WITHOUT_ICONV){
|
271 |
+
if(is_array($text)) {
|
272 |
+
foreach($text as $k => $v) {
|
273 |
+
$text[$k] = self::fixUTF8($v, $option);
|
274 |
+
}
|
275 |
+
return $text;
|
276 |
+
}
|
277 |
+
|
278 |
+
$last = "";
|
279 |
+
while($last <> $text){
|
280 |
+
$last = $text;
|
281 |
+
$text = self::toUTF8(self::utf8_decode($text, $option));
|
282 |
+
}
|
283 |
+
$text = self::toUTF8(self::utf8_decode($text, $option));
|
284 |
+
return $text;
|
285 |
+
}
|
286 |
+
|
287 |
+
static function UTF8FixWin1252Chars($text){
|
288 |
+
// If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1
|
289 |
+
// (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it.
|
290 |
+
// See: http://en.wikipedia.org/wiki/Windows-1252
|
291 |
+
|
292 |
+
return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text);
|
293 |
+
}
|
294 |
+
|
295 |
+
static function removeBOM($str=""){
|
296 |
+
if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) {
|
297 |
+
$str=substr($str, 3);
|
298 |
+
}
|
299 |
+
return $str;
|
300 |
+
}
|
301 |
+
|
302 |
+
protected static function strlen($text){
|
303 |
+
return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload')) & 2) ?
|
304 |
+
mb_strlen($text,'8bit') : strlen($text);
|
305 |
+
}
|
306 |
+
|
307 |
+
public static function normalizeEncoding($encodingLabel)
|
308 |
+
{
|
309 |
+
$encoding = strtoupper($encodingLabel);
|
310 |
+
$encoding = preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding);
|
311 |
+
$equivalences = array(
|
312 |
+
'ISO88591' => 'ISO-8859-1',
|
313 |
+
'ISO8859' => 'ISO-8859-1',
|
314 |
+
'ISO' => 'ISO-8859-1',
|
315 |
+
'LATIN1' => 'ISO-8859-1',
|
316 |
+
'LATIN' => 'ISO-8859-1',
|
317 |
+
'UTF8' => 'UTF-8',
|
318 |
+
'UTF' => 'UTF-8',
|
319 |
+
'WIN1252' => 'ISO-8859-1',
|
320 |
+
'WINDOWS1252' => 'ISO-8859-1'
|
321 |
+
);
|
322 |
+
|
323 |
+
if(empty($equivalences[$encoding])){
|
324 |
+
return 'UTF-8';
|
325 |
+
}
|
326 |
+
|
327 |
+
return $equivalences[$encoding];
|
328 |
+
}
|
329 |
+
|
330 |
+
public static function encode($encodingLabel, $text)
|
331 |
+
{
|
332 |
+
$encodingLabel = self::normalizeEncoding($encodingLabel);
|
333 |
+
if($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
|
334 |
+
return self::toUTF8($text);
|
335 |
+
}
|
336 |
+
|
337 |
+
protected static function utf8_decode($text, $option)
|
338 |
+
{
|
339 |
+
if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
|
340 |
+
$o = utf8_decode(
|
341 |
+
str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
|
342 |
+
);
|
343 |
+
} else {
|
344 |
+
$o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
|
345 |
+
}
|
346 |
+
return $o;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
}
|
lib/forceutf8/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
forceutf8
|
2 |
+
=========
|
3 |
+
|
4 |
+
PHP Class Encoding featuring popular \ForceUTF8\Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.
|
5 |
+
|
6 |
+
Description
|
7 |
+
===========
|
8 |
+
|
9 |
+
If you apply the PHP function utf8_encode() to an already-UTF8 string it will return a garbled UTF8 string.
|
10 |
+
|
11 |
+
This class addresses this issue and provides a handy static function called \ForceUTF8\Encoding::toUTF8().
|
12 |
+
|
13 |
+
You don't need to know what the encoding of your strings is. It can be Latin1 (iso 8859-1), Windows-1252 or UTF8, or the string can have a mix of them. \ForceUTF8\Encoding::toUTF8() will convert everything to UTF8.
|
14 |
+
|
15 |
+
Sometimes you have to deal with services that are unreliable in terms of encoding, possibly mixing UTF8 and Latin1 in the same string.
|
16 |
+
|
17 |
+
Update:
|
18 |
+
|
19 |
+
I've included another function, \ForceUTF8\Encoding::fixUTF8(), which will fix the double (or multiple) encoded UTF8 string that looks garbled.
|
20 |
+
|
21 |
+
Usage:
|
22 |
+
======
|
23 |
+
|
24 |
+
use \ForceUTF8\Encoding;
|
25 |
+
|
26 |
+
$utf8_string = Encoding::toUTF8($utf8_or_latin1_or_mixed_string);
|
27 |
+
|
28 |
+
$latin1_string = Encoding::toLatin1($utf8_or_latin1_or_mixed_string);
|
29 |
+
|
30 |
+
also:
|
31 |
+
|
32 |
+
$utf8_string = Encoding::fixUTF8($garbled_utf8_string);
|
33 |
+
|
34 |
+
Examples:
|
35 |
+
|
36 |
+
use \ForceUTF8\Encoding;
|
37 |
+
|
38 |
+
echo Encoding::fixUTF8("Fédération Camerounaise de Football\n");
|
39 |
+
echo Encoding::fixUTF8("Fédération Camerounaise de Football\n");
|
40 |
+
echo Encoding::fixUTF8("Fédération Camerounaise de Football\n");
|
41 |
+
echo Encoding::fixUTF8("Fédération Camerounaise de Football\n");
|
42 |
+
|
43 |
+
will output:
|
44 |
+
|
45 |
+
Fédération Camerounaise de Football
|
46 |
+
Fédération Camerounaise de Football
|
47 |
+
Fédération Camerounaise de Football
|
48 |
+
Fédération Camerounaise de Football
|
49 |
+
|
50 |
+
Install via composer:
|
51 |
+
=====================
|
52 |
+
Edit your composer.json file to include the following:
|
53 |
+
|
54 |
+
```json
|
55 |
+
{
|
56 |
+
"require": {
|
57 |
+
"neitanod/forceutf8": "dev-master"
|
58 |
+
}
|
59 |
+
}
|
60 |
+
```
|
61 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: www.lifeinthegrid.com/partner
|
|
4 |
Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 0.5.
|
8 |
License: GPLv2
|
9 |
|
10 |
Duplicate, clone, backup, move and transfer an entire site from one location to another.
|
4 |
Tags: backup, restore, move, migrate, localhost, synchronize, duplicate, clone, automate, niche
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 0.5.34
|
8 |
License: GPLv2
|
9 |
|
10 |
Duplicate, clone, backup, move and transfer an entire site from one location to another.
|
views/actions.php
CHANGED
@@ -66,19 +66,6 @@ function duplicator_package_build() {
|
|
66 |
die($json_response);
|
67 |
}
|
68 |
|
69 |
-
|
70 |
-
function duplicator_package_report() {
|
71 |
-
|
72 |
-
DUP_Util::CheckPermissions('export');
|
73 |
-
|
74 |
-
$scanReport = $_GET['scanfile'];
|
75 |
-
header('Content-Type: application/json');
|
76 |
-
header("Location: " . DUPLICATOR_SSDIR_URL . "/tmp/" . $scanReport);
|
77 |
-
echo DUPLICATOR_SSDIR_URL . "/tmp/" . $scanReport;
|
78 |
-
|
79 |
-
die();
|
80 |
-
}
|
81 |
-
|
82 |
/**
|
83 |
* DUPLICATOR_PACKAGE_DELETE
|
84 |
* Deletes the files and database record entries
|
66 |
die($json_response);
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
/**
|
70 |
* DUPLICATOR_PACKAGE_DELETE
|
71 |
* Deletes the files and database record entries
|
views/packages/new1.base.php
CHANGED
@@ -160,7 +160,7 @@ META-BOX1: SYSTEM REQUIREMENTS -->
|
|
160 |
</tr>
|
161 |
</table>
|
162 |
<small>
|
163 |
-
<?php _e("PHP versions 5.2.
|
164 |
</small>
|
165 |
</div>
|
166 |
</div>
|
160 |
</tr>
|
161 |
</table>
|
162 |
<small>
|
163 |
+
<?php _e("PHP versions 5.2.9+ or higher is required. For compression to work the ZipArchive extension for PHP is required. Safe Mode should be set to 'Off' in you php.ini file and is deprecated as of PHP 5.3.0. For any issues in this section please contact your hosting provider or server administrator. For additional information see our online documentation.", 'wpduplicator'); ?>
|
164 |
</small>
|
165 |
</div>
|
166 |
</div>
|