Файловый менеджер - Редактировать - /var/www/xthruster/html/wp-content/uploads/flags/element-manager.tar
Назад
ajax.php 0000644 00000013137 14721551253 0006212 0 ustar 00 <?php namespace Elementor\Modules\ElementManager; use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; use Elementor\Modules\Usage\Module as Usage_Module; use Elementor\Api; use Elementor\Plugin; use Elementor\User; use Elementor\Utils; use Elementor\Core\Utils\Promotions\Validate_Promotion; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Ajax { const ELEMENT_MANAGER_PROMOTION_URL = 'https://go.elementor.com/go-pro-element-manager/'; const FREE_TO_PRO_PERMISSIONS_PROMOTION_URL = 'https://go.elementor.com/go-pro-element-manager-permissions/'; const PRO_TO_ADVANCED_PERMISSIONS_PROMOTION_URL = 'https://go.elementor.com/go-pro-advanced-element-manager-permissions/'; public function register_endpoints() { add_action( 'wp_ajax_elementor_element_manager_get_admin_app_data', [ $this, 'ajax_get_admin_page_data' ] ); add_action( 'wp_ajax_elementor_element_manager_save_disabled_elements', [ $this, 'ajax_save_disabled_elements' ] ); add_action( 'wp_ajax_elementor_element_manager_get_widgets_usage', [ $this, 'ajax_get_widgets_usage' ] ); } public function ajax_get_admin_page_data() { $this->verify_permission(); $this->force_enabled_all_elements(); $widgets = []; $plugins = []; foreach ( Plugin::$instance->widgets_manager->get_widget_types() as $widget ) { $widget_title = sanitize_user( $widget->get_title() ); if ( empty( $widget_title ) || ! $widget->show_in_panel() ) { continue; } $plugin_name = $this->get_plugin_name_from_widget_instance( $widget ); if ( ! in_array( $plugin_name, $plugins ) ) { $plugins[] = $plugin_name; } $widgets[] = [ 'name' => $widget->get_name(), 'plugin' => $plugin_name, 'title' => $widget_title, 'icon' => $widget->get_icon(), ]; } $notice_id = 'e-element-manager-intro-1'; $data = [ 'disabled_elements' => Options::get_disabled_elements(), 'promotion_widgets' => [], 'widgets' => $widgets, 'plugins' => $plugins, 'notice_data' => [ 'notice_id' => $notice_id, 'is_viewed' => User::is_user_notice_viewed( $notice_id ), ], 'promotion_data' => [ 'manager_permissions' => [ 'pro' => $this->get_element_manager_promotion( [ 'text' => esc_html__( 'Upgrade Now', 'elementor' ), 'url' => self::FREE_TO_PRO_PERMISSIONS_PROMOTION_URL, ], 'pro_permissions' ), 'advanced' => $this->get_element_manager_promotion( [ 'text' => esc_html__( 'Upgrade Now', 'elementor' ), 'url' => self::PRO_TO_ADVANCED_PERMISSIONS_PROMOTION_URL, ], 'advanced_permissions' ), ], 'element_manager' => $this->get_element_manager_promotion( [ 'text' => esc_html__( 'Upgrade Now', 'elementor' ), 'url' => self::ELEMENT_MANAGER_PROMOTION_URL, ], 'element_manager' ), ], ]; if ( ! Utils::has_pro() ) { $data['promotion_widgets'] = Api::get_promotion_widgets(); } $data['additional_data'] = apply_filters( 'elementor/element_manager/admin_app_data/additional_data', [] ); wp_send_json_success( $data ); } private function get_element_manager_promotion( $promotion_data, $filter_id ): array { return Filtered_Promotions_Manager::get_filtered_promotion_data( $promotion_data, 'elementor/element_manager/admin_app_data/promotion_data/' . $filter_id, 'url' ); } private function verify_permission() { if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( esc_html__( 'You do not have permission to edit these settings.', 'elementor' ) ); } $nonce = Utils::get_super_global_value( $_POST, 'nonce' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'e-element-manager-app' ) ) { wp_send_json_error( esc_html__( 'Invalid nonce.', 'elementor' ) ); } } private function force_enabled_all_elements() { remove_all_filters( 'elementor/widgets/is_widget_enabled' ); } private function get_plugin_name_from_widget_instance( $widget ) { if ( in_array( 'wordpress', $widget->get_categories() ) ) { return esc_html__( 'WordPress Widgets', 'elementor' ); } $class_reflection = new \ReflectionClass( $widget ); $plugin_basename = plugin_basename( $class_reflection->getFileName() ); $plugin_directory = strtok( $plugin_basename, '/' ); $plugins_data = get_plugins( '/' . $plugin_directory ); $plugin_data = array_shift( $plugins_data ); return $plugin_data['Name'] ?? esc_html__( 'Unknown', 'elementor' ); } public function ajax_save_disabled_elements() { $this->verify_permission(); $elements = Utils::get_super_global_value( $_POST, 'widgets' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( empty( $elements ) ) { wp_send_json_error( esc_html__( 'No elements to save.', 'elementor' ) ); } $disabled_elements = json_decode( $elements ); if ( ! is_array( $disabled_elements ) ) { wp_send_json_error( esc_html__( 'Unexpected elements data.', 'elementor' ) ); } Options::update_disabled_elements( $disabled_elements ); do_action( 'elementor/element_manager/save_disabled_elements' ); wp_send_json_success(); } public function ajax_get_widgets_usage() { $this->verify_permission(); /** @var Usage_Module $usage_module */ $usage_module = Usage_Module::instance(); $usage_module->recalc_usage(); $widgets_usage = []; foreach ( $usage_module->get_formatted_usage( 'raw' ) as $data ) { foreach ( $data['elements'] as $element => $count ) { if ( ! isset( $widgets_usage[ $element ] ) ) { $widgets_usage[ $element ] = 0; } $widgets_usage[ $element ] += $count; } } wp_send_json_success( $widgets_usage ); } } module.php 0000644 00000005023 14721551253 0006547 0 ustar 00 <?php namespace Elementor\Modules\ElementManager; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Admin\Menu\Admin_Menu_Manager; use Elementor\Widget_Base; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Module extends BaseModule { const PAGE_ID = 'elementor-element-manager'; public function get_name() { return 'element-manager'; } public function __construct() { parent::__construct(); $ajax = new Ajax(); $ajax->register_endpoints(); add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) { $admin_menu->register( static::PAGE_ID, new Admin_Menu_App() ); }, 25 ); add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) { if ( ! empty( $hooks[ static::PAGE_ID ] ) ) { add_action( "admin_print_scripts-{$hooks[ static::PAGE_ID ]}", [ $this, 'enqueue_assets' ] ); add_action( "admin_footer-{$hooks[ static::PAGE_ID ]}", [ $this, 'print_styles' ], 1000 ); } }, 10, 2 ); add_filter( 'elementor/widgets/is_widget_enabled', function( $should_register, Widget_Base $widget_instance ) { return ! Options::is_element_disabled( $widget_instance->get_name() ); }, 10, 2 ); add_filter( 'elementor/system-info/usage/settings', function( $usage ) { $disabled_elements = Options::get_disabled_elements(); if ( ! empty( $disabled_elements ) ) { $usage['disabled_elements'] = implode( ', ', $disabled_elements ); } return $usage; } ); add_filter( 'elementor/tracker/send_tracking_data_params', function( $params ) { $disabled_elements = Options::get_disabled_elements(); if ( ! empty( $disabled_elements ) ) { $params['usages']['disabled_elements'] = $disabled_elements; } return $params; } ); } public function enqueue_assets() { wp_enqueue_script( 'e-element-manager-app', $this->get_js_assets_url( 'element-manager-admin' ), [ 'wp-element', 'wp-components', 'wp-dom-ready', 'wp-i18n', ], ELEMENTOR_VERSION ); wp_localize_script( 'e-element-manager-app', 'eElementManagerConfig', [ 'nonce' => wp_create_nonce( 'e-element-manager-app' ), 'ajaxurl' => admin_url( 'admin-ajax.php' ), ] ); wp_set_script_translations( 'e-element-manager-app', 'elementor' ); wp_enqueue_style( 'wp-components' ); wp_enqueue_style( 'wp-format-library' ); } public function print_styles() { ?> <style> .components-button.is-secondary:disabled { box-shadow: inset 0 0 0 1px #949494; } </style> <?php } } options.php 0000644 00000001024 14721551253 0006752 0 ustar 00 <?php namespace Elementor\Modules\ElementManager; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Options { public static function get_disabled_elements() { return (array) get_option( 'elementor_disabled_elements', [] ); } public static function update_disabled_elements( $elements ) { update_option( 'elementor_disabled_elements', (array) $elements ); } public static function is_element_disabled( $element_name ) { return in_array( $element_name, self::get_disabled_elements() ); } } admin-menu-app.php 0000644 00000001564 14721551253 0010100 0 ustar 00 <?php namespace Elementor\Modules\ElementManager; use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page; use Elementor\Settings; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Admin_Menu_App implements Admin_Menu_Item_With_Page { public function is_visible() { return true; } public function get_parent_slug() { return Settings::PAGE_ID; } public function get_label() { return esc_html__( 'Element Manager', 'elementor' ); } public function get_page_title() { return esc_html__( 'Element Manager', 'elementor' ); } public function get_capability() { return 'manage_options'; } public function render() { echo '<div class="wrap">'; echo '<h3 class="wp-heading-inline">' . esc_html__( 'Element Manager', 'elementor' ) . '</h3>'; echo '<div id="elementor-element-manager-wrap"></div>'; echo '</div>'; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.3-4ubuntu2.24 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка