Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 2.0.6.
|
||||
*
|
||||
* @since 2.0.6
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* This code is needed to flush the new rewrite rules we added to fix the Code Validation issue.
|
||||
*/
|
||||
function rank_math_pro_2_0_6_flush_rewrite_rules() {
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
rank_math_pro_2_0_6_flush_rewrite_rules();
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 2.1.0
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* This code is needed to opening hours data.
|
||||
*/
|
||||
function rank_math_pro_2_1_0_update_opening_hours() {
|
||||
$locations = get_posts(
|
||||
[
|
||||
'post_type' => 'rank_math_locations',
|
||||
'numberposts' => -1,
|
||||
'fields' => 'ids',
|
||||
]
|
||||
);
|
||||
|
||||
if ( empty( $locations ) || is_wp_error( $locations ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $locations as $location ) {
|
||||
$schemas = RankMath\Schema\DB::get_schemas( $location );
|
||||
foreach ( $schemas as $meta_id => $schema ) {
|
||||
if ( empty( $schema['openingHoursSpecification'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ( $schema['openingHoursSpecification'] as $key => $opening_hour ) {
|
||||
$opening_hour['dayOfWeek'] = array_map( 'ucfirst', $opening_hour['dayOfWeek'] );
|
||||
$schema['openingHoursSpecification'][ $key ] = $opening_hour;
|
||||
}
|
||||
|
||||
$meta_key = 'rank_math_schema_' . $schema['@type'];
|
||||
$db_id = absint( str_replace( 'schema-', '', $meta_id ) );
|
||||
update_metadata_by_mid( 'post', $db_id, $schema, $meta_key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rank_math_pro_2_1_0_update_opening_hours();
|
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 2.12.0.
|
||||
*
|
||||
* @since 2.12.0
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
/**
|
||||
* This code is needed to update the g_update settings value.
|
||||
*/
|
||||
function rank_math_pro_2_12_0_update_analytics_settings() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
|
||||
// Turn this option on by default after updating.
|
||||
$general['google_updates'] = 'on';
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_pro_2_12_0_update_analytics_settings();
|
||||
|
||||
/**
|
||||
* This code is needed to add the g_update data.
|
||||
*/
|
||||
function rank_math_pro_2_12_0_add_g_update_data() {
|
||||
$registered = RankMath\Admin\Admin_Helper::get_registration_data();
|
||||
if ( empty( $registered ) || empty( $registered['username'] ) || empty( $registered['api_key'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear cache and trigger re-check.
|
||||
delete_site_transient( 'rank_math_pro_updates' );
|
||||
$transient = get_site_transient( 'update_plugins' );
|
||||
set_site_transient( 'update_plugins', $transient );
|
||||
}
|
||||
rank_math_pro_2_12_0_add_g_update_data();
|
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 2.8.1.
|
||||
*
|
||||
* @since 2.8.1
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
/**
|
||||
* This code is needed to opening hours data.
|
||||
*/
|
||||
function rank_math_pro_2_8_1_update_news_sitemap_settings() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$sitemap = $all_opts['sitemap'];
|
||||
if ( empty( $sitemap['news_sitemap_post_type'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $sitemap['news_sitemap_post_type'] as $post_type ) {
|
||||
$exclude_terms = isset( $sitemap[ "news_sitemap_exclude_{$post_type}_terms" ] ) ? $sitemap[ "news_sitemap_exclude_{$post_type}_terms" ] : [];
|
||||
if ( empty( $exclude_terms ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$term = get_term( current( $exclude_terms ) );
|
||||
if ( empty( $term ) || is_wp_error( $term ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sitemap[ "news_sitemap_exclude_{$post_type}_terms" ] = [
|
||||
[ $term->taxonomy => $exclude_terms ],
|
||||
];
|
||||
}
|
||||
|
||||
Helper::update_all_settings( null, null, $sitemap );
|
||||
}
|
||||
|
||||
rank_math_pro_2_8_1_update_news_sitemap_settings();
|
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 3.0.17.
|
||||
*
|
||||
* @since 3.0.17
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
/**
|
||||
* This code is needed to update the podcast settings value.
|
||||
*/
|
||||
function rank_math_pro_3_0_17_update_podcast_settings() {
|
||||
$all_opts = rank_math()->settings->all_raw();
|
||||
$general = $all_opts['general'];
|
||||
|
||||
$general['podcast_title'] = '%sitename%';
|
||||
$general['podcast_description'] = '%sitedesc%';
|
||||
$general['podcast_tipodcast_explicittle'] = 'off';
|
||||
|
||||
Helper::update_all_settings( $general, null, null );
|
||||
rank_math()->settings->reset();
|
||||
}
|
||||
rank_math_pro_3_0_17_update_podcast_settings();
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 3.0.26.
|
||||
*
|
||||
* @since 3.0.26
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* This code is needed to update the UK country ISO code with GB value.
|
||||
*/
|
||||
function rank_math_pro_3_0_26_update_country_code() {
|
||||
$prev = get_option( 'rank_math_google_analytic_options', [] );
|
||||
|
||||
if (
|
||||
empty( $prev ) ||
|
||||
empty( $prev['country'] ) ||
|
||||
$prev['country'] !== 'UK'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$prev['country'] = 'GB';
|
||||
|
||||
update_option( 'rank_math_google_analytic_options', $prev );
|
||||
}
|
||||
|
||||
rank_math_pro_3_0_26_update_country_code();
|
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* The Updates routine for version 3.0.32.
|
||||
*
|
||||
* @since 3.0.32
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Updates
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
use MyThemeShop\Database\Database;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Update the deprecated schema type Attorney and use it as LegalService.
|
||||
*/
|
||||
function rank_math_pro_3_0_32_update_local_business_type() {
|
||||
$old_meta_key = 'rank_math_schema_Attorney';
|
||||
$schemas = Database::table( 'postmeta' )
|
||||
->select( 'post_id' )
|
||||
->whereLike( 'meta_key', $old_meta_key )
|
||||
->get();
|
||||
|
||||
if ( ! $schemas ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $schemas as $schema ) {
|
||||
$meta = get_post_meta( $schema->post_id, $old_meta_key, true );
|
||||
if ( ! $meta ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$meta['@type'] = 'LegalService';
|
||||
|
||||
// Add new meta.
|
||||
update_post_meta( $schema->post_id, 'rank_math_schema_LegalService', $meta );
|
||||
|
||||
// Delete old meta.
|
||||
delete_post_meta( $schema->post_id, $old_meta_key );
|
||||
}
|
||||
}
|
||||
|
||||
rank_math_pro_3_0_32_update_local_business_type();
|
Reference in New Issue
Block a user