diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php index f53740680..9a2069c8e 100644 --- a/all_in_one_seo_pack.php +++ b/all_in_one_seo_pack.php @@ -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.3.1 + * Version: 4.7.4.1 * Text Domain: all-in-one-seo-pack * Domain Path: /languages * License: GPL-3.0+ diff --git a/app/AIOSEO.php b/app/AIOSEO.php index a68134ae2..e37447677 100644 --- a/app/AIOSEO.php +++ b/app/AIOSEO.php @@ -323,6 +323,7 @@ public function load() { $this->filters = $this->pro ? new Pro\Main\Filters() : new Lite\Main\Filters(); $this->crawlCleanup = new Common\QueryArgs\CrawlCleanup(); $this->emailReports = new Common\EmailReports\EmailReports(); + $this->writingAssistant = new Common\WritingAssistant\WritingAssistant(); if ( ! wp_doing_ajax() && ! wp_doing_cron() ) { $this->rss = new Common\Rss(); diff --git a/app/AIOSEOAbstract.php b/app/AIOSEOAbstract.php index f0727a983..e2e4da7ed 100644 --- a/app/AIOSEOAbstract.php +++ b/app/AIOSEOAbstract.php @@ -580,4 +580,13 @@ abstract class AIOSEOAbstract { * @var null|\AIOSEO\Plugin\Common\EmailReports\EmailReports */ public $emailReports = null; + + /** + * WritingAssistant class instance. + * + * @since 4.7.4 + * + * @var null|\AIOSEO\Plugin\Common\WritingAssistant\WritingAssistant + */ + public $writingAssistant = null; } \ No newline at end of file diff --git a/app/Common/Admin/Admin.php b/app/Common/Admin/Admin.php index 783c6f604..e8c20f6d0 100644 --- a/app/Common/Admin/Admin.php +++ b/app/Common/Admin/Admin.php @@ -88,6 +88,7 @@ class Admin { */ public function __construct() { new SeoAnalysis(); + new WritingAssistant(); include_once ABSPATH . 'wp-admin/includes/plugin.php'; if ( diff --git a/app/Common/Admin/PostSettings.php b/app/Common/Admin/PostSettings.php index 12b816c14..9b52d22e9 100644 --- a/app/Common/Admin/PostSettings.php +++ b/app/Common/Admin/PostSettings.php @@ -334,7 +334,7 @@ public function getPostTypeOverview( $postType ) { '{"focus":{"keyphrase":""%', '{"focus":{"keyphrase":""%', $postType, - ...$specialPageIds + ...array_values( $specialPageIds ) ), ARRAY_A ); diff --git a/app/Common/Admin/WritingAssistant.php b/app/Common/Admin/WritingAssistant.php new file mode 100644 index 000000000..c5cb3df06 --- /dev/null +++ b/app/Common/Admin/WritingAssistant.php @@ -0,0 +1,110 @@ +delete(); + } + + /** + * Adds a meta box to the page/posts screens. + * + * @since 4.7.4 + * + * @return void + */ + public function addMetabox() { + if ( ! aioseo()->access->hasCapability( 'aioseo_page_writing_assistant_settings' ) ) { + return; + } + + if ( + ! aioseo()->options->writingAssistant->postTypes->all && + ! in_array( get_post_type(), aioseo()->options->writingAssistant->postTypes->included, true ) + ) { + return; + } + + // Skip post types that do not support an editor. + if ( ! post_type_supports( get_post_type(), 'editor' ) ) { + return; + } + + add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ] ); + + // Translators: 1 - The plugin short name ("AIOSEO"). + $aioseoMetaboxTitle = sprintf( esc_html__( '%1$s Writing Assistant', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME ); + + add_meta_box( + 'aioseo-writing-assistant-metabox', + $aioseoMetaboxTitle, + [ $this, 'renderMetabox' ], + null, + 'normal', + 'low' + ); + } + + /** + * Render the on-page settings metabox with the Vue App wrapper. + * + * @since 4.7.4 + * + * @return void + */ + public function renderMetabox() { + ?> +
+ {{ column.label }} + + + + + | +
---|
+
+ |
+
+
+ {{ strings.noResults }}
+
+ |
+
+
+
+
+
+ {{ column.label }} + | +