| @@ -82,9 +82,8 @@ | ||
| 82 | 82 | $this->add_action( 'mainwp_guided_tours_option_update', array( &$this, 'ajax_guided_tours_option_update' ) ); |
| 83 | 83 | $this->add_action( 'mainwp_help_modal_content_update', array( &$this, 'ajax_mainwp_help_modal_content_update' ) ); |
| 84 | 84 | $this->add_action( 'mainwp_widgets_connections_status_details_display_rows', array( MainWP_Connection_Status::instance(), 'ajax_display_rows' ) ); |
| 85 | 85 | |
| 86 | - | |
| 87 | 86 | // Page: Recent Posts. |
| 88 | 87 | if ( \mainwp_current_user_can( 'dashboard', 'manage_posts' ) ) { |
| 89 | 88 | $this->add_action( 'mainwp_post_unpublish', array( &$this, 'mainwp_post_unpublish' ) ); |
| 90 | 89 | $this->add_action( 'mainwp_post_publish', array( &$this, 'mainwp_post_publish' ) ); |
| @@ -540,8 +539,21 @@ | ||
| 540 | 539 | $this->secure_request( 'mainwp_notice_status_update' ); |
| 541 | 540 | |
| 542 | 541 | // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 543 | 542 | $no_id = isset( $_POST['notice_id'] ) ? sanitize_text_field( wp_unslash( $_POST['notice_id'] ) ) : false; |
| 543 | + | |
| 544 | + if ( ! empty( $_POST['short_term'] ) ) { | |
| 545 | + if ( empty( $no_id ) ) { | |
| 546 | + die( 'invalid' ); | |
| 547 | + } | |
| 548 | + | |
| 549 | + $keys = explode( ';', $no_id ); | |
| 550 | + foreach ( $keys as $key ) { | |
| 551 | + MainWP_Utility::dismiss_short_term_notice( $key ); | |
| 552 | + } | |
| 553 | + die( 'dismissed' ); | |
| 554 | + } | |
| 555 | + | |
| 544 | 556 | if ( 'mail_failed' === $no_id ) { |
| 545 | 557 | MainWP_Utility::update_option( 'mainwp_notice_wp_mail_failed', 'hide' ); |
| 546 | 558 | die( 'ok' ); |
| 547 | 559 | } |
| @@ -1072,10 +1084,10 @@ | ||
| 1072 | 1084 | echo wp_json_encode( $ret ); |
| 1073 | 1085 | exit; |
| 1074 | 1086 | } |
| 1075 | 1087 | |
| 1076 | - $client_id = 0; // 0 general fields. | |
| 1077 | - $deleted_count = 0; | |
| 1088 | + $client_id = 0; // 0 general fields. | |
| 1089 | + $deleted_count = 0; | |
| 1078 | 1090 | foreach ( $field_ids as $field_id ) { |
| 1079 | 1091 | if ( MainWP_DB_Client::instance()->delete_client_field_by( 'field_id', $field_id, $client_id ) ) { |
| 1080 | 1092 | ++$deleted_count; |
| 1081 | 1093 | } |
| @@ -2007,8 +2019,25 @@ | ||
| 2007 | 2019 | $results = array(); |
| 2008 | 2020 | } |
| 2009 | 2021 | |
| 2010 | 2022 | wp_send_json( $results ); |
| 2023 | + } | |
| 2024 | + | |
| 2025 | + /** | |
| 2026 | + * Handle self_connect action. | |
| 2027 | + */ | |
| 2028 | + public function ajax_self_connect() { | |
| 2029 | + | |
| 2030 | + $mainwp_run = isset( $_POST['mainwp_run'] ) ? sanitize_text_field( wp_unslash( $_POST['mainwp_run'] ) ) : ''; // phpcs:ignore -- NOSONAR -ok. | |
| 2031 | + | |
| 2032 | + if ( 'self_connect' !== $mainwp_run ) { | |
| 2033 | + status_header( 400 ); | |
| 2034 | + exit; | |
| 2035 | + } | |
| 2036 | + | |
| 2037 | + MainWP_System_Utility::instance()->handle_self_connect(); | |
| 2038 | + | |
| 2039 | + exit; | |
| 2011 | 2040 | } |
| 2012 | 2041 | |
| 2013 | 2042 | |
| 2014 | 2043 | /** |