Skip to content

Commit

Permalink
4.7.5 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
cristian-rossi committed Nov 14, 2024
1 parent e49951c commit 1c445f3
Show file tree
Hide file tree
Showing 135 changed files with 1,488 additions and 4,995 deletions.
3 changes: 2 additions & 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.7.4.2
* Version: 4.7.5
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
* License: GPL-3.0+
Expand Down Expand Up @@ -58,6 +58,7 @@
}

// We require WordPress 5.3+ for the whole plugin to work.
// Support for 5.3 is scheduled to be dropped in April 2025. 5.4, 5.5 and 5.6 will be dropped at the end of 2025.
global $wp_version;
if ( version_compare( $wp_version, '5.3', '<' ) ) {
add_action( 'admin_notices', 'aioseo_wordpress_notice' );
Expand Down
1 change: 0 additions & 1 deletion app/AIOSEO.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ public function load() {
public function loadInit() {
$this->settings = new Common\Utils\VueSettings( '_aioseo_settings' );
$this->sitemap->init();
$this->sitemap->ping->init();

$this->badBotBlocker->init();

Expand Down
1 change: 1 addition & 0 deletions app/Common/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ function_exists( 'exactmetrics_get_ua' )

// We don't want any plugin adding notices to our screens. Let's clear them out here.
remove_all_actions( 'admin_notices' );
remove_all_actions( 'network_admin_notices' );
remove_all_actions( 'all_admin_notices' );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );

Expand Down
3 changes: 1 addition & 2 deletions app/Common/Admin/Notices/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public function maybeShowNotice() {
return;
}

// Disable the notice for now since it is almost unnecessary. We can come back and revisit this in the future.
// $this->showNotice();
$this->showNotice();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Common/Admin/PostSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ public function getPostTypeOverview( $postType ) {
COUNT(*) as total,
COALESCE( SUM(CASE WHEN ap.keyphrases = '' OR ap.keyphrases IS NULL OR ap.keyphrases LIKE %s THEN 1 ELSE 0 END), 0) as withoutFocusKeyphrase,
COALESCE( SUM(CASE WHEN ap.seo_score < 50 AND NOT (ap.keyphrases = '' OR ap.keyphrases IS NULL OR ap.keyphrases LIKE %s) THEN 1 ELSE 0 END), 0) as needsImprovement,
COALESCE( SUM(CASE WHEN ap.seo_score BETWEEN 50 AND 80 AND NOT (ap.keyphrases = '' OR ap.keyphrases IS NULL OR ap.keyphrases LIKE %s) THEN 1 ELSE 0 END), 0) as okay,
COALESCE( SUM(CASE WHEN ap.seo_score > 80 AND NOT (ap.keyphrases = '' OR ap.keyphrases IS NULL OR ap.keyphrases LIKE %s) THEN 1 ELSE 0 END), 0) as good
COALESCE( SUM(CASE WHEN ap.seo_score BETWEEN 50 AND 79 AND NOT (ap.keyphrases = '' OR ap.keyphrases IS NULL OR ap.keyphrases LIKE %s) THEN 1 ELSE 0 END), 0) as okay,
COALESCE( SUM(CASE WHEN ap.seo_score >= 80 AND NOT (ap.keyphrases = '' OR ap.keyphrases IS NULL OR ap.keyphrases LIKE %s) THEN 1 ELSE 0 END), 0) as good
FROM {$wpdb->posts} as p
LEFT JOIN {$wpdb->prefix}aioseo_posts as ap ON ap.post_id = p.ID
WHERE p.post_status = 'publish'
Expand Down
2 changes: 2 additions & 0 deletions app/Common/Admin/WritingAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function __construct() {
/**
* Deletes the writing assistant post.
*
* @since 4.7.4
*
* @param int $postId The post id.
* @return void
*/
Expand Down
1 change: 1 addition & 0 deletions app/Common/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class Api {
'settings/toggle-radio' => [ 'callback' => [ 'Settings', 'toggleRadio' ], 'access' => 'any' ],
'settings/dismiss-alert' => [ 'callback' => [ 'Settings', 'dismissAlert' ], 'access' => 'any' ],
'settings/items-per-page' => [ 'callback' => [ 'Settings', 'changeItemsPerPage' ], 'access' => 'any' ],
'settings/semrush-country' => [ 'callback' => [ 'Settings', 'changeSemrushCountry' ], 'access' => 'any' ],
'settings/do-task' => [ 'callback' => [ 'Settings', 'doTask' ], 'access' => 'aioseo_tools_settings' ],
'sitemap/deactivate-conflicting-plugins' => [ 'callback' => [ 'Sitemaps', 'deactivateConflictingPlugins' ], 'access' => 'any' ],
'sitemap/delete-static-files' => [ 'callback' => [ 'Sitemaps', 'deleteStaticFiles' ], 'access' => 'aioseo_sitemap_settings' ],
Expand Down
19 changes: 19 additions & 0 deletions app/Common/Api/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,4 +738,23 @@ public static function doTask( $request ) {
'success' => true
], 200 );
}

/**
* Change Sem Rush Focus Keyphrase default country.
*
* @since 4.7.5
*
* @param \WP_REST_Request $request The REST Request
* @return \WP_REST_Response The response.
*/
public static function changeSemrushCountry( $request ) {
$body = $request->get_json_params();
$country = ! empty( $body['value'] ) ? sanitize_text_field( $body['value'] ) : 'US';

aioseo()->settings->semrushCountry = $country;

return new \WP_REST_Response( [
'success' => true
], 200 );
}
}
7 changes: 7 additions & 0 deletions app/Common/Api/WritingAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ public static function getContentAnalysis( $request ) {
], 200 );
}

