PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / trunk
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid vtrunk
7.9.3 7.9.2 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.2.0 4.2.1 4.2.2 4.2.3 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 6.0.0 7.0.0 7.0.1 7.0.2 7.1.0 7.2.0 7.2.1 7.2.10 7.2.11 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6 7.2.7 7.2.8 7.2.9 7.3.0 7.3.1 7.4.0 7.4.1 7.4.2 7.4.3 7.5.0 7.6.0 7.6.1 7.7.0 7.7.1 7.7.10 7.7.11 7.7.12 7.7.13 7.7.14 7.7.15 7.7.16 7.7.17 7.7.18 7.7.19 7.7.2 7.7.20 7.7.21 7.7.22 7.7.3 7.7.4 7.7.5 7.7.6 7.7.7 7.7.8 7.7.9 7.8.0 7.8.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1
the-post-grid / app / Widgets / elementor / base.php
the-post-grid / app / Widgets / elementor Last commit date
widgets 4 months ago base.php 9 months ago rtTPGElementorHelper.php 3 months ago rtTPGElementorQuery.php 4 months ago
base.php
126 lines
1 <?php
2 /**
3 * Base Abstract Class
4 *
5 * @package RT_TPG
6 */
7
8 use Elementor\Widget_Base;
9 use RT\ThePostGrid\Helpers\Fns;
10 use RT\ThePostGrid\Helpers\Options;
11
12
13 // Do not allow directly accessing this file.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 'This script cannot be accessed directly.' );
16 }
17
18 /**
19 * Base Abstract Class
20 */
21 abstract class Custom_Widget_Base extends Widget_Base {
22 public $tpg_name;
23 public $tpg_base;
24 public $tpg_category;
25 public $tpg_archive_category;
26 public $tpg_icon;
27 public $tpg_dir;
28 public $tpg_pro_dir;
29 public $is_post_layout;
30 public $pro_label;
31 public $get_pro_message;
32 public $prefix;
33 public $last_post_id;
34
35 /**
36 * Class Constructor
37 * @param $data
38 * @param $args
39 *
40 * @throws Exception
41 */
42 public function __construct( $data = [], $args = null ) {
43 $this->tpg_category = RT_THE_POST_GRID_PLUGIN_SLUG . '-elements'; // Category /@dev.
44 $this->tpg_archive_category = 'tpg-block-builder-widgets';
45 $this->tpg_icon = 'eicon-gallery-grid tpg-grid-icon';
46 $this->tpg_dir = dirname( ( new ReflectionClass( $this ) )->getFileName() );
47 $this->tpg_pro_dir = null;
48 $this->pro_label = null;
49 $this->is_post_layout = null;
50 $this->get_pro_message = null;
51 $this->last_post_id = Fns::get_last_post_id();
52
53 if ( ! rtTPG()->hasPro() ) {
54 $this->pro_label = sprintf( '<span class="tpg-pro-label">%s</span>', esc_html__( 'Pro', 'the-post-grid' ) );
55 $this->is_post_layout = ' the-post-grid-pro-needed';
56 $this->get_pro_message = 'Please <a target="_blank" href="' . esc_url( rtTpg()->proLink() ) . '">upgrade</a> to pro for more options';
57 }
58
59 parent::__construct( $data, $args );
60 }
61
62 /**
63 * Get Pro Message with markup
64 *
65 * @param $message
66 *
67 * @return string|void
68 */
69 public function get_pro_message( $message = 'more options.' ) {
70 if ( rtTPG()->hasPro() ) {
71 return;
72 }
73
74 return 'Please <a target="_blank" href="' . esc_url( rtTpg()->proLink() ) . '">upgrade</a> to pro for ' . esc_html( $message );
75 }
76
77 /**
78 * Get Name
79 *
80 * @return string
81 */
82 public function get_name() {
83 return $this->tpg_base;
84 }
85
86 /**
87 * Get Title
88 *
89 * @return string
90 */
91 public function get_title() {
92 return $this->tpg_name;
93 }
94
95 /**
96 * Get Icon
97 *
98 * @return string
99 */
100 public function get_icon() {
101 return $this->tpg_icon;
102 }
103
104 /**
105 * Get Categories
106 *
107 * @return string[]
108 */
109 public function get_categories() {
110 return [ $this->tpg_category ];
111 }
112
113 /**
114 * Return Pro Label
115 *
116 * @return string
117 */
118 public function pro_label() {
119 if ( ! rtTPG()->hasPro() ) {
120 return esc_html__( 'Pro', 'the-post-grid' );
121 }
122
123 return '';
124 }
125 }
126