88namespace Progress_Planner \Suggested_Tasks \Providers \Integrations \AIOSEO ;
99
1010use Progress_Planner \Suggested_Tasks \Data_Collector \Post_Author ;
11+ use Progress_Planner \Suggested_Tasks \Providers \Traits \Task_Action_Builder ;
12+ use Progress_Planner \Suggested_Tasks \Providers \Traits \Ajax_Security_AIOSEO ;
1113
1214/**
1315 * Add task for All in One SEO: disable author RSS feeds.
1416 */
1517class Crawl_Settings_Feed_Authors extends AIOSEO_Interactive_Provider {
1618
19+ use Task_Action_Builder;
20+ use Ajax_Security_AIOSEO;
21+
1722 /**
1823 * The minimum number of posts with a post format to add the task.
1924 *
@@ -145,19 +150,13 @@ public function print_popover_form_contents() {
145150 * @return void
146151 */
147152 public function handle_interactive_task_specific_submit () {
148- if ( ! \function_exists ( 'aioseo ' ) ) {
149- \wp_send_json_error ( [ 'message ' => \esc_html__ ( 'AIOSEO is not active. ' , 'progress-planner ' ) ] );
150- }
153+ $ this ->verify_aioseo_active_or_fail ();
154+ $ this ->verify_nonce_or_fail ();
151155
152- // Check the nonce.
153- if ( ! \check_ajax_referer ( 'progress_planner ' , 'nonce ' , false ) ) {
154- \wp_send_json_error ( [ 'message ' => \esc_html__ ( 'Invalid nonce. ' , 'progress-planner ' ) ] );
155- }
156-
157- \aioseo ()->options ->searchAppearance ->advanced ->crawlCleanup ->feeds ->authors = false ;
156+ \aioseo ()->options ->searchAppearance ->advanced ->crawlCleanup ->feeds ->authors = false ; // @phpstan-ignore-line
158157
159158 // Update the option.
160- \aioseo ()->options ->save ();
159+ \aioseo ()->options ->save (); // @phpstan-ignore-line
161160
162161 \wp_send_json_success ( [ 'message ' => \esc_html__ ( 'Setting updated. ' , 'progress-planner ' ) ] );
163162 }
@@ -171,11 +170,6 @@ public function handle_interactive_task_specific_submit() {
171170 * @return array
172171 */
173172 public function add_task_actions ( $ data = [], $ actions = [] ) {
174- $ actions [] = [
175- 'priority ' => 10 ,
176- 'html ' => '<a href="#" class="prpl-tooltip-action-text" role="button" onclick="document.getElementById( \'prpl-popover- ' . \esc_attr ( static ::POPOVER_ID ) . '\')?.showPopover();return false;"> ' . \esc_html__ ( 'Disable ' , 'progress-planner ' ) . '</a> ' ,
177- ];
178-
179- return $ actions ;
173+ return $ this ->add_popover_action ( $ actions , \__ ( 'Disable ' , 'progress-planner ' ) );
180174 }
181175}
0 commit comments