| @@ -46,8 +46,19 @@ | ||
| 46 | 46 | $this->additional_hooks(); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | + * Use the plugin version for cache-busting wizard assets. | |
| 51 | + * | |
| 52 | + * @since 4.2.0 | |
| 53 | + * | |
| 54 | + * @return string Version number. | |
| 55 | + */ | |
| 56 | + protected function get_version() { | |
| 57 | + return TOP_TEN_VERSION; | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 50 | 61 | * Additional hooks specific to Top 10. |
| 51 | 62 | * |
| 52 | 63 | * @since 4.2.0 |
| 53 | 64 | */ |
| @@ -53,9 +64,8 @@ | ||
| 53 | 64 | */ |
| 54 | 65 | protected function additional_hooks() { |
| 55 | 66 | // Trigger wizard setup logic on plugin activation. |
| 56 | 67 | add_action( 'tptn_activate', array( $this, 'trigger_wizard_on_activation' ) ); |
| 57 | - add_action( 'admin_init', array( $this, 'register_wizard_notice' ) ); | |
| 58 | 68 | |
| 59 | 69 | // Register Tom Select AJAX handlers for wizard taxonomy fields. |
| 60 | 70 | add_action( 'wp_ajax_nopriv_' . $this->prefix . '_taxonomy_search_tom_select', array( Settings::class, 'taxonomy_search_tom_select' ) ); |
| 61 | 71 | add_action( 'wp_ajax_' . $this->prefix . '_taxonomy_search_tom_select', array( Settings::class, 'taxonomy_search_tom_select' ) ); |
| @@ -199,9 +209,8 @@ | ||
| 199 | 209 | 'step_of' => __( 'Step %1$d of %2$d', 'top-10' ), |
| 200 | 210 | 'wizard_complete' => __( 'Setup Complete!', 'top-10' ), |
| 201 | 211 | 'setup_complete' => __( 'Your Top 10 plugin has been configured successfully. You can now start displaying popular posts on your site!', 'top-10' ), |
| 202 | 212 | 'go_to_settings' => __( 'Go to Settings', 'top-10' ), |
| 203 | - 'checkbox_modified' => __( 'Modified from default setting', 'top-10' ), | |
| 204 | 213 | ); |
| 205 | 214 | } |
| 206 | 215 | |
| 207 | 216 | /** |
| @@ -216,45 +225,8 @@ | ||
| 216 | 225 | set_transient( 'tptn_show_wizard_activation_redirect', true, HOUR_IN_SECONDS ); |
| 217 | 226 | |
| 218 | 227 | // Also set an option for more persistent storage in multisite environments. |
| 219 | 228 | update_option( 'tptn_show_wizard', true ); |
| 220 | - } | |
| 221 | - | |
| 222 | - /** | |
| 223 | - * Register the wizard notice with the Admin_Notices_API. | |
| 224 | - * | |
| 225 | - * @since 4.2.0 | |
| 226 | - */ | |
| 227 | - public function register_wizard_notice() { | |
| 228 | - $admin_notices_api = wz_top_ten()->admin->admin_notices_api; | |
| 229 | - if ( ! $admin_notices_api ) { | |
| 230 | - return; | |
| 231 | - } | |
| 232 | - | |
| 233 | - $admin_notices_api->register_notice( | |
| 234 | - array( | |
| 235 | - 'id' => 'tptn_wizard_notice', | |
| 236 | - 'message' => sprintf( | |
| 237 | - '<p>%s</p><p><a href="%s" class="button button-primary">%s</a></p>', | |
| 238 | - esc_html__( 'Welcome to Top 10! Would you like to run the setup wizard to configure the plugin?', 'top-10' ), | |
| 239 | - esc_url( admin_url( 'admin.php?page=tptn_wizard' ) ), | |
| 240 | - esc_html__( 'Run Setup Wizard', 'top-10' ) | |
| 241 | - ), | |
| 242 | - 'type' => 'info', | |
| 243 | - 'dismissible' => true, | |
| 244 | - 'capability' => 'manage_options', | |
| 245 | - 'conditions' => array( | |
| 246 | - function () { | |
| 247 | - $page = sanitize_key( (string) filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ); | |
| 248 | - | |
| 249 | - return ! $this->is_wizard_completed() && | |
| 250 | - ! get_option( 'tptn_wizard_notice_dismissed', false ) && | |
| 251 | - ( get_transient( 'tptn_show_wizard_activation_redirect' ) || get_option( 'tptn_show_wizard', false ) ) && | |
| 252 | - 'tptn_wizard' !== $page; | |
| 253 | - }, | |
| 254 | - ), | |
| 255 | - ) | |
| 256 | - ); | |
| 257 | 229 | } |
| 258 | 230 | |
| 259 | 231 | /** |
| 260 | 232 | * Get the URL to redirect to after wizard completion. |