| Server IP : 104.21.13.219 / Your IP : 104.23.197.161 Web Server : nginx/1.26.1 System : Linux HE9229 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/jl3_ph_com/wp-content/plugins/elementor/core/logger/ |
Upload File : |
<?php
namespace Elementor\Core\Logger;
use Elementor\Modules\System_Info\Reporters\Base;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Log reporter.
*
* Elementor log reporter handler class is responsible for generating the
* debug reports.
*
* @since 2.4.0
*/
class Log_Reporter extends Base {
const MAX_ENTRIES = 20;
const CLEAR_LOG_ACTION = 'elementor-clear-log';
public function get_title() {
return esc_html__( 'Log', 'elementor' );
}
public function get_fields() {
return [
'log_entries' => '',
];
}
public function print_html_label( $log_label ) {
$title = $this->get_title();
if ( empty( $_GET[ self::CLEAR_LOG_ACTION ] ) ) { // phpcs:ignore -- nonce validation is not require here.
$nonce = wp_create_nonce( self::CLEAR_LOG_ACTION );
$url = add_query_arg( [
self::CLEAR_LOG_ACTION => 1,
'_wpnonce' => $nonce,
] );
$title .= '<a href="' . esc_url( $url ) . '#elementor-clear-log" class="box-title-tool">' . esc_html__( 'Clear Log', 'elementor' ) . '</a>';
$title .= '<span id="elementor-clear-log"></span>';
}
parent::print_html_label( $title );
}
public function get_log_entries() {
/** @var \Elementor\Core\Logger\Manager $manager */
$manager = Manager::instance();
/** @var \Elementor\Core\Logger\Loggers\Db $logger */
$logger = $manager->get_logger( 'db' );
if ( ! empty( $_GET[ self::CLEAR_LOG_ACTION ] ) ) {
$nonce = Utils::get_super_global_value( $_GET, '_wpnonce' );
if ( ! wp_verify_nonce( $nonce, self::CLEAR_LOG_ACTION ) ) {
wp_die( 'Invalid Nonce', 'Invalid Nonce', [
'back_link' => true,
] );
}
$logger->clear();
}
$log_string = 'No entries to display';
$log_entries = $logger->get_formatted_log_entries( self::MAX_ENTRIES, false );
if ( ! empty( $log_entries ) ) {
$entries_string = '';
foreach ( $log_entries as $key => $log_entry ) {
if ( $log_entry['count'] ) {
$entries_string .= '<h3>' . sprintf( '%s: showing %s of %s', $key, $log_entry['count'], $log_entry['total_count'] ) . '</h3>';
$entries_string .= '<div class="elementor-log-entries">' . $log_entry['entries'] . '</div>';
}
}
if ( ! empty( $entries_string ) ) {
$log_string = $entries_string;
}
}
return [
'value' => $log_string,
];
}
public function get_raw_log_entries() {
$log_string = 'No entries to display';
/** @var \Elementor\Core\Logger\Manager $manager */
$manager = Manager::instance();
$logger = $manager->get_logger();
$log_entries = $logger->get_formatted_log_entries( self::MAX_ENTRIES, false );
if ( ! empty( $log_entries ) ) {
$entries_string = PHP_EOL;
foreach ( $log_entries as $key => $log_entry ) {
if ( $log_entry['count'] ) {
$entries_string .= sprintf( '%s: showing %s of %s', $key, $log_entry['count'], $log_entry['total_count'] ) . $log_entry['entries'] . PHP_EOL;
}
}
if ( ! empty( $entries_string ) ) {
$log_string = $entries_string;
}
}
return [
'value' => $log_string,
];
}
}