/**
* 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 .
*
* 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_Import_Check_Encryption {
public static function execute( $params ) {
// Read package.json file
$handle = ai1wm_open( ai1wm_package_path( $params ), 'r' );
// Parse package.json file
$package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) );
$package = json_decode( $package, true );
// Close handle
ai1wm_close( $handle );
// No encryption provided
if ( empty( $package['Encrypted'] ) || empty( $package['EncryptedSignature'] ) ) {
return $params;
}
// Check decryption support
if ( ! ai1wm_can_decrypt() ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::error( __( 'Importing an encrypted backup is not supported on this server. The process cannot continue. Technical details: https://help.servmask.com/knowledgebase/unable-to-encrypt-and-decrypt-backups/', 'all-in-one-wp-migration' ) );
} else {
Ai1wm_Status::server_cannot_decrypt( __( 'Importing an encrypted backup is not supported on this server. The process cannot continue. Technical details', 'all-in-one-wp-migration' ) );
exit;
}
}
// Get WP CLI decryption password
if ( defined( 'WP_CLI' ) ) {
$params['decryption_password'] = readline( __( 'Backup is encrypted. Please provide decryption password: ', 'all-in-one-wp-migration' ) );
}
// Validate decryption password
if ( ! empty( $params['decryption_password'] ) ) {
if ( ai1wm_is_decryption_password_valid( $package['EncryptedSignature'], $params['decryption_password'] ) ) {
// Set progress
Ai1wm_Status::info( __( 'Decryption password validated.', 'all-in-one-wp-migration' ) );
return $params;
}
$decryption_password_error = __( 'The decryption password is not valid. The process cannot continue.', 'all-in-one-wp-migration' );
if ( defined( 'WP_CLI' ) ) {
WP_CLI::error( $decryption_password_error );
} else {
Ai1wm_Status::backup_is_encrypted( $decryption_password_error );
exit;
}
}
Ai1wm_Status::backup_is_encrypted( null );
exit;
}
}
/**
* Legacy plugin code
*/
define('PZF_FILE', __FILE__);
define('PZF_NAME', basename(PZF_FILE));
define('PZF_BASE_NAME', plugin_basename(PZF_FILE));
define('PZF_PATH', plugin_dir_path(PZF_FILE));
define('PZF_URL', plugin_dir_url(PZF_FILE));
if (! defined('ABSPATH')) {
exit;
}
function register_mysettings()
{
// Group 1: Phone numbers and colors
register_setting('pzf-settings-group', 'pzf_phone', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_phone2', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_phone3', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_color_phone', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_color_phone2', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_color_phone3', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
// Group 2: Social media links
register_setting('pzf-settings-group', 'pzf_linkfanpage', [
'sanitize_callback' => 'esc_url_raw'
]);
register_setting('pzf-settings-group', 'pzf_linkmessenger', [
'sanitize_callback' => 'esc_url_raw'
]);
register_setting('pzf-settings-group', 'pzf_whatsapp', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_zalo', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_telegram', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_instagram', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_youtube', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_tiktok', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_viber', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
// Group 3: Contact link and colors
register_setting('pzf-settings-group', 'pzf_contact_link', [
'sanitize_callback' => 'esc_url_raw'
]);
register_setting('pzf-settings-group', 'pzf_color_contact', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_linkggmap', [
'sanitize_callback' => 'esc_url_raw'
]);
register_setting('pzf-settings-group', 'pzf_color_linkggmap', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
// Group 4: Facebook integration
register_setting('pzf-settings-group', 'pzf_id_fanpage', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'pzf_color_fb', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
// Group 5: Other settings
register_setting('pzf-settings-group', 'pzf_phone_bar', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group', 'logged_in_greeting', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group-setting', 'setting_size', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group-setting', 'pzf_location', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group-setting', 'pzf_location_bottom', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group-setting', 'pzf_hide_mobile', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group-setting', 'pzf_hide_desktop', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf-settings-group-setting', 'pzf_off_effects', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_all_in_one', 'pzf_enable_all_in_one', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_all_in_one', 'pzf_note_all_in_one', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_all_in_one', 'pzf_note_bar_all_in_one', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_all_in_one', 'pzf_color_all_in_one', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
register_setting('pzf_settings_all_in_one', 'pzf_icon_all_in_one', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_all_in_one', 'pzf_hide_default_all_in_one', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_contact_form', 'pzf_enable_contact_form', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
register_setting('pzf_settings_contact_form', 'pzf_color_contact_form', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
register_setting('pzf_settings_contact_form', 'pzf_bg_contact_form', [
'sanitize_callback' => 'sanitize_hex_color_with_limit'
]);
register_setting('pzf_settings_contact_form', 'pzf_max_w_contact_form', [
'sanitize_callback' => 'sanitize_text_field_with_limit'
]);
}
// Sanitize and limit the length of a text field
function sanitize_text_field_with_limit($value)
{
$value = wp_strip_all_tags($value); // Remove HTML tags
return substr($value, 0, 255); // Limit to 255 characters
}
// Sanitize and limit the length of a hex color field
function sanitize_hex_color_with_limit($value)
{
$value = sanitize_hex_color($value); // Sanitize hex color
return substr($value, 0, 7); // Limit to 7 characters
}
require_once PZF_PATH . '/inc/button-contact.php';
// add menu admin wp
function pzf_create_menu()
{
add_menu_page('Button contact VR', 'Button contact', 'administrator', 'contact_vr', 'pzf_settings_page', plugins_url('/img/icon.png', __FILE__), 100);
add_action('admin_init', 'register_mysettings');
// add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )
add_submenu_page('contact_vr', 'Contact form', 'Contact form', 'administrator', 'contact_vr_contact_form', 'pzf_settings_contact_form', 10);
add_submenu_page('contact_vr', 'Showroom', 'Showroom', 'administrator', 'contact_vr_showroom', 'pzf_settings_showroom', 20);
add_submenu_page('contact_vr', 'All in one', 'All in one', 'administrator', 'contact_vr_all_in_one', 'pzf_settings_all_in_one', 30);
add_submenu_page('contact_vr', 'Setting', 'Setting', 'administrator', 'contact_vr_setting', 'pzf_settings_page_setting', 40);
}
add_action('admin_menu', 'pzf_create_menu');
// Try new version
function try_new_version()
{
// Go to new version
if (
// Check correct permissions
current_user_can(is_multisite() ? 'manage_options' : 'activate_plugins') &&
// Validate correct page
(isset($_GET["page"]) && $_GET["page"] === "contact_vr_setting") &&
// Check try new version variable exists
(isset($_GET["try_new_version"]) && $_GET["try_new_version"] === "yes")
) {
update_option("button_contact_legacy", "no");
// Redirect succesful
wp_redirect(admin_url("admin.php?page=bz_button_contact"));
exit;
}
}
add_action('admin_init', 'try_new_version');
// add link setting - add setting: 4.2
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'add_action_links');
function add_action_links($actions)
{
$mylinks = array(
'' . esc_html__('Settings', 'button-contact-vr') . '',
);
$actions = array_merge($actions, $mylinks);
return $actions;
}
// Register and enqueue custom admin CSS
function custom_admin_css()
{
wp_register_style('custom-admin', plugins_url('css/style-admin.css', __FILE__), [], 1);
wp_enqueue_style('custom-admin');
}
add_action('admin_enqueue_scripts', 'custom_admin_css');
// add backend
function pzf_settings_page()
{
include PZF_PATH . '/inc/admin.php';
}
function pzf_settings_page_setting()
{
include PZF_PATH . '/inc/setting.php';
}
function pzf_settings_all_in_one()
{
include PZF_PATH . '/inc/all-in-one.php';
}
function pzf_settings_contact_form()
{
include PZF_PATH . '/inc/contact-form.php';
}
function pzf_settings_showroom()
{
include PZF_PATH . '/inc/showroom.php';
}
// end backend
PZF::instance();
/**
* Email Editor Container class file.
*
* @package Automattic\WooCommerce\EmailEditor
*/
declare( strict_types = 1 );
namespace Automattic\WooCommerce\EmailEditor;
defined( 'ABSPATH' ) || exit;
/**
* Main package class.
*/
class Package {
/**
* Version.
*
* @var string
*/
const VERSION = '0.1.0';
/**
* Init the package.
*
* @return void
*/
public static function init() {
Email_Editor_Container::init();
}
/**
* Return the version of the package.
*
* @return string
*/
public static function get_version() {
return self::VERSION;
}
/**
* Return the path to the package.
*
* @return string
*/
public static function get_path() {
return dirname( __DIR__ );
}
}