Skip to content

Commit b755f44

Browse files
committed
4.8.5 Release
1 parent 95f07ca commit b755f44

File tree

32 files changed

+415
-222
lines changed

32 files changed

+415
-222
lines changed

all_in_one_seo_pack.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs, business sites, ecommerce sites, and much more. More than 100 million downloads since 2007.
66
* Author: All in One SEO Team
77
* Author URI: https://aioseo.com/
8-
* Version: 4.8.4.1
8+
* Version: 4.8.5
99
* Text Domain: all-in-one-seo-pack
1010
* Domain Path: /languages
1111
* License: GPL-3.0+
@@ -60,7 +60,7 @@
6060
// We require WordPress 5.4+ for the whole plugin to work.
6161
// Support for 5.4, 5.5 and 5.6 will be dropped at the end of 2025.
6262
global $wp_version; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
63-
if ( version_compare( $wp_version, '5.4', '<' ) ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
63+
if ( version_compare( $wp_version, '5.7', '<' ) ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
6464
add_action( 'admin_notices', 'aioseo_wordpress_notice' );
6565

6666
// Do not process the plugin code further.

app/Common/Ai/Ai.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ public function updateCredits( $refresh = false ) {
149149
$body = wp_remote_retrieve_body( $response );
150150
$data = json_decode( $body );
151151
if ( empty( $data->success ) ) {
152+
if ( ! empty( $data->code ) && 'invalid-token' === $data->code ) {
153+
// Drop the access token in case it could not be found.
154+
aioseo()->internalOptions->internal->ai->accessToken = '';
155+
}
156+
152157
aioseo()->cache->update( 'ai-credits-error', true, HOUR_IN_SECONDS );
153158

154159
// Schedule another, one-time event in approx. 1 hour from now.

app/Common/Api/PostsTerms.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ public static function updatePostDetailsColumn( $request ) {
296296
}
297297

298298
$aioseoPost = Models\Post::getPost( $postId );
299-
$aioseoData = json_decode( wp_json_encode( $aioseoPost ), true );
300299

301300
if ( $isMedia ) {
302301
wp_update_post(
@@ -308,7 +307,13 @@ public static function updatePostDetailsColumn( $request ) {
308307
update_post_meta( $postId, '_wp_attachment_image_alt', sanitize_text_field( $body['imageAltTag'] ) );
309308
}
310309

311-
Models\Post::savePost( $postId, array_replace( $aioseoData, $body ) );
310+
$aioseoPost->title = $body['title'];
311+
$aioseoPost->description = $body['description'];
312+
$aioseoPost->updated = gmdate( 'Y-m-d H:i:s' );
313+
$aioseoPost->save();
314+
315+
// Trigger the action hook so we can create a revision.
316+
do_action( 'aioseo_insert_post', $postId );
312317

313318
$lastError = aioseo()->core->db->lastError();
314319
if ( ! empty( $lastError ) ) {

app/Common/Api/Settings.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,26 @@ class Settings {
2525
public static $importFile = [];
2626

2727
/**
28-
* Update the settings.
28+
* Retrieves the plugin options.
2929
*
3030
* @since 4.0.0
3131
*
32-
* @return \WP_REST_Response The response.
32+
* @param \WP_REST_Request $request The REST Request.
33+
* @return \WP_REST_Response The response containing all plugin options.
3334
*/
34-
public static function getOptions() {
35-
return new \WP_REST_Response( [
36-
'options' => aioseo()->options->all(),
37-
'settings' => aioseo()->settings->all()
38-
], 200 );
35+
public static function getOptions( $request ) {
36+
$siteId = (int) $request->get_param( 'siteId' );
37+
if ( $siteId ) {
38+
aioseo()->helpers->switchToBlog( $siteId );
39+
40+
// Re-initialize the options for this site.
41+
aioseo()->options->init();
42+
}
43+
44+
return new \WP_REST_Response([
45+
'success' => true,
46+
'options' => aioseo()->options->all()
47+
], 200);
3948
}
4049

4150
/**

app/Common/Core/Core.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ class Core {
3737
'aioseo_redirects_logs',
3838
'aioseo_terms',
3939
'aioseo_search_statistics_objects',
40+
'aioseo_search_statistics_keywords',
41+
'aioseo_search_statistics_keyword_groups',
42+
'aioseo_search_statistics_keyword_relationships',
4043
'aioseo_revisions',
41-
'aioseo_seo_analyzer_results'
44+
'aioseo_seo_analyzer_results',
45+
'aioseo_writing_assistant_keywords',
46+
'aioseo_writing_assistant_posts'
4247
];
4348

4449
/**

app/Common/Main/Uninstall.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public function dropData( $force = false ) {
4040

4141
// Delete all our custom capabilities.
4242
$this->uninstallCapabilities();
43+
44+
// Delete data for the addons.
45+
aioseo()->addons->doAddonFunction( 'uninstall', 'dropData', [
46+
'force' => $force
47+
] );
4348
}
4449

4550
/**

app/Common/Schema/Graphs/BreadcrumbList.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ public function get() {
2626
}
2727

2828
// Set the position for each breadcrumb.
29+
$position = 1;
2930
foreach ( $breadcrumbs as $k => $breadcrumb ) {
3031
if ( ! isset( $breadcrumb['position'] ) ) {
31-
$breadcrumbs[ $k ]['position'] = $k + 1;
32+
$breadcrumbs[ $k ]['position'] = $position;
3233
}
34+
$position++;
3335
}
3436

3537
$trailLength = count( $breadcrumbs );
@@ -39,7 +41,7 @@ public function get() {
3941

4042
$listItems = [];
4143
foreach ( $breadcrumbs as $breadcrumb ) {
42-
if ( empty( $breadcrumb['link'] ) ) {
44+
if ( empty( $breadcrumb['link'] ) || ! is_scalar( $breadcrumb['link'] ) ) {
4345
continue;
4446
}
4547

app/Common/SearchStatistics/Site.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,10 @@ public function worker() {
6262
}
6363

6464
$siteStatus = $this->checkStatus();
65-
if ( empty( $siteStatus ) ) {
66-
// If it failed to communicate with the server, try again in a few hours.
67-
aioseo()->actionScheduler->scheduleSingle( $this->action, wp_rand( HOUR_IN_SECONDS, 2 * HOUR_IN_SECONDS ), [], true );
68-
69-
return;
65+
if ( ! empty( $siteStatus ) ) {
66+
$this->processStatus( $siteStatus );
7067
}
7168

72-
$this->processStatus( $siteStatus );
73-
7469
// Schedule a new check for the next week.
7570
aioseo()->actionScheduler->scheduleSingle( $this->action, WEEK_IN_SECONDS + wp_rand( 0, 3 * DAY_IN_SECONDS ), [], true );
7671
}

app/Common/SearchStatistics/Sitemap.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,11 @@ public function worker() {
6565
$api = new Api\Request( 'google-search-console/sitemap/sync/', [ 'sitemaps' => aioseo()->sitemap->helpers->getSitemapUrls() ] );
6666
$response = $api->request();
6767

68-
if ( is_wp_error( $response ) || empty( $response['data'] ) ) {
69-
// If it failed to communicate with the server, try again in a few hours.
70-
aioseo()->actionScheduler->scheduleSingle( $this->action, wp_rand( HOUR_IN_SECONDS, 2 * HOUR_IN_SECONDS ), [], true );
71-
72-
return;
68+
if ( ! is_wp_error( $response ) && ! empty( $response['data'] ) ) {
69+
aioseo()->internalOptions->searchStatistics->sitemap->list = $response['data'];
70+
aioseo()->internalOptions->searchStatistics->sitemap->lastFetch = time();
7371
}
7472

75-
aioseo()->internalOptions->searchStatistics->sitemap->list = $response['data'];
76-
aioseo()->internalOptions->searchStatistics->sitemap->lastFetch = time();
77-
7873
// Schedule a new sync for the next week.
7974
aioseo()->actionScheduler->scheduleSingle( $this->action, WEEK_IN_SECONDS + wp_rand( 0, 3 * DAY_IN_SECONDS ), [], true );
8075
}

app/Common/Traits/Helpers/Url.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private function isValidDomain( $domain ) {
217217
*/
218218
private function isDomainWithPaths( $domain ) {
219219
// In case there are unicode characters, convert it into IDNA ASCII URLs.
220-
if ( function_exists( 'idn_to_ascii' ) ) {
220+
if ( $domain && function_exists( 'idn_to_ascii' ) ) {
221221
$domain = idn_to_ascii( $domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 );
222222
}
223223

@@ -390,15 +390,14 @@ public function makeUrlRelative( $url ) {
390390
*/
391391
public function makeUrlAbsolute( $url ) {
392392
if ( 0 !== strpos( $url, 'http' ) && '/' !== $url ) {
393-
$url = $this->sanitizeDomain( $url );
394-
if ( $this->isDomainWithPaths( $url ) ) {
395-
$scheme = wp_parse_url( site_url(), PHP_URL_SCHEME );
396-
$url = $scheme . '://' . $url;
397-
} elseif ( 0 === strpos( $url, '//' ) ) {
398-
$scheme = wp_parse_url( site_url(), PHP_URL_SCHEME );
399-
$url = $scheme . ':' . $url;
393+
$scheme = wp_parse_url( site_url(), PHP_URL_SCHEME );
394+
$cleanUrl = untrailingslashit( preg_replace( '#^https?://#i', '', trim( $url ) ) );
395+
if ( $this->isDomainWithPaths( $cleanUrl ) ) {
396+
$url = $scheme . '://' . $cleanUrl;
397+
} elseif ( 0 === strpos( $cleanUrl, '//' ) ) {
398+
$url = $scheme . ':' . $cleanUrl;
400399
} else {
401-
$url = site_url( $url );
400+
$url = site_url( $cleanUrl );
402401
}
403402
}
404403

0 commit comments

Comments
 (0)