PluginProbe ʕ •ᴥ•ʔ
Starter Templates – AI-Powered Templates for Elementor & Gutenberg / 4.4.8
Starter Templates – AI-Powered Templates for Elementor & Gutenberg v4.4.8
4.6.3 4.6.2 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 / inc / classes / class-astra-sites-white-label.php
astra-sites / inc / classes Last commit date
compatibility 1 year ago class-astra-sites-elementor-images.php 6 years ago class-astra-sites-elementor-pages.php 2 years ago class-astra-sites-error-handler.php 2 years ago class-astra-sites-file-system.php 2 years ago class-astra-sites-importer-log.php 2 years ago class-astra-sites-importer.php 1 year ago class-astra-sites-nps-notice.php 1 year ago class-astra-sites-page.php 1 year ago class-astra-sites-update.php 1 year ago class-astra-sites-utils.php 2 years ago class-astra-sites-white-label.php 2 years ago class-astra-sites-wp-cli.php 2 years ago class-astra-sites.php 1 year ago functions.php 2 years ago
class-astra-sites-white-label.php
329 lines
1 <?php
2 /**
3 * Astra Sites White Label
4 *
5 * @package Astra Sites
6 * @since 1.0.12
7 */
8
9 if ( ! class_exists( 'Astra_Sites_White_Label' ) ) :
10
11 /**
12 * Astra_Sites_White_Label
13 *
14 * @since 1.0.12
15 */
16 class Astra_Sites_White_Label {
17
18 /**
19 * Instance
20 *
21 * @since 1.0.12
22 *
23 * @var object Class Object.
24 * @access private
25 */
26 private static $instance;
27
28 /**
29 * Member Variable
30 *
31 * @since 1.0.12
32 *
33 * @var array branding
34 * @access private
35 */
36 private static $branding;
37
38 /**
39 * Settings
40 *
41 * @since 1.2.11
42 *
43 * @var array settings
44 *
45 * @access private
46 */
47 private $settings;
48
49 /**
50 * Initiator
51 *
52 * @since 1.0.12
53 *
54 * @return object initialized object of class.
55 */
56 public static function get_instance() {
57 if ( ! isset( self::$instance ) ) {
58 self::$instance = new self();
59 }
60 return self::$instance;
61 }
62
63 /**
64 * Constructor
65 *
66 * @since 1.0.12
67 */
68 public function __construct() {
69 add_filter( 'all_plugins', array( $this, 'plugins_page' ) );
70 add_filter( 'astra_addon_branding_options', __CLASS__ . '::settings' );
71 add_action( 'astra_pro_white_label_add_form', __CLASS__ . '::add_white_label_form' );
72 add_filter( 'astra_sites_menu_page_title', array( $this, 'get_white_label_name' ) );
73 add_filter( 'astra_sites_page_title', array( $this, 'get_white_label_name' ) );
74
75 // Update Astra's admin top level menu position.
76 add_filter( 'astra_menu_priority', array( $this, 'update_admin_menu_position' ) );
77
78 // Display the link with the plugin meta.
79 if ( is_admin() ) {
80 add_filter( 'plugin_row_meta', array( $this, 'plugin_links' ), 10, 4 );
81 }
82
83 add_filter( 'gutenberg_templates_localize_vars', array( $this, 'add_white_label_name' ) );
84
85 add_filter( 'ast_block_templates_white_label', array( $this, 'is_white_labeled' ) );
86 add_filter( 'ast_block_templates_white_label_name', array( $this, 'get_white_label' ) );
87 }
88
89 /**
90 * Update Astra's menu priority to show after Dashboard menu.
91 *
92 * @param int $menu_priority top level menu priority.
93 * @since 3.1.22
94 */
95 public function update_admin_menu_position( $menu_priority ) {
96 return 2.1;
97 }
98
99 /**
100 * Add White Label data
101 *
102 * @param array $args White label.
103 * @since 2.6.0
104 */
105 public function add_white_label_name( $args = array() ) {
106 $args['white_label_name'] = $this->get_white_label();
107 return $args;
108 }
109
110 /**
111 * White labels the plugins page.
112 *
113 * @since 1.0.12
114 *
115 * @param array $plugins Plugins Array.
116 * @return array
117 */
118 public function plugins_page( $plugins ) {
119
120 if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
121 return $plugins;
122 }
123
124 if ( ! isset( $plugins[ ASTRA_SITES_BASE ] ) ) {
125 return $plugins;
126 }
127
128 // Set White Labels.
129 $name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
130 $description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' );
131 $author = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author' );
132 $author_uri = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author_url' );
133
134 if ( ! empty( $name ) ) {
135 $plugins[ ASTRA_SITES_BASE ]['Name'] = $name;
136
137 // Remove Plugin URI if Agency White Label name is set.
138 $plugins[ ASTRA_SITES_BASE ]['PluginURI'] = '';
139 }
140
141 if ( ! empty( $description ) ) {
142 $plugins[ ASTRA_SITES_BASE ]['Description'] = $description;
143 }
144
145 if ( ! empty( $author ) ) {
146 $plugins[ ASTRA_SITES_BASE ]['Author'] = $author;
147 }
148
149 if ( ! empty( $author_uri ) ) {
150 $plugins[ ASTRA_SITES_BASE ]['AuthorURI'] = $author_uri;
151 }
152
153 return $plugins;
154 }
155
156 /**
157 * Get value of single key from option array.
158 *
159 * @since 2.0.0.
160 * @param string $type Option type.
161 * @param string $key Option key.
162 * @param string $default Default value if key not found.
163 * @return mixed Return stored option value.
164 */
165 public static function get_option( $type = '', $key = '', $default = null ) {
166
167 if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
168 return $default;
169 }
170
171 $value = Astra_Ext_White_Label_Markup::get_white_label( $type, $key );
172 if ( ! empty( $value ) ) {
173 return $value;
174 }
175
176 return $default;
177
178 }
179
180 /**
181 * Remove a "view details" link from the plugin list table
182 *
183 * @since 1.0.12
184 *
185 * @param array $plugin_meta List of links.
186 * @param string $plugin_file Relative path to the main plugin file from the plugins directory.
187 * @param array $plugin_data Data from the plugin headers.
188 * @return array
189 */
190 public function plugin_links( $plugin_meta, $plugin_file, $plugin_data ) {
191
192 if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
193 return $plugin_meta;
194 }
195
196 // Set White Labels.
197 if ( ASTRA_SITES_BASE === $plugin_file ) {
198
199 $name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
200 $description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' );
201
202 // Remove Plugin URI if Agency White Label name is set.
203 if ( ! empty( $name ) ) {
204 unset( $plugin_meta[2] );
205 }
206 }
207
208 return $plugin_meta;
209 }
210
211 /**
212 * Add White Label setting's
213 *
214 * @since 1.0.12
215 *
216 * @param array $settings White label setting.
217 * @return array
218 */
219 public static function settings( $settings = array() ) {
220
221 $settings['astra-sites'] = array(
222 'name' => '',
223 'description' => '',
224 );
225
226 return $settings;
227 }
228
229 /**
230 * Add White Label form
231 *
232 * @since 1.0.12
233 *
234 * @param array $settings White label setting.
235 * @return void
236 */
237 public static function add_white_label_form( $settings = array() ) {
238
239 /* translators: %1$s product name */
240 $plugin_name = sprintf( __( '%1$s Branding', 'astra-sites' ), ASTRA_SITES_NAME );
241
242 require_once ASTRA_SITES_DIR . 'inc/includes/white-label.php';
243 }
244
245 /**
246 * Page Title
247 *
248 * @since 1.0.12
249 *
250 * @param string $title Page Title.
251 * @return string Filtered Page Title.
252 */
253 public function get_white_label_name( $title = '' ) {
254 if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
255 $astra_sites_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
256 if ( ! empty( $astra_sites_name ) ) {
257 return Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
258 }
259 }
260
261 return ASTRA_SITES_NAME;
262 }
263
264 /**
265 * White Label Link
266 *
267 * @since 2.0.0
268 *
269 * @param string $link Default link.
270 * @return string Filtered Page Title.
271 */
272 public function get_white_label_link( $link = '' ) {
273 if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
274 $white_label_link = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'licence' );
275 if ( ! empty( $white_label_link ) ) {
276 return $white_label_link;
277 }
278 }
279
280 return $link;
281 }
282
283 /**
284 * Is Astra sites White labeled
285 *
286 * @since 1.2.13
287 *
288 * @return string
289 */
290 public function is_white_labeled() {
291 $white_label = $this->get_white_label();
292
293 if ( empty( $white_label ) ) {
294 return false;
295 }
296
297 return true;
298 }
299
300 /**
301 * Get white label name
302 *
303 * @since 2.6.0
304 *
305 * @return string
306 */
307 public function get_white_label() {
308 if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
309 return '';
310 }
311
312 $name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
313
314 if ( ! empty( $name ) ) {
315 return $name;
316 }
317
318 return '';
319 }
320
321 }
322
323 /**
324 * Kicking this off by calling 'get_instance()' method
325 */
326 Astra_Sites_White_Label::get_instance();
327
328 endif;
329