if ( empty( $contentAnalysis['result'] ) ) {
return new \WP_REST_Response( [
'success' => false,
'error' => __( 'Empty response from service', 'all-in-one-seo-pack' )
], 200 );
}

// Update the post with the content analysis.
$writingAssistantPost->content_analysis = $contentAnalysis['result'];
$writingAssistantPost->content_analysis_hash = $contentHash;
Expand Down
11 changes: 8 additions & 3 deletions app/Common/Breadcrumbs/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public function display( $echo = true ) {
}
$display .= '</div>';

// Final security cleaning.
$display = wp_kses_post( $display );

if ( $echo ) {
Expand All @@ -231,6 +232,13 @@ protected function breadcrumbToDisplay( $item ) {

// Do tags.
$templateItem['template'] = aioseo()->breadcrumbs->tags->replaceTags( $templateItem['template'], $item );
$templateItem['template'] = preg_replace_callback(
'/>(?![^<]*>)(?![^>]*")([^<]*?)>/',
function ( $matches ) {
return '>' . $matches[1] . '>';
},
htmlentities( $templateItem['template'] )
);

// Restore html.
$templateItem['template'] = aioseo()->helpers->decodeHtmlEntities( $templateItem['template'] );
Expand All @@ -243,9 +251,6 @@ protected function breadcrumbToDisplay( $item ) {
// Allow shortcodes to run in the final html.
$templateItem['template'] = do_shortcode( $templateItem['template'] );

// Final security cleaning.
$templateItem['template'] = wp_kses_post( $templateItem['template'] );

return $templateItem;
}

Expand Down
67 changes: 49 additions & 18 deletions app/Common/EmailReports/Summary/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,18 @@ public function getPostsStatistics() {
$result = [
'winning' => [
'url' => add_query_arg( [
'aioseo-scroll' => 'aioseo-search-statistics-post-table'
], $this->searchStatisticsUrl . '#/seo-statistics?tab=TopWinningPages' ),
'aioseo-scroll' => 'aioseo-search-statistics-post-table',
'aioseo-tab' => 'seo-statistics',
'table-filter' => 'TopWinningPages'
], $this->searchStatisticsUrl ),
'items' => []
],
'losing' => [
'url' => add_query_arg( [
'aioseo-scroll' => 'aioseo-search-statistics-post-table'
], $this->searchStatisticsUrl . '#/seo-statistics?tab=TopLosingPages' ),
'aioseo-scroll' => 'aioseo-search-statistics-post-table',
'aioseo-tab' => 'seo-statistics',
'table-filter' => 'TopLosingPages'
], $this->searchStatisticsUrl ),
'items' => []
]
];
Expand Down Expand Up @@ -235,11 +239,16 @@ public function getMilestones() { // phpcs:ignore Generic.Files.LineLength.MaxEx
}

