| @@ -103,9 +103,9 @@ | ||
| 103 | 103 | */ |
| 104 | 104 | public function scripts( $hook = '' ) { |
| 105 | 105 | $allowed_hooks = apply_filters( |
| 106 | 106 | 'templately_admin_enqueue_allowed_hooks', |
| 107 | - [ 'index.php', 'edit.php', 'plugins.php', 'toplevel_page_templately', 'elementor', 'gutenberg', 'templately_page_templately_settings' ], | |
| 107 | + [ 'index.php', 'edit.php', 'toplevel_page_templately', 'elementor', 'gutenberg', 'templately_page_templately_settings' ], | |
| 108 | 108 | $hook |
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | 111 | if ( !empty($hook) && ! in_array( $hook, $allowed_hooks, true ) ) { |
| @@ -165,34 +165,8 @@ | ||
| 165 | 165 | } |
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if ( 'plugins.php' === $hook ) { | |
| 170 | - templately()->assets->enqueue( | |
| 171 | - 'templately-inter', | |
| 172 | - set_url_scheme( '//fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap' ) | |
| 173 | - ); | |
| 174 | - /** | |
| 175 | - * plugins.php is not our screen, so the survey gets the scoped Tailwind | |
| 176 | - * build rather than css/tailwind.css. The unscoped bundle is compiled | |
| 177 | - * with `important: true` and no layer, so its utilities outranked | |
| 178 | - * wp-admin's own rules — `.inline` beat `.notice.inline` and `.hidden`, | |
| 179 | - * which collapsed the update notices in every plugin row into coloured | |
| 180 | - * slivers and revealed the hidden auto-update error placeholders. | |
| 181 | - * css/tailwind-survey.css carries the same rules prefixed with | |
| 182 | - * `.templately-scope`, the container the modal mounts into. | |
| 183 | - */ | |
| 184 | - templately()->assets->enqueue( 'templately-tailwind-survey', 'css/tailwind-survey.css', [ 'templately-inter' ] ); | |
| 185 | - templately()->assets->enqueue( 'templately-deactivate-survey', 'css/deactivate-survey-style.css', [ 'templately-tailwind-survey' ] ); | |
| 186 | - templately()->assets->enqueue( 'templately', 'js/deactivate-survey.js', [ 'regenerator-runtime' ], true ); | |
| 187 | - templately()->assets->localize( 'templately', 'templatelyDeactivateSurvey', [ | |
| 188 | - 'nonce' => wp_create_nonce( 'templately_nonce' ), | |
| 189 | - 'pluginBasename' => TEMPLATELY_PLUGIN_BASENAME, | |
| 190 | - 'reasons' => DeactivationSurvey::get_reasons_for_js(), | |
| 191 | - ] ); | |
| 192 | - return; | |
| 193 | - } | |
| 194 | - | |
| 195 | 169 | $templately = []; |
| 196 | 170 | |
| 197 | 171 | if ( 'edit.php' === $hook ) { |
| 198 | 172 | global $current_screen; |
| @@ -228,45 +202,23 @@ | ||
| 228 | 202 | $_localize_handle = 'templately-' . $hook; |
| 229 | 203 | $script_dependencies[] = $_localize_handle; |
| 230 | 204 | } |
| 231 | 205 | |
| 232 | - if ( 'templately_page_templately_settings' === $hook ) { | |
| 233 | - templately()->assets->register( 'settings-vendor', 'js/chunks/settings-vendor.js', [], true ); | |
| 234 | - $script_dependencies[] = 'settings-vendor'; | |
| 235 | - } | |
| 236 | - | |
| 237 | 206 | if ( $hook === 'toplevel_page_templately' || $hook == 'edit.php' || 'templately_page_templately_settings' === $hook ) { |
| 238 | 207 | templately()->assets->enqueue( 'templately-admin', 'css/admin.css', [ 'templately' ] ); |
| 239 | 208 | } |
| 240 | 209 | |
| 241 | - // Google Fonts Enqueueing | |
| 242 | - // DM Sans - Used in general UI | |
| 210 | + // Google Font Enqueueing | |
| 243 | 211 | templately()->assets->enqueue( |
| 244 | 212 | 'templately-dmsans', |
| 245 | 213 | set_url_scheme( '//fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap' ) |
| 246 | 214 | ); |
| 247 | 215 | |
| 248 | - // Inter - Used in Tailwind components and various UI elements | |
| 249 | - templately()->assets->enqueue( | |
| 250 | - 'templately-inter', | |
| 251 | - set_url_scheme( '//fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap' ) | |
| 252 | - ); | |
| 253 | - | |
| 254 | - // DM Mono - Used in settings and code-related UI | |
| 255 | - templately()->assets->enqueue( | |
| 256 | - 'templately-dmmono', | |
| 257 | - set_url_scheme( '//fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap' ) | |
| 258 | - ); | |
| 259 | - | |
| 260 | 216 | wp_enqueue_style('wp-components'); |
| 261 | 217 | |
| 262 | 218 | wp_enqueue_media(); |
| 263 | 219 | templately()->assets->enqueue( 'templately', 'js/templately.js', $script_dependencies, true ); |
| 264 | - templately()->assets->enqueue( 'templately', 'css/templately.css', ['templately-dmsans', 'templately-inter'] ); | |
| 265 | - $tailwind_hooks = apply_filters( 'templately_tailwind_hooks', [ 'toplevel_page_templately', 'elementor', 'gutenberg', 'templately_page_templately_settings', 'edit.php' ] ); | |
| 266 | - if ( in_array( $hook, $tailwind_hooks, true ) ) { | |
| 267 | - templately()->assets->enqueue( 'templately-tailwind', 'css/tailwind.css', ['templately', 'templately-inter'] ); | |
| 268 | - } | |
| 220 | + templately()->assets->enqueue( 'templately', 'css/templately.css', ['templately-dmsans'] ); | |
| 269 | 221 | |
| 270 | 222 | /** |
| 271 | 223 | * @var Elementor|Gutenberg $platform |
| 272 | 224 | */ |
| @@ -296,19 +248,13 @@ | ||
| 296 | 248 | 'not_found' => templately()->assets->icon( 'no-item-found.png' ), |
| 297 | 249 | 'no_items' => templately()->assets->icon( 'no-items.png' ), |
| 298 | 250 | 'loadingImage' => templately()->assets->icon( 'logos/loading-logo.gif' ), |
| 299 | 251 | 'current_url' => admin_url( 'admin.php?page=templately' ), |
| 300 | - 'wp_dashboard_url' => admin_url( 'index.php' ), | |
| 301 | - 'templately_library_url' => admin_url( 'edit.php?post_type=templately_library' ), | |
| 302 | 252 | 'is_signed' => Login::is_signed(), |
| 303 | 253 | 'is_globally_signed' => Login::is_globally_signed(), |
| 304 | 254 | 'signed_as_global' => Login::signed_as_global(), |
| 305 | 255 | 'current_screen' => $_current_screen, |
| 306 | 256 | 'can_fsi' => current_user_can('install_plugins') && current_user_can('install_themes'), |
| 307 | - // Account-level administration: the Subscription screen. Mirrors the | |
| 308 | - // subscription branch of `Checkout::checkout()`, so the sidebar can hide | |
| 309 | - // it for non-admins rather than route them to a 403. | |
| 310 | - 'can_manage_account' => current_user_can( 'manage_options' ), | |
| 311 | 257 | 'post_type' => get_post_type(), |
| 312 | 258 | 'has_elementor' => rest_sanitize_boolean( is_plugin_active( 'elementor/elementor.php' ) ), |
| 313 | 259 | 'has_elementor_pro' => rest_sanitize_boolean( is_plugin_active( 'elementor-pro/elementor-pro.php' ) ), |
| 314 | 260 | 'theme' => $_current_screen == 'templately' ? 'light' : $platform->ui_theme(), |
| @@ -318,16 +264,8 @@ | ||
| 318 | 264 | 'wp_user_avatar' => get_avatar_url( get_current_user_id(), [ 'size' => 96 ] ), |
| 319 | 265 | 'allowed_mime_types' => get_allowed_mime_types(), |
| 320 | 266 | 'is_free_user' => $global_user === false || isset( $global_user['plan'] ) && $global_user['plan'] == 'free', |
| 321 | 267 | 'is_disconnected' => ! empty( $global_user['is_disconnected'] ), |
| 322 | - 'tour_status' => Options::get_instance()->get( 'tour_status', [] ), | |
| 323 | - // Which Templately site the plugin talks to. `templatelyDeveloper.dev_api` | |
| 324 | - // carries the same flag, but only when developer mode is on and only from | |
| 325 | - // its own script handle — so anything rendered before that handle runs (the | |
| 326 | - // footer CTA, for one) linked to the live site while the plugin was pointed | |
| 327 | - // at dev. Kept here, on the main localized object, `webURL()` is right from | |
| 328 | - // the first paint. See `react-src/utils/helper.js#webURL`. | |
| 329 | - 'dev_api' => Helper::is_dev_api(), | |
| 330 | 268 | ], $templately ); |
| 331 | 269 | |
| 332 | 270 | // Apply filter to allow network admin modifications |
| 333 | 271 | $templately = apply_filters( 'templately_admin_localized_data', $templately ); |
| @@ -405,9 +343,9 @@ | ||
| 405 | 343 | 'class' => 'dismiss-btn' |
| 406 | 344 | ] |
| 407 | 345 | ], |
| 408 | 346 | 'support' => [ |
| 409 | - 'link' => Helper::web_url( '', [ 'support' => 'open' ] ), | |
| 347 | + 'link' => 'https://wpdeveloper.com/support', | |
| 410 | 348 | 'attributes' => [ |
| 411 | 349 | 'target' => '_blank' |
| 412 | 350 | ], |
| 413 | 351 | 'label' => __( 'I need help', 'templately' ), |
| @@ -461,39 +399,38 @@ | ||
| 461 | 399 | // 'nav-menus' |
| 462 | 400 | // ] |
| 463 | 401 | // ] ); |
| 464 | 402 | |
| 465 | - // spring_savings_2026 notice | |
| 466 | - $_notice_text_spring_savings_2026 = '<p style="margin-top: 0; margin-bottom: 0px;">🌸 Spring Savings: Design Website Quickly With 6,500+ Elementor & Gutenberg Templates, Including AI-Powered Features ⚡️ – Now <strong>Flat 50% OFF!</strong></p>'; | |
| 403 | + $notice_text = '<p style="margin-top: 0; margin-bottom: 0px;">Smarter & Faster Web Design With 6,500+ AI-Powered Elementor & Gutenberg Templates – Now <strong>Up To 50% OFF!</strong> 🎁</p>'; | |
| 467 | 404 | |
| 468 | - $_spring_savings_2026 = [ | |
| 405 | + $_black_friday = [ | |
| 469 | 406 | 'thumbnail' => templately()->assets->icon( 'logos/logo-full.svg' ), |
| 470 | - 'html' => $_notice_text_spring_savings_2026, | |
| 407 | + 'html' => $notice_text, | |
| 471 | 408 | 'links' => [ |
| 472 | - 'later' => [ | |
| 473 | - 'link' => Helper::web_url() . '#pricing', | |
| 409 | + 'later' => [ | |
| 410 | + 'link' => 'https://templately.com/#pricing', | |
| 474 | 411 | 'target' => '_blank', |
| 475 | - 'label' => __( 'Upgrade To Pro Now', 'templately' ), | |
| 412 | + 'label' => __( 'Upgrade To PRO', 'templately' ), | |
| 476 | 413 | 'attributes' => [ |
| 477 | 414 | 'class' => 'button button-primary', |
| 478 | 415 | ] |
| 479 | 416 | ], |
| 480 | 417 | 'never_show_again' => [ |
| 481 | - 'label' => __( 'Maybe Later', 'templately' ), | |
| 418 | + 'label' => __( 'I’ll Grab It Later', 'templately' ), | |
| 482 | 419 | 'attributes' => [ |
| 483 | 420 | 'data-dismiss' => true, |
| 484 | 421 | 'class' => 'button button-link dismiss-btn', |
| 485 | 422 | ] |
| 486 | - ], | |
| 423 | + ] | |
| 487 | 424 | ], |
| 488 | 425 | ]; |
| 489 | 426 | |
| 490 | - $notices->add( 'spring_savings_2026', $_spring_savings_2026, [ | |
| 491 | - 'start' => $notices->strtotime('00:00:01AM 8th April, 2026'), | |
| 427 | + $notices->add( 'holiday_2026_feb', $_black_friday, [ | |
| 428 | + 'start' => $notices->strtotime('00:00:01AM 10th February, 2026'), | |
| 492 | 429 | 'recurrence' => false, |
| 493 | 430 | 'dismissible' => true, |
| 494 | 431 | 'refresh' => TEMPLATELY_VERSION, |
| 495 | - "expire" => strtotime( '11:59:59pm 10th May, 2026' ), | |
| 432 | + "expire" => strtotime( '11:59:59pm 8th March, 2026' ), | |
| 496 | 433 | 'display_if' => !wp_is_mobile(), |
| 497 | 434 | 'screens' => [ |
| 498 | 435 | 'dashboard', |
| 499 | 436 | ], |
| @@ -509,13 +446,13 @@ | ||
| 509 | 446 | $holiday_text .= "<div class='wpnotice-button-wrapper'>"; |
| 510 | 447 | $holiday_text .= sprintf( |
| 511 | 448 | '<a class="button button-primary" target="_blank" href="%2$s">%1$s</a>', |
| 512 | 449 | $crown . __('GET PRO Lifetime Access', 'templately'), |
| 513 | - Helper::web_url() . '#pricing' | |
| 450 | + 'https://templately.com/#pricing' | |
| 514 | 451 | ); |
| 515 | 452 | $holiday_text .= sprintf( |
| 516 | 453 | '<button class="button button-link dismiss-btn" data-dismiss="true">%1$s</button>', |
| 517 | - __('No, I\'ll Pay Full Price Later', 'templately'), | |
| 454 | + __('No, I’ll Pay Full Price Later', 'templately'), | |
| 518 | 455 | ); |
| 519 | 456 | $holiday_text .= "</div>"; |
| 520 | 457 | |
| 521 | 458 | |
| @@ -564,44 +501,9 @@ | ||
| 564 | 501 | // ], '58.7' ); |
| 565 | 502 | } |
| 566 | 503 | |
| 567 | 504 | public function display() { |
| 568 | - Helper::views( 'template-library', [ | |
| 569 | - 'show_grid_skeleton' => $this->is_template_library_path(), | |
| 570 | - ] ); | |
| 571 | - } | |
| 572 | - | |
| 573 | - /** | |
| 574 | - * Whether the current `?path=` targets the template-library grid | |
| 575 | - * (`TemplatesTypeLayout`, e.g. `elementor/packs`) — the only route the | |
| 576 | - * pre-mount skeleton's card grid actually matches. Every other route | |
| 577 | - * (`clouds/*`, `downloads`, `favourites`, `subscription`, | |
| 578 | - * `purchased-items`, `ai-sites`, `settings/*`, item-detail pages, and | |
| 579 | - * Saved Templates) gets a generic shell instead, so a hard reload doesn't | |
| 580 | - * flash the wrong page shape before React mounts. See | |
| 581 | - * views/template-library.php. | |
| 582 | - * | |
| 583 | - * @return bool | |
| 584 | - */ | |
| 585 | - private function is_template_library_path() { | |
| 586 | - $path = isset( $_GET['path'] ) ? sanitize_text_field( wp_unslash( $_GET['path'] ) ) : ''; | |
| 587 | - | |
| 588 | - if ( $path === '' ) { | |
| 589 | - return true; | |
| 590 | - } | |
| 591 | - | |
| 592 | - $segments = array_values( array_filter( explode( '/', trim( $path, '/' ) ) ) ); | |
| 593 | - | |
| 594 | - $non_library_prefixes = [ 'clouds', 'downloads', 'favourites', 'subscription', 'purchased-items', 'ai-sites', 'settings' ]; | |
| 595 | - | |
| 596 | - if ( in_array( $segments[0] ?? '', $non_library_prefixes, true ) ) { | |
| 597 | - return false; | |
| 598 | - } | |
| 599 | - | |
| 600 | - // `/:platform/:type` (the grid) vs `/:platform/:type/:slug` (item | |
| 601 | - // detail, its own skeleton shape) or `/:platform/templates` (Saved | |
| 602 | - // Templates, a table) — only the 2-segment form matches the grid. | |
| 603 | - return count( $segments ) === 2 && $segments[1] !== 'templates'; | |
| 505 | + Helper::views( 'template-library' ); | |
| 604 | 506 | } |
| 605 | 507 | |
| 606 | 508 | /** |
| 607 | 509 | * If Elementor doesn't exists. |