Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,115 @@
<?php
/**
* The functionality related to the Backup.
*
* @since 1.0.240
* @package RankMath
* @subpackage RankMath\Status
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Status;
use RankMath\Helper;
defined( 'ABSPATH' ) || exit;
/**
* Backup class.
*/
class Backup {
/**
* Get backups from the database.
*
* @param {bool} $return_object Whether to retrun the backup data or only the keys with formatted date.
*/
public static function get_backups( $return_object = false ) {
$backups = get_option( 'rank_math_backups', [] );
if ( empty( $backups ) ) {
$backups = [];
} elseif ( ! is_array( $backups ) ) {
$backups = (array) $backups;
}
if ( empty( $backups ) || $return_object ) {
return $backups;
}
$data = [];
foreach ( array_keys( $backups ) as $backup ) {
$data[ $backup ] = esc_html( date_i18n( 'M jS Y, H:i a', $backup ) );
}
return $data;
}
/**
* Create Backup.
*/
public static function create_backup() {
$key = Helper::get_current_time();
if ( is_null( $key ) ) {
return [
'type' => 'error',
'message' => esc_html__( 'Unable to create backup this time.', 'rank-math' ),
];
}
$backups = self::get_backups( true );
$backups = [ $key => Import_Export_Settings::get_export_data() ] + $backups;
update_option( 'rank_math_backups', $backups, false );
return [
'type' => 'success',
'message' => esc_html__( 'Backup created successfully.', 'rank-math' ),
'backups' => self::get_backups(),
];
}
/**
* Create Backup.
*
* @param string $key Backup key to be restored.
*/
public static function restore_backup( $key ) {
$backups = self::get_backups( true );
if ( ! array_key_exists( $key, $backups ) ) {
return [
'type' => 'error',
'message' => esc_html__( 'Backup does not exist.', 'rank-math' ),
];
}
Import_Export_Settings::do_import_data( $backups[ $key ], true );
return [
'type' => 'success',
'message' => esc_html__( 'Backup restored successfully.', 'rank-math' ),
];
}
/**
* Delete Backup.
*
* @param string $key Backup key to be restored.
*/
public static function delete_backup( $key ) {
$backups = self::get_backups();
if ( ! isset( $backups[ $key ] ) ) {
return [
'type' => 'error',
'message' => esc_html__( 'No backup key found to delete.', 'rank-math' ),
'backups' => self::get_backups(),
];
}
unset( $backups[ $key ] );
update_option( 'rank_math_backups', $backups, false );
return [
'type' => 'success',
'message' => esc_html__( 'Backup successfully deleted.', 'rank-math' ),
'backups' => self::get_backups(),
];
}
}

View File

@@ -0,0 +1,116 @@
<?php
/**
* Locate, retrieve, and display the server's error log.
*
* @since 1.0.33
* @package RankMath
* @subpackage RankMath\Status
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Status;
use RankMath\Helper;
use RankMath\Helpers\Str;
defined( 'ABSPATH' ) || exit;
/**
* Error_Log class.
*/
class Error_Log {
/**
* Log path.
*
* @var string|bool
*/
private static $log_path = null;
/**
* File content.
*
* @var array
*/
private static $contents = null;
/**
* Get Error Log JSON data to be used on the System Status page.
*
* @return array Error Log data.
*/
public static function get_error_log_localized_data() {
$error_log_load_error = self::error_log_load_error();
// Early bail if Error log file could not be loaded.
if ( $error_log_load_error ) {
return [
'errorLogError' => $error_log_load_error,
];
}
return [
'errorLog' => self::get_error_log_rows( 100 ),
'errorLogPath' => esc_html( basename( self::get_log_path() ) ),
'errorLogSize' => is_array( self::$contents ) ? esc_html( Str::human_number( strlen( join( '', self::$contents ) ) ) ) : '0',
];
}
/**
* Get last x rows from the error log.
*
* @param integer $limit Max number of rows to return.
*
* @return string[] Array of rows of text.
*/
private static function get_error_log_rows( $limit = -1 ) {
if ( is_null( self::$contents ) ) {
$wp_filesystem = Helper::get_filesystem();
self::$contents = $wp_filesystem->get_contents_array( self::get_log_path() );
}
if ( -1 === $limit ) {
return join( '', self::$contents );
}
return is_array( self::$contents ) ? join( '', array_slice( self::$contents, -$limit ) ) : '';
}
/**
* Show error if the log cannot be loaded.
*/
private static function error_log_load_error() {
$log_file = self::get_log_path();
$wp_filesystem = Helper::get_filesystem();
if (
empty( $log_file ) ||
is_null( $wp_filesystem ) ||
! Helper::is_filesystem_direct() ||
! $wp_filesystem->exists( $log_file ) ||
! $wp_filesystem->is_readable( $log_file )
) {
return esc_html__( 'The error log cannot be retrieved.', 'rank-math' );
}
// Error log must be smaller than 100 MB.
$size = $wp_filesystem->size( $log_file );
if ( $size > 100000000 ) {
return esc_html__( 'The error log cannot be retrieved: Error log file is too large.', 'rank-math' );
}
return false;
}
/**
* Get error log file location.
*
* @return string Path to log file.
*/
private static function get_log_path() {
if ( is_null( self::$log_path ) ) {
self::$log_path = ini_get( 'error_log' );
}
return self::$log_path;
}
}

