Skip to content

Commit

Permalink
4.5.6 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbroes committed Feb 8, 2024
1 parent a78078a commit 1f3c8ed
Show file tree
Hide file tree
Showing 106 changed files with 7,596 additions and 5,006 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist
*.pem
*.env
.idea
*/filters.php
6 changes: 3 additions & 3 deletions 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.5
* Version: 4.5.6
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
*
Expand Down Expand Up @@ -56,9 +56,9 @@
return;
}

// We require WP 4.9+ for the whole plugin to work.
// We require WP 5.3+ for the whole plugin to work.
global $wp_version;
if ( version_compare( $wp_version, '4.9', '<' ) ) {
if ( version_compare( $wp_version, '5.3', '<' ) ) {
add_action( 'admin_notices', 'aioseo_wordpress_notice' );

// Do not process the plugin code further.
Expand Down
8 changes: 8 additions & 0 deletions app/Common/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,14 @@ public function addMenu() {
];
}

if ( current_user_can( $this->getPageRequiredCapability( 'aioseo-search-appearance' ) ) ) {
$submenu['users.php'][] = [
esc_html__( 'Author SEO', 'all-in-one-seo-pack' ),
$this->getPageRequiredCapability( 'aioseo-search-appearance' ),
admin_url( '/admin.php?page=aioseo-search-appearance/#author-seo' )
];
}

// We use the global submenu, because we are adding an external link here.
$count = count( Models\Notification::getAllActiveNotifications() );
$firstPageSlug = $this->getFirstAvailablePageSlug();
Expand Down
10 changes: 0 additions & 10 deletions app/Common/Schema/Graphs/Article/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ public function get( $graphData = null ) {
$data['pagination'] = $pageNumber;
}

// Check if our addons need to modify this graph.
$addonsArticleData = array_filter( aioseo()->addons->doAddonFunction( 'article', 'get', [
'postId' => $post->ID,
'data' => $data
] ) );

foreach ( $addonsArticleData as $addonArticleData ) {
$data = array_merge( $data, $addonArticleData );
}

return $data;
}

