Initial commit: WordPress wp-content (themes, plugins, languages)
- Theme: momentry (custom theme with REST API routes) - Plugins: code-snippets (contains all API proxies) - Languages: zh_TW translations - Excludes: cache, backups, uploads, logs
This commit is contained in:
82
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-mariadb.php
vendored
Normal file
82
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-mariadb.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Database_Mariadb extends Ai1wm_Database_Mysqli {
|
||||
|
||||
/**
|
||||
* Replace column types
|
||||
*
|
||||
* @param string $input Column value
|
||||
* @return string
|
||||
*/
|
||||
protected function replace_column_types( $input ) {
|
||||
static $search = null;
|
||||
static $replace = null;
|
||||
|
||||
// Cache column types on first call
|
||||
if ( is_null( $search ) || is_null( $replace ) ) {
|
||||
$search = array();
|
||||
$replace = array();
|
||||
|
||||
// Convert INET4 column type (10.10.0)
|
||||
if ( version_compare( $this->server_version(), '10.10.0', '<' ) ) {
|
||||
$search[] = '/(?<!`)\bINET4\b(?!\s*\()/i';
|
||||
$replace[] = 'VARCHAR(15)';
|
||||
}
|
||||
|
||||
// Convert INET6 column type (10.5.0)
|
||||
if ( version_compare( $this->server_version(), '10.5.0', '<' ) ) {
|
||||
$search[] = '/(?<!`)\bINET6\b(?!\s*\()/i';
|
||||
$replace[] = 'VARCHAR(45)';
|
||||
}
|
||||
|
||||
// Convert UUID column type (10.7.0)
|
||||
if ( version_compare( $this->server_version(), '10.7.0', '<' ) ) {
|
||||
$search[] = '/(?<!`)\bUUID\b(?!\s*\()/i';
|
||||
$replace[] = 'CHAR(36)';
|
||||
}
|
||||
|
||||
// Convert XMLTYPE column type (12.3.0)
|
||||
if ( version_compare( $this->server_version(), '12.3.0', '<' ) ) {
|
||||
$search[] = '/(?<!`)\bXMLTYPE\b(?!\s*\()/i';
|
||||
$replace[] = 'LONGTEXT';
|
||||
}
|
||||
|
||||
// Convert VECTOR(N) column type (11.7.1)
|
||||
if ( version_compare( $this->server_version(), '11.7.1', '<' ) ) {
|
||||
$search[] = '/(?<!`)\bVECTOR\s*\(\s*\d+\s*\)/i';
|
||||
$replace[] = 'BLOB';
|
||||
}
|
||||
}
|
||||
|
||||
return preg_replace( $search, $replace, $input );
|
||||
}
|
||||
}
|
||||
159
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-mysql.php
vendored
Normal file
159
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-mysql.php
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Database_Mysql extends Ai1wm_Database {
|
||||
|
||||
/**
|
||||
* Check whether table has auto increment attribute
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_auto_increment( $table_name ) {
|
||||
return stripos( $this->get_create_table( $table_name ), 'AUTO_INCREMENT' ) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run MySQL query
|
||||
*
|
||||
* @param string $input SQL query
|
||||
* @return mixed
|
||||
*/
|
||||
public function query( $input ) {
|
||||
if ( ! ( $result = mysql_query( $input, $this->wpdb->dbh ) ) ) {
|
||||
$mysql_errno = 0;
|
||||
|
||||
// Get MySQL error code
|
||||
if ( ! empty( $this->wpdb->dbh ) ) {
|
||||
if ( is_resource( $this->wpdb->dbh ) ) {
|
||||
$mysql_errno = mysql_errno( $this->wpdb->dbh );
|
||||
} else {
|
||||
$mysql_errno = 2006;
|
||||
}
|
||||
}
|
||||
|
||||
// MySQL server has gone away, try to reconnect
|
||||
if ( empty( $this->wpdb->dbh ) || 2006 === $mysql_errno ) {
|
||||
if ( ! $this->wpdb->check_connection( false ) ) {
|
||||
throw new Ai1wm_Database_Exception( __( 'Error reconnecting to the database. <a href="https://help.servmask.com/knowledgebase/mysql-error-reconnecting/" target="_blank">Technical details</a>', 'all-in-one-wp-migration' ), 503 );
|
||||
}
|
||||
|
||||
$result = mysql_query( $input, $this->wpdb->dbh );
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape string input for MySQL query
|
||||
*
|
||||
* @param string $input String to escape
|
||||
* @return string
|
||||
*/
|
||||
public function escape( $input ) {
|
||||
return mysql_real_escape_string( $input, $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the error code for the most recent function call
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function errno() {
|
||||
return mysql_errno( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string description of the last error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function error() {
|
||||
return mysql_error( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return server info
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function server_info() {
|
||||
static $cached_result = null;
|
||||
|
||||
// Cache server info on first call
|
||||
if ( $cached_result === null ) {
|
||||
$cached_result = mysql_get_server_info( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
return $cached_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the result from MySQL query as associative array
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return array
|
||||
*/
|
||||
public function fetch_assoc( &$result ) {
|
||||
return mysql_fetch_assoc( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the result from MySQL query as row
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return array
|
||||
*/
|
||||
public function fetch_row( &$result ) {
|
||||
return mysql_fetch_row( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number for rows from MySQL results
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return integer
|
||||
*/
|
||||
public function num_rows( &$result ) {
|
||||
return mysql_num_rows( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Free MySQL result memory
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return boolean
|
||||
*/
|
||||
public function free_result( &$result ) {
|
||||
return mysql_free_result( $result );
|
||||
}
|
||||
}
|
||||
181
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-mysqli.php
vendored
Normal file
181
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-mysqli.php
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Database_Mysqli extends Ai1wm_Database {
|
||||
|
||||
/**
|
||||
* Check whether table has auto increment attribute
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_auto_increment( $table_name ) {
|
||||
return stripos( $this->get_create_table( $table_name ), 'AUTO_INCREMENT' ) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run MySQL query
|
||||
*
|
||||
* @param string $input SQL query
|
||||
* @return mixed
|
||||
*/
|
||||
public function query( $input ) {
|
||||
if ( ! mysqli_real_query( $this->wpdb->dbh, $input ) ) {
|
||||
$mysqli_errno = 0;
|
||||
|
||||
// Get MySQL error code
|
||||
if ( ! empty( $this->wpdb->dbh ) ) {
|
||||
if ( $this->wpdb->dbh instanceof mysqli ) {
|
||||
$mysqli_errno = mysqli_errno( $this->wpdb->dbh );
|
||||
} else {
|
||||
$mysqli_errno = 2006;
|
||||
}
|
||||
}
|
||||
|
||||
// MySQL server has gone away, try to reconnect
|
||||
if ( empty( $this->wpdb->dbh ) || 2006 === $mysqli_errno ) {
|
||||
if ( ! $this->wpdb->check_connection( false ) ) {
|
||||
throw new Ai1wm_Database_Exception( __( 'Error reconnecting to the database. <a href="https://help.servmask.com/knowledgebase/mysql-error-reconnecting/" target="_blank">Technical details</a>', 'all-in-one-wp-migration' ), 503 );
|
||||
}
|
||||
|
||||
mysqli_real_query( $this->wpdb->dbh, $input );
|
||||
}
|
||||
}
|
||||
|
||||
// The parameter $mode has had no effect as of PHP 8.1.0.
|
||||
if ( ( PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION >= 1 ) || ! defined( 'MYSQLI_STORE_RESULT_COPY_DATA' ) ) {
|
||||
return mysqli_store_result( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
// Copy results from the internal mysqlnd buffer into the PHP variables fetched
|
||||
return mysqli_store_result( $this->wpdb->dbh, MYSQLI_STORE_RESULT_COPY_DATA );
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape string input for MySQL query
|
||||
*
|
||||
* @param string $input String to escape
|
||||
* @return string
|
||||
*/
|
||||
public function escape( $input ) {
|
||||
return mysqli_real_escape_string( $this->wpdb->dbh, $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the error code for the most recent function call
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function errno() {
|
||||
return mysqli_errno( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string description of the last error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function error() {
|
||||
return mysqli_error( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return server info
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function server_info() {
|
||||
static $cached_result = null;
|
||||
|
||||
// Cache server info on first call
|
||||
if ( $cached_result === null ) {
|
||||
$cached_result = mysqli_get_server_info( $this->wpdb->dbh );
|
||||
}
|
||||
|
||||
return $cached_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the result from MySQL query as associative array
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return array
|
||||
*/
|
||||
public function fetch_assoc( &$result ) {
|
||||
if ( $result === false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mysqli_fetch_assoc( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the result from MySQL query as row
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return array
|
||||
*/
|
||||
public function fetch_row( &$result ) {
|
||||
if ( $result === false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mysqli_fetch_row( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number for rows from MySQL results
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return integer
|
||||
*/
|
||||
public function num_rows( &$result ) {
|
||||
if ( $result === false ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mysqli_num_rows( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Free MySQL result memory
|
||||
*
|
||||
* @param mixed $result MySQL resource
|
||||
* @return boolean
|
||||
*/
|
||||
public function free_result( &$result ) {
|
||||
if ( $result === false ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return mysqli_free_result( $result );
|
||||
}
|
||||
}
|
||||
377
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-sqlite.php
vendored
Normal file
377
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-sqlite.php
vendored
Normal file
@@ -0,0 +1,377 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Database_Sqlite extends Ai1wm_Database {
|
||||
|
||||
/**
|
||||
* Check whether table has auto increment attribute
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_auto_increment( $table_name ) {
|
||||
return stripos( $this->get_create_table( $table_name ), 'AUTOINCREMENT' ) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get views
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_views() {
|
||||
if ( is_null( $this->views ) ) {
|
||||
$where_query = array();
|
||||
|
||||
// Loop over table prefixes
|
||||
if ( $this->get_table_prefix_filters() ) {
|
||||
foreach ( $this->get_table_prefix_filters() as $prefix_filter ) {
|
||||
if ( isset( $prefix_filter[0], $prefix_filter[1] ) ) {
|
||||
$where_query[] = sprintf( "(`name` REGEXP '^%s' AND `name` NOT REGEXP '^%s')", $prefix_filter[0], $prefix_filter[1] );
|
||||
} else {
|
||||
$where_query[] = sprintf( "`name` REGEXP '^%s'", $prefix_filter[0] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$where_query[] = 1;
|
||||
}
|
||||
|
||||
$this->views = array();
|
||||
|
||||
// Loop over views
|
||||
$result = $this->query( sprintf( "SELECT `name` FROM `sqlite_master` WHERE `type`='view' AND (%s)", implode( ' OR ', $where_query ) ) );
|
||||
while ( $row = $this->fetch_row( $result ) ) {
|
||||
if ( isset( $row[0] ) ) {
|
||||
$this->views[] = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->free_result( $result );
|
||||
}
|
||||
|
||||
return $this->views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get base tables
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_base_tables() {
|
||||
if ( is_null( $this->base_tables ) ) {
|
||||
$where_query = array();
|
||||
|
||||
// Loop over table prefixes
|
||||
if ( $this->get_table_prefix_filters() ) {
|
||||
foreach ( $this->get_table_prefix_filters() as $prefix_filter ) {
|
||||
if ( isset( $prefix_filter[0], $prefix_filter[1] ) ) {
|
||||
$where_query[] = sprintf( "(`name` REGEXP '^%s' AND `name` NOT REGEXP '^%s')", $prefix_filter[0], $prefix_filter[1] );
|
||||
} else {
|
||||
$where_query[] = sprintf( "`name` REGEXP '^%s'", $prefix_filter[0] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$where_query[] = 1;
|
||||
}
|
||||
|
||||
$this->base_tables = array();
|
||||
|
||||
// Loop over base tables
|
||||
$result = $this->query( sprintf( "SELECT `name` FROM `sqlite_master` WHERE `type`='table' AND (%s)", implode( ' OR ', $where_query ) ) );
|
||||
while ( $row = $this->fetch_row( $result ) ) {
|
||||
if ( isset( $row[0] ) ) {
|
||||
$this->base_tables[] = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->free_result( $result );
|
||||
}
|
||||
|
||||
return $this->base_tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run SQLite query
|
||||
*
|
||||
* @param string $input SQL query
|
||||
* @return mixed
|
||||
*/
|
||||
public function query( $input ) {
|
||||
return $this->wpdb->get_results( $input, ARRAY_A );
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape string input for SQLite query
|
||||
*
|
||||
* @param string $input String to escape
|
||||
* @return string
|
||||
*/
|
||||
public function escape( $input ) {
|
||||
return $this->wpdb->_real_escape( $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the error code for the most recent function call
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function errno() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string description of the last error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function error() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return server info
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function server_info() {
|
||||
return $this->wpdb->db_server_info();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return result as associative array
|
||||
*
|
||||
* @param mixed $result SQLite resource
|
||||
* @return array
|
||||
*/
|
||||
public function fetch_assoc( &$result ) {
|
||||
if ( key( $result ) === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$current = current( $result );
|
||||
next( $result );
|
||||
|
||||
return $current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the result from SQLite query as row
|
||||
*
|
||||
* @param mixed $result SQLite resource
|
||||
* @return array
|
||||
*/
|
||||
public function fetch_row( &$result ) {
|
||||
$current = $this->fetch_assoc( $result );
|
||||
if ( $current === false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array_values( $current );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number for rows from SQLite results
|
||||
*
|
||||
* @param mixed $result SQLite resource
|
||||
* @return integer
|
||||
*/
|
||||
public function num_rows( &$result ) {
|
||||
return count( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Stub for free SQLite result memory
|
||||
*
|
||||
* @param mixed $result SQLite resource
|
||||
* @return void
|
||||
*/
|
||||
public function free_result( &$result ) {
|
||||
unset( $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQLite create view
|
||||
*
|
||||
* @param string $table_name View name
|
||||
* @return string
|
||||
*/
|
||||
protected function get_create_view( $table_name ) {
|
||||
$result = $this->query( "SELECT `sql` FROM `sqlite_master` WHERE `name` = '{$table_name}'" );
|
||||
$row = $this->fetch_assoc( $result );
|
||||
|
||||
// Close result cursor
|
||||
$this->free_result( $result );
|
||||
|
||||
// Get create table
|
||||
if ( isset( $row['sql'] ) ) {
|
||||
return $row['sql'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQLite create table
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return string
|
||||
*/
|
||||
protected function get_create_table( $table_name ) {
|
||||
$result = $this->query( "SELECT `sql` FROM `sqlite_master` WHERE `name` = '{$table_name}'" );
|
||||
$row = $this->fetch_assoc( $result );
|
||||
|
||||
// Close result cursor
|
||||
$this->free_result( $result );
|
||||
|
||||
// Get create table
|
||||
if ( isset( $row['sql'] ) ) {
|
||||
return $row['sql'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace table defaults
|
||||
*
|
||||
* @param string $input SQL statement
|
||||
* @return string
|
||||
*/
|
||||
protected function replace_table_defaults( $input ) {
|
||||
$pattern = array(
|
||||
'/DEFAULT(\s+)(\d+)/i',
|
||||
"/DEFAULT(\s+)'(.*?)'/i",
|
||||
);
|
||||
|
||||
return preg_replace( $pattern, '', $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace view quotes
|
||||
*
|
||||
* @param string $input View value
|
||||
* @return string
|
||||
*/
|
||||
protected function replace_view_quotes( $input ) {
|
||||
return str_replace( '"', '`', $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace table quotes
|
||||
*
|
||||
* @param string $input Table value
|
||||
* @return string
|
||||
*/
|
||||
protected function replace_table_quotes( $input ) {
|
||||
return str_replace( '"', '`', $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQLite primary keys
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return array
|
||||
*/
|
||||
protected function get_primary_keys( $table_name ) {
|
||||
$primary_keys = array();
|
||||
|
||||
// Get primary keys
|
||||
$result = $this->query( "SELECT `table_info`.`name` FROM PRAGMA_TABLE_INFO('{$table_name}') AS table_info WHERE `table_info`.`pk` != 0" );
|
||||
while ( $row = $this->fetch_assoc( $result ) ) {
|
||||
if ( isset( $row['name'] ) ) {
|
||||
$primary_keys[] = $row['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// Close result cursor
|
||||
$this->free_result( $result );
|
||||
|
||||
return $primary_keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQLite column types
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return array
|
||||
*/
|
||||
protected function get_column_types( $table_name ) {
|
||||
$column_types = array();
|
||||
|
||||
// Get column types
|
||||
$result = $this->query( "SELECT `name`, `type` FROM PRAGMA_TABLE_INFO('{$table_name}')" );
|
||||
while ( $row = $this->fetch_assoc( $result ) ) {
|
||||
if ( isset( $row['name'] ) ) {
|
||||
$column_types[ strtolower( $row['name'] ) ] = $row['type'];
|
||||
}
|
||||
}
|
||||
|
||||
// Close result cursor
|
||||
$this->free_result( $result );
|
||||
|
||||
return $column_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQLite column names
|
||||
*
|
||||
* @param string $table_name Table name
|
||||
* @return array
|
||||
*/
|
||||
public function get_column_names( $table_name ) {
|
||||
$column_names = array();
|
||||
|
||||
// Get column names
|
||||
$result = $this->query( "SELECT `name` FROM PRAGMA_TABLE_INFO('{$table_name}')" );
|
||||
while ( $row = $this->fetch_assoc( $result ) ) {
|
||||
if ( isset( $row['name'] ) ) {
|
||||
$column_names[ strtolower( $row['name'] ) ] = $row['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// Close result cursor
|
||||
$this->free_result( $result );
|
||||
|
||||
return $column_names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQLite max allowed packet
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
protected function get_max_allowed_packet() {
|
||||
return PHP_INT_MAX;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use SQLite transactions
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function use_transactions() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
457
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-utility.php
vendored
Normal file
457
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database-utility.php
vendored
Normal file
@@ -0,0 +1,457 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2014-2025 ServMask Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Attribution: This code is part of the All-in-One WP Migration plugin, developed by
|
||||
*
|
||||
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
|
||||
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
|
||||
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
|
||||
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
|
||||
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
|
||||
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Kangaroos cannot jump here' );
|
||||
}
|
||||
|
||||
class Ai1wm_Database_Utility {
|
||||
|
||||
protected static $db_client = null;
|
||||
|
||||
/**
|
||||
* Set the database client instance for injection
|
||||
*
|
||||
* @param Ai1wm_Database $db_client Database client instance.
|
||||
* @return void
|
||||
*/
|
||||
public static function set_client( $db_client ) {
|
||||
self::$db_client = $db_client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database client instance, creating it if not set
|
||||
*
|
||||
* @return Ai1wm_Database
|
||||
*/
|
||||
public static function get_client() {
|
||||
if ( self::$db_client === null ) {
|
||||
return self::create_client();
|
||||
}
|
||||
|
||||
return self::$db_client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create DB client to be used for DB manipulation
|
||||
*
|
||||
* @return Ai1wm_Database
|
||||
*/
|
||||
private static function create_client() {
|
||||
global $wpdb;
|
||||
|
||||
// SQLite
|
||||
if ( $wpdb instanceof WP_SQLite_DB || $wpdb instanceof WP_SQLite_DB\wpsqlitedb ) {
|
||||
return new Ai1wm_Database_Sqlite( $wpdb );
|
||||
}
|
||||
|
||||
// MariaDB
|
||||
if ( ( $server_version = $wpdb->get_var( 'SELECT VERSION()' ) ) ) {
|
||||
if ( stripos( $server_version, 'MariaDB' ) !== false ) {
|
||||
return new Ai1wm_Database_Mariadb( $wpdb );
|
||||
}
|
||||
}
|
||||
|
||||
// MySQLi
|
||||
if ( PHP_MAJOR_VERSION >= 7 ) {
|
||||
return new Ai1wm_Database_Mysqli( $wpdb );
|
||||
}
|
||||
|
||||
// MySQL
|
||||
if ( empty( $wpdb->use_mysqli ) ) {
|
||||
return new Ai1wm_Database_Mysql( $wpdb );
|
||||
}
|
||||
|
||||
return new Ai1wm_Database_Mysqli( $wpdb );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all occurrences of the search string with the replacement string.
|
||||
* This function is case-sensitive.
|
||||
*
|
||||
* @param string $data Data to replace
|
||||
* @param array $search List of string we're looking to replace
|
||||
* @param array $replace What we want it to be replaced with
|
||||
* @return string The original string with all elements replaced as needed
|
||||
*/
|
||||
public static function replace_values( $data, $search = array(), $replace = array() ) {
|
||||
return strtr( $data, array_combine( $search, $replace ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace serialized occurrences of the search string with the replacement string.
|
||||
* This function is case-sensitive.
|
||||
*
|
||||
* @param string $data Data to replace
|
||||
* @param array $search List of string we're looking to replace
|
||||
* @param array $replace What we want it to be replaced with
|
||||
* @return string The original array with all elements replaced as needed
|
||||
*/
|
||||
public static function replace_serialized_values( $data, $search = array(), $replace = array() ) {
|
||||
$pos = 0;
|
||||
|
||||
$result = self::parse_serialized_values( $data, $pos, $search, $replace );
|
||||
if ( $pos !== strlen( $data ) ) {
|
||||
// Failed to parse entire data
|
||||
return strtr( $data, array_combine( $search, $replace ) );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse serialized string and replace needed substitutions.
|
||||
* This function is case-sensitive.
|
||||
*
|
||||
* @param string $data Serialized data
|
||||
* @param integer $pos Character position
|
||||
* @param array $search List of string we're looking to replace
|
||||
* @param array $replace What we want it to be replaced with
|
||||
* @return string The original string with all elements replaced as needed
|
||||
*/
|
||||
public static function parse_serialized_values( $data, &$pos, $search = array(), $replace = array() ) {
|
||||
$length = strlen( $data );
|
||||
if ( $pos >= $length ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$type = $data[ $pos ];
|
||||
$pos++;
|
||||
|
||||
switch ( $type ) {
|
||||
case 's':
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ':' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$len_end = strpos( $data, ':', $pos );
|
||||
if ( $len_end === false ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$str_length = (int) substr( $data, $pos, $len_end - $pos );
|
||||
|
||||
$pos = $len_end + 1;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '"' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$str = substr( $data, $pos, $str_length );
|
||||
|
||||
$pos += $str_length;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '"' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ';' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
|
||||
// If the string is a single letter, skip any parsing or replacement.
|
||||
if ( $str_length === 1 ) {
|
||||
return 's:' . $str_length . ':"' . $str . '";';
|
||||
}
|
||||
|
||||
// Attempt to parse the string as serialized data
|
||||
$pos_inner = 0;
|
||||
$parsed_str = self::parse_serialized_values( $str, $pos_inner, $search, $replace );
|
||||
if ( $pos_inner === strlen( $str ) ) {
|
||||
// The string is serialized data, use the parsed string
|
||||
$new_str = $parsed_str;
|
||||
} else {
|
||||
// Regular string, perform replacement
|
||||
$new_str = strtr( $str, array_combine( $search, $replace ) );
|
||||
}
|
||||
|
||||
return 's:' . strlen( $new_str ) . ':"' . $new_str . '";';
|
||||
|
||||
case 'i':
|
||||
case 'd':
|
||||
case 'b':
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ':' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$end = strpos( $data, ';', $pos );
|
||||
if ( $end === false ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$value = substr( $data, $pos, $end - $pos );
|
||||
$pos = $end + 1;
|
||||
|
||||
return $type . ':' . $value . ';';
|
||||
|
||||
case 'N':
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ';' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
|
||||
return 'N;';
|
||||
|
||||
case 'a':
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ':' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$len_end = strpos( $data, ':', $pos );
|
||||
if ( $len_end === false ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$array_length = (int) substr( $data, $pos, $len_end - $pos );
|
||||
|
||||
$pos = $len_end + 1;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '{' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$result = 'a:' . $array_length . ':{';
|
||||
for ( $i = 0; $i < $array_length * 2; $i++ ) {
|
||||
$element = self::parse_serialized_values( $data, $pos, $search, $replace );
|
||||
if ( $element === '' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$result .= $element;
|
||||
}
|
||||
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '}' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$result .= '}';
|
||||
|
||||
return $result;
|
||||
|
||||
case 'O':
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ':' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$class_len_end = strpos( $data, ':', $pos );
|
||||
if ( $class_len_end === false ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$class_length = (int) substr( $data, $pos, $class_len_end - $pos );
|
||||
|
||||
$pos = $class_len_end + 1;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '"' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$class_name = substr( $data, $pos, $class_length );
|
||||
|
||||
$pos += $class_length;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '"' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ':' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$prop_len_end = strpos( $data, ':', $pos );
|
||||
if ( $prop_len_end === false ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$prop_count = (int) substr( $data, $pos, $prop_len_end - $pos );
|
||||
|
||||
$pos = $prop_len_end + 1;
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '{' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$result = 'O:' . strlen( $class_name ) . ':"' . $class_name . '":' . $prop_count . ':{';
|
||||
for ( $i = 0; $i < $prop_count * 2; $i++ ) {
|
||||
$element = self::parse_serialized_values( $data, $pos, $search, $replace );
|
||||
if ( $element === '' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$result .= $element;
|
||||
}
|
||||
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== '}' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$result .= '}';
|
||||
|
||||
return $result;
|
||||
|
||||
case 'R':
|
||||
case 'r':
|
||||
if ( ! isset( $data[ $pos ] ) || $data[ $pos ] !== ':' ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$pos++;
|
||||
$end = strpos( $data, ';', $pos );
|
||||
if ( $end === false ) {
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
|
||||
$ref = substr( $data, $pos, $end - $pos );
|
||||
$pos = $end + 1;
|
||||
|
||||
return $type . ':' . $ref . ';';
|
||||
|
||||
default:
|
||||
$pos--;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse MySQL server version
|
||||
*
|
||||
* @param string $info Server info
|
||||
* @return string
|
||||
*/
|
||||
public static function parse_server_version( $info ) {
|
||||
$matches = array();
|
||||
if ( preg_match( '/(\d+\.\d+\.\d+)-(\d+\.\d+\.\d+)/i', $info, $matches ) ) {
|
||||
if ( isset( $matches[2] ) ) {
|
||||
return $matches[2];
|
||||
}
|
||||
}
|
||||
|
||||
if ( preg_match( '/(\d+\.\d+\.\d+)/i', $info, $matches ) ) {
|
||||
if ( isset( $matches[1] ) ) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
return '0.0.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape MySQL special characters
|
||||
*
|
||||
* @param string $data Data to escape
|
||||
* @return string
|
||||
*/
|
||||
public static function escape_mysql( $data ) {
|
||||
return strtr(
|
||||
$data,
|
||||
array_combine(
|
||||
array( "\x00", "\n", "\r", '\\', "'", '"', "\x1a" ),
|
||||
array( '\\0', '\\n', '\\r', '\\\\', "\\'", '\\"', '\\Z' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unescape MySQL special characters
|
||||
*
|
||||
* @param string $data Data to unescape
|
||||
* @return string
|
||||
*/
|
||||
public static function unescape_mysql( $data ) {
|
||||
return strtr(
|
||||
$data,
|
||||
array_combine(
|
||||
array( '\\0', '\\n', '\\r', '\\\\', "\\'", '\\"', '\\Z' ),
|
||||
array( "\x00", "\n", "\r", '\\', "'", '"', "\x1a" )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode base64 characters
|
||||
*
|
||||
* @param string $data Data to encode
|
||||
* @return string
|
||||
*/
|
||||
public static function base64_encode( $data ) {
|
||||
return base64_encode( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode base64 characters
|
||||
*
|
||||
* @param string $data Data to decode
|
||||
* @return string
|
||||
*/
|
||||
public static function base64_decode( $data ) {
|
||||
return base64_decode( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate base64 data
|
||||
*
|
||||
* @param string $data Data to validate
|
||||
* @return boolean
|
||||
*/
|
||||
public static function base64_validate( $data ) {
|
||||
return base64_encode( base64_decode( $data ) ) === $data;
|
||||
}
|
||||
}
|
||||
2281
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database.php
vendored
Normal file
2281
plugins/all-in-one-wp-migration/lib/vendor/servmask/database/class-ai1wm-database.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user