Skip to content

Commit

Permalink
4.7.6 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbroes committed Nov 28, 2024
1 parent cd5b454 commit 76db715
Show file tree
Hide file tree
Showing 135 changed files with 3,270 additions and 4,286 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.7.5.1
* Version: 4.7.6
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
* License: GPL-3.0+
Expand Down
1 change: 1 addition & 0 deletions app/AIOSEO.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ public function load() {
$this->filters = $this->pro ? new Pro\Main\Filters() : new Lite\Main\Filters();
$this->crawlCleanup = new Common\QueryArgs\CrawlCleanup();
$this->emailReports = new Common\EmailReports\EmailReports();
$this->thirdParty = new Common\ThirdParty\ThirdParty();
$this->writingAssistant = new Common\WritingAssistant\WritingAssistant();

if ( ! wp_doing_ajax() && ! wp_doing_cron() ) {
Expand Down
15 changes: 12 additions & 3 deletions app/AIOSEOAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,20 @@ abstract class AIOSEOAbstract {
public $emailReports = null;

/**
* WritingAssistant class instance.
* ThirdParty class instance.
*
* @since 4.7.4
* @since 4.7.6
*
* @var null|\AIOSEO\Plugin\Common\WritingAssistant\WritingAssistant
* @var \AIOSEO\Plugin\Common\ThirdParty\ThirdParty
*/
public $thirdParty = null;

/**
* WritingAssistant class instance.
*
* @since 4.7.4
*
* @var null|\AIOSEO\Plugin\Common\WritingAssistant\WritingAssistant
*/
public $writingAssistant = null;
}
25 changes: 18 additions & 7 deletions app/Common/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,16 @@ public function init() {
add_action( 'admin_init', [ $this, 'addPluginScripts' ] );

// Add redirects messages to trashed posts.
add_filter( 'bulk_post_updated_messages', [ $this, 'appendTrashedMessage' ] );
add_filter( 'bulk_post_updated_messages', [ $this, 'appendTrashedMessage' ], PHP_INT_MAX );

$this->registerLinkFormatHooks();

add_action( 'admin_footer', [ $this, 'addAioseoModalPortal' ] );
}

$this->loadTextDomain();
$this->setPages();

add_action( 'init', [ $this, 'setPages' ] );
}

/**
Expand All @@ -185,7 +186,7 @@ public function init() {
*
* @return void
*/
protected function setPages() {
public function setPages() {
// TODO: Remove this after a couple months.
$newIndicator = '<span class="aioseo-menu-new-indicator">&nbsp;NEW!</span>';

Expand Down Expand Up @@ -588,11 +589,16 @@ protected function addEditSeoMenuItem() {
return;
}

$href = get_edit_post_link( $post->ID );
if ( ! $href ) {
return;
}

$this->adminBarMenuItems[] = [
'id' => 'aioseo-edit-' . $post->ID,
'parent' => 'aioseo-main',
'title' => esc_html__( 'Edit SEO', 'all-in-one-seo-pack' ),
'href' => get_edit_post_link( $post->ID ) . '#aioseo-settings',
'href' => $href . '#aioseo-settings',
];
}

Expand Down Expand Up @@ -1144,6 +1150,7 @@ public function getFirstAvailablePageSlug() {
*/
public function appendTrashedMessage( $messages ) {
// Let advanced users override this.

if ( apply_filters( 'aioseo_redirects_disable_trashed_posts_suggestions', false ) ) {
return $messages;
}
Expand All @@ -1152,7 +1159,7 @@ public function appendTrashedMessage( $messages ) {
return $messages;
}

if ( empty( $_GET['ids'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
if ( empty( $_GET['ids'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
return $messages;
}

Expand Down Expand Up @@ -1186,8 +1193,12 @@ public function appendTrashedMessage( $messages ) {
$url = aioseo()->slugMonitor->manualRedirectUrl( $posts );
$addRedirect = _n( 'Add Redirect to improve SEO', 'Add Redirects to improve SEO', count( $posts ), 'all-in-one-seo-pack' );

$messages['post']['trashed'] = $messages['post']['trashed'] . '&nbsp;<a href="' . $url . '" class="aioseo-redirects-trashed-post">' . $addRedirect . '</a> |';
$messages['page']['trashed'] = $messages['page']['trashed'] . '&nbsp;<a href="' . $url . '" class="aioseo-redirects-trashed-post">' . $addRedirect . '</a> |';
$postType = get_post_type( $id );
if ( empty( $messages[ $postType ]['trashed'] ) ) {
$messages[ $postType ]['trashed'] = $messages['post']['trashed'];
}

$messages[ $postType ]['trashed'] = $messages[ $postType ]['trashed'] . '&nbsp;<a href="' . $url . '" class="aioseo-redirects-trashed-post">' . $addRedirect . '</a> |';

return $messages;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Admin/NetworkAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct() {
public function init() {
add_action( 'network_admin_menu', [ $this, 'addNetworkMenu' ] );

$this->setPages();
add_action( 'init', [ $this, 'setPages' ] );
}

/**
Expand Down
1 change: 1 addition & 0 deletions app/Common/Admin/PostSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public function saveSettingsMetabox( $postId ) {

// If there is no data, there likely was an error, e.g. if the hidden field wasn't populated on load and the user saved the post without making changes in the metabox.
// In that case we should return to prevent a complete reset of the data.

if ( empty( $currentPost ) ) {
return;
}
Expand Down
18 changes: 15 additions & 3 deletions app/Common/Admin/WritingAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,27 @@ public function addMetabox() {
return;
}

$postType = get_post_type();
if (
! aioseo()->options->writingAssistant->postTypes->all &&
! in_array( get_post_type(), aioseo()->options->writingAssistant->postTypes->included, true )
(
! aioseo()->options->writingAssistant->postTypes->all &&
! in_array( $postType, aioseo()->options->writingAssistant->postTypes->included, true )
) ||
! in_array( $postType, aioseo()->helpers->getPublicPostTypes( true ), true )
) {
return;
}

// Skip post types that do not support an editor.
if ( ! post_type_supports( get_post_type(), 'editor' ) ) {
if ( ! post_type_supports( $postType, 'editor' ) ) {
return;
}

// Ignore certain plugins.
if (
aioseo()->thirdParty->webStories->isPluginActive() &&
'web-story' === $postType
) {
return;
}

Expand Down
3 changes: 3 additions & 0 deletions app/Common/Breadcrumbs/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ public function buildBreadcrumbs( $type, $reference, $paged = [] ) {
$this->addCrumbs( $this->getPostParentCrumbs( $reference ) );
$this->addCrumbs( $this->getPostCrumb( $reference ) );
break;
case 'buddypress':
$this->addCrumbs( aioseo()->standalone->buddyPress->component->getCrumbs() );
break;
}

// Paged crumb.
Expand Down
116 changes: 62 additions & 54 deletions app/Common/Breadcrumbs/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
exit;
}

use AIOSEO\Plugin\Common\Integrations\BuddyPress as BuddyPressIntegration;

/**
* Class Frontend.
*
Expand Down Expand Up @@ -33,71 +35,77 @@ public function getBreadcrumbs() {
return apply_filters( 'aioseo_breadcrumbs_trail', $this->breadcrumbs );
}

$type = '';
$reference = get_queried_object();
// These types need the queried object for reference.
if ( is_object( $reference ) ) {
if ( is_single() ) {
$type = 'single';
}

if ( is_singular( 'post' ) ) {
$type = 'post';
}

if ( is_page() && ! is_front_page() ) {
$type = 'page';
}

if ( is_category() || is_tag() ) {
$type = 'category';
}

if ( is_tax() ) {
$type = 'taxonomy';
}

if ( is_post_type_archive() ) {
$type = 'postTypeArchive';
}
$type = '';
if ( BuddyPressIntegration::isComponentPage() ) {
$type = 'buddypress';
}

if ( is_author() ) {
$type = 'author';
if ( ! $type ) {
// These types need the queried object for reference.
if ( is_object( $reference ) ) {
if ( is_single() ) {
$type = 'single';
}

if ( is_singular( 'post' ) ) {
$type = 'post';
}

if ( is_page() && ! is_front_page() ) {
$type = 'page';
}

if ( is_category() || is_tag() ) {
$type = 'category';
}

if ( is_tax() ) {
$type = 'taxonomy';
}

if ( is_post_type_archive() ) {
$type = 'postTypeArchive';
}

if ( is_author() ) {
$type = 'author';
}

if ( is_home() ) {
$type = 'blog';
}

// Support WC shop page.
if ( aioseo()->helpers->isWooCommerceShopPage() ) {
$type = 'wcShop';
}

// Support WC products.
if ( aioseo()->helpers->isWooCommerceProductPage() ) {
$type = 'wcProduct';
}
}

if ( is_home() ) {
$type = 'blog';
if ( is_date() ) {
$type = 'date';
$reference = [
'year' => get_query_var( 'year' ),
'month' => get_query_var( 'monthnum' ),
'day' => get_query_var( 'day' )
];
}

// Support WC shop page.
if ( aioseo()->helpers->isWooCommerceShopPage() ) {
$type = 'wcShop';
if ( is_search() ) {
$type = 'search';
$reference = htmlspecialchars( sanitize_text_field( get_search_query() ) );
}

// Support WC products.
if ( aioseo()->helpers->isWooCommerceProductPage() ) {
$type = 'wcProduct';
if ( is_404() ) {
$type = 'notFound';
}
}

if ( is_date() ) {
$type = 'date';
$reference = [
'year' => get_query_var( 'year' ),
'month' => get_query_var( 'monthnum' ),
'day' => get_query_var( 'day' )
];
}

if ( is_search() ) {
$type = 'search';
$reference = htmlspecialchars( sanitize_text_field( get_search_query() ) );
}

if ( is_404() ) {
$type = 'notFound';
}

$paged = false;
if ( is_paged() || ( is_singular() && 1 < get_query_var( 'page' ) ) ) {
global $wp;
Expand Down
Loading

0 comments on commit 76db715

Please sign in to comment.