Skip to content

Commit

Permalink
4.7.2 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbroes committed Sep 30, 2024
1 parent 0df0d40 commit 5e87528
Show file tree
Hide file tree
Showing 112 changed files with 13,971 additions and 6,206 deletions.
4 changes: 2 additions & 2 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.7.1.1
* Version: 4.7.2
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
* License: GPL-3.0+
Expand Down Expand Up @@ -57,7 +57,7 @@
return;
}

// We require WP 5.3+ for the whole plugin to work.
// We require WordPress 5.3+ for the whole plugin to work.
global $wp_version;
if ( version_compare( $wp_version, '5.3', '<' ) ) {
add_action( 'admin_notices', 'aioseo_wordpress_notice' );
Expand Down
1 change: 1 addition & 0 deletions app/AIOSEO.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ public function load() {
$this->ai = $this->pro ? new Pro\Ai\Ai() : null;
$this->filters = $this->pro ? new Pro\Main\Filters() : new Lite\Main\Filters();
$this->crawlCleanup = new Common\QueryArgs\CrawlCleanup();
$this->emailReports = new Common\EmailReports\EmailReports();

if ( ! wp_doing_ajax() && ! wp_doing_cron() ) {
$this->rss = new Common\Rss();
Expand Down
9 changes: 9 additions & 0 deletions app/AIOSEOAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,4 +571,13 @@ abstract class AIOSEOAbstract {
* @var \AIOSEO\Plugin\Common\QueryArgs\CrawlCleanup
*/
public $crawlCleanup = null;

/**
* EmailReports class instance.
*
* @since 4.7.2
*
* @var null|\AIOSEO\Plugin\Common\EmailReports\EmailReports
*/
public $emailReports = null;
}
32 changes: 4 additions & 28 deletions app/Common/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,39 +173,15 @@ public function displayRssDashboardWidget() {
return;
}

include_once ABSPATH . WPINC . '/feed.php';
$rssItems = aioseo()->helpers->fetchAioseoArticles();
if ( ! $rssItems ) {
esc_html_e( 'Temporarily unable to load feed.', 'all-in-one-seo-pack' );

$rssItems = aioseo()->core->networkCache->get( 'rss_feed' );
if ( null === $rssItems ) {
$rss = fetch_feed( 'https://aioseo.com/feed/' );
if ( is_wp_error( $rss ) ) {
esc_html_e( 'Temporarily unable to load feed.', 'all-in-one-seo-pack' );

return;
}
$rssItems = $rss->get_items( 0, 4 ); // Show four items.
$cached = [];
foreach ( $rssItems as $item ) {
$cached[] = [
'url' => $item->get_permalink(),
'title' => aioseo()->helpers->decodeHtmlEntities( $item->get_title() ),
'date' => $item->get_date( get_option( 'date_format' ) ),
'content' => substr( wp_strip_all_tags( $item->get_content() ), 0, 128 ) . '...',
];
}
$rssItems = $cached;

aioseo()->core->networkCache->update( 'rss_feed', $cached, 12 * HOUR_IN_SECONDS );
return;
}
?>
<ul>
<?php
if ( false === $rssItems ) {
echo '<li>' . esc_html( __( 'No articles were found.', 'all-in-one-seo-pack' ) ) . '</li>';

return;
}

foreach ( $rssItems as $item ) {
?>
<li>
Expand Down
26 changes: 18 additions & 8 deletions app/Common/Admin/SiteHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,24 +277,34 @@ public function testCheckSchemaMarkup() {
}

/**
* Checks whether the required settings for our schema markup are set.
* Checks if the plugin should be updated.
*
* @since 4.0.0
* @since 4.7.2
*
* @return array The test result.
* @return bool Whether the plugin should be updated.
*/
public function testCheckPluginUpdate() {
public function shouldUpdate() {
$response = wp_remote_get( 'https://api.wordpress.org/plugins/info/1.0/all-in-one-seo-pack.json' );
$body = wp_remote_retrieve_body( $response );
if ( ! $body ) {
// Something went wrong.
return;
return false;
}

$pluginData = json_decode( $body );
$shouldUpdate = version_compare( AIOSEO_VERSION, $pluginData->version, '<' );
$pluginData = json_decode( $body );

if ( $shouldUpdate ) {
return version_compare( AIOSEO_VERSION, $pluginData->version, '<' );
}

/**
* Checks whether the required settings for our schema markup are set.
*
* @since 4.0.0
*
* @return array The test result.
*/
public function testCheckPluginUpdate() {
if ( $this->shouldUpdate() ) {
return $this->result(
'aioseo_plugin_update',
'critical',
Expand Down
2 changes: 1 addition & 1 deletion app/Common/Admin/Usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function getData() {
'theme_version' => $themeData->version,
'user_count' => function_exists( 'get_user_count' ) ? get_user_count() : null,
'locale' => get_locale(),
'timezone_offset' => aioseo()->helpers->getTimeZoneOffset(),
'timezone_offset' => wp_timezone_string(),
'email' => get_bloginfo( 'admin_email' ),
// AIOSEO specific data.
'aioseo_version' => AIOSEO_VERSION,
Expand Down
7 changes: 6 additions & 1 deletion app/Common/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Api {
'search-statistics/sitemap/delete' => [ 'callback' => [ 'SearchStatistics', 'deleteSitemap' ], 'access' => [ 'aioseo_search_statistics_settings', 'aioseo_general_settings' ] ], // phpcs:ignore Generic.Files.LineLength.MaxExceeded
'search-statistics/sitemap/ignore' => [ 'callback' => [ 'SearchStatistics', 'ignoreSitemap' ], 'access' => [ 'aioseo_search_statistics_settings', 'aioseo_general_settings' ] ], // phpcs:ignore Generic.Files.LineLength.MaxExceeded
'settings/export' => [ 'callback' => [ 'Settings', 'exportSettings' ], 'access' => 'aioseo_tools_settings' ],
'settings/export-content' => [ 'callback' => [ 'Settings', 'exportContent' ], 'access' => 'aioseo_tools_settings' ],
'settings/hide-setup-wizard' => [ 'callback' => [ 'Settings', 'hideSetupWizard' ], 'access' => 'any' ],
'settings/hide-upgrade-bar' => [ 'callback' => [ 'Settings', 'hideUpgradeBar' ], 'access' => 'any' ],
'settings/import' => [ 'callback' => [ 'Settings', 'importSettings' ], 'access' => 'aioseo_tools_settings' ],
Expand Down Expand Up @@ -143,6 +144,10 @@ class Api {
'callback' => [ 'CrawlCleanup', 'deleteLog', 'AIOSEO\\Plugin\\Common\\QueryArgs' ],
'access' => [ 'aioseo_search_appearance_settings' ]
],
'email-summary/send' => [
'callback' => [ 'EmailSummary', 'send' ],
'access' => 'aioseo_page_advanced_settings'
],
],
'DELETE' => [
'backup' => [ 'callback' => [ 'Tools', 'deleteBackup' ], 'access' => 'aioseo_tools_settings' ],
Expand All @@ -152,7 +157,7 @@ class Api {
];

/**
* Class contructor.
* Class constructor.
*
* @since 4.0.0
*/
Expand Down
47 changes: 47 additions & 0 deletions app/Common/Api/EmailSummary.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace AIOSEO\Plugin\Common\Api;

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

/**
* Email Summary related REST API endpoint callbacks.
*
* @since 4.7.2
*/
class EmailSummary {
/**
* Sends a summary.
*
* @since 4.7.2
*
* @param \WP_REST_Request $request The REST Request
* @return \WP_REST_Response The response.
*/
public static function send( $request ) {
try {
$body = $request->get_json_params();

$to = $body['to'] ?? '';
$frequency = $body['frequency'] ?? '';
if ( $to && $frequency ) {
aioseo()->emailReports->summary->run( [
'recipient' => $to,
'frequency' => $frequency,
] );
}

return new \WP_REST_Response( [
'success' => true,
], 200 );
} catch ( \Exception $e ) {
return new \WP_REST_Response( [
'success' => false,
'message' => $e->getMessage()
], 200 );
}
}
}
Loading

0 comments on commit 5e87528

Please sign in to comment.