Skip to content

Commit

Permalink
4.6.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbroes committed Jun 6, 2024
1 parent 7667a1d commit ea79f29
Show file tree
Hide file tree
Showing 42 changed files with 1,501 additions and 2,046 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.6.3
* Version: 4.6.4
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
*
Expand Down
12 changes: 4 additions & 8 deletions app/Common/Api/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public static function saveWizard( $request ) {
$options->searchAppearance->global->schema->organizationName = $additionalInformation['organizationName'];
}

if ( ! empty( $additionalInformation['organizationDescription'] ) ) {
$options->searchAppearance->global->schema->organizationDescription = $additionalInformation['organizationDescription'];
}

if ( ! empty( $additionalInformation['phone'] ) ) {
$options->searchAppearance->global->schema->phone = $additionalInformation['phone'];
}
Expand All @@ -140,14 +144,6 @@ public static function saveWizard( $request ) {
$options->searchAppearance->global->schema->personLogo = $additionalInformation['personLogo'];
}

if ( ! empty( $additionalInformation['contactType'] ) ) {
$options->searchAppearance->global->schema->contactType = $additionalInformation['contactType'];
}

if ( ! empty( $additionalInformation['contactTypeManual'] ) ) {
$options->searchAppearance->global->schema->contactTypeManual = $additionalInformation['contactTypeManual'];
}