if ( false !== strpos( $message, '%1' ) ) {
$percentageDiff = 0 === absint( $currentData['impressions'] ) ? '100%' : round( ( absint( $intDifference ) / absint( $currentData['impressions'] ) ) * 100 ) . '%';
$percentageDiff = 0 === absint( $currentData['impressions'] )
? 100
: round( ( absint( $intDifference ) / absint( $currentData['impressions'] ) ) * 100, 2 );
$percentageDiff = false !== strpos( $percentageDiff, '.' )
? number_format_i18n( $percentageDiff, count( explode( '.', $percentageDiff ) ) )
: $percentageDiff;
$message = sprintf(
$message,
'<strong>' . aioseo()->helpers->compactNumber( absint( $intDifference ) ) . '</strong>',
'<strong>' . $percentageDiff . '</strong>'
'<strong>' . $percentageDiff . '%</strong>'
);
}

Expand All @@ -266,11 +275,16 @@ public function getMilestones() { // phpcs:ignore Generic.Files.LineLength.MaxEx
}

if ( false !== strpos( $message, '%1' ) ) {
$percentageDiff = 0 === absint( $currentData['clicks'] ) ? '100%' : round( ( absint( $intDifference ) / absint( $currentData['clicks'] ) ) * 100 ) . '%';
$percentageDiff = 0 === absint( $currentData['clicks'] )
? 100
: round( ( absint( $intDifference ) / absint( $currentData['clicks'] ) ) * 100, 2 );
$percentageDiff = false !== strpos( $percentageDiff, '.' )
? number_format_i18n( $percentageDiff, count( explode( '.', $percentageDiff ) ) )
: $percentageDiff;
$message = sprintf(
$message,
'<strong>' . aioseo()->helpers->compactNumber( absint( $intDifference ) ) . '</strong>',
'<strong>' . $percentageDiff . '</strong>'
'<strong>' . $percentageDiff . '%</strong>'
);
}

Expand Down Expand Up @@ -326,11 +340,16 @@ public function getMilestones() { // phpcs:ignore Generic.Files.LineLength.MaxEx
}

if ( false !== strpos( $message, '%1' ) ) {
$percentageDiff = 0 === absint( $currentData['keywords'] ) ? '100%' : round( ( absint( $intDifference ) / absint( $currentData['keywords'] ) ) * 100 ) . '%';
$percentageDiff = 0 === absint( $currentData['keywords'] )
? 100
: round( ( absint( $intDifference ) / absint( $currentData['keywords'] ) ) * 100, 2 );
$percentageDiff = false !== strpos( $percentageDiff, '.' )
? number_format_i18n( $percentageDiff, count( explode( '.', $percentageDiff ) ) )
: $percentageDiff;
$message = sprintf(
$message,
'<strong>' . aioseo()->helpers->compactNumber( absint( $intDifference ) ) . '</strong>',
'<strong>' . $percentageDiff . '</strong>'
'<strong>' . $percentageDiff . '%</strong>'
);
}

