PluginProbe ʕ •ᴥ•ʔ
Starter Templates – AI-Powered Templates for Elementor & Gutenberg / 2.6.20
Starter Templates – AI-Powered Templates for Elementor & Gutenberg v2.6.20
4.6.1 4.6.0 4.5.4 4.5.3 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.5.0 2.5.1 2.6.0 2.6.1 2.6.10 2.6.11 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.18 2.6.19 2.6.2 2.6.20 2.6.21 2.6.22 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.18 3.0.19 3.0.2 3.0.20 3.0.21 3.0.22 3.0.23 3.0.24 3.0.25 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.21 3.1.22 3.1.23 3.1.24 3.1.25 3.1.26 3.1.27 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.10 4.4.11 4.4.12 4.4.13 4.4.14 4.4.16 4.4.17 4.4.18 4.4.19 4.4.2 4.4.20 4.4.21 4.4.22 4.4.23 4.4.24 trunk 4.4.25 0.4.4.0 4.4.26 0.4.4.15 4.4.27 1.0.0 4.4.28 1.0.1 4.4.29 1.0.10 4.4.3 1.0.11 4.4.30 1.0.12 4.4.31 1.0.13 4.4.32 1.0.14 4.4.33 1.0.2 4.4.34 1.0.3 4.4.35 1.0.4 4.4.36 1.0.5 4.4.37 1.0.6 4.4.38 1.0.7 4.4.39 1.0.8 4.4.4 1.0.9 4.4.40 1.1.0 4.4.41 1.1.1 4.4.42 1.1.2 4.4.43 1.1.3 4.4.44 1.1.4 4.4.45 1.1.5 4.4.46 1.1.6 4.4.47 1.1.7 4.4.48 1.1.8 4.4.49 1.1.9 4.4.5 1.2.0 4.4.50 1.2.1 4.4.51 1.2.10 4.4.52 1.2.11 4.4.6 1.2.12 4.4.7 1.2.13 4.4.8 1.2.14 4.4.9 1.2.15 4.5.0 1.2.2 4.5.1 1.2.3 4.5.2 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 2.0.0 2.0.1 2.0.2 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5
astra-sites / classes / class-astra-sites-admin.php
astra-sites / classes Last commit date
class-astra-sites-admin.php 4 years ago
class-astra-sites-admin.php
198 lines
1 <?php
2 /**
3 * Admin Notices
4 *
5 * @since 2.3.7
6 * @package Astra Sites
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 if ( ! class_exists( 'Astra_Sites_Admin' ) ) :
14
15 /**
16 * Admin
17 */
18 class Astra_Sites_Admin {
19
20 /**
21 * Instance of Astra_Sites_Admin
22 *
23 * @since 2.3.7
24 * @var (Object) Astra_Sites_Admin
25 */
26 private static $instance = null;
27
28 /**
29 * Instance of Astra_Sites_Admin.
30 *
31 * @since 2.3.7
32 *
33 * @return object Class object.
34 */
35 public static function get_instance() {
36 if ( ! isset( self::$instance ) ) {
37 self::$instance = new self();
38 }
39
40 return self::$instance;
41 }
42
43 /**
44 * Constructor.
45 *
46 * @since 2.3.7
47 */
48 private function __construct() {
49 add_action( 'admin_notices', array( $this, 'admin_notices' ) );
50 add_action( 'astra_notice_before_markup', array( $this, 'notice_assets' ) );
51 add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
52 add_action( 'astra_sites_after_site_grid', array( $this, 'custom_upgrade_cta' ) );
53 add_filter( 'astra_sites_quick_links', array( $this, 'change_quick_links' ) );
54 }
55
56 /**
57 * Change quick links
58 *
59 * @since 2.6.18
60 * @param array $links All quick links.
61 * @return array
62 */
63 public function change_quick_links( $links = array() ) {
64
65 if ( ! isset( $links['links']['upgrade'] ) ) {
66 return $links;
67 }
68
69 // Change default call to action link.
70 $links['links']['upgrade']['url'] = Astra_Sites::get_instance()->get_cta_link( 'quick-links-corner' );
71
72 return $links;
73 }
74
75 /**
76 * Admin Assets
77 */
78 public function admin_assets() {
79 $current_screen = get_current_screen();
80
81 if ( 'appearance_page_starter-templates' !== $current_screen->id ) {
82 return;
83 }
84
85 if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
86 return;
87 }
88
89 wp_enqueue_style( 'astra-sites-admin-page', ASTRA_SITES_URI . 'assets/css/admin.css', ASTRA_SITES_VER, true );
90 wp_enqueue_script( 'astra-sites-admin-js', ASTRA_SITES_URI . 'assets/js/admin.js', array( 'astra-sites-admin-page', 'jquery' ), ASTRA_SITES_VER, true );
91 }
92
93 /**
94 * Add Custom CTA Infobar.
95 */
96 public function custom_upgrade_cta() {
97 $current_screen = get_current_screen();
98
99 if ( 'appearance_page_starter-templates' !== $current_screen->id ) {
100 return;
101 }
102
103 if ( Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
104 return;
105 }
106
107 $custom_cta_content_data = apply_filters(
108 'astra_sites_custom_cta_vars',
109 array(
110 'text' => __( 'Get unlimited access to all premium Starter Templates and more, at a single low cost!', 'astra-sites' ),
111 'button_text' => __( 'Get Essential Bundle', 'astra-sites' ),
112 'cta_link' => Astra_Sites::get_instance()->get_cta_link(),
113 )
114 );
115
116 $html = '<div class="astra-sites-custom-cta-wrap">';
117 $html .= '<span class="astra-sites-cta-title">' . esc_html( $custom_cta_content_data['text'] ) . '</span>';
118 $html .= '<span class="astra-sites-cta-btn">';
119 $html .= '<a class="astra-sites-cta-link" href="' . esc_url( $custom_cta_content_data['cta_link'] ) . '" target="_blank" >' . esc_html( $custom_cta_content_data['button_text'] ) . '</a>';
120 $html .= '</span>';
121 $html .= '</div>';
122 echo wp_kses_post( $html );
123 }
124
125 /**
126 * Admin Notices
127 *
128 * @since 2.3.7
129 * @return void
130 */
131 public function admin_notices() {
132
133 $image_path = esc_url( ASTRA_SITES_URI . 'inc/assets/images/logo.svg' );
134
135 $complete = get_option( 'astra_sites_import_complete', '' );
136
137 Astra_Notices::add_notice(
138 array(
139 'id' => 'astra-sites-5-start-notice',
140 'type' => 'info',
141 'class' => 'astra-sites-5-star',
142 'show_if' => ( 'yes' === $complete && false === Astra_Sites_White_Label::get_instance()->is_white_labeled() ),
143 /* translators: %1$s white label plugin name and %2$s deactivation link */
144 'message' => sprintf(
145 '<div class="notice-image" style="display: flex;">
146 <img src="%1$s" class="custom-logo" alt="Starter Templates" itemprop="logo" style="max-width: 90px;"></div>
147 <div class="notice-content">
148 <div class="notice-heading">
149 %2$s
150 </div>
151 %3$s<br />
152 <div class="astra-review-notice-container">
153 <a href="%4$s" class="astra-notice-close astra-review-notice button-primary" target="_blank">
154 %5$s
155 </a>
156 <span class="dashicons dashicons-calendar"></span>
157 <a href="#" data-repeat-notice-after="%6$s" class="astra-notice-close astra-review-notice">
158 %7$s
159 </a>
160 <span class="dashicons dashicons-smiley"></span>
161 <a href="#" class="astra-notice-close astra-review-notice">
162 %8$s
163 </a>
164 </div>
165 </div>',
166 $image_path,
167 __( 'Hello! Seems like you have used Starter Templates to build this website &mdash; Thanks a ton!', 'astra-sites' ),
168 __( 'Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Starter Templates.', 'astra-sites' ),
169 'https://wordpress.org/support/plugin/astra-sites/reviews/?filter=5#new-post',
170 __( 'Ok, you deserve it', 'astra-sites' ),
171 MONTH_IN_SECONDS,
172 __( 'Nope, maybe later', 'astra-sites' ),
173 __( 'I already did', 'astra-sites' )
174 ),
175 )
176 );
177 }
178
179 /**
180 * Enqueue Astra Notices CSS.
181 *
182 * @since 2.3.7
183 *
184 * @return void
185 */
186 public static function notice_assets() {
187 $file = is_rtl() ? 'astra-notices-rtl.css' : 'astra-notices.css';
188 wp_enqueue_style( 'astra-sites-notices', ASTRA_SITES_URI . 'assets/css/' . $file, array(), ASTRA_SITES_VER );
189 }
190 }
191
192 /**
193 * Kicking this off by calling 'get_instance()' method
194 */
195 Astra_Sites_Admin::get_instance();
196
197 endif;
198