WordPress 7.1.3
This commit is contained in:
@@ -439,6 +439,9 @@ class DB {
|
||||
return '';
|
||||
}
|
||||
|
||||
$host = Helper::get_home_url();
|
||||
$url = str_replace( $host, '', $url );
|
||||
|
||||
$url = urldecode( preg_replace( '/#.*$/', '', $url ) );
|
||||
|
||||
$url = self::remove_hash( $url );
|
||||
@@ -446,22 +449,18 @@ class DB {
|
||||
// Parse the URL to get the path component.
|
||||
$parsed_url = wp_parse_url( $url );
|
||||
if ( isset( $parsed_url['path'] ) ) {
|
||||
return $parsed_url['path'];
|
||||
$page = $parsed_url['path'];
|
||||
} else {
|
||||
// Remove ASCII domain. idn_to_ascii() needs ext-intl, which isn't
|
||||
// guaranteed to be installed on every host — fall back to the
|
||||
// unconverted host rather than fatal-erroring when it's missing.
|
||||
$host_ascii = function_exists( 'idn_to_ascii' ) ? idn_to_ascii( $host ) : $host;
|
||||
$url = str_replace( $host_ascii, '', $url );
|
||||
|
||||
$page = preg_replace( '#^https?://(www\.)?#i', '', $url );
|
||||
}
|
||||
|
||||
// Fallback: try to extract path by removing domain.
|
||||
$host = Helper::get_home_url();
|
||||
$url = str_replace( $host, '', $url );
|
||||
|
||||
// Remove ASCII domain. idn_to_ascii() needs ext-intl, which isn't
|
||||
// guaranteed to be installed on every host — fall back to the
|
||||
// unconverted host rather than fatal-erroring when it's missing.
|
||||
$host_ascii = function_exists( 'idn_to_ascii' ) ? idn_to_ascii( $host ) : $host;
|
||||
$url = str_replace( $host_ascii, '', $url );
|
||||
|
||||
$url = preg_replace( '#^https?://(www\.)?#i', '', $url );
|
||||
|
||||
return apply_filters( 'rank_math/analytics/get_page', $url );
|
||||
return apply_filters( 'rank_math/analytics/get_page', $page );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,8 +61,9 @@ class Objects extends Summary {
|
||||
'noData' => $request->get_param( 'noData' ),
|
||||
];
|
||||
$field_name = 'seo_score';
|
||||
$per_page = $request->get_param( 'per_page' ) ? sanitize_text_field( $request->get_param( 'per_page' ) ) : 25;
|
||||
$offset = ( sanitize_text_field( $request->get_param( 'page' ) ) - 1 ) * $per_page;
|
||||
$per_page = absint( $request->get_param( 'per_page' ) );
|
||||
$per_page = $per_page ? min( $per_page, 100 ) : 25;
|
||||
$offset = ( max( 1, absint( $request->get_param( 'page' ) ) ) - 1 ) * $per_page;
|
||||
|
||||
// Construct SQL condition based on filter parameters.
|
||||
$conditions = [];
|
||||
|
||||
@@ -48,6 +48,20 @@ class Rest extends WP_REST_Controller {
|
||||
],
|
||||
'postsRowsByObjects' => [
|
||||
'callback' => [ Stats::get(), 'get_posts_rows_by_objects' ],
|
||||
'args' => [
|
||||
'page' => [
|
||||
'description' => esc_html__( 'Page number.', 'seo-by-rank-math' ),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
'sanitize_callback' => 'absint',
|
||||
],
|
||||
'per_page' => [
|
||||
'description' => esc_html__( 'Results per page.', 'seo-by-rank-math' ),
|
||||
'type' => 'integer',
|
||||
'required' => false,
|
||||
'sanitize_callback' => 'absint',
|
||||
],
|
||||
],
|
||||
],
|
||||
'post/(?P<id>\d+)' => [
|
||||
'callback' => [ $this, 'get_post' ],
|
||||
|
||||
@@ -250,7 +250,7 @@ class Table extends List_Table {
|
||||
'deactivate' => '<a href="' . $url . '" data-action="deactivate" class="rank-math-redirection-action">' . esc_html__( 'Deactivate', 'seo-by-rank-math' ) . '</a>',
|
||||
'activate' => '<a href="' . $url . '" data-action="activate" class="rank-math-redirection-action">' . esc_html__( 'Activate', 'seo-by-rank-math' ) . '</a>',
|
||||
'trash' => '<a href="' . $url . '" data-action="trash" class="rank-math-redirection-action">' . esc_html__( 'Trash', 'seo-by-rank-math' ) . '</a>',
|
||||
'view' => '<a href="' . $view_url . '" rel="bookmark">' . esc_html__( 'View', 'seo-by-rank-math' ) . '</a>',
|
||||
'view' => '<a href="' . esc_url( $view_url ) . '" rel="bookmark">' . esc_html__( 'View', 'seo-by-rank-math' ) . '</a>',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,11 @@ class DB {
|
||||
'usermeta' => 'user_id',
|
||||
];
|
||||
$key = isset( $keys_by_table[ $table ] ) ? $keys_by_table[ $table ] : 'post_id';
|
||||
$data = self::table( $table )
|
||||
->select( 'meta_id' )
|
||||
|
||||
// The wp_usermeta table's primary key column is umeta_id, unlike post/term/comment meta tables which use meta_id.
|
||||
$id_column = 'usermeta' === $table ? 'umeta_id' : 'meta_id';
|
||||
$data = self::table( $table )
|
||||
->select( [ $id_column => 'meta_id' ] )
|
||||
->select( 'meta_value' )
|
||||
->where( $key, $object_id )
|
||||
->whereLike( 'meta_key', 'rank_math_schema', '' )
|
||||
|
||||
+16
-7
@@ -89,7 +89,7 @@ class SEO_Analyzer {
|
||||
$this->analyse_url = home_url();
|
||||
|
||||
$this->action( 'init', 'set_url' );
|
||||
$this->maybe_clear_storage();
|
||||
$this->action( 'admin_init', 'maybe_clear_storage' );
|
||||
|
||||
$this->ajax( 'analyze', 'analyze_me' );
|
||||
$this->ajax( 'enable_auto_update', 'enable_auto_update' );
|
||||
@@ -235,13 +235,22 @@ class SEO_Analyzer {
|
||||
/**
|
||||
* Clear stored results if needed.
|
||||
*/
|
||||
private function maybe_clear_storage() {
|
||||
if ( '1' === Param::request( 'clear_results' ) ) {
|
||||
delete_option( 'rank_math_seo_analysis_results' );
|
||||
delete_option( 'rank_math_seo_analysis_date' );
|
||||
Helper::redirect( Security::remove_query_arg_raw( 'clear_results' ) );
|
||||
exit;
|
||||
public function maybe_clear_storage() {
|
||||
if ( '1' !== Param::request( 'clear_results' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
! Helper::has_cap( 'site_analysis' ) ||
|
||||
! wp_verify_nonce( Param::request( 'security' ), 'rank-math-ajax-nonce' )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete_option( 'rank_math_seo_analysis_results' );
|
||||
delete_option( 'rank_math_seo_analysis_date' );
|
||||
Helper::redirect( Security::remove_query_arg_raw( [ 'clear_results', 'security' ] ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -307,6 +307,9 @@ class Sitemap {
|
||||
* @param int $max_entries Entries per sitemap.
|
||||
*/
|
||||
public static function maybe_redirect( $count, $max_entries ) {
|
||||
if ( ! apply_filters( 'rank_math/sitemap/maybe_redirect', true ) ) {
|
||||
return;
|
||||
}
|
||||
$current_page = (int) get_query_var( 'sitemap_n' );
|
||||
if ( ! $current_page && $count > $max_entries ) {
|
||||
Helper::redirect( preg_replace( '/\.xml$/', '1.xml', Helper::get_current_page_url() ) );
|
||||
|
||||
+1
@@ -50,6 +50,7 @@ class Import_Export_Settings {
|
||||
// Parse Options.
|
||||
$wp_filesystem = Helper::get_filesystem();
|
||||
if ( is_null( $wp_filesystem ) || ! Helper::is_filesystem_direct() ) {
|
||||
\wp_delete_file( $file['file'] );
|
||||
return [
|
||||
'error' => esc_html__( 'Uploaded file could not be read.', 'seo-by-rank-math' ),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user