| @@ -1,335 +1,346 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly. |
| 3 | -defined( 'ABSPATH' ) || exit; | |
| 3 | +defined('ABSPATH') || exit; | |
| 4 | 4 | |
| 5 | -class Blockspare_Setup { | |
| 5 | +class Blockspare_Setup | |
| 6 | +{ | |
| 6 | 7 | |
| 7 | - public $name; | |
| 8 | - public $type; | |
| 9 | - public $dismiss_url; | |
| 10 | - public $temporary_dismiss_url; | |
| 11 | - public $pricing_url; | |
| 12 | - public $current_user_id; | |
| 8 | + public $name; | |
| 9 | + public $type; | |
| 10 | + public $dismiss_url; | |
| 11 | + public $temporary_dismiss_url; | |
| 12 | + public $pricing_url; | |
| 13 | + public $current_user_id; | |
| 13 | 14 | |
| 14 | - /** | |
| 15 | - * Constructor. | |
| 16 | - */ | |
| 17 | - public function __construct( $name, $type, $dismiss_url, $temporary_dismiss_url ) { | |
| 15 | + /** | |
| 16 | + * Constructor. | |
| 17 | + */ | |
| 18 | + public function __construct($name, $type, $dismiss_url, $temporary_dismiss_url) | |
| 19 | + { | |
| 18 | 20 | |
| 19 | - $this->name = $name; | |
| 20 | - $this->type = $type; | |
| 21 | - $this->dismiss_url = $dismiss_url; | |
| 22 | - $this->temporary_dismiss_url = $temporary_dismiss_url; | |
| 23 | - $this->pricing_url = 'https://www.blockspare.com/'; | |
| 24 | - $this->current_user_id = get_current_user_id(); | |
| 21 | + $this->name = $name; | |
| 22 | + $this->type = $type; | |
| 23 | + $this->dismiss_url = $dismiss_url; | |
| 24 | + $this->temporary_dismiss_url = $temporary_dismiss_url; | |
| 25 | + $this->pricing_url = 'https://www.blockspare.com/'; | |
| 26 | + $this->current_user_id = get_current_user_id(); | |
| 25 | 27 | |
| 26 | - add_action( 'admin_notices', array( $this, 'notice' ) ); | |
| 28 | + add_action('admin_notices', array($this, 'notice')); | |
| 27 | 29 | |
| 28 | - $this->dismiss_notice(); | |
| 29 | - $this->dismiss_notice_temporary(); | |
| 30 | - } | |
| 30 | + $this->dismiss_notice(); | |
| 31 | + $this->dismiss_notice_temporary(); | |
| 32 | + } | |
| 31 | 33 | |
| 32 | - /** | |
| 33 | - * Display notice. | |
| 34 | - */ | |
| 35 | - public function notice() { | |
| 34 | + /** | |
| 35 | + * Display notice. | |
| 36 | + */ | |
| 37 | + public function notice() | |
| 38 | + { | |
| 36 | 39 | |
| 37 | - if ( ! current_user_can( 'publish_posts' ) ) { | |
| 38 | - return; | |
| 39 | - } | |
| 40 | + if (! current_user_can('publish_posts')) { | |
| 41 | + return; | |
| 42 | + } | |
| 40 | 43 | |
| 41 | - $current_screen = get_current_screen(); | |
| 44 | + $current_screen = get_current_screen(); | |
| 42 | 45 | |
| 43 | - if ( ! $current_screen ) { | |
| 44 | - return; | |
| 45 | - } | |
| 46 | + if (! $current_screen) { | |
| 47 | + return; | |
| 48 | + } | |
| 46 | 49 | |
| 47 | - if ( | |
| 48 | - 'dashboard' !== $current_screen->id && | |
| 49 | - 'themes' !== $current_screen->id && | |
| 50 | - 'plugins' !== $current_screen->id | |
| 51 | - ) { | |
| 52 | - return; | |
| 53 | - } | |
| 54 | 50 | |
| 55 | - if ( ! $this->is_dismiss_notice() ) { | |
| 56 | - $this->notice_markup(); | |
| 57 | - } | |
| 51 | + if ( | |
| 52 | + 'dashboard' !== $current_screen->id && | |
| 53 | + 'themes' !== $current_screen->id && | |
| 54 | + 'plugins' !== $current_screen->id | |
| 55 | + ) { | |
| 56 | + return; | |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | - /** | |
| 61 | - * Check if notice dismissed. | |
| 62 | - */ | |
| 63 | - private function is_dismiss_notice() { | |
| 64 | - return apply_filters( 'blockspare_' . $this->name . '_notice_dismiss', false ); | |
| 59 | + if (! $this->is_dismiss_notice()) { | |
| 60 | + $this->notice_markup(); | |
| 65 | 61 | } |
| 62 | + } | |
| 66 | 63 | |
| 67 | - /** | |
| 68 | - * Notice markup. | |
| 69 | - */ | |
| 70 | - public function notice_markup() { | |
| 71 | - echo ''; | |
| 72 | - } | |
| 64 | + /** | |
| 65 | + * Check if notice dismissed. | |
| 66 | + */ | |
| 67 | + private function is_dismiss_notice() | |
| 68 | + { | |
| 69 | + return apply_filters('blockspare_' . $this->name . '_notice_dismiss', false); | |
| 70 | + } | |
| 73 | 71 | |
| 74 | - /** | |
| 75 | - * Permanently dismiss notice. | |
| 76 | - */ | |
| 77 | - public function dismiss_notice() { | |
| 72 | + /** | |
| 73 | + * Notice markup. | |
| 74 | + */ | |
| 75 | + public function notice_markup() | |
| 76 | + { | |
| 77 | + echo ''; | |
| 78 | + } | |
| 78 | 79 | |
| 79 | - if ( | |
| 80 | - isset( $_GET['blockspare_setup_notice_dismiss'] ) && | |
| 81 | - isset( $_GET['_blockspare_setup_notice_dismiss_nonce'] ) | |
| 82 | - ) { | |
| 80 | + /** | |
| 81 | + * Permanently dismiss notice. | |
| 82 | + */ | |
| 83 | + public function dismiss_notice() | |
| 84 | + { | |
| 83 | 85 | |
| 84 | - if ( | |
| 85 | - ! wp_verify_nonce( | |
| 86 | - wp_unslash( $_GET['_blockspare_setup_notice_dismiss_nonce'] ), | |
| 87 | - 'blockspare_setup_notice_dismiss_nonce' | |
| 88 | - ) | |
| 89 | - ) { | |
| 90 | - wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'blockspare' ) ); | |
| 91 | - } | |
| 86 | + if ( | |
| 87 | + isset($_GET['blockspare_setup_notice_dismiss']) && | |
| 88 | + isset($_GET['_blockspare_setup_notice_dismiss_nonce']) | |
| 89 | + ) { | |
| 92 | 90 | |
| 93 | - if ( ! current_user_can( 'publish_posts' ) ) { | |
| 94 | - wp_die( esc_html__( 'Cheatin’ huh?', 'blockspare' ) ); | |
| 95 | - } | |
| 91 | + if ( | |
| 92 | + ! wp_verify_nonce( | |
| 93 | + wp_unslash($_GET['_blockspare_setup_notice_dismiss_nonce']), | |
| 94 | + 'blockspare_setup_notice_dismiss_nonce' | |
| 95 | + ) | |
| 96 | + ) { | |
| 97 | + wp_die(esc_html__('Action failed. Please refresh the page and retry.', 'blockspare')); | |
| 98 | + } | |
| 96 | 99 | |
| 97 | - $dismiss_notice = sanitize_text_field( wp_unslash( $_GET['blockspare_setup_notice_dismiss'] ) ); | |
| 100 | + if (! current_user_can('publish_posts')) { | |
| 101 | + wp_die(esc_html__('Cheatin’ huh?', 'blockspare')); | |
| 102 | + } | |
| 98 | 103 | |
| 99 | - // FIX: Match current notice name dynamically instead of hardcoded 'setup' | |
| 100 | - if ( $this->name === $dismiss_notice ) { | |
| 101 | - update_user_meta( | |
| 102 | - $this->current_user_id, | |
| 103 | - 'blockspare_' . $dismiss_notice . '_notice_dismiss', | |
| 104 | - 'yes' | |
| 105 | - ); | |
| 106 | - | |
| 107 | - wp_safe_redirect( remove_query_arg( array( 'blockspare_setup_notice_dismiss', '_blockspare_setup_notice_dismiss_nonce' ) ) ); | |
| 108 | - exit; | |
| 109 | - } | |
| 110 | - } | |
| 104 | + $dismiss_notice = sanitize_text_field(wp_unslash($_GET['blockspare_setup_notice_dismiss'])); | |
| 105 | + | |
| 106 | + // FIX: Match current notice name dynamically instead of hardcoded 'setup' | |
| 107 | + if ($this->name === $dismiss_notice) { | |
| 108 | + update_user_meta( | |
| 109 | + $this->current_user_id, | |
| 110 | + 'blockspare_' . $dismiss_notice . '_notice_dismiss', | |
| 111 | + 'yes' | |
| 112 | + ); | |
| 113 | + | |
| 114 | + wp_safe_redirect(remove_query_arg(array('blockspare_setup_notice_dismiss', '_blockspare_setup_notice_dismiss_nonce'))); | |
| 115 | + exit; | |
| 116 | + } | |
| 111 | 117 | } |
| 118 | + } | |
| 112 | 119 | |
| 113 | - /** | |
| 114 | - * Temporarily dismiss notice. | |
| 115 | - */ | |
| 116 | - public function dismiss_notice_temporary() { | |
| 120 | + /** | |
| 121 | + * Temporarily dismiss notice. | |
| 122 | + */ | |
| 123 | + public function dismiss_notice_temporary() | |
| 124 | + { | |
| 117 | 125 | |
| 118 | - if ( | |
| 119 | - isset( $_GET['blockspare_setup_notice_dismiss_temporary'] ) && | |
| 120 | - isset( $_GET['_blockspare_setup_notice_dismiss_temporary_nonce'] ) | |
| 121 | - ) { | |
| 126 | + if ( | |
| 127 | + isset($_GET['blockspare_setup_notice_dismiss_temporary']) && | |
| 128 | + isset($_GET['_blockspare_setup_notice_dismiss_temporary_nonce']) | |
| 129 | + ) { | |
| 122 | 130 | |
| 123 | - if ( | |
| 124 | - ! wp_verify_nonce( | |
| 125 | - wp_unslash( $_GET['_blockspare_setup_notice_dismiss_temporary_nonce'] ), | |
| 126 | - 'blockspare_setup_notice_dismiss_temporary_nonce' | |
| 127 | - ) | |
| 128 | - ) { | |
| 129 | - wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'blockspare' ) ); | |
| 130 | - } | |
| 131 | + if ( | |
| 132 | + ! wp_verify_nonce( | |
| 133 | + wp_unslash($_GET['_blockspare_setup_notice_dismiss_temporary_nonce']), | |
| 134 | + 'blockspare_setup_notice_dismiss_temporary_nonce' | |
| 135 | + ) | |
| 136 | + ) { | |
| 137 | + wp_die(esc_html__('Action failed. Please refresh the page and retry.', 'blockspare')); | |
| 138 | + } | |
| 131 | 139 | |
| 132 | - if ( ! current_user_can( 'publish_posts' ) ) { | |
| 133 | - wp_die( esc_html__( 'Cheatin’ huh?', 'blockspare' ) ); | |
| 134 | - } | |
| 140 | + if (! current_user_can('publish_posts')) { | |
| 141 | + wp_die(esc_html__('Cheatin’ huh?', 'blockspare')); | |
| 142 | + } | |
| 135 | 143 | |
| 136 | - $dismiss_notice = sanitize_text_field( wp_unslash( $_GET['blockspare_setup_notice_dismiss_temporary'] ) ); | |
| 144 | + $dismiss_notice = sanitize_text_field(wp_unslash($_GET['blockspare_setup_notice_dismiss_temporary'])); | |
| 137 | 145 | |
| 138 | - // FIX: Match current notice name dynamically instead of hardcoded 'setup' | |
| 139 | - if ( $this->name === $dismiss_notice ) { | |
| 140 | - update_user_meta( | |
| 141 | - $this->current_user_id, | |
| 142 | - 'blockspare_' . $dismiss_notice . '_notice_dismiss_temporary', | |
| 143 | - 'yes' | |
| 144 | - ); | |
| 145 | - | |
| 146 | - wp_safe_redirect( remove_query_arg( array( 'blockspare_setup_notice_dismiss_temporary', '_blockspare_setup_notice_dismiss_temporary_nonce' ) ) ); | |
| 147 | - exit; | |
| 148 | - } | |
| 149 | - } | |
| 146 | + // FIX: Match current notice name dynamically instead of hardcoded 'setup' | |
| 147 | + if ($this->name === $dismiss_notice) { | |
| 148 | + update_user_meta( | |
| 149 | + $this->current_user_id, | |
| 150 | + 'blockspare_' . $dismiss_notice . '_notice_dismiss_temporary', | |
| 151 | + 'yes' | |
| 152 | + ); | |
| 153 | + | |
| 154 | + wp_safe_redirect(remove_query_arg(array('blockspare_setup_notice_dismiss_temporary', '_blockspare_setup_notice_dismiss_temporary_nonce'))); | |
| 155 | + exit; | |
| 156 | + } | |
| 150 | 157 | } |
| 158 | + } | |
| 151 | 159 | } |
| 152 | 160 | |
| 153 | -class Blockspare_Setup_Notice extends Blockspare_Setup { | |
| 161 | +class Blockspare_Setup_Notice extends Blockspare_Setup | |
| 162 | +{ | |
| 154 | 163 | |
| 155 | - /** | |
| 156 | - * Constructor. | |
| 157 | - */ | |
| 158 | - public function __construct() { | |
| 164 | + /** | |
| 165 | + * Constructor. | |
| 166 | + */ | |
| 167 | + public function __construct() | |
| 168 | + { | |
| 159 | 169 | |
| 160 | - $dismiss_url = wp_nonce_url( | |
| 161 | - add_query_arg( | |
| 162 | - 'blockspare_setup_notice_dismiss', | |
| 163 | - 'setup', | |
| 164 | - admin_url() | |
| 165 | - ), | |
| 166 | - 'blockspare_setup_notice_dismiss_nonce', | |
| 167 | - '_blockspare_setup_notice_dismiss_nonce' | |
| 168 | - ); | |
| 170 | + $dismiss_url = wp_nonce_url( | |
| 171 | + add_query_arg( | |
| 172 | + 'blockspare_setup_notice_dismiss', | |
| 173 | + 'setup', | |
| 174 | + admin_url() | |
| 175 | + ), | |
| 176 | + 'blockspare_setup_notice_dismiss_nonce', | |
| 177 | + '_blockspare_setup_notice_dismiss_nonce' | |
| 178 | + ); | |
| 169 | 179 | |
| 170 | - $temporary_dismiss_url = wp_nonce_url( | |
| 171 | - add_query_arg( | |
| 172 | - 'blockspare_setup_notice_dismiss_temporary', | |
| 173 | - 'setup', | |
| 174 | - admin_url() | |
| 175 | - ), | |
| 176 | - 'blockspare_setup_notice_dismiss_temporary_nonce', | |
| 177 | - '_blockspare_setup_notice_dismiss_temporary_nonce' | |
| 178 | - ); | |
| 180 | + $temporary_dismiss_url = wp_nonce_url( | |
| 181 | + add_query_arg( | |
| 182 | + 'blockspare_setup_notice_dismiss_temporary', | |
| 183 | + 'setup', | |
| 184 | + admin_url() | |
| 185 | + ), | |
| 186 | + 'blockspare_setup_notice_dismiss_temporary_nonce', | |
| 187 | + '_blockspare_setup_notice_dismiss_temporary_nonce' | |
| 188 | + ); | |
| 179 | 189 | |
| 180 | - parent::__construct( | |
| 181 | - 'setup', | |
| 182 | - 'info', | |
| 183 | - $dismiss_url, | |
| 184 | - $temporary_dismiss_url | |
| 185 | - ); | |
| 190 | + parent::__construct( | |
| 191 | + 'setup', | |
| 192 | + 'info', | |
| 193 | + $dismiss_url, | |
| 194 | + $temporary_dismiss_url | |
| 195 | + ); | |
| 186 | 196 | |
| 187 | - $this->set_notice_time(); | |
| 188 | - $this->set_temporary_dismiss_notice_time(); | |
| 189 | - $this->set_dismiss_notice(); | |
| 197 | + $this->set_notice_time(); | |
| 198 | + $this->set_temporary_dismiss_notice_time(); | |
| 199 | + $this->set_dismiss_notice(); | |
| 200 | + } | |
| 201 | + | |
| 202 | + /** | |
| 203 | + * Set initial notice time. | |
| 204 | + */ | |
| 205 | + private function set_notice_time() | |
| 206 | + { | |
| 207 | + if (! get_option('blockspare_setup_notice_start_time')) { | |
| 208 | + update_option('blockspare_setup_notice_start_time', time()); | |
| 190 | 209 | } |
| 210 | + } | |
| 191 | 211 | |
| 192 | - /** | |
| 193 | - * Set initial notice time. | |
| 194 | - */ | |
| 195 | - private function set_notice_time() { | |
| 196 | - if ( ! get_option( 'blockspare_setup_notice_start_time' ) ) { | |
| 197 | - update_option( 'blockspare_setup_notice_start_time', time() ); | |
| 198 | - } | |
| 212 | + /** | |
| 213 | + * Set temporary dismiss time. | |
| 214 | + */ | |
| 215 | + private function set_temporary_dismiss_notice_time() | |
| 216 | + { | |
| 217 | + if ( | |
| 218 | + isset($_GET['blockspare_setup_notice_dismiss_temporary']) && | |
| 219 | + 'setup' === $_GET['blockspare_setup_notice_dismiss_temporary'] | |
| 220 | + ) { | |
| 221 | + update_user_meta( | |
| 222 | + $this->current_user_id, | |
| 223 | + 'blockspare_setup_notice_dismiss_temporary_start_time', | |
| 224 | + time() | |
| 225 | + ); | |
| 199 | 226 | } |
| 227 | + } | |
| 200 | 228 | |
| 201 | - /** | |
| 202 | - * Set temporary dismiss time. | |
| 203 | - */ | |
| 204 | - private function set_temporary_dismiss_notice_time() { | |
| 205 | - if ( | |
| 206 | - isset( $_GET['blockspare_setup_notice_dismiss_temporary'] ) && | |
| 207 | - 'setup' === $_GET['blockspare_setup_notice_dismiss_temporary'] | |
| 208 | - ) { | |
| 209 | - update_user_meta( | |
| 210 | - $this->current_user_id, | |
| 211 | - 'blockspare_setup_notice_dismiss_temporary_start_time', | |
| 212 | - time() | |
| 213 | - ); | |
| 214 | - } | |
| 229 | + /** | |
| 230 | + * Set dismiss conditions. | |
| 231 | + */ | |
| 232 | + public function set_dismiss_notice() | |
| 233 | + { | |
| 234 | + $user_id = get_current_user_id(); | |
| 235 | + | |
| 236 | + $is_permanently_dismissed = ('yes' === get_user_meta($user_id, 'blockspare_setup_notice_dismiss', true)); | |
| 237 | + | |
| 238 | + $temporary_dismiss_time = (int) get_user_meta($user_id, 'blockspare_setup_notice_dismiss_temporary_start_time', true); | |
| 239 | + $is_temporarily_dismissed = ($temporary_dismiss_time > strtotime('-2 days')); | |
| 240 | + | |
| 241 | + // FIX: Clean, predictable condition parsing | |
| 242 | + if ($is_permanently_dismissed || $is_temporarily_dismissed) { | |
| 243 | + add_filter('blockspare_setup_notice_dismiss', '__return_true'); | |
| 244 | + } else { | |
| 245 | + add_filter('blockspare_setup_notice_dismiss', '__return_false'); | |
| 215 | 246 | } |
| 247 | + } | |
| 216 | 248 | |
| 217 | - /** | |
| 218 | - * Set dismiss conditions. | |
| 219 | - */ | |
| 220 | - public function set_dismiss_notice() { | |
| 221 | - $user_id = get_current_user_id(); | |
| 249 | + /** | |
| 250 | + * Notice markup. | |
| 251 | + */ | |
| 252 | + public function notice_markup() | |
| 253 | + { | |
| 222 | 254 | |
| 223 | - $is_permanently_dismissed = ( 'yes' === get_user_meta( $user_id, 'blockspare_setup_notice_dismiss', true ) ); | |
| 224 | - | |
| 225 | - $temporary_dismiss_time = (int) get_user_meta( $user_id, 'blockspare_setup_notice_dismiss_temporary_start_time', true ); | |
| 226 | - $is_temporarily_dismissed = ( $temporary_dismiss_time > strtotime( '-2 days' ) ); | |
| 255 | + if (! function_exists('get_plugin_data')) { | |
| 256 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 257 | + } | |
| 227 | 258 | |
| 228 | - // FIX: Clean, predictable condition parsing | |
| 229 | - if ( $is_permanently_dismissed || $is_temporarily_dismissed ) { | |
| 230 | - add_filter( 'blockspare_setup_notice_dismiss', '__return_true' ); | |
| 231 | - } else { | |
| 232 | - add_filter( 'blockspare_setup_notice_dismiss', '__return_false' ); | |
| 233 | - } | |
| 234 | - } | |
| 259 | + $plugin_data = get_plugin_data(BLOCKSPARE_BASE_FILE); | |
| 260 | + $version = isset($plugin_data['Version']) ? $plugin_data['Version'] : ''; | |
| 235 | 261 | |
| 236 | - /** | |
| 237 | - * Notice markup. | |
| 238 | - */ | |
| 239 | - public function notice_markup() { | |
| 262 | +?> | |
| 240 | 263 | |
| 241 | - if ( ! function_exists( 'get_plugin_data' ) ) { | |
| 242 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 243 | - } | |
| 244 | - | |
| 245 | - $plugin_data = get_plugin_data( BLOCKSPARE_BASE_FILE ); | |
| 246 | - $version = isset( $plugin_data['Version'] ) ? $plugin_data['Version'] : ''; | |
| 247 | - | |
| 248 | - ?> | |
| 249 | - | |
| 250 | - <div class="notice notice-success blockspare-notice-setup" style="padding: 18px; position: relative;"> | |
| 251 | - | |
| 252 | - <div style="display:flex; justify-content:space-between; gap:20px; align-items:flex-start;"> | |
| 253 | - | |
| 254 | - <div style="flex:1;"> | |
| 255 | - | |
| 256 | - <h2 style="margin:0 0 8px; font-size:18px; line-height:1.4;"> | |
| 257 | - <?php esc_html_e( 'Welcome to BlockSpare 👋', 'blockspare' ); ?> | |
| 258 | - </h2> | |
| 259 | - | |
| 260 | - <p style="margin:0 0 12px; font-size:14px; color:#555;"> | |
| 261 | - <?php esc_html_e( 'Build professional news, magazine, blog, and business websites faster using ready-made Gutenberg blocks, starter templates, and content-focused layouts.', 'blockspare' ); ?> | |
| 262 | - </p> | |
| 263 | - | |
| 264 | - <div style="display:flex; gap:10px; flex-wrap:wrap; margin-top:10px;"> | |
| 265 | - | |
| 266 | - <a | |
| 267 | - class="button button-primary" | |
| 268 | - href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page&blockspare_show_intro=true' ) ); ?>" | |
| 269 | - > | |
| 270 | - <?php esc_html_e( 'Get Started', 'blockspare' ); ?> | |
| 271 | - </a> | |
| 272 | - | |
| 273 | - <a | |
| 274 | - class="button" | |
| 275 | - href="<?php echo esc_url( admin_url( 'admin.php?page=blockspare' ) ); ?>" | |
| 276 | - > | |
| 277 | - <?php esc_html_e( 'Browse Templates', 'blockspare' ); ?> | |
| 278 | - </a> | |
| 279 | - | |
| 280 | - <a | |
| 281 | - class="button button-secondary" | |
| 282 | - href="<?php echo esc_url( 'https://blockspare.com/' ); ?>" | |
| 283 | - target="_blank" | |
| 284 | - > | |
| 285 | - <?php esc_html_e( 'Learn More', 'blockspare' ); ?> | |
| 286 | - </a> | |
| 287 | - | |
| 288 | - </div> | |
| 289 | - | |
| 290 | - <?php if ( $version ) : ?> | |
| 291 | - <p style="margin-top:10px; font-size:12px; color:#888;"> | |
| 292 | - <?php echo esc_html( 'Version ' . $version ); ?> | |
| 293 | - </p> | |
| 294 | - <?php endif; ?> | |
| 295 | - | |
| 296 | - </div> | |
| 297 | - | |
| 298 | - <div style="min-width:120px; text-align:right;"> | |
| 299 | - | |
| 300 | - <div style="font-size:12px; color:#777; margin-bottom:8px;"> | |
| 301 | - <?php esc_html_e( 'Quick Setup', 'blockspare' ); ?> | |
| 302 | - </div> | |
| 303 | - | |
| 304 | - <div style="font-size:11px; color:#999;"> | |
| 305 | - <?php esc_html_e( 'Takes less than 2 minutes', 'blockspare' ); ?> | |
| 306 | - </div> | |
| 307 | - | |
| 308 | - </div> | |
| 309 | - | |
| 310 | - </div> | |
| 311 | - | |
| 264 | + <div class="notice notice-success blockspare-notice-setup" style="padding: 18px; position: relative;"> | |
| 265 | + | |
| 266 | + <div style="display:flex; justify-content:space-between; gap:20px; align-items:flex-start;"> | |
| 267 | + | |
| 268 | + <div style="flex:1;"> | |
| 269 | + | |
| 270 | + <h2 style="margin:0 0 8px; font-size:18px; line-height:1.4;"> | |
| 271 | + <?php esc_html_e('Welcome to BlockSpare 👋', 'blockspare'); ?> | |
| 272 | + </h2> | |
| 273 | + | |
| 274 | + <p style="margin:0 0 12px; font-size:14px; color:#555;"> | |
| 275 | + <?php esc_html_e('Build professional news, magazine, blog, and business websites faster using ready-made Gutenberg blocks, starter templates, and content-focused layouts.', 'blockspare'); ?> | |
| 276 | + </p> | |
| 277 | + | |
| 278 | + <div style="display:flex; gap:10px; flex-wrap:wrap; margin-top:10px;"> | |
| 279 | + | |
| 312 | 280 | <a |
| 313 | - class="notice-dismiss" | |
| 314 | - href="<?php echo esc_url( $this->dismiss_url ); ?>" | |
| 315 | - ></a> | |
| 316 | - | |
| 281 | + class="button button-primary" | |
| 282 | + href="<?php echo esc_url(admin_url('post-new.php?post_type=page&blockspare_show_intro=true')); ?>"> | |
| 283 | + <?php esc_html_e('Get Started', 'blockspare'); ?> | |
| 284 | + </a> | |
| 285 | + | |
| 286 | + <a | |
| 287 | + class="button" | |
| 288 | + href="<?php echo esc_url(admin_url('admin.php?page=blockspare')); ?>"> | |
| 289 | + <?php esc_html_e('Browse Templates', 'blockspare'); ?> | |
| 290 | + </a> | |
| 291 | + | |
| 292 | + <a | |
| 293 | + class="button button-secondary" | |
| 294 | + href="<?php echo esc_url('https://blockspare.com/'); ?>" | |
| 295 | + target="_blank"> | |
| 296 | + <?php esc_html_e('Learn More', 'blockspare'); ?> | |
| 297 | + </a> | |
| 298 | + | |
| 299 | + </div> | |
| 300 | + | |
| 301 | + <?php if ($version) : ?> | |
| 302 | + <p style="margin-top:10px; font-size:12px; color:#888;"> | |
| 303 | + <?php echo esc_html('Version ' . $version); ?> | |
| 304 | + </p> | |
| 305 | + <?php endif; ?> | |
| 306 | + | |
| 317 | 307 | </div> |
| 318 | - | |
| 319 | - <?php | |
| 320 | - } | |
| 308 | + | |
| 309 | + <div style="min-width:120px; text-align:right;"> | |
| 310 | + | |
| 311 | + <div style="font-size:12px; color:#777; margin-bottom:8px;"> | |
| 312 | + <?php esc_html_e('Quick Setup', 'blockspare'); ?> | |
| 313 | + </div> | |
| 314 | + | |
| 315 | + <div style="font-size:11px; color:#999;"> | |
| 316 | + <?php esc_html_e('Takes less than 2 minutes', 'blockspare'); ?> | |
| 317 | + </div> | |
| 318 | + | |
| 319 | + </div> | |
| 320 | + | |
| 321 | + </div> | |
| 322 | + | |
| 323 | + <a | |
| 324 | + class="notice-dismiss" | |
| 325 | + href="<?php echo esc_url($this->dismiss_url); ?>"></a> | |
| 326 | + | |
| 327 | + </div> | |
| 328 | + | |
| 329 | +<?php | |
| 330 | + } | |
| 321 | 331 | } |
| 322 | 332 | |
| 323 | 333 | /** |
| 324 | 334 | * Initialize notice after WordPress admin loads. |
| 325 | 335 | */ |
| 326 | -function blockspare_setup_notice_init() { | |
| 336 | +function blockspare_setup_notice_init() | |
| 337 | +{ | |
| 327 | 338 | |
| 328 | - if ( ! is_admin() ) { | |
| 329 | - return; | |
| 330 | - } | |
| 339 | + if (! is_admin()) { | |
| 340 | + return; | |
| 341 | + } | |
| 331 | 342 | |
| 332 | - new Blockspare_Setup_Notice(); | |
| 343 | + new Blockspare_Setup_Notice(); | |
| 333 | 344 | } |
| 334 | 345 | |
| 335 | -add_action( 'admin_init', 'blockspare_setup_notice_init' ); | |
| 346 | +add_action('admin_init', 'blockspare_setup_notice_init'); | |