if ( ! empty( $additionalInformation['socialShareImage'] ) ) {
$options->social->facebook->general->defaultImagePosts = $additionalInformation['socialShareImage'];
$options->social->twitter->general->defaultImagePosts = $additionalInformation['socialShareImage'];
Expand Down
4 changes: 0 additions & 4 deletions app/Common/ImportExport/SeoPress/SocialMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ private function migrateKnowledge() {

aioseo()->options->searchAppearance->global->schema->siteRepresents = $type;

if ( ! empty( $this->options['seopress_social_knowledge_contact_type'] ) ) {
aioseo()->options->searchAppearance->global->schema->contactType = ucwords( $this->options['seopress_social_knowledge_contact_type'] );
}

$settings = [
'seopress_social_knowledge_img' => [ 'type' => 'string', 'newOption' => [ 'searchAppearance', 'global', 'schema', $type . 'Logo' ] ],
'seopress_social_knowledge_name' => [ 'type' => 'string', 'newOption' => [ 'searchAppearance', 'global', 'schema', $type . 'Name' ] ],
Expand Down
37 changes: 0 additions & 37 deletions app/Common/Main/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public function runUpdates() {
}

if ( version_compare( $lastActiveVersion, '4.2.4', '<' ) ) {
$this->migrateContactTypes();
$this->addNotificationsAddonColumn();
}

Expand Down Expand Up @@ -943,42 +942,6 @@ private function migrateUserContactMethods() {
);
}

/**
* Migrates some older values in the Knowledge Panel contact type setting that were removed.
*
* @since 4.2.4
*
* @return void
*/
public function migrateContactTypes() {
$oldValue = aioseo()->options->searchAppearance->global->schema->contactType;
$oldValueLowerCase = strtolower( (string) $oldValue );

// Return if there is no value set or manual input is being used.
if ( ! $oldValue || 'manual' === $oldValueLowerCase ) {
return;
}

switch ( $oldValueLowerCase ) {
case 'billing support':
case 'customer support':
case 'reservations':
case 'sales':
case 'technical support':
// If we still support the value, do nothing.
return;
default:
// Otherwise, migrate the existing value to the manual input field.
if ( 'bagage tracking' === $oldValueLowerCase ) {
// Let's also fix this old typo.
$oldValue = 'Baggage Tracking';
}

aioseo()->options->searchAppearance->global->schema->contactType = 'manual';
aioseo()->options->searchAppearance->global->schema->contactTypeManual = $oldValue;
}
}

/**
* Add an addon column to the notifications table.
*
Expand Down
5 changes: 0 additions & 5 deletions app/Common/Migration/GeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,6 @@ private function migrateSchemaMarkupSettings() {
aioseo()->options->searchAppearance->global->schema->person = intval( $this->oldOptions['aiosp_schema_person_user'] );
}
}

if ( ! empty( $this->oldOptions['aiosp_schema_contact_type'] ) ) {
aioseo()->options->searchAppearance->global->schema->contactType = 'manual';
aioseo()->options->searchAppearance->global->schema->contactTypeManual = aioseo()->helpers->sanitizeOption( $this->oldOptions['aiosp_schema_contact_type'] );
}
}

/**
Expand Down
11 changes: 11 additions & 0 deletions app/Common/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,17 @@ private static function runDynamicSchemaMigration( $post ) {
if ( property_exists( $graph, 'id' ) && '#' !== substr( $graph->id, 0, 1 ) ) {
$graph->id = '#' . $graph->id;
}

// If the graph has an old rating value, we need to migrate it to the review.
if (
property_exists( $graph, 'id' ) &&
preg_match( '/(movie|software-application)/', $graph->id ) &&
property_exists( $graph->properties, 'rating' ) &&
property_exists( $graph->properties->rating, 'value' )
) {
$graph->properties->review->rating = $graph->properties->rating->value;
unset( $graph->properties->rating->value );
}
}

return $post;
Expand Down
32 changes: 18 additions & 14 deletions app/Common/Options/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,24 @@ class Options {
'metaDescription' => [ 'type' => 'string', 'localized' => true, 'default' => '#tagline' ],
'keywords' => [ 'type' => 'string', 'localized' => true ],
'schema' => [
'websiteName' => [ 'type' => 'string' ],
'websiteAlternateName' => [ 'type' => 'string' ],
'siteRepresents' => [ 'type' => 'string', 'default' => 'organization' ],
'person' => [ 'type' => 'string' ],
'organizationName' => [ 'type' => 'string' ],
'organizationLogo' => [ 'type' => 'string' ],
'personName' => [ 'type' => 'string' ],
'personLogo' => [ 'type' => 'string' ],
'phone' => [ 'type' => 'string' ],
'contactType' => [ 'type' => 'string' ],
'contactTypeManual' => [ 'type' => 'string' ]
'websiteName' => [ 'type' => 'string', 'default' => '#site_title' ],
'websiteAlternateName' => [ 'type' => 'string' ],
'siteRepresents' => [ 'type' => 'string', 'default' => 'organization' ],
'person' => [ 'type' => 'string' ],
'organizationName' => [ 'type' => 'string', 'default' => '#site_title' ],
'organizationDescription' => [ 'type' => 'string', 'default' => '#tagline' ],
'organizationLogo' => [ 'type' => 'string' ],
'personName' => [ 'type' => 'string' ],
'personLogo' => [ 'type' => 'string' ],
'phone' => [ 'type' => 'string' ],
'email' => [ 'type' => 'string' ],
'foundingDate' => [ 'type' => 'string' ],
'numberOfEmployees' => [
'isRange' => [ 'type' => 'boolean' ],
'from' => [ 'type' => 'number' ],
'to' => [ 'type' => 'number' ],
'number' => [ 'type' => 'number' ]
]
]
],
'advanced' => [
Expand Down Expand Up @@ -518,12 +525,9 @@ protected function setInitialDefaults() {

$hasInitialized = true;

$this->defaults['searchAppearance']['global']['schema']['organizationName']['default'] = aioseo()->helpers->decodeHtmlEntities( get_bloginfo( 'name' ) );
$this->defaults['deprecated']['tools']['blocker']['custom']['bots']['default'] = implode( "\n", aioseo()->badBotBlocker->getBotList() );
$this->defaults['deprecated']['tools']['blocker']['custom']['referer']['default'] = implode( "\n", aioseo()->badBotBlocker->getRefererList() );

$this->defaults['searchAppearance']['global']['schema']['organizationName']['default'] = aioseo()->helpers->decodeHtmlEntities( get_bloginfo( 'name' ) );
$this->defaults['searchAppearance']['global']['schema']['websiteName']['default'] = aioseo()->helpers->decodeHtmlEntities( get_bloginfo( 'name' ) );
$this->defaults['searchAppearance']['global']['schema']['organizationLogo']['default'] = aioseo()->helpers->getSiteLogoUrl() ? aioseo()->helpers->getSiteLogoUrl() : '';
}

Expand Down
39 changes: 39 additions & 0 deletions app/Common/Schema/Graphs/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,43 @@ protected function getData( $data, $dataFunctions ) {

return $data;
}

/**
* Decodes a multiselect field and returns the values.
*
* @since 4.6.4
*
* @param string $json The JSON encoded multiselect field.
* @return array The decoded values.
*/
protected function extractMultiselectTags( $json ) {
$tags = is_string( $json ) ? json_decode( $json ) : [];
if ( ! $tags ) {
return [];
}

return wp_list_pluck( $tags, 'value' );
}

/**
* Merges in data from our addon plugins.
*
* @since 4.5.6
* @version 4.6.4 Moved to main graph class.
*
* @param array $data The graph data.
* @return array The graph data.
*/
protected function getAddonData( $data, $className, $methodName = 'getAdditionalGraphData' ) {
$addonData = array_filter( aioseo()->addons->doAddonFunction( $className, $methodName, [
'postId' => get_the_ID(),
'data' => $data
] ) );

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

return $data;
}
}
59 changes: 38 additions & 21 deletions app/Common/Schema/Graphs/KnowledgeGraph/KgOrganization.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,45 @@ class KgOrganization extends Graphs\Graph {
* @return array $data The graph data.
*/
public function get() {
$homeUrl = trailingslashit( home_url() );
$organizationName = aioseo()->options->searchAppearance->global->schema->organizationName;
$data = [
'@type' => 'Organization',
'@id' => $homeUrl . '#organization',
'name' => $organizationName ? $organizationName : aioseo()->helpers->decodeHtmlEntities( get_bloginfo( 'name' ) ),
'url' => $homeUrl,
$homeUrl = trailingslashit( home_url() );
$organizationName = aioseo()->tags->replaceTags( aioseo()->options->searchAppearance->global->schema->organizationName );
$organizationDescription = aioseo()->tags->replaceTags( aioseo()->options->searchAppearance->global->schema->organizationDescription );

$data = [
'@type' => 'Organization',
'@id' => $homeUrl . '#organization',
'name' => $organizationName ? $organizationName : aioseo()->helpers->decodeHtmlEntities( get_bloginfo( 'name' ) ),
'description' => $organizationDescription,
'url' => $homeUrl,
'email' => aioseo()->options->searchAppearance->global->schema->email,
'telephone' => aioseo()->options->searchAppearance->global->schema->phone,
'foundingDate' => aioseo()->options->searchAppearance->global->schema->foundingDate
];

$numberOfEmployeesData = aioseo()->options->searchAppearance->global->schema->numberOfEmployees->all();

if (
$numberOfEmployeesData['isRange'] &&
! empty( $numberOfEmployeesData['from'] ) &&
! empty( $numberOfEmployeesData['to'] )
) {
$data['numberOfEmployees'] = [
'@type' => 'QuantitativeValue',
'minValue' => $numberOfEmployeesData['from'],
'maxValue' => $numberOfEmployeesData['to']
];
}

if (
! $numberOfEmployeesData['isRange'] &&
! empty( $numberOfEmployeesData['number'] )
) {
$data['numberOfEmployees'] = [
'@type' => 'QuantitativeValue',
'value' => $numberOfEmployeesData['number']
];
}

$logo = $this->logo();
if ( ! empty( $logo ) ) {
$data['logo'] = $logo;
Expand All @@ -42,20 +72,7 @@ public function get() {
$data['sameAs'] = $socialUrls;
}

$phone = aioseo()->options->searchAppearance->global->schema->phone;
$contactType = aioseo()->options->searchAppearance->global->schema->contactType;
if ( $phone && $contactType ) {
if ( 'manual' === $contactType ) {
$contactType = aioseo()->options->searchAppearance->global->schema->contactTypeManual;
}
if ( $contactType ) {
$data['contactPoint'] = [
'@type' => 'ContactPoint',
'telephone' => $phone,
'contactType' => $contactType,
];
}
}
$data = $this->getAddonData( $data, 'kgOrganization' );

return $data;
}
Expand Down
25 changes: 25 additions & 0 deletions app/Common/Schema/Graphs/WebPage/CheckoutPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
namespace AIOSEO\Plugin\Common\Schema\Graphs\WebPage;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* CheckoutPage graph class.
*
* @since 4.6.4
*/
class CheckoutPage extends WebPage {
/**
* The graph type.
*
* This value can be overridden by WebPage child graphs that are more specific.
*
* @since 4.6.4
*
* @var string
*/
protected $type = 'CheckoutPage';
}
25 changes: 25 additions & 0 deletions app/Common/Schema/Graphs/WebPage/MedicalWebPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
namespace AIOSEO\Plugin\Common\Schema\Graphs\WebPage;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* MedicalWebPage graph class.
*
* @since 4.6.4
*/
class MedicalWebPage extends WebPage {
/**
* The graph type.
*
* This value can be overridden by WebPage child graphs that are more specific.
*
* @since 4.6.4
*
* @var string
*/
protected $type = 'MedicalWebPage';
}
8 changes: 6 additions & 2 deletions app/Common/Schema/Graphs/WebPage/ProfilePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ class ProfilePage extends WebPage {
public function get() {
$data = parent::get();

$post = aioseo()->helpers->getPost();
$author = get_queried_object();
if ( ! is_a( $author, 'WP_User' ) ) {
if (
! is_a( $author, 'WP_User' ) &&
( is_singular() && ! is_a( $post, 'WP_Post' ) )
) {
return [];
}

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

0 comments on commit ea79f29

Please sign in to comment.