Edit File by line
/home/zeestwma/richards.../wp-conte.../mu-plugi...
File: elementor-safe-mode.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Plugin Name: Elementor Safe Mode
[3] Fix | Delete
* Description: Safe Mode allows you to troubleshoot issues by only loading the editor, without loading the theme or any other plugin.
[4] Fix | Delete
* Plugin URI: https://elementor.com/?utm_source=safe-mode&utm_campaign=plugin-uri&utm_medium=wp-dash
[5] Fix | Delete
* Author: Elementor.com
[6] Fix | Delete
* Version: 1.0.0
[7] Fix | Delete
* Author URI: https://elementor.com/?utm_source=safe-mode&utm_campaign=author-uri&utm_medium=wp-dash
[8] Fix | Delete
*
[9] Fix | Delete
* Text Domain: elementor
[10] Fix | Delete
*
[11] Fix | Delete
* @package Elementor
[12] Fix | Delete
* @category Safe Mode
[13] Fix | Delete
*
[14] Fix | Delete
* Elementor is free software: you can redistribute it and/or modify
[15] Fix | Delete
* it under the terms of the GNU General Public License as published by
[16] Fix | Delete
* the Free Software Foundation, either version 3 of the License, or
[17] Fix | Delete
* any later version.
[18] Fix | Delete
*
[19] Fix | Delete
* Elementor is distributed in the hope that it will be useful,
[20] Fix | Delete
* but WITHOUT ANY WARRANTY; without even the implied warranty of
[21] Fix | Delete
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[22] Fix | Delete
* GNU General Public License for more details.
[23] Fix | Delete
*/
[24] Fix | Delete
[25] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[26] Fix | Delete
exit; // Exit if accessed directly
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
class Safe_Mode {
[30] Fix | Delete
[31] Fix | Delete
const OPTION_ENABLED = 'elementor_safe_mode';
[32] Fix | Delete
const OPTION_TOKEN = self::OPTION_ENABLED . '_token';
[33] Fix | Delete
[34] Fix | Delete
public function is_enabled() {
[35] Fix | Delete
return get_option( self::OPTION_ENABLED );
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
public function is_valid_token() {
[39] Fix | Delete
$token = isset( $_COOKIE[ self::OPTION_TOKEN ] ) ? $_COOKIE[ self::OPTION_TOKEN ] : null;
[40] Fix | Delete
[41] Fix | Delete
if ( $token && get_option( self::OPTION_TOKEN ) === $token ) {
[42] Fix | Delete
return true;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
return false;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
public function is_requested() {
[49] Fix | Delete
return ! empty( $_REQUEST['elementor-mode'] ) && 'safe' === $_REQUEST['elementor-mode'];
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
public function is_editor() {
[53] Fix | Delete
return is_admin() && isset( $_GET['action'] ) && 'elementor' === $_GET['action'];
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
public function is_editor_preview() {
[57] Fix | Delete
return isset( $_GET['elementor-preview'] );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
public function is_editor_ajax() {
[61] Fix | Delete
// PHPCS - There is already nonce verification in the Ajax Manager
[62] Fix | Delete
return is_admin() && isset( $_POST['action'] ) && 'elementor_ajax' === $_POST['action']; // phpcs:ignore WordPress.Security.NonceVerification.Missing
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
public function add_hooks() {
[66] Fix | Delete
add_filter( 'pre_option_active_plugins', function () {
[67] Fix | Delete
return get_option( 'elementor_safe_mode_allowed_plugins' );
[68] Fix | Delete
} );
[69] Fix | Delete
[70] Fix | Delete
add_filter( 'pre_option_stylesheet', function () {
[71] Fix | Delete
return 'elementor-safe';
[72] Fix | Delete
} );
[73] Fix | Delete
[74] Fix | Delete
add_filter( 'pre_option_template', function () {
[75] Fix | Delete
return 'elementor-safe';
[76] Fix | Delete
} );
[77] Fix | Delete
[78] Fix | Delete
add_action( 'elementor/init', function () {
[79] Fix | Delete
do_action( 'elementor/safe_mode/init' );
[80] Fix | Delete
} );
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
/**
[84] Fix | Delete
* Plugin row meta.
[85] Fix | Delete
*
[86] Fix | Delete
* Adds row meta links to the plugin list table
[87] Fix | Delete
*
[88] Fix | Delete
* Fired by `plugin_row_meta` filter.
[89] Fix | Delete
*
[90] Fix | Delete
* @access public
[91] Fix | Delete
*
[92] Fix | Delete
* @param array $plugin_meta An array of the plugin's metadata, including
[93] Fix | Delete
* the version, author, author URI, and plugin URI.
[94] Fix | Delete
* @param string $plugin_file Path to the plugin file, relative to the plugins
[95] Fix | Delete
* directory.
[96] Fix | Delete
*
[97] Fix | Delete
* @return array An array of plugin row meta links.
[98] Fix | Delete
*/
[99] Fix | Delete
public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
[100] Fix | Delete
if ( basename( __FILE__ ) === $plugin_file ) {
[101] Fix | Delete
$row_meta = [
[102] Fix | Delete
'docs' => '<a href="https://go.elementor.com/safe-mode/" aria-label="' . esc_attr( esc_html__( 'Learn More', 'elementor' ) ) . '" target="_blank">' . esc_html__( 'Learn More', 'elementor' ) . '</a>',
[103] Fix | Delete
];
[104] Fix | Delete
[105] Fix | Delete
$plugin_meta = array_merge( $plugin_meta, $row_meta );
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
return $plugin_meta;
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
public function __construct() {
[112] Fix | Delete
add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 4 );
[113] Fix | Delete
[114] Fix | Delete
$enabled_type = $this->is_enabled();
[115] Fix | Delete
[116] Fix | Delete
if ( ! $enabled_type || ! $this->is_valid_token() ) {
[117] Fix | Delete
return;
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
if ( ! $this->is_requested() && 'global' !== $enabled_type ) {
[121] Fix | Delete
return;
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
if ( ! $this->is_editor() && ! $this->is_editor_preview() && ! $this->is_editor_ajax() ) {
[125] Fix | Delete
return;
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
$this->add_hooks();
[129] Fix | Delete
}
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
new Safe_Mode();
[133] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function