Skip to content

Commit f065a31

Browse files
4.7.7 Release
1 parent 76db715 commit f065a31

File tree

177 files changed

+1500
-880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+1500
-880
lines changed

all_in_one_seo_pack.php

+3-3
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.7.6
8+
* Version: 4.7.7
99
* Text Domain: all-in-one-seo-pack
1010
* Domain Path: /languages
1111
* License: GPL-3.0+
@@ -59,8 +59,8 @@
5959

6060
// We require WordPress 5.3+ for the whole plugin to work.
6161
// 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.
62-
global $wp_version;
63-
if ( version_compare( $wp_version, '5.3', '<' ) ) {
62+
global $wp_version; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
63+
if ( version_compare( $wp_version, '5.3', '<' ) ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
6464
add_action( 'admin_notices', 'aioseo_wordpress_notice' );
6565

6666
// Do not process the plugin code further.

app/AIOSEOAbstract.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,11 @@ abstract class AIOSEOAbstract {
591591
public $thirdParty = null;
592592

593593
/**
594-
* WritingAssistant class instance.
595-
*
596-
* @since 4.7.4
597-
*
598-
* @var null|\AIOSEO\Plugin\Common\WritingAssistant\WritingAssistant
599-
*/
594+
* WritingAssistant class instance.
595+
*
596+
* @since 4.7.4
597+
*
598+
* @var \AIOSEO\Plugin\Common\WritingAssistant\WritingAssistant
599+
*/
600600
public $writingAssistant = null;
601601
}

app/Common/Admin/Admin.php

+84-56
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ class Admin {
8181
*/
8282
public $connect = null;
8383

84+
/**
85+
* Whether we're editing a post or term.
86+
*
87+
* @since 4.7.7
88+
*
89+
* @var bool
90+
*/
91+
private $isEditor = false;
92+
8493
/**
8594
* Construct method.
8695
*
@@ -135,7 +144,7 @@ public function deactivationSurvey() {
135144
* @return string The possibly modified HTML language attribute.
136145
*/
137146
public function alwaysAddHtmlDirAttribute( $output ) {
138-
if ( is_rtl() || preg_match( '/dir=[\'"](ltr|rtl|auto)[\'"]/i', $output ) ) {
147+
if ( is_rtl() || preg_match( '/dir=[\'"](ltr|rtl|auto)[\'"]/i', (string) $output ) ) {
139148
return $output;
140149
}
141150

@@ -276,8 +285,8 @@ private function registerLinkFormatHooks() {
276285

277286
add_action( 'wp_enqueue_editor', [ $this, 'addClassicLinkFormatScript' ], 999999 );
278287

279-
global $wp_version;
280-
if ( version_compare( $wp_version, '5.3', '>=' ) || is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
288+
global $wp_version; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
289+
if ( version_compare( $wp_version, '5.3', '>=' ) || is_plugin_active( 'gutenberg/gutenberg.php' ) ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
281290
add_action( 'current_screen', [ $this, 'addGutenbergLinkFormatScript' ] );
282291
add_action( 'enqueue_block_editor_assets', [ $this, 'enqueueBlockEditorLinkFormat' ] );
283292
}
@@ -418,7 +427,6 @@ public function addGutenbergLinkFormatScript() {
418427
*/
419428
public function adminBarMenu() {
420429
if ( false === apply_filters( 'aioseo_show_in_admin_bar', true ) ) {
421-
// API filter hook to disable showing SEO in admin bar.
422430
return;
423431
}
424432

@@ -427,21 +435,21 @@ public function adminBarMenu() {
427435
return;
428436
}
429437

430-
$classes = is_admin()
438+
$classes = is_admin()
431439
? 'wp-core-ui wp-ui-notification aioseo-menu-notification-counter'
432440
: 'aioseo-menu-notification-counter aioseo-menu-notification-counter-frontend';
433-
$count = count( Models\Notification::getAllActiveNotifications() );
434-
$htmlCount = 10 > $count ? $count : '!';
435-
$htmlCount = $htmlCount ? "<div class=\"{$classes}\">" . $htmlCount . '</div>' : '';
436-
$htmlCount .= '<div id="aioseo-menu-new-notifications"></div>';
441+
$notificationCount = count( Models\Notification::getAllActiveNotifications() );
442+
$htmlCount = 10 > $notificationCount ? $notificationCount : '!';
443+
$htmlCount = $htmlCount ? "<div class=\"{$classes}\">" . $htmlCount . '</div>' : '';
444+
$htmlCount .= '<div id="aioseo-menu-new-notifications"></div>';
437445

438446
$this->adminBarMenuItems[] = [
439447
'id' => 'aioseo-main',
440448
'title' => '<div class="ab-item aioseo-logo svg"></div><span class="text">' . esc_html__( 'SEO', 'all-in-one-seo-pack' ) . '</span>' . wp_kses_post( $htmlCount ),
441449
'href' => esc_url( admin_url( 'admin.php?page=' . $firstPageSlug ) )
442450
];
443451

444-
if ( $count ) {
452+
if ( $notificationCount ) {
445453
$this->adminBarMenuItems[] = [
446454
'parent' => 'aioseo-main',
447455
'id' => 'aioseo-notifications',
@@ -452,14 +460,22 @@ public function adminBarMenu() {
452460

453461
$this->adminBarMenuItems[] = aioseo()->standalone->seoPreview->getAdminBarMenuItemNode();
454462

463+
$currentScreen = aioseo()->helpers->getCurrentScreen();
464+
if (
465+
is_admin() &&
466+
( 'post' === $currentScreen->base || 'term' === $currentScreen->base )
467+
) {
468+
$this->isEditor = true;
469+
}
470+
455471
$htmlSitemapRequested = aioseo()->htmlSitemap->isDedicatedPage;
456-
if ( ! is_admin() && ! $htmlSitemapRequested ) {
472+
if ( $htmlSitemapRequested || ! is_admin() || $this->isEditor ) {
457473
$this->addPageAnalyzerMenuItems();
458474
}
459475

460476
if ( $htmlSitemapRequested ) {
461-
global $wp_admin_bar;
462-
$wp_admin_bar->remove_node( 'edit' );
477+
global $wp_admin_bar; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
478+
$wp_admin_bar->remove_node( 'edit' ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
463479
}
464480

465481
$this->addSettingsMenuItems();
@@ -477,9 +493,9 @@ public function adminBarMenu() {
477493
* @return void
478494
*/
479495
protected function addAdminBarMenuItems() {
480-
global $wp_admin_bar;
496+
global $wp_admin_bar; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
481497
foreach ( $this->adminBarMenuItems as $item ) {
482-
$wp_admin_bar->add_menu( $item );
498+
$wp_admin_bar->add_menu( $item ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
483499
}
484500
}
485501

@@ -491,9 +507,31 @@ protected function addAdminBarMenuItems() {
491507
* @return void
492508
*/
493509
public function addPageAnalyzerMenuItems() {
494-
global $wp;
495-
// Make sure the trailing slash matches the site configuration.
496-
$url = user_trailingslashit( home_url( $wp->request ) );
510+
$url = '';
511+
$currentScreen = aioseo()->helpers->getCurrentScreen();
512+
if (
513+
is_singular() ||
514+
( is_admin() && 'post' === $currentScreen->base )
515+
) {
516+
$post = aioseo()->helpers->getPost();
517+
if ( is_a( $post, 'WP_Post' ) && 'publish' === $post->post_status && '' !== $post->post_name ) {
518+
$url = get_permalink( $post->ID );
519+
}
520+
}
521+
522+
if (
523+
is_category() ||
524+
is_tag() ||
525+
is_tax() ||
526+
( is_admin() && 'term' === $currentScreen->base )
527+
) {
528+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, HM.Security.NonceVerification.Recommended
529+
$termId = ! empty( $_REQUEST['tag_ID'] ) ? intval( $_REQUEST['tag_ID'] ) : 0;
530+
$term = is_admin() && $termId ? get_term( $termId ) : get_queried_object();
531+
if ( is_a( $term, 'WP_Term' ) ) {
532+
$url = get_term_link( $term );
533+
}
534+
}
497535

498536
if ( ! $url ) {
499537
return;
@@ -502,61 +540,51 @@ public function addPageAnalyzerMenuItems() {
502540
$this->adminBarMenuItems[] = [
503541
'id' => 'aioseo-analyze-page',
504542
'parent' => 'aioseo-main',
505-
'title' => esc_html__( 'Analyze this page', 'all-in-one-seo-pack' ),
543+
'title' => esc_html__( 'Analyze this page', 'all-in-one-seo-pack' )
506544
];
507545

508546
$url = urlencode( $url );
509547

510548
$submenuItems = [
511549
[
512-
'id' => 'aioseo-analyze-page-inlinks',
513-
'title' => esc_html__( 'Check links to this URL', 'all-in-one-seo-pack' ),
514-
'href' => 'https://search.google.com/search-console/links/drilldown?resource_id=' . urlencode( get_option( 'siteurl' ) ) . '&type=EXTERNAL&target=' . $url . '&domain=',
550+
'id' => 'aioseo-analyze-page-pagespeed',
551+
'title' => esc_html__( 'Google Page Speed Test', 'all-in-one-seo-pack' ),
552+
'href' => 'https://pagespeed.web.dev/report?url=' . $url
515553
],
516554
[
517-
'id' => 'aioseo-analyze-page-cache',
518-
'title' => esc_html__( 'Check Google Cache', 'all-in-one-seo-pack' ),
519-
'href' => '//webcache.googleusercontent.com/search?strip=1&q=cache:' . $url,
555+
'id' => 'aioseo-analyze-page-structureddata',
556+
'title' => esc_html__( 'Google Rich Results Test', 'all-in-one-seo-pack' ),
557+
'href' => 'https://search.google.com/test/rich-results?url=' . $url
520558
],
521559
[
522560
'id' => 'aioseo-analyze-page-structureddata',
523-
'title' => esc_html__( 'Google Rich Results Test', 'all-in-one-seo-pack' ),
524-
'href' => 'https://search.google.com/test/rich-results?url=' . $url,
561+
'title' => esc_html__( 'Schema.org Validator', 'all-in-one-seo-pack' ),
562+
'href' => 'https://validator.schema.org/?url=' . $url
563+
],
564+
[
565+
'id' => 'aioseo-analyze-page-inlinks',
566+
'title' => esc_html__( 'Inbound Links', 'all-in-one-seo-pack' ),
567+
'href' => 'https://search.google.com/search-console/links/drilldown?resource_id=' . urlencode( get_option( 'siteurl' ) ) . '&type=EXTERNAL&target=' . $url . '&domain='
525568
],
526569
[
527570
'id' => 'aioseo-analyze-page-facebookdebug',
528571
'title' => esc_html__( 'Facebook Debugger', 'all-in-one-seo-pack' ),
529-
'href' => 'https://developers.facebook.com/tools/debug/?q=' . $url,
572+
'href' => 'https://developers.facebook.com/tools/debug/?q=' . $url
530573
],
531574
[
532-
'id' => 'aioseo-analyze-page-pinterestvalidator',
533-
'title' => esc_html__( 'Pinterest Rich Pins Validator', 'all-in-one-seo-pack' ),
534-
'href' => 'https://developers.pinterest.com/tools/url-debugger/?link=' . $url,
575+
'id' => 'aioseo-external-tools-linkedin-post-inspector',
576+
'title' => esc_html__( 'LinkedIn Post Inspector', 'all-in-one-seo-pack' ),
577+
'href' => "https://www.linkedin.com/post-inspector/inspect/$url"
535578
],
536579
[
537580
'id' => 'aioseo-analyze-page-htmlvalidation',
538581
'title' => esc_html__( 'HTML Validator', 'all-in-one-seo-pack' ),
539-
'href' => '//validator.w3.org/check?uri=' . $url,
582+
'href' => '//validator.w3.org/check?uri=' . $url
540583
],
541584
[
542585
'id' => 'aioseo-analyze-page-cssvalidation',
543586
'title' => esc_html__( 'CSS Validator', 'all-in-one-seo-pack' ),
544-
'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . $url,
545-
],
546-
[
547-
'id' => 'aioseo-analyze-page-pagespeed',
548-
'title' => esc_html__( 'Google Page Speed Test', 'all-in-one-seo-pack' ),
549-
'href' => 'https://pagespeed.web.dev/report?url=' . $url,
550-
],
551-
[
552-
'id' => 'aioseo-analyze-page-google-mobile-friendly',
553-
'title' => esc_html__( 'Mobile-Friendly Test', 'all-in-one-seo-pack' ),
554-
'href' => 'https://www.google.com/webmasters/tools/mobile-friendly/?url=' . $url,
555-
],
556-
[
557-
'id' => 'aioseo-external-tools-linkedin-post-inspector',
558-
'title' => esc_html__( 'LinkedIn Post Inspector', 'all-in-one-seo-pack' ),
559-
'href' => "https://www.linkedin.com/post-inspector/inspect/$url"
587+
'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . $url
560588
]
561589
];
562590

@@ -566,7 +594,7 @@ public function addPageAnalyzerMenuItems() {
566594
'id' => $item['id'],
567595
'title' => $item['title'],
568596
'href' => $item['href'],
569-
'meta' => [ 'target' => '_blank' ],
597+
'meta' => [ 'target' => '_blank' ]
570598
];
571599
}
572600
}
@@ -610,7 +638,7 @@ protected function addEditSeoMenuItem() {
610638
* @return void
611639
*/
612640
protected function addSettingsMenuItems() {
613-
if ( ! is_admin() ) {
641+
if ( ! is_admin() || $this->isEditor ) {
614642
$this->adminBarMenuItems[] = [
615643
'id' => 'aioseo-settings-main',
616644
'parent' => 'aioseo-main',
@@ -619,7 +647,7 @@ protected function addSettingsMenuItems() {
619647
];
620648
}
621649

622-
$parent = is_admin() ? 'aioseo-main' : 'aioseo-settings-main';
650+
$parent = is_admin() && ! $this->isEditor ? 'aioseo-main' : 'aioseo-settings-main';
623651
foreach ( $this->pages as $id => $page ) {
624652
// Remove page from admin bar menu.
625653
if ( ! empty( $page['hide_admin_bar_menu'] ) ) {
@@ -791,9 +819,9 @@ public function page() {
791819
*/
792820
public function hooks() {
793821
$currentScreen = aioseo()->helpers->getCurrentScreen();
794-
global $admin_page_hooks;
822+
global $admin_page_hooks; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
795823

796-
if ( ! is_object( $currentScreen ) || empty( $currentScreen->id ) || empty( $admin_page_hooks ) ) {
824+
if ( ! is_object( $currentScreen ) || empty( $currentScreen->id ) || empty( $admin_page_hooks ) ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
797825
return;
798826
}
799827

@@ -822,7 +850,7 @@ public function hooks() {
822850
$addScripts = true;
823851
}
824852

825-
if ( ! empty( $admin_page_hooks['aioseo'] ) && $currentScreen->id === $admin_page_hooks['aioseo'] ) {
853+
if ( ! empty( $admin_page_hooks['aioseo'] ) && $currentScreen->id === $admin_page_hooks['aioseo'] ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
826854
$addScripts = true;
827855
}
828856

@@ -968,13 +996,13 @@ public function addFooterText() {
968996
);
969997

970998
// Stop WP Core from outputting its version number and instead add both theirs & ours.
971-
global $wp_version;
999+
global $wp_version; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
9721000
printf(
9731001
wp_kses_post( '<p class="alignright">%1$s</p>' ),
9741002
sprintf(
9751003
// Translators: 1 - WP Core version number, 2 - AIOSEO version number.
9761004
esc_html__( 'WordPress %1$s | AIOSEO %2$s', 'all-in-one-seo-pack' ),
977-
esc_html( $wp_version ),
1005+
esc_html( $wp_version ), // phpcs:ignore Squiz.NamingConventions.ValidVariableName
9781006
esc_html( AIOSEO_VERSION )
9791007
)
9801008
);

app/Common/Admin/Notices/DeprecatedWordPress.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct() {
2929
* @return void
3030
*/
3131
public function maybeShowNotice() {
32-
global $wp_version;
32+
global $wp_version; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
3333

3434
$dismissed = get_option( '_aioseo_deprecated_wordpress_dismissed', true );
3535
if ( '1' === $dismissed ) {
@@ -42,7 +42,7 @@ public function maybeShowNotice() {
4242
}
4343

4444
// Only show if WordPress version is deprecated.
45-
if ( version_compare( $wp_version, '5.3', '>=' ) ) {
45+
if ( version_compare( $wp_version, '5.3', '>=' ) ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
4646
return;
4747
}
4848

app/Common/Admin/Notices/Notices.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ public function validateType( $type ) {
303303
*/
304304
public function versionMatch( $currentVersion, $compareVersion ) {
305305
if ( is_array( $compareVersion ) ) {
306-
foreach ( $compareVersion as $compare_single ) {
307-
$recursiveResult = $this->versionMatch( $currentVersion, $compare_single );
306+
foreach ( $compareVersion as $compare_single ) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName
307+
$recursiveResult = $this->versionMatch( $currentVersion, $compare_single ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
308308
if ( $recursiveResult ) {
309309
return true;
310310
}

app/Common/Admin/PostSettings.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public function changeClausesToFilterPosts( $clauses, $query = null ) {
407407
*/
408408
public function filterPostsAfterChangingClauses() {
409409
remove_action( 'wp', [ $this, 'filterPostsAfterChangingClauses' ] );
410-
410+
// phpcs:disable Squiz.NamingConventions.ValidVariableName
411411
global $wp_query;
412412
if ( ! empty( $wp_query->posts ) && is_array( $wp_query->posts ) ) {
413413
$wp_query->posts = array_filter( $wp_query->posts, function ( $post ) {
@@ -419,5 +419,6 @@ public function filterPostsAfterChangingClauses() {
419419
$wp_query->post_count = count( $wp_query->posts );
420420
}
421421
}
422+
// phpcs:enable Squiz.NamingConventions.ValidVariableName
422423
}
423424
}

app/Common/Api/Api.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ class Api {
7878
'email-debug-info' => [ 'callback' => [ 'Tools', 'emailDebugInfo' ], 'access' => 'aioseo_tools_settings' ],
7979
'migration/fix-blank-formats' => [ 'callback' => [ 'Migration', 'fixBlankFormats' ], 'access' => 'any' ],
8080
'notification/blog-visibility-reminder' => [ 'callback' => [ 'Notifications', 'blogVisibilityReminder' ], 'access' => 'any' ],
81-
'notification/description-format-reminder' => [ 'callback' => [ 'Notifications', 'descriptionFormatReminder' ], 'access' => 'any' ],
8281
'notification/conflicting-plugins-reminder' => [ 'callback' => [ 'Notifications', 'conflictingPluginsReminder' ], 'access' => 'any' ],
82+
'notification/description-format-reminder' => [ 'callback' => [ 'Notifications', 'descriptionFormatReminder' ], 'access' => 'any' ],
83+
'notification/email-reports-enable' => [ 'callback' => [ 'EmailSummary', 'enableEmailReports' ], 'access' => 'any' ],
8384
'notification/install-addons-reminder' => [ 'callback' => [ 'Notifications', 'installAddonsReminder' ], 'access' => 'any' ],
8485
'notification/install-aioseo-image-seo-reminder' => [ 'callback' => [ 'Notifications', 'installImageSeoReminder' ], 'access' => 'any' ],
8586
'notification/install-aioseo-local-business-reminder' => [ 'callback' => [ 'Notifications', 'installLocalBusinessReminder' ], 'access' => 'any' ],
@@ -327,7 +328,7 @@ protected function getRouteData( $request ) {
327328
if ( empty( $routeData ) ) {
328329
foreach ( $this->getRoutes()[ $request->get_method() ] as $routeRegex => $routeInfo ) {
329330
$routeRegex = str_replace( '@', '\@', $routeRegex );
330-
if ( preg_match( "@{$routeRegex}@", $route ) ) {
331+
if ( preg_match( "@{$routeRegex}@", (string) $route ) ) {
331332
$routeData = $routeInfo;
332333
break;
333334
}

0 commit comments

Comments
 (0)