Skip to content

Commit

Permalink
4.5.9.1 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
cristian-rossi committed Mar 21, 2024
1 parent a2af392 commit 0958551
Show file tree
Hide file tree
Showing 67 changed files with 3,543 additions and 2,603 deletions.
2 changes: 1 addition & 1 deletion all_in_one_seo_pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.
* Author: All in One SEO Team
* Author URI: https://aioseo.com/
* Version: 4.5.8
* Version: 4.5.9.1
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
*
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Api/Analyze.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function analyzeSite( $request ) {
) {
$token = aioseo()->internalOptions->internal->siteAnalysis->connectToken;
$url = defined( 'AIOSEO_ANALYZE_URL' ) ? AIOSEO_ANALYZE_URL : 'https://analyze.aioseo.com';
$response = aioseo()->helpers->wpRemotePost( $url . '/v2/analyze/', [
$response = aioseo()->helpers->wpRemotePost( $url . '/v3/analyze/', [
'timeout' => 60,
'headers' => [
'X-AIOSEO-Key' => $token,
Expand Down
2 changes: 1 addition & 1 deletion app/Common/ImportExport/RankMath/PostMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function importPostMeta() {
if ( ! empty( $value['max-snippet'] ) && intval( $value['max-snippet'] ) ) {
$meta['robots_max_snippet'] = intval( $value['max-snippet'] );
}
if ( ! empty( $value['max-video-preview'] ) && intval( $value['max-video-preview'] ) ) {
if ( isset( $value['max-video-preview'] ) && is_numeric( $value['max-video-preview'] ) ) {
$meta['robots_max_videopreview'] = intval( $value['max-video-preview'] );
}
if ( ! empty( $value['max-image-preview'] ) ) {
Expand Down
6 changes: 3 additions & 3 deletions app/Common/ImportExport/RankMath/TitleMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function migrateArchiveSettings() {
if ( ! empty( $this->options[ "{$archive}_advanced_robots" ]['max-snippet'] ) ) {
aioseo()->options->searchAppearance->archives->$archive->advanced->robotsMeta->maxSnippet = intval( $this->options[ "{$archive}_advanced_robots" ]['max-snippet'] );
}
if ( ! empty( $this->options[ "{$archive}_advanced_robots" ]['max-video-preview'] ) ) {
if ( isset( $this->options[ "{$archive}_advanced_robots" ]['max-video-preview'] ) && is_numeric( isset( $this->options[ "{$archive}_advanced_robots" ]['max-video-preview'] ) ) ) {
aioseo()->options->searchAppearance->archives->$archive->advanced->robotsMeta->maxVideoPreview = intval( $this->options[ "{$archive}_advanced_robots" ]['max-video-preview'] );
}
if ( ! empty( $this->options[ "{$archive}_advanced_robots" ]['max-image-preview'] ) ) {
Expand Down Expand Up @@ -249,7 +249,7 @@ private function migratePostTypeSettings() {
if ( ! empty( $value['max-snippet'] ) ) {
aioseo()->dynamicOptions->searchAppearance->postTypes->$postType->advanced->robotsMeta->maxSnippet = intval( $value['max-snippet'] );
}
if ( ! empty( $value['max-video-preview'] ) ) {
if ( isset( $value['max-video-preview'] ) && is_numeric( $value['max-video-preview'] ) ) {
aioseo()->dynamicOptions->searchAppearance->postTypes->$postType->advanced->robotsMeta->maxVideoPreview = intval( $value['max-video-preview'] );
}
if ( ! empty( $value['max-image-preview'] ) ) {
Expand Down Expand Up @@ -353,7 +353,7 @@ private function migrateRobotMetaSettings() {
if ( ! empty( $this->options['robots_global']['max-snippet'] ) ) {
aioseo()->options->searchAppearance->advanced->globalRobotsMeta->maxSnippet = intval( $this->options['robots_global']['max-snippet'] );
}
if ( ! empty( $this->options['robots_global']['max-video-preview'] ) ) {
if ( isset( $this->options['robots_global']['max-video-preview'] ) && is_numeric( $this->options['robots_global']['max-video-preview'] ) ) {
aioseo()->options->searchAppearance->advanced->globalRobotsMeta->maxVideoPreview = intval( $this->options['robots_global']['max-video-preview'] );
}
if ( ! empty( $this->options['robots_global']['max-image-preview'] ) ) {
Expand Down
32 changes: 31 additions & 1 deletion app/Common/Main/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public function runUpdates() {
$this->addQueryArgMonitorNotification();
}

if ( version_compare( $lastActiveVersion, '4.5.9', '<' ) ) {
$this->deprecateNoPaginationForCanonicalUrlsSetting();
}

do_action( 'aioseo_run_updates', $lastActiveVersion );

// Always clear the cache if the last active version is different from our current.
Expand Down Expand Up @@ -1634,7 +1638,11 @@ public function addQueryArgMonitorTables() {
* @return void
*/
private function addQueryArgMonitorNotification() {
if ( ! aioseo()->options->searchAppearance->advanced->crawlCleanup->enable || ! aioseo()->options->searchAppearance->advanced->crawlCleanup->removeUnrecognizedQueryArgs ) {
$options = $this->getRawOptions();
if (
empty( $options['searchAppearance']['advanced']['crawlCleanup']['enable'] ) ||
empty( $options['searchAppearance']['advanced']['crawlCleanup']['removeUnrecognizedQueryArgs'] )
) {
return;
}

Expand All @@ -1655,4 +1663,26 @@ private function addQueryArgMonitorNotification() {
'start' => gmdate( 'Y-m-d H:i:s' )
] );
}

/**
* Deprecates the "No Pagination for Canonical URLs" setting.
*
* @since 4.5.9
*
* @return void
*/
public function deprecateNoPaginationForCanonicalUrlsSetting() {
$options = $this->getRawOptions();
if ( empty( $options['searchAppearance']['advanced']['noPaginationForCanonical'] ) ) {
return;
}

$deprecatedOptions = aioseo()->internalOptions->deprecatedOptions;
if ( ! in_array( 'noPaginationForCanonical', $deprecatedOptions, true ) ) {
$deprecatedOptions[] = 'noPaginationForCanonical';
aioseo()->internalOptions->deprecatedOptions = $deprecatedOptions;
}

aioseo()->options->deprecated->searchAppearance->advanced->noPaginationForCanonical = true;
}
}
4 changes: 2 additions & 2 deletions app/Common/Meta/Robots.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ protected function globalValues( $optionOrder = [], $isDynamicOption = false ) {
$this->attributes['max-image-preview'] = "max-image-preview:$maxImagePreview";
}
$maxVideoPreview = $robotsMeta['maxVideoPreview'];
if ( $maxVideoPreview && intval( $maxVideoPreview ) ) {
if ( isset( $maxVideoPreview ) && is_numeric( $maxVideoPreview ) ) {
$this->attributes['max-video-preview'] = "max-video-preview:$maxVideoPreview";
}

Expand Down Expand Up @@ -363,7 +363,7 @@ protected function metaValues( $metaData ) {
if ( ! $metaData->robots_noimageindex && $metaData->robots_max_imagepreview && in_array( $metaData->robots_max_imagepreview, [ 'none', 'standard', 'large' ], true ) ) {
$this->attributes['max-image-preview'] = "max-image-preview:$metaData->robots_max_imagepreview";
}
if ( $metaData->robots_max_videopreview && intval( $metaData->robots_max_videopreview ) ) {
if ( isset( $metaData->robots_max_videopreview ) && is_numeric( $metaData->robots_max_videopreview ) ) {
$this->attributes['max-video-preview'] = "max-video-preview:$metaData->robots_max_videopreview";
}

Expand Down
23 changes: 22 additions & 1 deletion app/Common/Migration/GeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public function __construct() {
$this->migrateRssContentSettings();
$this->migrateRedirectToParent();
$this->migrateDisabledPosts();
$this->migrateNoPaginationForCanonicalUrls();

$settings = [
'aiosp_no_paged_canonical_links' => [ 'type' => 'boolean', 'newOption' => [ 'searchAppearance', 'advanced', 'noPaginationForCanonical' ] ],
'aiosp_admin_bar' => [ 'type' => 'boolean', 'newOption' => [ 'advanced', 'adminBarMenu' ] ],
'aiosp_google_verify' => [ 'type' => 'string', 'newOption' => [ 'webmasterTools', 'google' ] ],
'aiosp_bing_verify' => [ 'type' => 'string', 'newOption' => [ 'webmasterTools', 'bing' ] ],
Expand Down Expand Up @@ -862,4 +862,25 @@ private function migrateDisabledPosts() {
}
aioseo()->options->deprecated->searchAppearance->advanced->excludePosts = $excludedPosts;
}

/**
* Migrates the deprecated "No Pagination for Canonical URLs" setting.
*
* @since 4.5.9
*
* @return void
*/
private function migrateNoPaginationForCanonicalUrls() {
if ( empty( $this->oldOptions['aiosp_no_paged_canonical_links'] ) ) {
return;
}

$deprecatedOptions = aioseo()->internalOptions->deprecatedOptions;
if ( ! in_array( 'noPaginationForCanonical', $deprecatedOptions, true ) ) {
$deprecatedOptions[] = 'noPaginationForCanonical';
aioseo()->internalOptions->deprecatedOptions = $deprecatedOptions;
}

aioseo()->options->deprecated->searchAppearance->advanced->noPaginationForCanonical = true;
}
}
2 changes: 1 addition & 1 deletion app/Common/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ protected static function sanitizeAndSetDefaults( $postId, $thePost, $data ) {
$thePost->robots_nosnippet = isset( $data['nosnippet'] ) ? rest_sanitize_boolean( $data['nosnippet'] ) : 0;
$thePost->robots_noodp = isset( $data['noodp'] ) ? rest_sanitize_boolean( $data['noodp'] ) : 0;
$thePost->robots_max_snippet = ! empty( $data['maxSnippet'] ) ? (int) sanitize_text_field( $data['maxSnippet'] ) : -1;
$thePost->robots_max_videopreview = ! empty( $data['maxVideoPreview'] ) ? (int) sanitize_text_field( $data['maxVideoPreview'] ) : -1;
$thePost->robots_max_videopreview = isset( $data['maxVideoPreview'] ) && is_numeric( $data['maxVideoPreview'] ) ? (int) sanitize_text_field( $data['maxVideoPreview'] ) : -1;
$thePost->robots_max_imagepreview = ! empty( $data['maxImagePreview'] ) ? sanitize_text_field( $data['maxImagePreview'] ) : 'large';
// Open Graph Meta
$thePost->og_title = ! empty( $data['og_title'] ) ? sanitize_text_field( $data['og_title'] ) : null;
Expand Down
11 changes: 6 additions & 5 deletions app/Common/Options/InternalOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ class InternalOptions {
* @var array
*/
protected $allDeprecatedOptions = [
'autogenerateDescriptions',
'badBotBlocker',
'descriptionFormat',
'enableSchemaMarkup',
'excludePosts',
'excludeTerms',
'autogenerateDescriptions',
'descriptionFormat',
'badBotBlocker',
'googleAnalytics',
'noPaginationForCanonical',
'staticSitemap',
'staticVideoSitemap',
'useContentForAutogeneratedDescriptions',
'googleAnalytics'
'useContentForAutogeneratedDescriptions'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Options/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ class Options {
'sitelinks' => [ 'type' => 'boolean', 'default' => true ],
'noIndexEmptyCat' => [ 'type' => 'boolean', 'default' => true ],
'removeStopWords' => [ 'type' => 'boolean', 'default' => false ],
'noPaginationForCanonical' => [ 'type' => 'boolean', 'default' => true ],
'useKeywords' => [ 'type' => 'boolean', 'default' => false ],
'keywordsLooking' => [ 'type' => 'boolean', 'default' => true ],
'useCategoriesForMetaKeywords' => [ 'type' => 'boolean', 'default' => false ],
Expand Down Expand Up @@ -418,6 +417,7 @@ class Options {
'useContentForAutogeneratedDescriptions' => [ 'type' => 'boolean', 'default' => false ],
'excludePosts' => [ 'type' => 'array', 'default' => [] ],
'excludeTerms' => [ 'type' => 'array', 'default' => [] ],
'noPaginationForCanonical' => [ 'type' => 'boolean', 'default' => true ]
]
],
'sitemap' => [
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Schema/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function term( $term ) {
);

if ( $term->parent ) {
$term = get_term( $term->parent );
$term = get_term( $term->parent, $term->taxonomy );
} else {
$term = false;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Schema/Graphs/KnowledgeGraph/KgOrganization.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function get() {
$logo = $this->logo();
if ( ! empty( $logo ) ) {
$data['logo'] = $logo;
$data['image'] = [ '@id' => $homeUrl . '#organizationLogo' ];
$data['image'] = [ '@id' => $data['logo']['@id'] ];
}

$socialUrls = array_values( $this->getOrganizationProfiles() );
Expand Down
39 changes: 32 additions & 7 deletions app/Common/Traits/Helpers/ThirdParty.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,23 +630,48 @@ public function isAmpPage( $pluginName = '' ) {
}

/**
* Helper function for {@see isAmpPage()}.
* Checks if the current page is an AMP page.
* Helper function for isAmpPage(). Contains common logic that applies to both AMP and AMP for WP.
*
* @since 4.2.4
*
* @return bool Whether the current page is an AMP page.
*/
private function isAmpPageHelper() {
// Check if the AMP or AMP for WP plugin is active.
if ( ! function_exists( 'is_amp_endpoint' ) ) {
return false;
// First check for the existence of any AMP plugin functions. Bail early if none are found, and prevent false positives.
if (
! function_exists( 'amp_is_request' ) &&
! function_exists( 'is_amp_endpoint' ) &&
! function_exists( 'ampforwp_is_amp_endpoint' ) &&
! function_exists( 'is_amp_wp' )
) {
// If none of the AMP plugin functions are found, return false and allow compatibility with custom implementations.
return apply_filters( 'aioseo_is_amp_page', false );
}

global $wp;
if ( did_action( 'parse_query' ) ) {
// Check for the "AMP" plugin.
if ( function_exists( 'amp_is_request' ) ) {
return (bool) amp_is_request();
}

// Check for the "AMP" plugin (`is_amp_endpoint()` is deprecated).
if ( function_exists( 'is_amp_endpoint' ) ) {
return (bool) is_amp_endpoint();
}

// Check for the "AMP for WP – Accelerated Mobile Pages" plugin.
if ( function_exists( 'ampforwp_is_amp_endpoint' ) ) {
return (bool) ampforwp_is_amp_endpoint();
}

// Check for the "AMP WP" plugin.
if ( function_exists( 'is_amp_wp' ) ) {
return (bool) is_amp_wp();
}
}

// This URL param is set when using plain permalinks.
return isset( $_GET['amp'] ) || preg_match( '/amp$/', untrailingslashit( $wp->request ) ); // phpcs:ignore HM.Security.NonceVerification.Recommended
return false;
}

/**
Expand Down
Loading

0 comments on commit 0958551

Please sign in to comment.