Skip to content

Commit

Permalink
4.2.5.1 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudbroes committed Sep 13, 2022
1 parent aeb20ec commit 483ae95
Show file tree
Hide file tree
Showing 434 changed files with 24,128 additions and 18,795 deletions.
10 changes: 4 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"vue/no-mutating-props": "off",
"vue/no-v-for-template-key": "off",
"vue/multi-word-component-names": "off",
"vue/no-v-text-v-html-on-component": "off",
"object-shorthand": "off", // TODO: Add this in.
"import/extensions": "off",
"no-empty": [
2,
{
Expand Down Expand Up @@ -143,10 +146,5 @@
"no-new": 0,
"prefer-regex-literals": "off"
},
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "babel-eslint",
"sourceType": "module",
"allowImportExportEverywhere": false
}
"parser": "vue-eslint-parser"
}
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 80 million downloads since 2007.
* Author: All in One SEO Team
* Author URI: https://aioseo.com/
* Version: 4.2.4
* Version: 4.2.5.1
* Text Domain: all-in-one-seo-pack
* Domain Path: /languages
*
Expand Down
13 changes: 9 additions & 4 deletions app/AIOSEO.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ private function preLoad() {
$this->backwardsCompatibility();

// Internal Options.
$this->helpers = $this->pro ? new Pro\Utils\Helpers() : new Lite\Utils\Helpers();
$this->internalOptions = $this->pro ? new Pro\Options\InternalOptions() : new Lite\Options\InternalOptions();
$this->helpers = $this->pro ? new Pro\Utils\Helpers() : new Lite\Utils\Helpers();
$this->internalNetworkOptions = ( $this->pro && is_multisite() ) ? new Pro\Options\InternalNetworkOptions() : new Common\Options\InternalNetworkOptions();
$this->internalOptions = $this->pro ? new Pro\Options\InternalOptions() : new Lite\Options\InternalOptions();

// Run pre-updates.
$this->preUpdates = $this->pro ? new Pro\Main\PreUpdates() : new Common\Main\PreUpdates();
Expand Down Expand Up @@ -379,18 +380,21 @@ public function load() {
$translations->init();
}

$this->thirdParty = new Common\ThirdParty\ThirdParty();
$this->addons = $this->pro ? new Pro\Utils\Addons() : new Common\Utils\Addons();
$this->tags = $this->pro ? new Pro\Utils\Tags() : new Common\Utils\Tags();
$this->blocks = new Common\Utils\Blocks();
$this->badBotBlocker = new Common\Tools\BadBotBlocker();
$this->breadcrumbs = $this->pro ? new Pro\Breadcrumbs\Breadcrumbs() : new Common\Breadcrumbs\Breadcrumbs();
$this->dynamicBackup = $this->pro ? new Pro\Options\DynamicBackup() : new Common\Options\DynamicBackup();
$this->options = $this->pro ? new Pro\Options\Options() : new Lite\Options\Options();
$this->networkOptions = ( $this->pro && is_multisite() ) ? new Pro\Options\NetworkOptions() : new Common\Options\NetworkOptions();
$this->dynamicOptions = $this->pro ? new Pro\Options\DynamicOptions() : new Common\Options\DynamicOptions();
$this->backup = new Common\Utils\Backup();
$this->access = $this->pro ? new Pro\Utils\Access() : new Common\Utils\Access();
$this->usage = $this->pro ? new Pro\Admin\Usage() : new Lite\Admin\Usage();
$this->siteHealth = $this->pro ? new Pro\Admin\SiteHealth() : new Common\Admin\SiteHealth();
$this->networkLicense = $this->pro && is_multisite() ? new Pro\Admin\NetworkLicense() : null;
$this->license = $this->pro ? new Pro\Admin\License() : null;
$this->autoUpdates = $this->pro ? new Pro\Admin\AutoUpdates() : null;
$this->updates = $this->pro ? new Pro\Main\Updates() : new Common\Main\Updates();
Expand All @@ -402,22 +406,23 @@ public function load() {
$this->notices = $this->pro ? new Pro\Admin\Notices\Notices() : new Lite\Admin\Notices\Notices();
$this->wpNotices = new Common\Admin\Notices\WpNotices();
$this->admin = $this->pro ? new Pro\Admin\Admin() : new Lite\Admin\Admin();
$this->networkAdmin = is_multisite() ? ( $this->pro ? new Pro\Admin\NetworkAdmin() : new Common\Admin\NetworkAdmin() ) : null;
$this->activate = $this->pro ? new Pro\Main\Activate() : new Common\Main\Activate();
$this->conflictingPlugins = $this->pro ? new Pro\Admin\ConflictingPlugins() : new Common\Admin\ConflictingPlugins();
$this->migration = $this->pro ? new Pro\Migration\Migration() : new Common\Migration\Migration();
$this->importExport = $this->pro ? new Pro\ImportExport\ImportExport() : new Common\ImportExport\ImportExport();
$this->sitemap = $this->pro ? new Pro\Sitemap\Sitemap() : new Common\Sitemap\Sitemap();
$this->htmlSitemap = new Common\Sitemap\Html\Sitemap();
$this->templates = new Common\Utils\Templates();
$this->templates = $this->pro ? new Pro\Utils\Templates() : new Common\Utils\Templates();
$this->categoryBase = $this->pro ? new Pro\Main\CategoryBase() : null;
$this->postSettings = $this->pro ? new Pro\Admin\PostSettings() : new Lite\Admin\PostSettings();
$this->standalone = new Common\Standalone\Standalone();
$this->slugMonitor = new Common\Admin\SlugMonitor();
$this->schema = $this->pro ? new Pro\Schema\Schema() : new Common\Schema\Schema();

if ( ! wp_doing_ajax() && ! wp_doing_cron() ) {
$this->rss = new Common\Rss();
$this->main = $this->pro ? new Pro\Main\Main() : new Common\Main\Main();
$this->schema = $this->pro ? new Pro\Schema\Schema() : new Common\Schema\Schema();
$this->head = $this->pro ? new Pro\Main\Head() : new Common\Main\Head();
$this->filters = $this->pro ? new Pro\Main\Filters() : new Lite\Main\Filters();
$this->dashboard = $this->pro ? new Pro\Admin\Dashboard() : new Common\Admin\Dashboard();
Expand Down
76 changes: 43 additions & 33 deletions app/Common/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ class Admin {
* @since 4.0.0
*/
public function __construct() {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if (
is_network_admin() &&
! is_plugin_active_for_network( plugin_basename( AIOSEO_FILE ) )
) {
return;
}

add_action( 'aioseo_unslash_escaped_data_posts', [ $this, 'unslashEscapedDataPosts' ] );

if ( wp_doing_ajax() || wp_doing_cron() ) {
Expand Down Expand Up @@ -122,9 +130,6 @@ public function init() {
// Add the menu to the sidebar.
add_action( 'admin_menu', [ $this, 'addMenu' ] );
add_action( 'admin_menu', [ $this, 'hideScheduledActionsMenu' ], 99999 );
if ( is_multisite() ) {
add_action( 'network_admin_menu', [ $this, 'addRobotsMenu' ] );
}

// Add Score to Publish metabox.
add_action( 'post_submitbox_misc_actions', [ $this, 'addPublishScore' ] );
Expand All @@ -135,6 +140,9 @@ public function init() {
add_filter( 'bulk_post_updated_messages', [ $this, 'appendTrashedMessage' ], 10, 2 );

$this->registerLinkFormatHooks();

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

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

Expand All @@ -159,7 +167,9 @@ private function setPages() {
'parent' => $this->pageSlug
],
'aioseo-settings' => [
'menu_title' => esc_html__( 'General Settings', 'all-in-one-seo-pack' ),
'menu_title' => is_network_admin()
? esc_html__( 'Network Settings', 'all-in-one-seo-pack' )
: esc_html__( 'General Settings', 'all-in-one-seo-pack' ),
'parent' => $this->pageSlug
],
'aioseo-search-appearance' => [
Expand Down Expand Up @@ -193,7 +203,9 @@ private function setPages() {
'parent' => $this->pageSlug
],
'aioseo-tools' => [
'menu_title' => esc_html__( 'Tools', 'all-in-one-seo-pack' ),
'menu_title' => is_network_admin()
? esc_html__( 'Network Tools', 'all-in-one-seo-pack' )
: esc_html__( 'Tools', 'all-in-one-seo-pack' ),
'parent' => $this->pageSlug
],
'aioseo-feature-manager' => [
Expand Down Expand Up @@ -226,7 +238,6 @@ private function registerLinkFormatHooks() {
add_action( 'wp_enqueue_editor', [ $this, 'addClassicLinkFormatScript' ], 999999 );

global $wp_version;
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( version_compare( $wp_version, '5.3', '>=' ) || is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
add_action( 'current_screen', [ $this, 'addGutenbergLinkFormatScript' ] );
add_action( 'enqueue_block_editor_assets', [ $this, 'enqueueBlockEditorLinkFormat' ] );
Expand Down Expand Up @@ -644,29 +655,6 @@ public function addMenu() {
}
}

/**
* Add the robots only menu inside of the WordPress network admin.
*
* @since 4.0.0
*
* @return void
*/
public function addRobotsMenu() {
$slug = 'aioseo-tools';
$this->addMainMenu( $slug );

$page = $this->pages[ $slug ];
$hook = add_submenu_page(
$slug,
! empty( $page['page_title'] ) ? $page['page_title'] : $page['menu_title'],
$page['menu_title'],
$this->getPageRequiredCapability( $slug ),
$slug,
[ $this, 'page' ]
);
add_action( "load-{$hook}", [ $this, 'hooks' ] );
}

/**
* Add the main menu.
*
Expand All @@ -675,7 +663,7 @@ public function addRobotsMenu() {
* @param string $slug which slug to use.
* @return void
*/
private function addMainMenu( $slug = 'aioseo' ) {
protected function addMainMenu( $slug = 'aioseo' ) {
add_menu_page(
$this->menuName,
$this->menuName,
Expand Down Expand Up @@ -827,7 +815,7 @@ function_exists( 'exactmetrics_get_ua' )
add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ], 11 );
add_action( 'admin_enqueue_scripts', [ $this, 'dequeueTagDivOptinBuilderScript' ], 99999 );

add_action( 'admin_footer_text', [ $this, 'addFooterText' ] );
add_filter( 'admin_footer_text', [ $this, 'addFooterText' ] );

// Only enqueue the media library if we need it in our module
if ( in_array( $page, [
Expand Down Expand Up @@ -1146,7 +1134,7 @@ public function appendTrashedMessage( $messages, $counts ) {

if ( ! empty( $post ) ) {
$posts[] = [
'url' => str_replace( aioseo()->helpers->getSiteUrl(), '', str_replace( '__trashed', '', get_permalink( $post ) ) ),
'url' => str_replace( '__trashed', '', get_permalink( $post ) ),
'target' => '/',
'type' => 301
];
Expand Down Expand Up @@ -1208,4 +1196,26 @@ public function loadTextDomain() {
public function dequeueTagDivOptinBuilderScript() {
wp_dequeue_script( 'tds_js_vue_files_last' );
}

/**
* Add the div for the modal portal.
*
* @since 4.2.5
*
* @return void
*/
public function addAioseoModalPortal() {
echo '<div id="aioseo-modal-portal"></div>';
}

/**
* Add the assets for the modal portal.
*
* @since 4.2.5
*
* @return void
*/
public function enqueueAioseoModalPortal() {
aioseo()->core->assets->load( 'src/vue/standalone/modal-portal/main.js' );
}
}
4 changes: 2 additions & 2 deletions app/Common/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function enqueue() {
public function getAioseoRssFeed() {
include_once( ABSPATH . WPINC . '/feed.php' );

$rssItems = aioseo()->core->cache->get( 'rss_feed' );
$rssItems = aioseo()->core->networkCache->get( 'rss_feed' );
if ( null === $rssItems ) {
$rss = fetch_feed( 'https://aioseo.com/feed/' );
if ( is_wp_error( $rss ) ) {
Expand All @@ -168,7 +168,7 @@ public function getAioseoRssFeed() {
}
$rssItems = $cached;

aioseo()->core->cache->update( 'rss_feed', $cached, 12 * HOUR_IN_SECONDS );
aioseo()->core->networkCache->update( 'rss_feed', $cached, 12 * HOUR_IN_SECONDS );
}

return $rssItems;
Expand Down
83 changes: 83 additions & 0 deletions app/Common/Admin/NetworkAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
namespace AIOSEO\Plugin\Common\Admin;

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

/**
* Abstract class that Pro and Lite both extend.
*
* @since 4.2.5
*/
class NetworkAdmin extends Admin {
/**
* Construct method.
*
* @since 4.2.5
*/
public function __construct() {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if (
is_network_admin() &&
! is_plugin_active_for_network( plugin_basename( AIOSEO_FILE ) )
) {
return;
}

if ( wp_doing_ajax() || wp_doing_cron() ) {
return;
}

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

/**
* Initialize the admin.
*
* @since 4.2.5
*
* @return void
*/
public function init() {
add_action( 'network_admin_menu', [ $this, 'addNetworkMenu' ] );

$this->setPages();
}

/**
* Add the network menu inside of WordPress.
*
* @since 4.2.5
*
* @return void
*/
public function addNetworkMenu() {
$this->addMainMenu( 'aioseo' );

foreach ( $this->pages as $slug => $page ) {
if (
'aioseo-settings' !== $slug &&
'aioseo-tools' !== $slug &&
'aioseo-about' !== $slug &&
'aioseo-feature-manager' !== $slug
) {
continue;
}

$hook = add_submenu_page(
$this->pageSlug,
! empty( $page['page_title'] ) ? $page['page_title'] : $page['menu_title'],
$page['menu_title'],
$this->getPageRequiredCapability( $slug ),
$slug,
[ $this, 'page' ]
);
add_action( "load-{$hook}", [ $this, 'hooks' ] );
}

// Remove the "dashboard" submenu page that is not needed in the network admin.
remove_submenu_page( $this->pageSlug, $this->pageSlug );
}
}
4 changes: 2 additions & 2 deletions app/Common/Admin/Notices/Notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function init() {
* @return void
*/
private function maybeUpdate() {
$nextRun = aioseo()->core->cache->get( 'admin_notifications_update' );
$nextRun = aioseo()->core->networkCache->get( 'admin_notifications_update' );
if ( null !== $nextRun && time() < $nextRun ) {
return;
}
Expand All @@ -81,7 +81,7 @@ private function maybeUpdate() {
aioseo()->helpers->scheduleAsyncAction( 'aioseo_admin_notifications_update' );

// Update the cache.
aioseo()->core->cache->update( 'admin_notifications_update', time() + DAY_IN_SECONDS );
aioseo()->core->networkCache->update( 'admin_notifications_update', time() + DAY_IN_SECONDS );
}

/**
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 @@ -74,6 +74,7 @@ public function enqueuePostSettingsAssets() {

aioseo()->core->assets->load( 'src/vue/standalone/post-settings/main.js', [], aioseo()->helpers->getVueData( $page ) );
aioseo()->core->assets->load( 'src/vue/standalone/link-format/main.js', [], aioseo()->helpers->getVueData( $page ) );
aioseo()->admin->enqueueAioseoModalPortal();
}

$screen = get_current_screen();
Expand Down
8 changes: 2 additions & 6 deletions app/Common/Api/Analyze.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@ public static function analyzeSite( $request ) {
$refreshResults
) {
$token = aioseo()->internalOptions->internal->siteAnalysis->connectToken;
$license = aioseo()->options->has( 'general' ) && aioseo()->options->general->has( 'licenseKey' )
? aioseo()->options->general->licenseKey
: '';
$url = defined( 'AIOSEO_ANALYZE_URL' ) ? AIOSEO_ANALYZE_URL : 'https://analyze.aioseo.com';
$response = aioseo()->helpers->wpRemotePost( $url . '/v1/analyze/', [
'timeout' => 60,
'headers' => [
'X-AIOSEO-Key' => $token,
'X-AIOSEO-License' => $license,
'Content-Type' => 'application/json'
'X-AIOSEO-Key' => $token,
'Content-Type' => 'application/json'
],
'body' => wp_json_encode( [
'url' => $analyzeOrHomeUrl
Expand Down
Loading

0 comments on commit 483ae95

Please sign in to comment.