File manager - Edit - /home/premiey/www/wp-includes/images/media/manager.php.tar
Back
home/premiey/www/wp-content/plugins/elementor/data/manager.php 0000666 00000022274 15165314047 0020620 0 ustar 00 <?php namespace Elementor\Data; use Elementor\Core\Base\Module as BaseModule; use Elementor\Data\Base\Processor; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Manager extends BaseModule { const ROOT_NAMESPACE = 'elementor'; const REST_BASE = ''; const VERSION = '1'; /** * @var \WP_REST_Server */ private $server; /** * @var boolean */ private $is_internal = false; /** * @var array */ private $cache = []; /** * Loaded controllers. * * @var \Elementor\Data\Base\Controller[] */ public $controllers = []; /** * Loaded command(s) format. * * @var string[] */ public $command_formats = []; /** * Fix issue with 'Potentially polymorphic call. The code may be inoperable depending on the actual class instance passed as the argument.'. * * @return \Elementor\Core\Base\Module|\Elementor\Data\Manager */ public static function instance() { return ( parent::instance() ); } public function __construct() { add_action( 'rest_api_init', [ $this, 'register_rest_error_handler' ] ); } public function get_name() { return 'data-manager'; } /** * @return \Elementor\Data\Base\Controller[] */ public function get_controllers() { return $this->controllers; } private function get_cache( $key ) { return self::get_items( $this->cache, $key ); } private function set_cache( $key, $value ) { $this->cache[ $key ] = $value; } /** * Register controller. * * @param string $controller_class_name * * @return \Elementor\Data\Base\Controller */ public function register_controller( $controller_class_name ) { $controller_instance = new $controller_class_name(); return $this->register_controller_instance( $controller_instance ); } /** * Register controller instance. * * @param \Elementor\Data\Base\Controller $controller_instance * * @return \Elementor\Data\Base\Controller */ public function register_controller_instance( $controller_instance ) { // TODO: Validate instance. $this->controllers[ $controller_instance->get_name() ] = $controller_instance; return $controller_instance; } /** * Register endpoint format. * * @param string $command * @param string $format * */ public function register_endpoint_format( $command, $format ) { $this->command_formats[ $command ] = rtrim( $format, '/' ); } public function register_rest_error_handler() { if ( ! $this->is_internal() ) { $logger_manager = \Elementor\Core\Logger\Manager::instance(); $logger_manager->register_error_handler(); } } /** * Find controller instance. * * By given command name. * * @param string $command * * @return false|\Elementor\Data\Base\Controller */ public function find_controller_instance( $command ) { $command_parts = explode( '/', $command ); $assumed_command_parts = []; foreach ( $command_parts as $command_part ) { $assumed_command_parts [] = $command_part; foreach ( $this->controllers as $controller_name => $controller ) { $assumed_command = implode( '/', $assumed_command_parts ); if ( $assumed_command === $controller_name ) { return $controller; } } } return false; } /** * Command extract args. * * @param string $command * @param array $args * * @return \stdClass */ public function command_extract_args( $command, $args = [] ) { $result = new \stdClass(); $result->command = $command; $result->args = $args; if ( false !== strpos( $command, '?' ) ) { $command_parts = explode( '?', $command ); $pure_command = $command_parts[0]; $query_string = $command_parts[1]; parse_str( $query_string, $temp ); $result->command = rtrim( $pure_command, '/' ); $result->args = array_merge( $args, $temp ); } return $result; } /** * Command to endpoint. * * Format is required otherwise $command will returned. * * @param string $command * @param string $format * @param array $args * * @return string endpoint */ public function command_to_endpoint( $command, $format, $args ) { $endpoint = $command; if ( $format ) { $formatted = $format; array_walk( $args, function ( $val, $key ) use ( &$formatted ) { $formatted = str_replace( '{' . $key . '}', $val, $formatted ); } ); // Remove remaining format if not requested via `$args`. if ( strstr( $formatted, '/{' ) ) { /** * Example: * $command = 'example/documents'; * $format = 'example/documents/{document_id}/elements/{element_id}'; * $formatted = 'example/documents/1618/elements/{element_id}'; * Result: * $formatted = 'example/documents/1618/elements'; */ $formatted = substr( $formatted, 0, strpos( $formatted, '/{' ) ); } $endpoint = $formatted; } return $endpoint; } /** * Run server. * * Init WordPress reset api. * * @return \WP_REST_Server */ public function run_server() { /** * If run_server() called means, that rest api is simulated from the backend. */ $this->is_internal = true; if ( ! $this->server ) { // Remove all 'rest_api_init' actions. remove_all_actions( 'rest_api_init' ); // Call custom reset api loader. do_action( 'elementor_rest_api_before_init' ); $this->server = rest_get_server(); // Init API. } return $this->server; } /** * Kill server. * * Free server and controllers. */ public function kill_server() { global $wp_rest_server; $this->controllers = []; $this->command_formats = []; $this->server = false; $this->is_internal = false; $this->cache = []; $wp_rest_server = false; } /** * Run processor. * * @param \Elementor\Data\Base\Processor $processor * @param array $data * * @return mixed */ public function run_processor( $processor, $data ) { if ( call_user_func_array( [ $processor, 'get_conditions' ], $data ) ) { return call_user_func_array( [ $processor, 'apply' ], $data ); } return null; } /** * Run processors. * * Filter them by class. * * @param \Elementor\Data\Base\Processor[] $processors * @param string $filter_by_class * @param array $data * * @return false|array */ public function run_processors( $processors, $filter_by_class, $data ) { foreach ( $processors as $processor ) { if ( $processor instanceof $filter_by_class ) { if ( Processor\Before::class === $filter_by_class ) { $this->run_processor( $processor, $data ); } elseif ( Processor\After::class === $filter_by_class ) { $result = $this->run_processor( $processor, $data ); if ( $result ) { $data[1] = $result; } } else { // TODO: error break; } } } return isset( $data[1] ) ? $data[1] : false; } /** * Run request. * * Simulate rest API from within the backend. * Use args as query. * * @param string $endpoint * @param array $args * @param string $method * * @return \WP_REST_Response */ private function run_request( $endpoint, $args, $method ) { $this->run_server(); $endpoint = '/' . self::ROOT_NAMESPACE . '/v' . self::VERSION . '/' . $endpoint; // Run reset api. $request = new \WP_REST_Request( $method, $endpoint ); if ( 'GET' === $method ) { $request->set_query_params( $args ); } else { $request->set_body_params( $args ); } return rest_do_request( $request ); } /** * Run endpoint. * * Wrapper for `$this->run_request` return `$response->getData()` instead of `$response`. * * @param string $endpoint * @param array $args * @param string $method * * @return array */ public function run_endpoint( $endpoint, $args = [], $method = 'GET' ) { $response = $this->run_request( $endpoint, $args, $method ); return $response->get_data(); } /** * Run ( simulated reset api ). * * Do: * Init reset server. * Run before processors. * Run command as reset api endpoint from internal. * Run after processors. * * @param string $command * @param array $args * @param string $method * * @return array|false processed result */ public function run( $command, $args = [], $method = 'GET' ) { $key = crc32( $command . '-' . wp_json_encode( $args ) . '-' . $method ); $cache = $this->get_cache( $key ); if ( $cache ) { return $cache; } $this->run_server(); $controller_instance = $this->find_controller_instance( $command ); if ( ! $controller_instance ) { $this->set_cache( $key, [] ); return []; } $extracted_command = $this->command_extract_args( $command, $args ); $command = $extracted_command->command; $args = $extracted_command->args; $format = isset( $this->command_formats[ $command ] ) ? $this->command_formats[ $command ] : false; $command_processors = $controller_instance->get_processors( $command ); $endpoint = $this->command_to_endpoint( $command, $format, $args ); $this->run_processors( $command_processors, Processor\Before::class, [ $args ] ); $response = $this->run_request( $endpoint, $args, $method ); $result = $response->get_data(); if ( $response->is_error() ) { $this->set_cache( $key, [] ); return []; } $result = $this->run_processors( $command_processors, Processor\After::class, [ $args, $result ] ); $this->set_cache( $key, $result ); return $result; } public function is_internal() { return $this->is_internal; } } home/premiey/www/wp-content/plugins/elementor/core/logger/manager.php 0000666 00000015440 15165335524 0022116 0 ustar 00 <?php namespace Elementor\Core\Logger; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Common\Modules\Ajax\Module; use Elementor\Core\Logger\Loggers\Logger_Interface; use Elementor\Core\Logger\Items\PHP; use Elementor\Core\Logger\Items\JS; use Elementor\Plugin; use Elementor\Modules\System_Info\Module as System_Info; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Manager extends BaseModule { protected $loggers = []; protected $default_logger = ''; public function get_name() { return 'log'; } public function shutdown( $last_error = null, $should_exit = false ) { if ( ! $last_error ) { $last_error = error_get_last(); } if ( ! $last_error ) { return; } if ( empty( $last_error['file'] ) ) { return; } if ( ! Utils::is_elementor_path( $last_error['file'] ) ) { return; } $last_error['type'] = $this->get_log_type_from_php_error( $last_error['type'] ); $last_error['trace'] = true; $item = new PHP( $last_error ); $this->get_logger()->log( $item ); if ( $should_exit ) { exit; } } public function rest_error_handler( $error_number, $error_message, $error_file, $error_line ) { // Temporary solution until all PHP notices will be fixed in the core and pro. if ( Utils::is_wp_cli() ) { return null; } $error = new \WP_Error( $error_number, $error_message, [ 'type' => $error_number, 'message' => $error_message, 'file' => $error_file, 'line' => $error_line, ] ); if ( ! Utils::is_elementor_path( $error_file ) ) { // Do execute PHP internal error handler. return false; } $is_an_error = in_array( // It can be notice or warning $error_number, [ E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR ], true ); $error_data = $error->get_error_data(); // TODO: This part should be modular, temporary hard-coded. // Notify $e.data. if ( $is_an_error && ! headers_sent() ) { header( 'Content-Type: application/json; charset=UTF-8' ); http_response_code( 500 ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { echo wp_json_encode( $error_data ); } else { echo wp_json_encode( [ 'message' => 'Server error, see Elementor => System Info', ] ); } } $this->shutdown( $error_data, $is_an_error ); } public function register_error_handler() { set_error_handler( [ $this, 'rest_error_handler' ], E_ALL ); } public function add_system_info_report() { System_Info::add_report( 'log', [ 'file_name' => __DIR__ . '/log-reporter.php', 'class_name' => __NAMESPACE__ . '\Log_Reporter', ] ); } /** * Javascript log. * * Log Elementor errors and save them in the database. * * Fired by `wp_ajax_elementor_js_log` action. * */ public function js_log() { /** @var Module $ajax */ $ajax = Plugin::$instance->common->get_component( 'ajax' ); // PHPCS ignore is added throughout this method because nonce verification happens in the $ajax->verify_request_nonce() method. if ( ! $ajax->verify_request_nonce() || empty( $_POST['data'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing wp_send_json_error(); } // PHPCS - See comment above. $data = Utils::get_super_global_value( $_POST, 'data' ) ?? []; // phpcs:ignore WordPress.Security.NonceVerification.Missing array_walk_recursive( $data, function( &$value ) { $value = sanitize_text_field( $value ); } ); // PHPCS - See comment above. foreach ( $data as $error ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing $error['type'] = Logger_Interface::LEVEL_ERROR; if ( ! empty( $error['customFields'] ) ) { $error['meta'] = $error['customFields']; } $item = new JS( $error ); $this->get_logger()->log( $item ); } wp_send_json_success(); } public function register_logger( $name, $class ) { $this->loggers[ $name ] = $class; } public function set_default_logger( $name ) { if ( ! empty( $this->loggers[ $name ] ) ) { $this->default_logger = $name; } } public function register_default_loggers() { $this->register_logger( 'db', 'Elementor\Core\Logger\Loggers\Db' ); $this->set_default_logger( 'db' ); } /** * @param string $name * * @return Logger_Interface */ public function get_logger( $name = '' ) { $this->register_loggers(); if ( empty( $name ) || ! isset( $this->loggers[ $name ] ) ) { $name = $this->default_logger; } if ( ! $this->get_component( $name ) ) { $this->add_component( $name, new $this->loggers[ $name ]() ); } return $this->get_component( $name ); } /** * @param string $message * @param array $args * * @return void */ public function log( $message, $args = [] ) { $this->get_logger()->log( $message, $args ); } /** * @param string $message * @param array $args * * @return void */ public function info( $message, $args = [] ) { $this->get_logger()->info( $message, $args ); } /** * @param string $message * @param array $args * * @return void */ public function notice( $message, $args = [] ) { $this->get_logger()->notice( $message, $args ); } /** * @param string $message * @param array $args * * @return void */ public function warning( $message, $args = [] ) { $this->get_logger()->warning( $message, $args ); } /** * @param string $message * @param array $args * * @return void */ public function error( $message, $args = [] ) { $this->get_logger()->error( $message, $args ); } private function get_log_type_from_php_error( $type ) { $error_map = [ E_CORE_ERROR => Logger_Interface::LEVEL_ERROR, E_ERROR => Logger_Interface::LEVEL_ERROR, E_USER_ERROR => Logger_Interface::LEVEL_ERROR, E_COMPILE_ERROR => Logger_Interface::LEVEL_ERROR, E_RECOVERABLE_ERROR => Logger_Interface::LEVEL_ERROR, E_PARSE => Logger_Interface::LEVEL_ERROR, E_STRICT => Logger_Interface::LEVEL_ERROR, E_WARNING => Logger_Interface::LEVEL_WARNING, E_USER_WARNING => Logger_Interface::LEVEL_WARNING, E_CORE_WARNING => Logger_Interface::LEVEL_WARNING, E_COMPILE_WARNING => Logger_Interface::LEVEL_WARNING, E_NOTICE => Logger_Interface::LEVEL_NOTICE, E_USER_NOTICE => Logger_Interface::LEVEL_NOTICE, E_DEPRECATED => Logger_Interface::LEVEL_NOTICE, E_USER_DEPRECATED => Logger_Interface::LEVEL_NOTICE, ]; return isset( $error_map[ $type ] ) ? $error_map[ $type ] : Logger_Interface::LEVEL_ERROR; } private function register_loggers() { if ( ! did_action( 'elementor/loggers/register' ) ) { do_action( 'elementor/loggers/register', $this ); } } public function __construct() { register_shutdown_function( [ $this, 'shutdown' ] ); add_action( 'admin_init', [ $this, 'add_system_info_report' ], 80 ); add_action( 'wp_ajax_elementor_js_log', [ $this, 'js_log' ] ); add_action( 'elementor/loggers/register', [ $this, 'register_default_loggers' ] ); } } home/premiey/www/wp-content/plugins/elementor/core/settings/manager.php 0000666 00000011751 15165353567 0022507 0 ustar 00 <?php namespace Elementor\Core\Settings; use Elementor\Core\Settings\Base\CSS_Model; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Elementor settings manager. * * Elementor settings manager handler class is responsible for registering and * managing Elementor settings managers. * * @since 1.6.0 */ class Manager { /** * Settings managers. * * Holds all the registered settings managers. * * @since 1.6.0 * @access private * * @var Base\Manager[] */ private static $settings_managers = []; /** * Builtin settings managers names. * * Holds the names for builtin Elementor settings managers. * * @since 1.6.0 * @access private * * @var array */ private static $builtin_settings_managers_names = [ 'page', 'editorPreferences' ]; /** * Add settings manager. * * Register a single settings manager to the registered settings managers. * * @since 1.6.0 * @access public * @static * * @param Base\Manager $manager Settings manager. */ public static function add_settings_manager( Base\Manager $manager ) { self::$settings_managers[ $manager->get_name() ] = $manager; } /** * Get settings managers. * * Retrieve registered settings manager(s). * * If no parameter passed, it will retrieve all the settings managers. For * any given parameter it will retrieve a single settings manager if one * exist, or `null` otherwise. * * @since 1.6.0 * @access public * @static * * @param string $manager_name Optional. Settings manager name. Default is * null. * * @return Base\Manager|Base\Manager[] Single settings manager, if it exists, * null if it doesn't exists, or the all * the settings managers if no parameter * defined. */ public static function get_settings_managers( $manager_name = null ) { if ( $manager_name ) { // Backwards compatibility for `general` manager, since 3.0.0. // Register the class only if needed. if ( 'general' === $manager_name ) { // TODO: _deprecated_argument( $manager_name, '3.0.0', 'Plugin::$instance->kits_manager->get_active_kit_for_frontend();' ); $manager_class = self::get_manager_class( $manager_name ); self::add_settings_manager( new $manager_class() ); } if ( isset( self::$settings_managers[ $manager_name ] ) ) { return self::$settings_managers[ $manager_name ]; } return null; } return self::$settings_managers; } /** * Register default settings managers. * * Register builtin Elementor settings managers. * * @since 1.6.0 * @access private * @static */ private static function register_default_settings_managers() { foreach ( self::$builtin_settings_managers_names as $manager_name ) { $manager_class = self::get_manager_class( $manager_name ); self::add_settings_manager( new $manager_class() ); } } /** * Get class path for default settings managers. * * @param $manager_name * * @return string * @since 3.0.0 * @access private * @static */ private static function get_manager_class( $manager_name ) { return __NAMESPACE__ . '\\' . ucfirst( $manager_name ) . '\Manager'; } /** * Get settings managers config. * * Retrieve the settings managers configuration. * * @since 1.6.0 * @access public * @static * * @return array The settings managers configuration. */ public static function get_settings_managers_config() { $config = []; $user_can = Plugin::instance()->role_manager->user_can( 'design' ); foreach ( self::$settings_managers as $name => $manager ) { $settings_model = $manager->get_model_for_config(); $tabs = $settings_model->get_tabs_controls(); if ( ! $user_can ) { unset( $tabs['style'] ); } $config[ $name ] = [ 'name' => $manager->get_name(), 'panelPage' => $settings_model->get_panel_page_settings(), 'controls' => $settings_model->get_controls(), 'tabs' => $tabs, 'settings' => $settings_model->get_settings(), ]; if ( $settings_model instanceof CSS_Model ) { $config[ $name ]['cssWrapperSelector'] = $settings_model->get_css_wrapper_selector(); } } return $config; } /** * Get settings frontend config. * * Retrieve the settings managers frontend configuration. * * @since 1.6.0 * @access public * @static * * @return array The settings managers frontend configuration. */ public static function get_settings_frontend_config() { $config = []; foreach ( self::$settings_managers as $name => $manager ) { $settings_model = $manager->get_model_for_config(); if ( $settings_model ) { $config[ $name ] = $settings_model->get_frontend_settings(); } } return $config; } /** * Run settings managers. * * Register builtin Elementor settings managers. * * @since 1.6.0 * @access public * @static */ public static function run() { self::register_default_settings_managers(); } } home/premiey/www/wp-content/plugins/elementor/core/files/manager.php 0000666 00000010352 15165353605 0021736 0 ustar 00 <?php namespace Elementor\Core\Files; use Elementor\Core\Common\Modules\Ajax\Module as Ajax; use Elementor\Core\Files\CSS\Global_CSS; use Elementor\Core\Files\CSS\Post as Post_CSS; use Elementor\Core\Page_Assets\Data_Managers\Base as Page_Assets_Data_Manager; use Elementor\Core\Responsive\Files\Frontend; use Elementor\Plugin; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Elementor files manager. * * Elementor files manager handler class is responsible for creating files. * * @since 1.2.0 */ class Manager { private $files = []; /** * Files manager constructor. * * Initializing the Elementor files manager. * * @since 1.2.0 * @access public */ public function __construct() { $this->register_actions(); } public function get( $class, $args ) { $id = $class . '-' . wp_json_encode( $args ); if ( ! isset( $this->files[ $id ] ) ) { // Create an instance from dynamic args length. $reflection_class = new \ReflectionClass( $class ); $this->files[ $id ] = $reflection_class->newInstanceArgs( $args ); } return $this->files[ $id ]; } /** * On post delete. * * Delete post CSS immediately after a post is deleted from the database. * * Fired by `deleted_post` action. * * @since 1.2.0 * @access public * * @param string $post_id Post ID. */ public function on_delete_post( $post_id ) { if ( ! Utils::is_post_support( $post_id ) ) { return; } $css_file = Post_CSS::create( $post_id ); $css_file->delete(); } /** * On export post meta. * * When exporting data using WXR, skip post CSS file meta key. This way the * export won't contain the post CSS file data used by Elementor. * * Fired by `wxr_export_skip_postmeta` filter. * * @since 1.2.0 * @access public * * @param bool $skip Whether to skip the current post meta. * @param string $meta_key Current meta key. * * @return bool Whether to skip the post CSS meta. */ public function on_export_post_meta( $skip, $meta_key ) { if ( Post_CSS::META_KEY === $meta_key ) { $skip = true; } return $skip; } /** * Clear cache. * * Delete all meta containing files data. And delete the actual * files from the upload directory. * * @since 1.2.0 * @access public */ public function clear_cache() { // Delete files. $path = Base::get_base_uploads_dir() . Base::DEFAULT_FILES_DIR . '*'; foreach ( glob( $path ) as $file_path ) { unlink( $file_path ); } delete_post_meta_by_key( Post_CSS::META_KEY ); delete_option( Global_CSS::META_KEY ); delete_option( Frontend::META_KEY ); $this->reset_assets_data(); /** * Elementor clear files. * * Fires after Elementor clears files * * @since 2.1.0 */ do_action( 'elementor/core/files/clear_cache' ); } /** * Register Ajax Actions * * Deprecated - use the Uploads Manager instead. * * @deprecated 3.5.0 * * @param Ajax $ajax */ public function register_ajax_actions( Ajax $ajax ) { Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' ); Plugin::$instance->uploads_manager->register_ajax_actions( $ajax ); } /** * Ajax Unfiltered Files Upload * * Deprecated - use the Uploads Manager instead. * * @deprecated 3.5.0 */ public function ajax_unfiltered_files_upload() { Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' ); Plugin::$instance->uploads_manager->enable_unfiltered_files_upload(); } /** * Register actions. * * Register filters and actions for the files manager. * * @since 1.2.0 * @access private */ private function register_actions() { add_action( 'deleted_post', [ $this, 'on_delete_post' ] ); add_filter( 'wxr_export_skip_postmeta', [ $this, 'on_export_post_meta' ], 10, 2 ); add_action( 'update_option_home', function () { $this->reset_assets_data(); } ); add_action( 'update_option_siteurl', function () { $this->reset_assets_data(); } ); } /** * Reset Assets Data. * * Reset the page assets data. * * @since 3.3.0 * @access private */ private function reset_assets_data() { delete_option( Page_Assets_Data_Manager::ASSETS_DATA_KEY ); } }
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings