PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.2
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.2
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / libs / pro-awareness / pro-awareness.php
elementskit-lite / libs / pro-awareness Last commit date
assets 3 years ago pro-awareness.php 1 week ago
pro-awareness.php
526 lines
1 <?php
2
3 namespace Wpmet\Libs;
4
5 defined( 'ABSPATH' ) || exit;
6
7 if ( ! class_exists( '\Wpmet\Libs\Pro_Awareness' ) ) :
8
9 class Pro_Awareness {
10
11
12 private static $instance;
13
14 private $text_domain;
15 private $plugin_file;
16 private $parent_menu_slug;
17 private $menu_slug = '_get_help';
18 private $default_grid_link = 'https://wpmet.com/support-ticket';
19 private $default_grid_title = '';
20 private $default_grid_thumbnail = '';
21 private $default_grid_desc = '';
22 private $pro_link_conf = array();
23
24 private $grids = array();
25 private $action_links = array();
26 private $row_meta_links = array();
27 private $parent_menu_text = '';
28 private $products = array();
29
30
31 protected $script_version = '1.2.0';
32
33 /**
34 * Get version of this script
35 *
36 * @return string Version name
37 */
38 public function get_version() {
39 return $this->script_version;
40 }
41
42 /**
43 * Get current directory path
44 *
45 * @return string
46 */
47 public function get_script_location() {
48 return __FILE__;
49 }
50
51
52 public static function instance( $text_domain ) {
53
54 self::$instance = new self();
55
56 return self::$instance->set_text_domain( $text_domain );
57 }
58
59 protected function set_text_domain( $val ) {
60
61 $this->text_domain = $val;
62
63 return $this;
64 }
65
66 private function default_grid() {
67
68 $title = ! empty( $this->default_grid_title )
69 ? $this->default_grid_title
70 : esc_html__( 'Support Center', 'elementskit-lite' );
71 $description = ! empty( $this->default_grid_desc )
72 ? $this->default_grid_desc
73 : esc_html__( 'Our experienced support team is ready to resolve your issues any time.', 'elementskit-lite' );
74 return array(
75 'url' => $this->default_grid_link,
76 'title' => $title,
77 'thumbnail' => $this->default_grid_thumbnail,
78 'description' => $description,
79 );
80 }
81
82 public function set_parent_menu_text( $text ) {
83
84 $this->parent_menu_text = $text;
85
86 return $this;
87 }
88
89 public function set_default_grid_link( $url ) {
90
91 $this->default_grid_link = $url;
92
93 return $this;
94 }
95
96 public function set_default_grid_title( $title ) {
97
98 $this->default_grid_title = $title;
99
100 return $this;
101 }
102
103 public function set_default_grid_desc( $title ) {
104
105 $this->default_grid_desc = $title;
106
107 return $this;
108 }
109
110 public function set_default_grid_thumbnail( $thumbnail ) {
111
112 $this->default_grid_thumbnail = $thumbnail;
113
114 return $this;
115 }
116
117 public function set_parent_menu_slug( $slug ) {
118
119 $this->parent_menu_slug = $slug;
120
121 return $this;
122 }
123
124
125 public function set_menu_slug( $slug ) {
126
127 $this->menu_slug = $slug;
128
129 return $this;
130 }
131
132 public function set_plugin_file( $plugin_file ) {
133
134 $this->plugin_file = $plugin_file;
135
136 return $this;
137 }
138
139 public function set_pro_link( $url, $conf = array() ) {
140
141 if ( $url == '' ) {
142 return $this;
143 }
144
145 $this->pro_link_conf[] = array(
146 'url' => $url,
147 'target' => '_blank',
148 'anchor' => empty( $conf['anchor'] ) ? sprintf( '<span style="color: #FCB214;" class="pro_aware pro">%s</span>', esc_html__( 'Upgrade To Premium', 'elementskit-lite' ) ) : $conf['anchor'],
149 'permission' => empty( $conf['permission'] ) ? 'manage_options' : $conf['permission'],
150 );
151
152 return $this;
153 }
154
155 /**
156 * Set page grid
157 */
158 public function set_page_grid( $conf = array() ) {
159
160 if ( ! empty( $conf['url'] ) ) {
161
162 $this->grids[] = array(
163 'url' => $conf['url'],
164 'title' => empty( $conf['title'] ) ? esc_html__( 'Default Title', 'elementskit-lite' ) : $conf['title'],
165 'thumbnail' => empty( $conf['thumbnail'] ) ? '' : esc_url( $conf['thumbnail'] ),
166 'description' => empty( $conf['description'] ) ? '' : $conf['description'],
167 );
168 }
169
170 return $this;
171 }
172
173 /**
174 * Set wpmet products
175 */
176 public function set_products( $product = array() ) {
177 $this->products[] = array(
178 'url' => empty( $product['url'] ) ? '' : esc_url( $product['url'] ),
179 'title' => empty( $product['title'] ) ? esc_html__( 'Default Title', 'elementskit-lite' ) : $product['title'],
180 'thumbnail' => empty( $product['thumbnail'] ) ? '' : esc_url( $product['thumbnail'] ),
181 'description' => empty( $product['description'] ) ? '' : $product['description'],
182 );
183
184 return $this;
185 }
186
187 /**
188 * @deprecated This method will be removed
189 */
190 public function set_grid( $conf = array() ) {
191 $this->set_page_grid( $conf );
192
193 return $this;
194 }
195
196 protected function prepare_pro_links() {
197
198 if ( ! empty( $this->pro_link_conf ) ) {
199
200 foreach ( $this->pro_link_conf as $conf ) {
201
202 add_submenu_page( $this->parent_menu_slug, $conf['anchor'], $conf['anchor'], $conf['permission'], $conf['url'], '' );
203 }
204 }
205 }
206
207 protected function prepare_grid_links() {
208
209 if ( ! empty( $this->grids ) ) {
210
211 $get_help_title = !empty( $this->parent_menu_text )
212 ? $this->parent_menu_text
213 : esc_html__( 'Get Help', 'elementskit-lite' );
214
215 add_submenu_page(
216 $this->parent_menu_slug,
217 $get_help_title,
218 $get_help_title,
219 'manage_options',
220 $this->text_domain . $this->menu_slug,
221 array( $this, 'generate_grids' )
222 );
223 }
224 }
225
226
227 public function generate_grids() {
228
229 /**
230 * Adding default grid at first position
231 */
232 array_unshift( $this->grids, $this->default_grid() );
233
234 ?>
235
236
237 <div class="pro_aware grid_container wpmet_pro_a-grid-container">
238
239 <?php do_action( $this->text_domain . '/pro_awareness/before_grid_contents' ); ?>
240
241 <div class="wpmet_pro_a-row">
242 <?php
243 foreach ( $this->grids as $grid ) {
244 ?>
245 <div class="grid wpmet_pro_a-grid">
246 <div class="wpmet_pro_a-grid-inner">
247 <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $grid['url'] ); ?>"
248 class="wpmet_pro_a_wrapper" title="<?php echo esc_attr( $grid['title'] ); ?>"
249 title="<?php echo esc_attr( $grid['title'] ); ?>">
250 <div class="wpmet_pro_a_thumb">
251 <img src="<?php echo esc_url( $grid['thumbnail'] ); ?>" alt="Thumbnail">
252 </div>
253 <!-- // thumbnail -->
254
255 <h4 class="wpmet_pro_a_grid_title"><?php echo esc_html( $grid['title'] ); ?></h4>
256 <?php if ( ! empty( $grid['description'] ) ) { ?>
257 <p class="wpmet_pro_a_description"><?php echo esc_html( $grid['description'] ); ?></p>
258 <!-- // description -->
259 <?php } ?>
260 <!-- // title -->
261 </a>
262 </div>
263 </div>
264 <?php
265 }
266 ?>
267 </div>
268
269 <div class="wpmet-products hidden">
270 <div class="wpmet-products__header">
271 <h1><?php esc_html_e('Take your website to the next level','elementskit-lite'); ?></h1>
272 <p><?php esc_html_e('We have some plugins you can install to get most from Wordpress.','elementskit-lite'); ?>
273 <br> <?php esc_html_e('These are absolute FREE to use.','elementskit-lite'); ?></p>
274 </div>
275 <div class="wpmet-products__content">
276 <?php foreach ( $this->products as $product ) : ?>
277 <a title="<?php echo esc_attr($product['title']); ?>" class="help-card" href="<?php echo esc_url( $product['url'] ); ?>" target="_blank" rel="noopener noreferrer">
278 <label>
279 <img src="<?php echo esc_url( $product['thumbnail'] ); ?>" alt="Thumbnail">
280 </label>
281 <span><?php echo esc_html($product['description']); ?></span></a>
282 <?php endforeach; ?>
283 </div>
284 </div>
285
286 <?php do_action( $this->text_domain . '/pro_awareness/after_grid_contents' ); ?>
287
288 </div>
289
290 <?php
291 }
292
293 public static function enqueue_scripts() {
294 echo "
295 <script>
296 jQuery(document).ready( function($) {
297 $('.pro_aware').parent().attr('target','_blank');
298 });
299 </script>
300
301 <style>
302 .wpmet_pro_a-grid-container {
303 max-width: 1350px;
304 width: 100%;
305 padding-right: 15px;
306 padding-left: 15px;
307 box-sizing: border-box;
308 margin-top: 50px;
309 }
310
311 .wpmet_pro_a-grid-inner .wpmet_pro_a_wrapper {
312 padding: 35px 50px;
313 display: block;
314 }
315
316 .wpmet_pro_a-row {
317 display: grid;
318 grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
319 grid-gap: 30px;
320 }
321
322 .wpmet_pro_a-grid {
323 background-color: #fff;
324 border-radius: 4px;
325 box-shadow: 0px 2px 5px 10px rgba(0,0,0,.01);
326 transition: all .4s ease;
327 }
328
329 .wpmet_pro_a-grid:hover {
330 transform: translateY(-3px);
331 box-shadow: 0px 10px 15px 15px rgba(0,0,0,.05);
332 }
333
334 .wpmet_pro_a_thumb {
335 min-height: 76px;
336 margin-bottom: 10px;
337 display: block;
338 border-radius: inherit;
339 }
340
341 .wpmet_pro_a_grid_title {
342 font-size: 1.6rem;
343 display: inline-block;
344 line-height: normal;
345 text-decoration: none;
346 margin: 0px;
347 font-weight: 600;
348 color: #021343;
349 }
350
351 .wpmet_pro_a_description {
352 margin-bottom: 0;
353 text-decoration: none;
354 display: inline-block;
355 margin-top: 10px;
356 font-size: 15px;
357 line-height: 22px;
358 color: #5D5E65;
359 }
360 .wp-submenu > li > a{
361 position: relative;
362 }
363
364 .wpmet_pro_a-grid-container .wpmet-products {
365 margin-top: 80px;
366 }
367
368 .wpmet_pro_a-grid-container .wpmet-products h1 {
369 font-size: 40px;
370 color: #021343;
371 font-weight: 700;
372 margin-bottom: 0;
373 line-height: 44px;
374 }
375
376 .wpmet_pro_a-grid-container .wpmet-products p {
377 color: #5D5E65;
378 font-size: 16px;
379 }
380
381 .wpmet_pro_a-grid-container .wpmet-products__content {
382 margin-top: 40px;
383 display: grid;
384 grid-gap: 20px;
385 grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
386 }
387
388 .wpmet_pro_a-grid-container .wpmet-products__content .help-card {
389 background-color: #fff;
390 border-radius: 4px;
391 -webkit-box-shadow: 0px 2px 5px 10px #00000003;
392 box-shadow: 0px 2px 5px 10px #00000003;
393 -webkit-transition: all .4s ease;
394 transition: all .4s ease;
395 padding: 30px;
396 }
397
398 .wpmet_pro_a-grid-container .wpmet-products__content .help-card:hover {
399 -webkit-transform: translateY(-3px);
400 transform: translateY(-3px);
401 -webkit-box-shadow: 0px 10px 15px 15px #0000000d;
402 box-shadow: 0px 10px 15px 15px #0000000d;
403 }
404
405 .wpmet_pro_a-grid-container .wpmet-products__content label {
406 color: #021343;
407 font-size: 16px;
408 font-weight: 700;
409 display: -webkit-box;
410 display: -ms-flexbox;
411 display: flex;
412 -webkit-column-gap: 10px;
413 -moz-column-gap: 10px;
414 column-gap: 10px;
415 -webkit-box-align: center;
416 -ms-flex-align: center;
417 align-items: center;
418 margin-bottom: 15px;
419 }
420
421 .wpmet_pro_a-grid-container .wpmet-products__content span {
422 display: inline-block;
423 color: #5D5E65;
424 font-size: 16px;
425 }
426
427 @media (max-width: 767px) {
428 .wpmet_pro_a_grid_title {
429 font-size: 1.2rem;
430 }
431 }
432 </style>
433 ";
434 }
435
436 public function insert_plugin_links( $links ) {
437
438 foreach ( $this->action_links as $action_link ) {
439
440 if ( ! empty( $action_link['link'] ) && ! empty( $action_link['text'] ) ) {
441
442 $attributes = '';
443
444 if ( ! empty( $action_link['attr'] ) ) {
445
446 foreach ( $action_link['attr'] as $key => $val ) {
447
448 $attributes .= $key . '="' . esc_attr( $val ) . '" ';
449 }
450 }
451
452 $links[] = sprintf( '<a href="%s" ' . $attributes . ' > %s </a>', esc_url( $action_link['link'] ), esc_html( $action_link['text'] ) );
453 }
454 }
455
456 return $links;
457 }
458
459 public function insert_plugin_row_meta( $links, $file ) {
460 if ( $file == $this->plugin_file ) {
461
462 foreach ( $this->row_meta_links as $meta ) {
463
464 if ( ! empty( $meta['link'] ) && ! empty( $meta['text'] ) ) {
465
466 $attributes = '';
467
468 if ( ! empty( $meta['attr'] ) ) {
469
470 foreach ( $meta['attr'] as $key => $val ) {
471
472 $attributes .= $key . '="' . esc_attr( $val ) . '" ';
473 }
474 }
475
476 $links[] = sprintf( '<a href="%s" %s > %s </a>', $meta['link'], $attributes, esc_html( $meta['text'] ) );
477 }
478 }
479 }
480
481 return $links;
482 }
483
484 public function set_plugin_action_link( $text, $link, $attr = array() ) {
485
486 $this->action_links[] = array(
487 'text' => $text,
488 'link' => $link,
489 'attr' => $attr,
490 );
491
492 return $this;
493 }
494
495 public function set_plugin_row_meta( $text, $link, $attr = array() ) {
496
497 $this->row_meta_links[] = array(
498 'text' => $text,
499 'link' => $link,
500 'attr' => $attr,
501 );
502
503 return $this;
504 }
505
506 public function generate_menus() {
507 add_filter( 'plugin_action_links_' . $this->plugin_file, array( $this, 'insert_plugin_links' ) );
508 add_filter( 'plugin_row_meta', array( $this, 'insert_plugin_row_meta' ), 10, 2 );
509
510 if ( ! empty( $this->parent_menu_slug ) ) {
511 $this->prepare_grid_links();
512 $this->prepare_pro_links();
513 }
514 }
515
516 public static function init() {
517 add_action( 'admin_head', array( __CLASS__, 'enqueue_scripts' ) );
518 }
519
520 public function call() {
521 add_action( 'admin_menu', array( $this, 'generate_menus' ), 99999 );
522 }
523 }
524
525 endif;
526