View File

@@ -0,0 +1,244 @@
<?php
/**
* The Import Export Settings Class
*
* @since 1.0.240
* @package RankMath
* @subpackage RankMath\Admin
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Status;
use WP_REST_Response;
use RankMath\Helper;
use RankMath\Helpers\Param;
use RankMath\Status\Backup;
defined( 'ABSPATH' ) || exit;
/**
* Import_Export_Settings class.
*/
class Import_Export_Settings {
/**
* Handle export.
*/
public static function export() {
$panels = Param::post( 'panels', [], FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
return wp_json_encode( self::get_export_data( $panels ) );
}
/**
* Handle import.
*/
public static function import() {
$file = Helper::handle_file_upload();
if ( isset( $file['error'] ) ) {
return [
'error' => esc_html__( 'Settings could not be imported:', 'rank-math' ) . ' ' . $file['error'],
];
}
if ( ! isset( $file['file'] ) ) {
return [
'error' => esc_html__( 'Settings could not be imported: Upload failed.', 'rank-math' ),
];
}
// Parse Options.
$wp_filesystem = Helper::get_filesystem();
if ( is_null( $wp_filesystem ) || ! Helper::is_filesystem_direct() ) {
return [
'error' => esc_html__( 'Uploaded file could not be read.', 'rank-math' ),
];
}
$settings = $wp_filesystem->get_contents( $file['file'] );
$settings = json_decode( $settings, true );
\wp_delete_file( $file['file'] );
if ( is_array( $settings ) && self::do_import_data( $settings ) ) {
return [
'success' => esc_html__( 'Settings successfully imported. Your old configuration has been saved as a backup.', 'rank-math' ),
];
}
return [
'error' => esc_html__( 'No settings found to be imported.', 'rank-math' ),
];
}
/**
* Does import data.
*
* @param array $data Import data.
* @param bool $suppress_hooks Suppress hooks or not.
* @return bool
*/
public static function do_import_data( array $data, $suppress_hooks = false ) {
self::run_import_hooks( 'pre_import', $data, $suppress_hooks );
Backup::create_backup();
// Import options.
$down = self::set_options( $data );
// Import capabilities.
if ( ! empty( $data['role-manager'] ) ) {
$down = true;
Helper::set_capabilities( $data['role-manager'] );
}
// Import redirections.
if ( ! empty( $data['redirections'] ) ) {
$down = true;
self::set_redirections( $data['redirections'] );
}
self::run_import_hooks( 'after_import', $data, $suppress_hooks );
return $down;
}
/**
* Set options from data.
*
* @param array $data An array of data.
*/
private static function set_options( $data ) {
$set = false;
$hash = [
'modules' => 'rank_math_modules',
'general' => 'rank-math-options-general',
'titles' => 'rank-math-options-titles',
'sitemap' => 'rank-math-options-sitemap',
];
foreach ( $hash as $key => $option_key ) {
if ( ! empty( $data[ $key ] ) ) {
$set = true;
update_option( $option_key, $data[ $key ] );
}
}
return $set;
}
/**
* Set redirections.
*
* @param array $redirections An array of redirections to import.
*/
private static function set_redirections( $redirections ) {
foreach ( $redirections as $key => $redirection ) {
$matched = \RankMath\Redirections\DB::match_redirections_source( $redirection['sources'] );
if ( ! empty( $matched ) || ! is_serialized( $redirection['sources'] ) ) {
continue;
}
$sources = unserialize( trim( $redirection['sources'] ), [ 'allowed_classes' => false ] ); // phpcs:ignore -- We are going to move Redirections sources to JSON, that will fix this issue.
if ( ! is_array( $sources ) || $sources instanceof \__PHP_Incomplete_Class ) {
continue;
}
\RankMath\Redirections\DB::add(
[
'url_to' => $redirection['url_to'],
'sources' => self::sanitize_sources( $sources ),
'header_code' => $redirection['header_code'],
'hits' => $redirection['hits'],
'created' => $redirection['created'],
'updated' => $redirection['updated'],
]
);
}
}
/**
* Sanitize the redirection source before storing it.
*
* @param array $sources An array of redirection sources.
*/
private static function sanitize_sources( $sources ) {
$data = [];
foreach ( $sources as $source ) {
if ( empty( $source['pattern'] ) ) {
continue;
}
$data[] = [
'ignore' => ! empty( $source['ignore'] ) ? 'case' : '',
'pattern' => wp_strip_all_tags( $source['pattern'], true ),
'comparison' => in_array( $source['comparison'], [ 'exact', 'contains', 'start', 'end', 'regex' ], true ) ? $source['comparison'] : 'exact',
];
}
return $data;
}
/**
* Run import hooks
*
* @param string $hook Hook to fire.
* @param array $data Import data.
* @param bool $suppress Suppress hooks or not.
*/
private static function run_import_hooks( $hook, $data, $suppress ) {
if ( ! $suppress ) {
/**
* Fires while importing settings.
*
* @since 0.9.0
*
* @param array $data Import data.
*/
do_action( 'rank_math/import/settings/' . $hook, $data );
}
}
/**
* Gets export data.
*
* @param array $panels Which panels to export. All panels will be exported if this param is empty.
* @return array
*/
public static function get_export_data( array $panels = [] ) {
if ( ! $panels ) {
$panels = [ 'general', 'titles', 'sitemap', 'role-manager', 'redirections' ];
}
if ( ! \RankMath\Helpers\DB::check_table_exists( 'rank_math_redirections' ) ) {
$redirections_index = array_search( 'redirections', $panels, true );
if ( false !== $redirections_index ) {
unset( $panels[ $redirections_index ] );
}
}
$settings = rank_math()->settings->all_raw();
$data = [];
foreach ( $panels as $panel ) {
if ( isset( $settings[ $panel ] ) ) {
$data[ $panel ] = $settings[ $panel ];
continue;
}
if ( 'role-manager' === $panel ) {
$data['role-manager'] = Helper::get_roles_capabilities();
}
if ( 'redirections' === $panel ) {
$items = \RankMath\Redirections\DB::get_redirections( [ 'limit' => 1000 ] );
$data['redirections'] = $items['redirections'];
}
$data = apply_filters( 'rank_math/export/settings', $data, $panel );
}
$data['modules'] = get_option( 'rank_math_modules', [] );
return $data;
}
}

View File

@@ -0,0 +1,201 @@
<?php
/**
* The Global functionality of the plugin.
*
* Defines the functionality loaded on admin.
*
* @since 1.0.71
* @package RankMath
* @subpackage RankMath\Rest
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Status;
use WP_Error;
use WP_REST_Server;
use WP_REST_Request;
use WP_REST_Response;
use WP_REST_Controller;
use RankMath\Helper;
use RankMath\Admin\Admin_Helper;
defined( 'ABSPATH' ) || exit;
/**
* Rest class.
*/
class Rest extends WP_REST_Controller {
/**
* Constructor.
*/
public function __construct() {
$this->namespace = \RankMath\Rest\Rest_Helper::BASE . '/status';
}
/**
* Registers the routes for the objects of the controller.
*/
public function register_routes() {
register_rest_route(
$this->namespace,
'/getViewData',
[
'methods' => 'POST',
'callback' => [ $this, 'get_view_data' ],
'permission_callback' => [ '\\RankMath\\Rest\\Rest_Helper', 'can_manage_options' ],
]
);
register_rest_route(
$this->namespace,
'/updateViewData',
[
'methods' => 'POST',
'callback' => [ $this, 'update_view_data' ],
'permission_callback' => [ '\\RankMath\\Rest\\Rest_Helper', 'can_manage_options' ],
]
);
register_rest_route(
$this->namespace,
'/importSettings',
[
'methods' => 'POST',
'callback' => [ '\\RankMath\\Status\\Import_Export_Settings', 'import' ],
'permission_callback' => [ $this, 'has_import_export_permission' ],
]
);
register_rest_route(
$this->namespace,
'/exportSettings',
[
'methods' => 'POST',
'callback' => [ '\\RankMath\\Status\\Import_Export_Settings', 'export' ],
'permission_callback' => [ $this, 'has_import_export_permission' ],
]
);
register_rest_route(
$this->namespace,
'/runBackup',
[
'methods' => 'POST',
'callback' => [ $this, 'run_backup' ],
'permission_callback' => [ $this, 'has_import_export_permission' ],
]
);
}
/**
* Rest permission_callback method to check if user has the capability to import/export the data.
*/
public function has_import_export_permission() {
if ( ! Helper::has_cap( 'general' ) ) {
return new WP_Error(
'rest_cannot_access',
__( 'Sorry, you are not authorized to Import/Export the settings.', 'rank-math' ),
[ 'status' => rest_authorization_required_code() ]
);
}
return true;
}
/**
* Run Backup.
*
* @param WP_REST_Request $request Full details about the request.
*
* @return int Credits.
*/
public function run_backup( WP_REST_Request $request ) {
$action = $request->get_param( 'action' );
if ( ! in_array( $action, [ 'create', 'delete', 'restore' ], true ) ) {
return new WP_REST_Response(
[
'type' => 'error',
'message' => esc_html__( 'Invalid action selected.', 'rank-math' ),
]
);
}
$key = $request->get_param( 'key' );
$method = "{$action}_backup";
$data = Backup::$method( $key );
return new WP_REST_Response(
[
'type' => $data['type'],
'message' => $data['message'],
'backups' => isset( $data['backups'] ) ? $data['backups'] : false,
]
);
}
/**
* Get View data
*
* @param WP_REST_Request $request Full details about the request.
*
* @return array View Data.
*/
public function get_view_data( WP_REST_Request $request ) {
$view = $request->get_param( 'activeTab' );
$hash = [
'version_control' => '\RankMath\Version_Control',
'tools' => '\RankMath\Tools\Database_Tools',
'status' => '\RankMath\Status\System_Status',
'import_export' => '\RankMath\Admin\Import_Export',
];
if ( ! isset( $hash[ $view ] ) ) {
return [];
}
return apply_filters(
"rank_math/status/$view/json_data",
$hash[ $view ]::get_json_data()
);
}
/**
* Update Version Control data.
*
* @param WP_REST_Request $request Full details about the request.
*/
public function update_view_data( WP_REST_Request $request ) {
$panel = $request->get_param( 'panel' );
$method = "update_{$panel}";
return $this->$method( $request );
}
/**
* Update the Auto Update panel data.
*
* @param WP_REST_Request $request Full details about the request.
*/
private function update_auto_update( $request ) {
$enable_auto_update = $request->get_param( 'autoUpdate' );
$enable_auto_update = $enable_auto_update ? 'on' : 'off';
Helper::toggle_auto_update_setting( $enable_auto_update );
$enable_notifications = (bool) $request->get_param( 'updateNotificationEmail' );
$settings = get_option( 'rank-math-options-general', [] );
$settings['update_notification_email'] = $enable_notifications;
update_option( 'rank-math-options-general', $settings );
return true;
}
/**
* Update the Auto Update panel data.
*
* @param WP_REST_Request $request Full details about the request.
*/
private function update_beta_optin( $request ) {
$beta_optin = $request->get_param( 'betaOptin' );
$settings = get_option( 'rank-math-options-general', [] );
$settings['beta_optin'] = $beta_optin;
update_option( 'rank-math-options-general', $settings );
return true;
}
}

View File

@@ -0,0 +1,125 @@
<?php
/**
* The Status & Tools internal module.
*
* @since 1.0.33
* @package RankMath
* @subpackage RankMath\Status
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Status;
use RankMath\Helper;
use RankMath\Helpers\Param;
use RankMath\Module\Base;
use RankMath\Admin\Page;
use RankMath\Traits\Hooker;
defined( 'ABSPATH' ) || exit;
/**
* Status class.
*/
class Status extends Base {
use Hooker;
/**
* Module ID.
*
* @var string
*/
public $id = '';
/**
* Module directory.
*
* @var string
*/
public $directory = '';
/**
* Module page.
*
* @var object
*/
public $page;
/**
* Class constructor.
*/
public function __construct() {
$this->action( 'rest_api_init', 'init_rest_api' );
if ( Helper::is_heartbeat() ) {
return;
}
$directory = __DIR__;
$this->config(
[
'id' => 'status',
'directory' => $directory,
]
);
parent::__construct();
}
/**
* Load the REST API endpoints.
*/
public function init_rest_api() {
$rest = new Rest();
$rest->register_routes();
}
/**
* Register admin page.
*/
public function register_admin_page() {
$uri = untrailingslashit( plugin_dir_url( __FILE__ ) );
$this->page = new Page(
'rank-math-status',
esc_html__( 'Status & Tools', 'rank-math' ),
[
'position' => 70,
'parent' => 'rank-math',
'classes' => [ 'rank-math-page' ],
'render' => $this->directory . '/views/main.php',
'assets' => [
'styles' => [
'wp-components' => '',
'rank-math-common' => '',
'rank-math-status' => $uri . '/assets/css/status.css',
],
'scripts' => [
'lodash' => '',
'rank-math-components' => '',
'rank-math-dashboard' => '',
'rank-math-status' => $uri . '/assets/js/status.js',
],
'json' => $this->get_json_data( Param::get( 'view', 'version_control' ) ),
],
]
);
}
/**
* Get localized JSON data based on the Page view.
*
* @param string $view Current Page view.
*/
private function get_json_data( $view ) {
return [
'isAdvancedMode' => Helper::is_advanced_mode(),
'isPluginActiveForNetwork' => Helper::is_plugin_active_for_network(),
'canUser' => [
'manageOptions' => current_user_can( 'manage_options' ),
'setupNetwork' => current_user_can( 'setup_network' ),
'installPlugins' => current_user_can( 'install_plugins' ),
],
];
}
}

View File

@@ -0,0 +1,189 @@
<?php
/**
* This class handles the content in Status & Tools > System Status.
*
* @since 1.0.33
* @package RankMath
* @subpackage RankMath\Status
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Status;
use RankMath\Helper;
use RankMath\Helpers\DB as DB_Helper;
use RankMath\Google\Authentication;
use RankMath\Admin\Admin_Helper;
use RankMath\Google\Permissions;
defined( 'ABSPATH' ) || exit;
/**
* System_Status class.
*/
class System_Status {
/**
* Get localized JSON data based on the Page view.
*/
public static function get_json_data() {
global $wpdb;
$info = [];
$plan = Admin_Helper::get_registration_data();
$tokens = Authentication::tokens();
$modules = Helper::get_active_modules();
$permissions = Permissions::get_status();
$permissions_data = '';
if ( ! empty( $permissions ) ) {
$permissions_data = implode(
', ',
array_map(
fn( $k, $v ) => "$k: $v",
array_keys( $permissions ),
$permissions
)
);
}
$rankmath = [
'label' => esc_html__( 'Rank Math', 'rank-math' ),
'fields' => [
'version' => [
'label' => esc_html__( 'Version', 'rank-math' ),
'value' => get_option( 'rank_math_version' ),
],
'database_version' => [
'label' => esc_html__( 'Database version', 'rank-math' ),
'value' => get_option( 'rank_math_db_version' ),
],
'plugin_plan' => [
'label' => esc_html__( 'Plugin subscription plan', 'rank-math' ),
'value' => isset( $plan['plan'] ) ? \ucwords( $plan['plan'] ) : esc_html__( 'Free', 'rank-math' ),
],
'active_modules' => [
'label' => esc_html__( 'Active modules', 'rank-math' ),
'value' => empty( $modules ) ? esc_html__( '(none)', 'rank-math' ) : join( ', ', $modules ),
],
'refresh_token' => [
'label' => esc_html__( 'Google Refresh token', 'rank-math' ),
'value' => empty( $tokens['refresh_token'] ) ? esc_html__( 'No token', 'rank-math' ) : esc_html__( 'Token exists', 'rank-math' ),
],
'permissions' => [
'label' => esc_html__( 'Google Permission', 'rank-math' ),
'value' => $permissions_data,
],
],
];
$database_tables = DB_Helper::get_results(
$wpdb->prepare(
"SELECT
table_name AS 'name'
FROM information_schema.TABLES
WHERE table_schema = %s
AND table_name LIKE %s
ORDER BY name ASC;",
DB_NAME,
'%rank\\_math%'
)
);
$tables = [];
foreach ( $database_tables as $table ) {
$name = \str_replace( $wpdb->prefix, '', $table->name );
$tables[ $name ] = true;
}
$should_exist = [
'rank_math_404_logs' => esc_html__( 'Database Table: 404 Log', 'rank-math' ),
'rank_math_redirections' => esc_html__( 'Database Table: Redirection', 'rank-math' ),
'rank_math_redirections_cache' => esc_html__( 'Database Table: Redirection Cache', 'rank-math' ),
'rank_math_internal_links' => esc_html__( 'Database Table: Internal Link', 'rank-math' ),
'rank_math_internal_meta' => esc_html__( 'Database Table: Internal Link Meta', 'rank-math' ),
'rank_math_analytics_gsc' => esc_html__( 'Database Table: Google Search Console', 'rank-math' ),
'rank_math_analytics_objects' => esc_html__( 'Database Table: Flat Posts', 'rank-math' ),
'rank_math_analytics_ga' => esc_html__( 'Database Table: Google Analytics', 'rank-math' ),
'rank_math_analytics_adsense' => esc_html__( 'Database Table: Google AdSense', 'rank-math' ),
'rank_math_analytics_keyword_manager' => esc_html__( 'Database Table: Keyword Manager', 'rank-math' ),
'rank_math_analytics_inspections' => esc_html__( 'Database Table: Inspections', 'rank-math' ),
];
if ( ! defined( 'RANK_MATH_PRO_FILE' ) ) {
unset(
$should_exist['rank_math_analytics_ga'],
$should_exist['rank_math_analytics_adsense'],
$should_exist['rank_math_analytics_keyword_manager']
);
}
foreach ( $should_exist as $name => $label ) {
$rankmath['fields'][ $name ] = [
'label' => $label,
'value' => isset( $tables[ $name ] ) ? self::get_table_size( $name ) : esc_html__( 'Not found', 'rank-math' ),
];
}
// Core debug data.
if ( ! class_exists( 'WP_Debug_Data' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php'; // @phpstan-ignore-line
}
if ( ! function_exists( 'got_url_rewrite' ) ) {
require_once ABSPATH . 'wp-admin/includes/misc.php'; // @phpstan-ignore-line
}
if ( false === function_exists( 'get_core_updates' ) ) {
require_once ABSPATH . 'wp-admin/includes/update.php'; // @phpstan-ignore-line
}
if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; // @phpstan-ignore-line
}
$rankmath_data = apply_filters( 'rank_math/status/rank_math_info', $rankmath );
$core_data = \WP_Debug_Data::debug_data();
// Keep only relevant data.
$core_data = array_intersect_key(
$core_data,
array_flip(
[
'wp-core',
'wp-dropins',
'wp-active-theme',
'wp-parent-theme',
'wp-mu-plugins',
'wp-plugins-active',
'wp-server',
'wp-database',
'wp-constants',
'wp-filesystem',
]
)
);
$system_info = [ 'rank-math' => $rankmath_data ] + $core_data;
return array_merge(
[
'systemInfo' => $system_info,
'systemInfoCopy' => esc_attr( \WP_Debug_Data::format( $system_info, 'debug' ) ),
],
\RankMath\Status\Error_Log::get_error_log_localized_data()
);
}
/**
* Get Table size.
*
* @param string $table Table name.
*
* @return int Table size.
*/
public static function get_table_size( $table ) {
global $wpdb;
$size = (int) DB_Helper::get_var( "SELECT SUM((data_length + index_length)) AS size FROM information_schema.TABLES WHERE table_schema='" . $wpdb->dbname . "' AND (table_name='" . $wpdb->prefix . $table . "')" );
return size_format( $size );
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -0,0 +1,24 @@
<?php
/**
* Status & Tools main view file.
*
* @package RankMath
* @subpackage RankMath\Status
* @author Rank Math <support@rankmath.com>
* @license GPL-2.0+
* @link https://rankmath.com/wordpress/plugin/seo-suite/
* @copyright 2019 Rank Math
*/
defined( 'ABSPATH' ) || exit;
use RankMath\Rollback_Version;
// Header.
if ( Rollback_Version::should_rollback() ) {
$rollback = new Rollback_Version();
$rollback->rollback();
return;
}
?>
<div id="rank-math-tools-wrapper"></div>