Expand Down
45 changes: 40 additions & 5 deletions app/Common/Schema/Graphs/WebPage/ProfilePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
* @since 4.0.0
*/
class ProfilePage extends WebPage {
/**
* The graph type.
*
* @since 4.5.6
*
* @var string
*/
protected $type = 'ProfilePage';

/**
* Returns the graph data.
*
Expand All @@ -22,14 +31,40 @@ class ProfilePage extends WebPage {
public function get() {
$data = parent::get();

$data['@type'] = 'ProfilePage';
$author = get_queried_object();
if ( ! is_a( $author, 'WP_User' ) ) {
return [];
}

global $wp_query;
$articles = [];
$authorId = $author->ID;
foreach ( $wp_query->posts as $post ) {
if ( $post->post_author !== $authorId ) {
continue;
}

// Check if our addons need to add more data.
$addonsPersonAuthorData = array_filter( aioseo()->addons->doAddonFunction( 'profilePage', 'get' ) );
foreach ( $addonsPersonAuthorData as $addonPersonAuthorData ) {
$data = array_merge( $data, $addonPersonAuthorData );
$articles[] = [
'@type' => 'Article',
'url' => get_permalink( $post->ID ),
'headline' => $post->post_title,
'datePublished' => mysql2date( DATE_W3C, $post->post_date, false ),
'dateModified' => mysql2date( DATE_W3C, $post->post_modified, false ),
'author' => [
'@id' => get_author_posts_url( $authorId ) . '#author'
]
];
}

$data = array_merge( $data, [
'dateCreated' => mysql2date( DATE_W3C, $author->user_registered, false ),
'mainEntity' => [
'@id' => get_author_posts_url( $authorId ) . '#author'
],
'hasPart' => $articles

] );

return $data;
}
}
27 changes: 27 additions & 0 deletions app/Common/Schema/Graphs/WebPage/WebPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public function get() {

if ( is_singular() ) {
if ( ! isset( aioseo()->schema->context['object'] ) || ! aioseo()->schema->context['object'] ) {
$data = $this->getAddonData( $data );

return $data;
}

Expand All @@ -83,13 +85,38 @@ public function get() {
$data['datePublished'] = mysql2date( DATE_W3C, $post->post_date, false );
$data['dateModified'] = mysql2date( DATE_W3C, $post->post_modified, false );

$data = $this->getAddonData( $data );

return $data;
}

if ( is_front_page() ) {
$data['about'] = [ '@id' => trailingslashit( home_url() ) . '#' . aioseo()->options->searchAppearance->global->schema->siteRepresents ];
}

$data = $this->getAddonData( $data );

return $data;
}

/**
* Merges in data from our addon plugins.
*
* @since 4.5.6
*
* @param array $data The graph data.
* @return array The graph data.
*/
protected function getAddonData( $data ) {
$addonData = array_filter( aioseo()->addons->doAddonFunction( 'webPage', 'get', [
'postId' => get_the_ID(),
'data' => $data
] ) );

foreach ( $addonData as $addonGraphData ) {
$data = array_merge( $data, $addonGraphData );
}

return $data;
}
}
2 changes: 1 addition & 1 deletion app/Common/Sitemap/Image/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private function extract() {
$images = array_merge( $images, $this->getPostGalleryImages() );

// Now, get the remaining images from image tags in the post content.
$parsedPostContent = function_exists( 'do_blocks' ) ? do_blocks( $this->post->post_content ) : $this->post->post_content; // phpcs:disable AIOSEO.WpFunctionUse.NewFunctions
$parsedPostContent = do_blocks( $this->post->post_content );
$parsedPostContent = aioseo()->helpers->doShortcodes( $parsedPostContent, true, $this->post->ID );
$parsedPostContent = preg_replace( '/\s\s+/u', ' ', trim( $parsedPostContent ) ); // Trim both internal and external whitespace.

Expand Down
2 changes: 1 addition & 1 deletion app/Common/Sitemap/Image/ThirdParty.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private function nextGen() {

// For this specific check, we only want to parse blocks and do not want to run shortcodes because some NextGen blocks (e.g. Mosaic) are parsed into shortcodes.
// And after parsing the shortcodes, the attributes we're looking for are gone.
$contentWithBlocksParsed = function_exists( 'do_blocks' ) ? do_blocks( $this->post->post_content ) : $this->post->post_content; // phpcs:disable AIOSEO.WpFunctionUse.NewFunctions
$contentWithBlocksParsed = do_blocks( $this->post->post_content );

$imageIds = [];
preg_match_all( '/\[ngg.*src="galleries" ids="(.*?)".*\]/i', $contentWithBlocksParsed, $shortcodes );
Expand Down
2 changes: 0 additions & 2 deletions app/Common/Standalone/HeadlineAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public function __construct() {
* @return void
*/
public function enqueue() {
global $wp_version;
if (
! aioseo()->helpers->isScreenBase( 'post' ) ||
version_compare( $wp_version, '5.2', '<' ) ||
! aioseo()->access->hasCapability( 'aioseo_page_analysis' )
) {
return;
Expand Down
26 changes: 10 additions & 16 deletions app/Common/Standalone/SeoPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function init() {
is_admin() ||
! is_admin_bar_showing() ||
// If we're seeing the Divi theme Visual Builder.
function_exists( 'et_core_is_fb_enabled' ) && et_core_is_fb_enabled() ||
( function_exists( 'et_core_is_fb_enabled' ) && et_core_is_fb_enabled() ) ||
aioseo()->helpers->isAmpPage()
) {
return;
Expand Down Expand Up @@ -183,10 +183,14 @@ private function getVueData() {
'keyphrases' => isset( $keyphrases ) ? $keyphrases : '',
'page_analysis' => isset( $pageAnalysis ) ? $pageAnalysis : '',
'urls' => [
'home' => home_url(),
'domain' => aioseo()->helpers->getSiteDomain(),
'mainSiteUrl' => aioseo()->helpers->getSiteUrl(),
],
'mainAssetCssQueue' => aioseo()->core->assets->getJsAssetCssQueue( $this->mainAssetRelativeFilename ),
'data' => [
'isDev' => aioseo()->helpers->isDev()
]
];
}

Expand All @@ -209,16 +213,11 @@ private function getEditSnippetUrl( $templateType, $snippet, $object = null ) {
}

// If we're in a post/page/term (not an attachment) we'll have a URL directly to the meta box.
if (
'single' === $templateType ||
'page' === $templateType ||
'taxonomy' === $templateType
) {
$url = in_array( $templateType, [ 'single', 'page' ], true )
? get_edit_post_link( $object, 'url' ) . '#aioseo-settings'
: get_edit_term_link( $object, $object->taxonomy ) . '#aioseo-term-settings-field';
if ( in_array( $templateType, [ 'single', 'page', 'attachment', 'taxonomy' ], true ) ) {
$url = 'taxonomy' === $templateType
? get_edit_term_link( $object, $object->taxonomy ) . '#aioseo-term-settings-field'
: get_edit_post_link( $object, 'url' ) . '#aioseo-settings';

// Default `$queryArgs` for 'google' snippet.
$queryArgs = [ 'aioseo-tab' => 'general' ];
if ( in_array( $snippet, [ 'facebook', 'twitter' ], true ) ) {
$queryArgs = [
Expand All @@ -231,12 +230,7 @@ private function getEditSnippetUrl( $templateType, $snippet, $object = null ) {
}

// If we're in any sort of archive let's point to the global archive editing.
if (
'archive' === $templateType ||
'author' === $templateType ||
'date' === $templateType ||
'search' === $templateType
) {
if ( in_array( $templateType, [ 'archive', 'author', 'date', 'search' ], true ) ) {
return admin_url( 'admin.php?page=aioseo-search-appearance' ) . '#/archives';
}

Expand Down
18 changes: 1 addition & 17 deletions app/Common/Traits/Helpers/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@
* @since 4.1.4
*/
trait Language {
/**
* Returns the language of the current response.
*
* @since 4.1.4
*
* @return string The language code.
*/
public function currentLanguageCode() {
global $wp_version;
if ( version_compare( $wp_version, '5.0', '<' ) ) {
return get_locale();
}

return determine_locale(); // phpcs:ignore AIOSEO.WpFunctionUse.NewFunctions.determine_localeFound
}

/**
* Returns the language of the current response in BCP 47 format.
*
Expand All @@ -36,6 +20,6 @@ public function currentLanguageCode() {
* @return string The language code in BCP 47 format.
*/
public function currentLanguageCodeBCP47() {
return str_replace( '_', '-', $this->currentLanguageCode() );
return str_replace( '_', '-', determine_locale() );
}
}
1 change: 0 additions & 1 deletion app/Common/Traits/Helpers/Vue.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ private function setPostData() {
'maxImagePreview' => $post->robots_max_imagepreview,
'modalOpen' => false,
'generalMobilePrev' => false,
'socialMobilePreview' => false,
'og_object_type' => ! empty( $post->og_object_type ) ? $post->og_object_type : 'default',
'og_title' => $post->og_title,
'og_description' => $post->og_description,
Expand Down
22 changes: 1 addition & 21 deletions app/Common/Traits/Helpers/Wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function getPublicTaxonomies( $namesOnly = false, $rewriteType = false )

$taxObjects = get_taxonomies( [], 'objects' );
foreach ( $taxObjects as $taxObject ) {
if ( empty( $taxObject->label ) || ! $this->isTaxonomyViewable( $taxObject ) ) {
if ( empty( $taxObject->label ) || ! is_taxonomy_viewable( $taxObject ) ) {
continue;
}

Expand Down Expand Up @@ -763,26 +763,6 @@ public function getPostTitle( $postId ) {
return $titles[ $postId ];
}

/**
* Checks whether the taxonomy should be considered viewable.
* This function is a copy of the WordPress core function is_taxonomy_viewable() which was introduced in WP 5.1.
*
* @since 4.3.5.1
*
* @param string|\WP_Taxonomy $taxonomy The taxonomy name or object.
* @return bool Whether the taxonomy is viewable.
*/
public function isTaxonomyViewable( $taxonomy ) {
if ( is_scalar( $taxonomy ) ) {
$taxonomy = get_taxonomy( $taxonomy );
if ( ! is_a( $taxonomy, 'WP_Taxonomy' ) ) {
return false;
}
}

return $taxonomy->publicly_queryable;
}

/**
* Checks whether the post status should be considered viewable.
* This function is a copy of the WordPress core function is_post_status_viewable() which was introduced in WP 5.7.
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Traits/Helpers/WpContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function theContent( $postContent ) {
$this->originalPost = is_a( $post, 'WP_Post' ) ? $this->deepClone( $post ) : null;

// The order of the function calls below is intentional and should NOT change.
$postContent = function_exists( 'do_blocks' ) ? do_blocks( $postContent ) : $postContent; // phpcs:ignore AIOSEO.WpFunctionUse.NewFunctions.do_blocksFound
$postContent = do_blocks( $postContent );
$postContent = wpautop( $postContent );
$postContent = $this->doShortcodes( $postContent );

Expand Down
20 changes: 19 additions & 1 deletion app/Common/Utils/Addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,24 @@ public function getAddonLevels( $addonName ) {
return [];
}

/**
* Returns a list of addon SKUs.
*
* @since 4.5.6
*
* @return array The addon SKUs.
*/
public function getAddonSkus() {
$addons = $this->getAddons();
if ( empty( $addons ) ) {
return [];
}

return array_map( function( $addon ) {
return $addon->sku;
}, $addons );
}

/**
* Get the URL to get addons.
*
Expand Down Expand Up @@ -606,7 +624,7 @@ protected function getDefaultAddons() {
'descriptionVersion' => 0,
'productUrl' => 'https://aioseo.com/author-seo-eeat/',
'learnMoreUrl' => 'https://aioseo.com/author-seo-eeat/',
'manageUrl' => '',
'manageUrl' => 'https://route#aioseo-search-appearance:author-seo',
'basename' => 'aioseo-eeat/aioseo-eeat.php',
'installed' => false,
'isActive' => false,
Expand Down
Loading

0 comments on commit 1f3c8ed

Please sign in to comment.