init(); DUP_Settings::init(); DUP_Log::Init(); DUP_Util::init(); DUP_DB::init(); /** ======================================================== * ACTIVATE/DEACTIVE/UPDATE HOOKS * ===================================================== */ register_activation_hook(DUPLICATOR_LITE_FILE, array('DUP_LITE_Plugin_Upgrade', 'onActivationAction')); register_deactivation_hook(DUPLICATOR_LITE_FILE, 'duplicator_deactivate'); /** * Hooked into `plugins_loaded`. Routines used to update the plugin * * @access global * @return null */ function duplicator_update() { if (DUPLICATOR_VERSION != get_option(DUP_LITE_Plugin_Upgrade::DUP_VERSION_OPT_KEY)) { DUP_LITE_Plugin_Upgrade::onActivationAction(); // $snapShotDirPerm = substr(sprintf("%o", fileperms(DUP_Settings::getSsdirPath())),-4); } load_plugin_textdomain('duplicator'); } /** * Hooked into `register_deactivation_hook`. Routines used to deactivate the plugin * For uninstall see uninstall.php WordPress by default will call the uninstall.php file * * @access global * @return null */ function duplicator_deactivate() { //Logic has been added to uninstall.php } /** ======================================================== * ACTION HOOKS * ===================================================== */ add_action('plugins_loaded', 'duplicator_update'); add_action('plugins_loaded', 'duplicator_wpfront_integrate'); function duplicator_load_textdomain() { load_plugin_textdomain('duplicator', false, false); } add_action('plugins_loaded', 'duplicator_load_textdomain'); add_action('admin_init', 'duplicator_admin_init'); add_action('admin_menu', 'duplicator_menu'); add_action('admin_enqueue_scripts', 'duplicator_admin_enqueue_scripts'); DUP_UI_Notice::init(); //CTRL ACTIONS DUP_Web_Services::init(); add_action('wp_ajax_duplicator_active_package_info', 'duplicator_active_package_info'); add_action('wp_ajax_duplicator_package_scan', 'duplicator_package_scan'); add_action('wp_ajax_duplicator_package_build', 'duplicator_package_build'); add_action('wp_ajax_duplicator_package_delete', 'duplicator_package_delete'); add_action('wp_ajax_duplicator_duparchive_package_build', 'duplicator_duparchive_package_build'); $GLOBALS['CTRLS_DUP_CTRL_UI'] = new DUP_CTRL_UI(); $GLOBALS['CTRLS_DUP_CTRL_Tools'] = new DUP_CTRL_Tools(); $GLOBALS['CTRLS_DUP_CTRL_Package'] = new DUP_CTRL_Package(); /** * User role editor integration * * @access global * @return null */ function duplicator_wpfront_integrate() { if (DUP_Settings::Get('wpfront_integrate')) { do_action('wpfront_user_role_editor_duplicator_init', array('export', 'manage_options', 'read')); } } /** * Hooked into `admin_init`. Init routines for all admin pages * * @access global * @return null */ function duplicator_admin_init() { /* CSS */ wp_register_style('dup-jquery-ui', DUPLICATOR_PLUGIN_URL . 'assets/css/jquery-ui.css', null, "1.11.2"); wp_register_style('dup-font-awesome', DUPLICATOR_PLUGIN_URL . 'assets/css/fontawesome-all.min.css', null, '5.7.2'); wp_register_style('dup-plugin-global-style', DUPLICATOR_PLUGIN_URL . 'assets/css/global_admin_style.css', null, DUPLICATOR_VERSION); wp_register_style('dup-plugin-style', DUPLICATOR_PLUGIN_URL . 'assets/css/style.css', array('dup-plugin-global-style'), DUPLICATOR_VERSION); wp_register_style('dup-jquery-qtip', DUPLICATOR_PLUGIN_URL . 'assets/js/jquery.qtip/jquery.qtip.min.css', null, '2.2.1'); wp_register_style('dup-parsley-style', DUPLICATOR_PLUGIN_URL . 'assets/css/parsley.css', null, '2.3.5'); /* JS */ wp_register_script('dup-handlebars', DUPLICATOR_PLUGIN_URL . 'assets/js/handlebars.min.js', array('jquery'), '4.0.10'); wp_register_script('dup-parsley', DUPLICATOR_PLUGIN_URL . 'assets/js/parsley.min.js', array('jquery'), '1.1.18'); wp_register_script('dup-jquery-qtip', DUPLICATOR_PLUGIN_URL . 'assets/js/jquery.qtip/jquery.qtip.min.js', array('jquery'), '2.2.1'); add_action('admin_head', array('DUP_UI_Screen', 'getCustomCss')); // Clean tmp folder DUP_Package::not_active_files_tmp_cleanup(); $unhook_third_party_js = DUP_Settings::Get('unhook_third_party_js'); $unhook_third_party_css = DUP_Settings::Get('unhook_third_party_css'); if ($unhook_third_party_js || $unhook_third_party_css) { add_action('admin_enqueue_scripts', 'duplicator_unhook_third_party_assets', 99999, 1); } } /** * Hooked into `admin_enqueue_scripts`. Init routines for all admin pages * * @access global * @return null */ function duplicator_admin_enqueue_scripts() { wp_enqueue_script('dup-global-script', DUPLICATOR_PLUGIN_URL . 'assets/js/global-admin-script.js', array('jquery'), DUPLICATOR_VERSION, true); wp_localize_script('dup-global-script', 'dup_global_script_data', array( 'duplicator_admin_notice_to_dismiss' => wp_create_nonce('duplicator_admin_notice_to_dismiss') ) ); wp_enqueue_style('dup-plugin-global-style'); } /** * Redirects the clicked menu item to the correct location * * @access global * @return null */ function duplicator_get_menu() { $current_page = isset($_REQUEST['page']) ? sanitize_text_field($_REQUEST['page']) : 'duplicator'; switch ($current_page) { case 'duplicator': include(DUPLICATOR_PLUGIN_PATH.'views/packages/controller.php'); break; case 'duplicator-settings': include(DUPLICATOR_PLUGIN_PATH.'views/settings/controller.php'); break; case 'duplicator-tools': include(DUPLICATOR_PLUGIN_PATH.'views/tools/controller.php'); break; case 'duplicator-debug': include(DUPLICATOR_PLUGIN_PATH.'debug/main.php'); break; case 'duplicator-gopro': include(DUPLICATOR_PLUGIN_PATH.'views/settings/gopro.php'); break; } } /** * Hooked into `admin_menu`. Loads all of the wp left nav admin menus for Duplicator * * @access global * @return null */ function duplicator_menu() { $wpfront_caps_translator = 'wpfront_user_role_editor_duplicator_translate_capability'; //SVG Icon: See https://websemantics.uk/tools/image-to-data-uri-converter/ //older version //$icon_svg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQXJ0d29yayIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIw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wLjM3NCwwLjUyMw0KCQkJYzMuMzA0LDAsNi42MDctMC4xNjIsOS45LTAuNDc5bDEzLjM2NSwyMC4zMzVsMTcuMzQ3LTQuNjQ2bDEuMzk5LTI0LjIwMmM2LjA3My0yLjcyNSwxMS45MzEtNi4wNzcsMTcuNDg2LTEwLjAzOGwyMS44MzEsMTAuOTc0DQoJCQlsMTIuNjk5LTEyLjY5OGwtMTAuOTEtMjEuNzAxYzQuMDEyLTUuNTIxLDcuMzk2LTExLjM1MiwxMC4xNjktMTcuMzk4bDI0LjM2OS0xLjQwOGw0LjY0OS0xNy4zNDhsLTIwLjI0Mi0xMy4zDQoJCQljMC43MDgtNi43MzYsMC43ODQtMTMuNTIzLDAuMTY0LTIwLjI2NmwyMC4yODUtMTMuMzI4bC00LjY0OC0xNy4zNDhsLTIzLjMyNC0xLjM0OWwtMC4yMjcsMC44MjVsLTkuMTA3LDMzLjE3NQ0KCQkJYzIuMTI3LDI0LjMzMi02LjEwNCw0OS40MDEtMjQuNzI5LDY4LjAyNGMtMTYuNzA5LDE2LjcxLTM4LjYwNCwyNS4wNjEtNjAuNTAxLDI1LjA2MWMtMTMuOTk4LDAtMjcuOTk1LTMuNDEtNDAuNjQzLTEwLjIyOQ0KCQkJTDIwNS40OCw4Ny45ODRsMi41ODYsMzIuMzU2TDIyOS4wMTUsNDQuMDM2TDIyOS4wMTUsNDQuMDM2eiIvPg0KCTwvZz4NCjwvZz4NCjwvc3ZnPg0K'; //Main Menu $perms = 'export'; $perms = apply_filters($wpfront_caps_translator, $perms); $main_menu = add_menu_page('Duplicator Plugin', 'Duplicator', $perms, 'duplicator', 'duplicator_get_menu', $icon_svg); $perms = 'export'; $perms = apply_filters($wpfront_caps_translator, $perms); $lang_txt = esc_html__('Packages', 'duplicator'); $page_packages = add_submenu_page('duplicator', $lang_txt, $lang_txt, $perms, 'duplicator', 'duplicator_get_menu'); $GLOBALS['DUP_Package_Screen'] = new DUP_Package_Screen($page_packages); $perms = 'manage_options'; $perms = apply_filters($wpfront_caps_translator, $perms); $lang_txt = esc_html__('Tools', 'duplicator'); $page_tools = add_submenu_page('duplicator', $lang_txt, $lang_txt, $perms, 'duplicator-tools', 'duplicator_get_menu'); $perms = 'manage_options'; $perms = apply_filters($wpfront_caps_translator, $perms); $lang_txt = esc_html__('Settings', 'duplicator'); $page_settings = add_submenu_page('duplicator', $lang_txt, $lang_txt, $perms, 'duplicator-settings', 'duplicator_get_menu'); $perms = 'manage_options'; $admin_color = get_user_option('admin_color'); $orange_for_admin_colors = array( 'fresh', 'coffee', 'ectoplasm', 'midnight' ); $style = in_array($admin_color, $orange_for_admin_colors) ? 'style="color:#f18500"' : ''; $lang_txt = esc_html__('Go Pro!', 'duplicator'); $go_pro_link = '' . $lang_txt . ''; $perms = apply_filters($wpfront_caps_translator, $perms); $page_gopro = add_submenu_page('duplicator', $go_pro_link, $go_pro_link, $perms, 'duplicator-gopro', 'duplicator_get_menu'); //Apply Scripts add_action('admin_print_scripts-' . $page_packages, 'duplicator_scripts'); add_action('admin_print_scripts-' . $page_settings, 'duplicator_scripts'); add_action('admin_print_scripts-' . $page_tools, 'duplicator_scripts'); add_action('admin_print_scripts-' . $page_gopro, 'duplicator_scripts'); //Apply Styles add_action('admin_print_styles-' . $page_packages, 'duplicator_styles'); add_action('admin_print_styles-' . $page_settings, 'duplicator_styles'); add_action('admin_print_styles-' . $page_tools, 'duplicator_styles'); add_action('admin_print_styles-' . $page_gopro, 'duplicator_styles'); } /** * Loads all required javascript libs/source for DupPro * * @access global * @return null */ function duplicator_scripts() { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-progressbar'); wp_enqueue_script('dup-parsley'); wp_enqueue_script('dup-jquery-qtip'); } /** * Loads all CSS style libs/source for DupPro * * @access global * @return null */ function duplicator_styles() { wp_enqueue_style('dup-jquery-ui'); wp_enqueue_style('dup-font-awesome'); wp_enqueue_style('dup-plugin-style'); wp_enqueue_style('dup-jquery-qtip'); } /** ======================================================== * FILTERS * ===================================================== */ add_filter('plugin_action_links', 'duplicator_manage_link', 10, 2); add_filter('plugin_row_meta', 'duplicator_meta_links', 10, 2); /** * Adds the manage link in the plugins list * * @access global * @return string The manage link in the plugins list */ function duplicator_manage_link($links, $file) { static $this_plugin; if (!$this_plugin) $this_plugin = plugin_basename(DUPLICATOR_LITE_FILE); if ($file == $this_plugin) { /* $settings_link = '' . esc_html__("Manage", 'duplicator') . ''; array_unshift($links, $settings_link); */ $upgrade_link = '' . esc_html__("Upgrade to Professional", 'duplicator') . ''; array_unshift($links, $upgrade_link); } return $links; } /** * Adds links to the plugins manager page * * @access global * @return string The meta help link data for the plugins manager */ function duplicator_meta_links($links, $file) { $plugin = plugin_basename(DUPLICATOR_LITE_FILE); // create link if ($file == $plugin) { $links[] = '' . esc_html__('Manage', 'duplicator') . ''; return $links; } return $links; } /** ======================================================== * GENERAL * ===================================================== */ /** * Used for installer files to redirect if accessed directly * * @access global * @return null */ function duplicator_secure_check() { $baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; header("HTTP/1.1 301 Moved Permanently"); header("Location: $baseURL"); exit; } if (!function_exists('duplicator_unhook_third_party_assets')) { /** * Remove all external styles and scripts coming from other plugins * which may cause compatibility issue, especially with React * * @return void */ function duplicator_unhook_third_party_assets($hook) { /* $hook values in duplicator admin pages: toplevel_page_duplicator duplicator_page_duplicator-tools duplicator_page_duplicator-settings duplicator_page_duplicator-gopro */ if (strpos($hook, 'duplicator') !== false && strpos($hook, 'duplicator-pro') === false) { $unhook_third_party_js = DUP_Settings::Get('unhook_third_party_js'); $unhook_third_party_css = DUP_Settings::Get('unhook_third_party_css'); $assets = array(); if ($unhook_third_party_css) $assets['styles'] = wp_styles(); if ($unhook_third_party_js) $assets['scripts'] = wp_scripts(); foreach ($assets as $type => $asset) { foreach ($asset->registered as $handle => $dep) { $src = $dep->src; // test if the src is coming from /wp-admin/ or /wp-includes/ or /wp-fsqm-pro/. if ( is_string($src) && // For some built-ins, $src is true|false strpos($src, 'wp-admin') === false && strpos($src, 'wp-include') === false && // things below are specific to your plugin, so change them strpos($src, 'duplicator') === false && strpos($src, 'woocommerce') === false && strpos($src, 'jetpack') === false && strpos($src, 'debug-bar') === false ) { 'scripts' === $type ? wp_dequeue_script($handle) : wp_dequeue_style($handle); } } } } } } } }