Skip to content

Commit 6ede6f2

Browse files
committed
4.9.1 Release
1 parent ecf67da commit 6ede6f2

File tree

181 files changed

+9267
-2775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+9267
-2775
lines changed

all_in_one_seo_pack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 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.
66
* Author: All in One SEO Team
77
* Author URI: https://aioseo.com/
8-
* Version: 4.9.0
8+
* Version: 4.9.1
99
* Text Domain: all-in-one-seo-pack
1010
* Domain Path: /languages
1111
* License: GPL-3.0+

app/AIOSEO.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ public function load() {
306306
$this->thirdParty = new Common\ThirdParty\ThirdParty();
307307
$this->writingAssistant = new Common\WritingAssistant\WritingAssistant();
308308
$this->llms = $this->pro ? new Pro\Llms\Llms() : new Common\Llms\Llms();
309+
$this->redirects = $this->pro ? new Pro\Redirects\Redirects() : null;
309310

310311
if ( ! wp_doing_ajax() && ! wp_doing_cron() ) {
311312
$this->rss = new Common\Rss();

app/AIOSEOAbstract.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,4 +616,13 @@ abstract class AIOSEOAbstract {
616616
* @var \AIOSEO\Plugin\Common\Llms\Llms|\AIOSEO\Plugin\Pro\Llms\Llms
617617
*/
618618
public $llms = null;
619+
620+
/**
621+
* Redirects class instance.
622+
*
623+
* @since 4.9.1
624+
*
625+
* @var \AIOSEO\Plugin\Pro\Redirects\Redirects
626+
*/
627+
public $redirects = null;
619628
}

app/Common/Admin/Admin.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ public function init() {
204204
* @return void
205205
*/
206206
public function setPages() {
207-
// TODO: Remove this after a couple months.
208207
$newIndicator = '<span class="aioseo-menu-new-indicator">&nbsp;NEW!</span>';
209208

210209
$this->pages = [
@@ -239,6 +238,11 @@ public function setPages() {
239238
'menu_title' => esc_html__( 'Redirects', 'all-in-one-seo-pack' ),
240239
'parent' => $this->pageSlug
241240
],
241+
'aioseo-ai-insights' => [
242+
'menu_title' => esc_html__( 'AI Insights', 'all-in-one-seo-pack' ) . $newIndicator,
243+
'page_title' => esc_html__( 'AI Insights', 'all-in-one-seo-pack' ),
244+
'parent' => $this->pageSlug
245+
],
242246
'aioseo-local-seo' => [
243247
'menu_title' => esc_html__( 'Local SEO', 'all-in-one-seo-pack' ),
244248
'parent' => $this->pageSlug
@@ -248,8 +252,7 @@ public function setPages() {
248252
'parent' => $this->pageSlug
249253
],
250254
'aioseo-search-statistics' => [
251-
'menu_title' => esc_html__( 'Search Statistics', 'all-in-one-seo-pack' ) . $newIndicator,
252-
'page_title' => esc_html__( 'Search Statistics', 'all-in-one-seo-pack' ),
255+
'menu_title' => esc_html__( 'Search Statistics', 'all-in-one-seo-pack' ),
253256
'parent' => $this->pageSlug
254257
],
255258
'aioseo-tools' => [
@@ -844,6 +847,7 @@ public function hooks() {
844847
'sitemaps',
845848
'link-assistant',
846849
'redirects',
850+
'ai-insights',
847851
'local-seo',
848852
'seo-analysis',
849853
'search-statistics',
@@ -1194,11 +1198,11 @@ public function appendTrashedMessage( $messages ) {
11941198
return $messages;
11951199
}
11961200

1197-
if ( function_exists( 'aioseoRedirects' ) && aioseoRedirects()->options->monitor->trash ) {
1201+
if ( ! empty( aioseo()->redirects->options ) && aioseo()->redirects->options->monitor->trash ) {
11981202
return $messages;
11991203
}
12001204

1201-
if ( empty( $_GET['ids'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
1205+
if ( empty( $_GET['ids'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended
12021206
return $messages;
12031207
}
12041208

app/Common/Admin/Notices/ConflictingPlugins.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ public function __construct() {
3030
* @return void
3131
*/
3232
public function maybeShowNotice() {
33-
$dismissed = get_option( '_aioseo_conflicting_plugins_dismissed', true );
33+
$userId = get_current_user_id();
34+
$dismissed = get_user_meta( $userId, '_aioseo_conflicting_plugins_dismissed', true );
3435
if ( '1' === $dismissed ) {
3536
return;
3637
}
3738

38-
if ( ! current_user_can( 'activate_plugins' ) ) {
39+
if ( ! current_user_can( 'deactivate_plugins' ) ) {
3940
return;
4041
}
4142

@@ -168,7 +169,8 @@ public function dismissNotice() {
168169

169170
check_ajax_referer( 'aioseo-dismiss-conflicting-plugins', 'nonce' );
170171

171-
update_option( '_aioseo_conflicting_plugins_dismissed', true );
172+
$userId = get_current_user_id();
173+
update_user_meta( $userId, '_aioseo_conflicting_plugins_dismissed', true );
172174

173175
return wp_send_json_success();
174176
}

app/Common/Admin/Notices/WpNotices.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ public function adminNotices() {
251251
}
252252

253253
$notices = $this->getNoticesInContext();
254+
$notices = array_filter( $notices, function( $notice ) {
255+
return is_array( $notice );
256+
} );
257+
254258
foreach ( $notices as $notice ) {
255259
// Hide snackbar notices on classic editor.
256260
if ( ! empty( $notice['options']['type'] ) && 'snackbar' === $notice['options']['type'] ) {
@@ -270,8 +274,8 @@ class="notice notice-<?php echo esc_attr( $status ) ?> <?php echo esc_attr( $cla
270274
if ( ! empty( $action['url'] ) ) {
271275
$class = ! empty( $action['class'] ) ? $action['class'] : '';
272276
$target = ! empty( $action['target'] ) ? $action['target'] : '';
273-
echo '<a
274-
href="' . esc_attr( $action['url'] ) . '"
277+
echo '<a
278+
href="' . esc_attr( $action['url'] ) . '"
275279
class="' . esc_attr( $class ) . '"
276280
target="' . esc_attr( $target ) . '"
277281
>';

app/Common/Admin/SlugMonitor.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,11 @@ public function postUpdated( $postId, $post = null, $postBefore = null ) {
119119

120120
// Default notice redirecting to the Redirects screen.
121121
$action = [
122-
'url' => $redirectUrl,
123-
'label' => __( 'Add Redirect to improve SEO', 'all-in-one-seo-pack' ),
124-
'target' => '_blank',
125-
'class' => 'aioseo-redirects-slug-changed'
122+
'url' => $redirectUrl,
123+
'label' => __( 'Add Redirect to improve SEO', 'all-in-one-seo-pack' ),
124+
'class' => 'aioseo-redirects-slug-changed'
126125
];
127126

128-
// If redirects is active we'll show add-redirect in a modal.
129-
if ( aioseo()->addons->getLoadedAddon( 'redirects' ) ) {
130-
// We need to remove the target here so the action keeps the url used by the add-redirect modal.
131-
unset( $action['target'] );
132-
}
133-
134127
aioseo()->wpNotices->addNotice( $message, 'warning', [ 'actions' => [ $action ] ], [ 'posts' ] );
135128
}
136129

@@ -173,11 +166,11 @@ private function canMonitorPost( $post, $postBefore ) {
173166
* @return bool True if an automatic redirect was added.
174167
*/
175168
private function automaticRedirect( $postType, $before, $after ) {
176-
if ( ! aioseo()->addons->getLoadedAddon( 'redirects' ) ) {
169+
if ( empty( aioseo()->redirects->isActive ) ) {
177170
return false;
178171
}
179172

180-
return aioseoRedirects()->monitor->automaticRedirect( $postType, $before, $after );
173+
return aioseo()->redirects->monitor->automaticRedirect( $postType, $before, $after );
181174
}
182175

183176
/**
@@ -189,10 +182,10 @@ private function automaticRedirect( $postType, $before, $after ) {
189182
* @return string The redirect link.
190183
*/
191184
public function manualRedirectUrl( $urls ) {
192-
if ( ! aioseo()->addons->getLoadedAddon( 'redirects' ) ) {
185+
if ( empty( aioseo()->redirects->isActive ) ) {
193186
return admin_url( 'admin.php?page=aioseo-redirects' );
194187
}
195188

196-
return aioseoRedirects()->helpers->manualRedirectUrl( $urls );
189+
return aioseo()->redirects->helpers->manualRedirectUrl( $urls );
197190
}
198191
}

app/Common/Admin/Usage.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ abstract public function getType();
4646
*/
4747
public function __construct() {
4848
add_action( 'init', [ $this, 'init' ], 2 );
49+
50+
add_action( 'aioseo_send_usage_data', [ $this, 'process' ] );
4951
}
5052

5153
/**
@@ -64,9 +66,6 @@ public function init() {
6466
return;
6567
}
6668

67-
// Register the action handler.
68-
add_action( $action, [ $this, 'process' ] );
69-
7069
if ( ! as_next_scheduled_action( $action ) ) {
7170
as_schedule_recurring_action( $this->generateStartDate(), WEEK_IN_SECONDS, $action, [], 'aioseo' );
7271

app/Common/Ai/Ai.php

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
* @since 4.8.4
1414
*/
1515
class Ai {
16+
/**
17+
* The assistant class.
18+
*
19+
* @since 4.9.1
20+
*
21+
* @var Assistant|null
22+
*/
23+
public $assistant = null;
24+
1625
/**
1726
* The image class.
1827
*
@@ -41,6 +50,15 @@ class Ai {
4150
*/
4251
private $aiGeneratorApiUrl = 'https://ai-generator.aioseo.com/v1/';
4352

53+
/**
54+
* The action name for getting the access token.
55+
*
56+
* @since 4.9.1
57+
*
58+
* @var string
59+
*/
60+
protected $getAccessTokenAction = 'aioseo_ai_get_access_token';
61+
4462
/**
4563
* The action name for fetching credits.
4664
*
@@ -56,9 +74,10 @@ class Ai {
5674
* @since 4.8.4
5775
*/
5876
public function __construct() {
59-
add_action( 'init', [ $this, 'getAccessToken' ] );
60-
77+
add_action( 'init', [ $this, 'scheduleGetAccessToken' ] );
6178
add_action( 'init', [ $this, 'scheduleCreditFetchAction' ] );
79+
80+
add_action( $this->getAccessTokenAction, [ $this, 'getAccessToken' ] );
6281
add_action( $this->creditFetchAction, [ $this, 'updateCredits' ] );
6382

6483
// If param is set, fetch credits but just once per 5 minutes to prevent abuse.
@@ -71,7 +90,25 @@ public function __construct() {
7190
aioseo()->core->cache->update( 'ai_get_credits', true, 5 * MINUTE_IN_SECONDS );
7291
}
7392

74-
$this->image = new Image();
93+
$this->assistant = new Assistant();
94+
$this->image = new Image();
95+
}
96+
97+
/**
98+
* Schedules the initial access token fetch action if no access token is set.
99+
*
100+
* @since 4.9.1
101+
*
102+
* @return void
103+
*/
104+
public function scheduleGetAccessToken() {
105+
if ( aioseo()->internalOptions->internal->ai->accessToken ) {
106+
return;
107+
}
108+
109+
if ( ! aioseo()->actionScheduler->isScheduled( $this->getAccessTokenAction ) ) {
110+
aioseo()->actionScheduler->scheduleSingle( $this->getAccessTokenAction, 0, [], true );
111+
}
75112
}
76113

77114
/**
@@ -219,6 +256,10 @@ public function updateCredits( $refresh = false ) {
219256
} else {
220257
aioseo()->internalOptions->internal->ai->credits->license->reset();
221258
}
259+
260+
if ( ! empty( $data->costPerFeature ) ) {
261+
aioseo()->internalOptions->internal->ai->costPerFeature = json_decode( wp_json_encode( $data->costPerFeature ), true );
262+
}
222263
}
223264

224265
/**

app/Common/Ai/Assistant.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace AIOSEO\Plugin\Common\Ai;
3+
4+
// Exit if accessed directly.
5+
if ( ! defined( 'ABSPATH' ) ) {
6+
exit;
7+
}
8+
9+
/**
10+
* AI Assistant handler for managing AI Assistant blocks.
11+
*
12+
* @since 4.9.1
13+
*/
14+
class Assistant {
15+
/**
16+
* Returns the data for Vue.
17+
*
18+
* @since 4.9.1
19+
*
20+
* @param int|null $objectId The object ID.
21+
* @return array The data.
22+
*/
23+
public function getVueDataEdit( $objectId = null ) {
24+
$objectId = $objectId ?: absint( get_the_ID() );
25+
26+
return [
27+
'extend' => [
28+
'blockEditorInserterButton' => apply_filters( 'aioseo_ai_assistant_extend_block_editor_inserter_button', true, $objectId ),
29+
]
30+
];
31+
}
32+
}

0 commit comments

Comments
 (0)