Expand Down Expand Up @@ -360,14 +379,20 @@ public function getKeywords() {
$result = [
'winning' => [
'url' => add_query_arg( [
'aioseo-scroll' => 'aioseo-search-statistics-keywords-table'
], $this->searchStatisticsUrl . '#/keyword-rank-tracker?tab=AllKeywords&table-filter=TopWinningKeywords' ),
'aioseo-scroll' => 'aioseo-search-statistics-keywords-table',
'aioseo-tab' => 'keyword-rank-tracker',
'tab' => 'AllKeywords',
'table-filter' => 'TopWinningKeywords'
], $this->searchStatisticsUrl ),
'items' => []
],
'losing' => [
'url' => add_query_arg( [
'aioseo-scroll' => 'aioseo-search-statistics-keywords-table'
], $this->searchStatisticsUrl . '#/keyword-rank-tracker?tab=AllKeywords&table-filter=TopLosingKeywords' ),
'aioseo-scroll' => 'aioseo-search-statistics-keywords-table',
'aioseo-tab' => 'keyword-rank-tracker',
'tab' => 'AllKeywords',
'table-filter' => 'TopLosingKeywords'
], $this->searchStatisticsUrl ),
'items' => []
]
];
Expand Down Expand Up @@ -404,8 +429,9 @@ public function getKeywords() {
*/
public function getAioPosts() {
$result = [
'publish' => [],
'cta' => [
'publish' => [],
'optimize' => [],
'cta' => [
'text' => esc_html__( 'Create New Post', 'all-in-one-seo-pack' ),
'url' => admin_url( 'post-new.php' )
],
Expand Down Expand Up @@ -454,7 +480,10 @@ public function getAioPosts() {
'tru_seo' => aioseo()->helpers->isTruSeoEligible( $postId ) ? $this->parseSeoScore( $row['seoScore'] ?? 0 ) : [],
'decay_percent' => $this->parseDifference( $row['decayPercent'] ?? '', true ),
'issues' => [
'url' => $this->searchStatisticsUrl . "#/post-detail?postId=$postId",
'url' => add_query_arg( [
'aioseo-tab' => 'post-detail',
'post' => $postId
], $this->searchStatisticsUrl ),
'items' => []
]
];
Expand All @@ -466,7 +495,9 @@ public function getAioPosts() {
}

$result['optimize'] = [
'url' => $this->searchStatisticsUrl . '#/content-rankings',
'url' => add_query_arg( [
'aioseo-tab' => 'content-rankings',
], $this->searchStatisticsUrl ),
'items' => $items,
'show_tru_seo' => ! empty( array_filter( array_column( $items, 'tru_seo' ) ) ),
];
Expand Down
2 changes: 1 addition & 1 deletion app/Common/EmailReports/Summary/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private function getContentHtml() { // phpcs:disable VariableAnalysis.CodeAnalys
],
];
$links = [
'disable' => admin_url( 'admin.php?page=aioseo-settings&aioseo-scroll=aioseo-email-summary-row&aioseo-highlight=aioseo-email-summary-row#/advanced' ),
'disable' => admin_url( 'admin.php?page=aioseo-settings&aioseo-scroll=aioseo-email-summary-row&aioseo-highlight=aioseo-email-summary-row&aioseo-tab=advanced' ),
'update' => admin_url( 'update-core.php' ),
'marketing-site' => aioseo()->helpers->utmUrl( $mktUrl, $medium ),
'facebook' => aioseo()->helpers->utmUrl( $mktUrl . 'plugin/facebook', $medium ),
Expand Down
2 changes: 1 addition & 1 deletion app/Common/ImportExport/YoastSeo/PostMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function importPostMeta() {
case '_yoast_wpseo_meta-robots-nofollow':
if ( (bool) $value ) {
$meta[ $mappedMeta[ $name ] ] = (bool) $value;
$meta['robots_default'] = false;
$meta['robots_default'] = false;
}
break;
case '_yoast_wpseo_meta-robots-adv':
Expand Down
17 changes: 17 additions & 0 deletions app/Common/Main/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ public function runUpdates() {
aioseo()->access->addCapabilities();
}

if ( version_compare( $lastActiveVersion, '4.7.5', '<' ) ) {
$this->cancelScheduledSitemapPings();
}

do_action( 'aioseo_run_updates', $lastActiveVersion );

// Always clear the cache if the last active version is different from our current.
Expand Down Expand Up @@ -1762,4 +1766,17 @@ private function addWritingAssistantTables() {
);
}
}

/**
* Cancels all outstanding sitemap ping actions.
* This is needed because we've removed the Ping class.
*
* @since 4.7.5
*
* @return void
*/
private function cancelScheduledSitemapPings() {
as_unschedule_all_actions( 'aioseo_sitemap_ping' );
as_unschedule_all_actions( 'aioseo_sitemap_ping_recurring' );
}
}
6 changes: 3 additions & 3 deletions app/Common/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ public static function savePost( $postId, $data ) {
* @return array The data.
*/
private static function checkForDefaultFormat( $postId, $thePost, $data ) {
$data['title'] = trim( $data['title'] );
$data['description'] = trim( $data['description'] );
$data['title'] = trim( (string) $data['title'] );
$data['description'] = trim( (string) $data['description'] );

$post = aioseo()->helpers->getPost( $postId );
$defaultTitleFormat = trim( aioseo()->meta->title->getPostTypeTitle( $post->post_type ) );
Expand Down Expand Up @@ -438,7 +438,7 @@ protected static function sanitizeAndSetDefaults( $postId, $thePost, $data ) {
$thePost->post_id = $postId;
$thePost->title = ! empty( $data['title'] ) ? sanitize_text_field( $data['title'] ) : null;
$thePost->description = ! empty( $data['description'] ) ? sanitize_text_field( $data['description'] ) : null;
$thePost->canonical_url = ! empty( $data['canonicalUrl'] ) ? esc_url_raw( $data['canonicalUrl'] ) : null;
$thePost->canonical_url = ! empty( $data['canonicalUrl'] ) ? sanitize_text_field( $data['canonicalUrl'] ) : null;
$thePost->keywords = ! empty( $data['keywords'] ) ? aioseo()->helpers->sanitize( $data['keywords'] ) : null;
$thePost->pillar_content = isset( $data['pillar_content'] ) ? rest_sanitize_boolean( $data['pillar_content'] ) : 0;
// TruSEO
Expand Down
16 changes: 11 additions & 5 deletions app/Common/Options/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,11 +731,17 @@ private function sanitizeEmailSummary( &$options ) {
continue;
}

// Remove duplicate emails.
$emails = array_column( $options['advanced']['emailSummary']['recipients'], 'email' );
$emails = array_count_values( $emails );
if ( $emails[ $recipient['email'] ] > 1 ) {
unset( $options['advanced']['emailSummary']['recipients'][ $k ] );
// Remove duplicate emails with the same frequency.
foreach ( $options['advanced']['emailSummary']['recipients'] as $k2 => $recipient2 ) {
if (
$k !== $k2 &&
$recipient['email'] === $recipient2['email'] &&
$recipient['frequency'] === $recipient2['frequency']
) {
unset( $options['advanced']['emailSummary']['recipients'][ $k ] );

break;
}
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions app/Common/Schema/Graphs/BreadcrumbList.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ public function get() {
}

if ( $trailLength > $breadcrumb['position'] ) {
$listItem['nextItem'] = $breadcrumbs[ $breadcrumb['position'] ]['url'] . '#listItem';
$listItem['nextItem'] = [
'@type' => 'ListItem',
'@id' => $breadcrumbs[ $breadcrumb['position'] ]['url'] . '#listItem',
'name' => $breadcrumbs[ $breadcrumb['position'] ]['name'],
];
}

if ( 1 < $breadcrumb['position'] ) {
$listItem['previousItem'] = $breadcrumbs[ $breadcrumb['position'] - 2 ]['url'] . '#listItem';
$listItem['previousItem'] = [
'@type' => 'ListItem',
'@id' => $breadcrumbs[ $breadcrumb['position'] - 2 ]['url'] . '#listItem',
'name' => $breadcrumbs[ $breadcrumb['position'] - 2 ]['name'],
];
}

$listItems[] = $listItem;
Expand Down
Loading

0 comments on commit 1c445f3

Please sign in to comment.