PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.6.4
Post Grid Gutenberg Blocks – PostX v2.6.4
5.0.41 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 All 238 releases
← All changes | classes/options/Addons.php +314 -45 2.1.22.6.4 View file →
@@ -2,70 +2,339 @@
2 2 namespace ULTP;
3 3
4 4 defined('ABSPATH') || exit;
5 5
6 -class Options_Addons{
6 +class Option_Addons{
7 7 public function __construct() {
8 - add_submenu_page('ultp-settings', 'Addons', 'Addons', 'manage_options', 'ultp-addons', array( $this, 'create_admin_page'), 10);
8 + $this->create_admin_page();
9 + add_filter('ultp_settings', array($this, 'get_addon_settings'), 10, 1);
9 10 }
10 11
12 +
13 + public static function get_addon_settings($config) {
14 + $arr = array(
15 + 'addon' => array(
16 + 'label' => __('Blocks', 'ultimate-post'),
17 + 'attr' => array(
18 + 'addon_enable' => array(
19 + 'type' => 'heading',
20 + 'label' => __('Enable/Disable Blocks', 'ultimate-post'),
21 + ),
22 + 'post_grid_1' => array(
23 + 'type' => 'switch',
24 + 'label' => __('Enable / Disable', 'ultimate-post'),
25 + 'default' => true,
26 + 'desc' => __('Post Grid #1 Block.', 'ultimate-post')
27 + ),
28 + 'post_grid_2' => array(
29 + 'type' => 'switch',
30 + 'label' => __('Enable / Disable', 'ultimate-post'),
31 + 'default' => true,
32 + 'desc' => __('Post Grid #2 Block.', 'ultimate-post')
33 + ),
34 + 'post_grid_3' => array(
35 + 'type' => 'switch',
36 + 'label' => __('Enable / Disable', 'ultimate-post'),
37 + 'default' => true,
38 + 'desc' => __('Post Grid #3 Block.', 'ultimate-post')
39 + ),
40 + 'post_grid_4' => array(
41 + 'type' => 'switch',
42 + 'label' => __('Enable / Disable', 'ultimate-post'),
43 + 'default' => true,
44 + 'desc' => __('Post Grid #4 Block.', 'ultimate-post')
45 + ),
46 + 'post_grid_5' => array(
47 + 'type' => 'switch',
48 + 'label' => __('Enable / Disable', 'ultimate-post'),
49 + 'default' => true,
50 + 'desc' => __('Post Grid #5 Block.', 'ultimate-post')
51 + ),
52 + 'post_grid_6' => array(
53 + 'type' => 'switch',
54 + 'label' => __('Enable / Disable', 'ultimate-post'),
55 + 'default' => true,
56 + 'desc' => __('Post Grid #6 Block.', 'ultimate-post')
57 + ),
58 + 'post_grid_7' => array(
59 + 'type' => 'switch',
60 + 'label' => __('Enable / Disable', 'ultimate-post'),
61 + 'default' => true,
62 + 'desc' => __('Post Grid #7 Block.', 'ultimate-post')
63 + ),
64 + 'post_list_1' => array(
65 + 'type' => 'switch',
66 + 'label' => __('Enable / Disable', 'ultimate-post'),
67 + 'default' => true,
68 + 'desc' => __('Post List #1 Block.', 'ultimate-post')
69 + ),
70 + 'post_list_2' => array(
71 + 'type' => 'switch',
72 + 'label' => __('Enable / Disable', 'ultimate-post'),
73 + 'default' => true,
74 + 'desc' => __('Post List #2 Block.', 'ultimate-post')
75 + ),
76 + 'post_list_3' => array(
77 + 'type' => 'switch',
78 + 'label' => __('Enable / Disable', 'ultimate-post'),
79 + 'default' => true,
80 + 'desc' => __('Post List #3 Block.', 'ultimate-post')
81 + ),
82 + 'post_list_4' => array(
83 + 'type' => 'switch',
84 + 'label' => __('Enable / Disable', 'ultimate-post'),
85 + 'default' => true,
86 + 'desc' => __('Post List #4 Block.', 'ultimate-post')
87 + ),
88 + 'post_module_1' => array(
89 + 'type' => 'switch',
90 + 'label' => __('Enable / Disable', 'ultimate-post'),
91 + 'default' => true,
92 + 'desc' => __('Post Module #1 Block.', 'ultimate-post')
93 + ),
94 + 'post_module_2' => array(
95 + 'type' => 'switch',
96 + 'label' => __('Enable / Disable', 'ultimate-post'),
97 + 'default' => true,
98 + 'desc' => __('Post Module #2 Block.', 'ultimate-post')
99 + ),
100 + 'post_slider_1' => array(
101 + 'type' => 'switch',
102 + 'label' => __('Enable / Disable', 'ultimate-post'),
103 + 'default' => true,
104 + 'desc' => __('Post Slider #1 Block.', 'ultimate-post')
105 + ),
106 + 'heading' => array(
107 + 'type' => 'switch',
108 + 'label' => __('Enable / Disable', 'ultimate-post'),
109 + 'default' => true,
110 + 'desc' => __('Heading Block.', 'ultimate-post')
111 + ),
112 + 'image' => array(
113 + 'type' => 'switch',
114 + 'label' => __('Enable / Disable', 'ultimate-post'),
115 + 'default' => true,
116 + 'desc' => __('Image Block.', 'ultimate-post')
117 + ),
118 + 'taxonomy' => array(
119 + 'type' => 'switch',
120 + 'label' => __('Enable / Disable', 'ultimate-post'),
121 + 'default' => true,
122 + 'desc' => __('Taxonomy Block.', 'ultimate-post')
123 + ),
124 + 'wrapper' => array(
125 + 'type' => 'switch',
126 + 'label' => __('Enable / Disable', 'ultimate-post'),
127 + 'default' => true,
128 + 'desc' => __('Wrapper Block.', 'ultimate-post')
129 + )
130 + )
131 + )
132 + );
133 + return array_merge($config, $arr);
134 + }
135 +
136 +
11 137 public static function all_addons(){
12 138 $all_addons = array(
13 139 'ultp_category' => array(
14 140 'name' => __( 'Category', 'ultimate-post' ),
15 - 'desc' => __( 'Set your category-specific color and image for your block design.', 'ultimate-post' ),
141 + 'desc' => __( 'Choose your desired color and Image for categories or any taxonomy.', 'ultimate-post' ),
16 142 'img' => ULTP_URL.'/assets/img/addons/category-style.svg',
17 - 'is_pro' => true
18 - )
19 - );
20 - return apply_filters('ultp_addons_config', $all_addons);
143 + 'is_pro' => true,
144 + 'docs' => 'https://docs.wpxpo.com/docs/postx/',
145 + 'live' => 'https://www.wpxpo.com/postx/addons/category/'
146 + ),
147 + 'ultp_builder' => array(
148 + 'name' => __( 'Builder', 'ultimate-post' ),
149 + 'desc' => __( 'Design template for Archive, Category, Custom Taxonomy, Date, and Search Page.', 'ultimate-post' ),
150 + 'img' => ULTP_URL.'/assets/img/addons/builder-icon.svg',
151 + 'is_pro' => true,
152 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/archive-builder/',
153 + 'live' => 'https://www.wpxpo.com/postx/addons/builder/'
154 + ),
155 + 'ultp_progressbar' => array(
156 + 'name' => __( 'Progressbar', 'ultimate-post' ),
157 + 'desc' => __( 'Let the users see a graphical indicator to know the reading progress of a blog post.', 'ultimate-post' ),
158 + 'img' => ULTP_URL.'/assets/img/addons/progressbar.svg',
159 + 'is_pro' => true,
160 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/progress-bar/',
161 + 'live' => 'https://www.wpxpo.com/postx/progress-bar/'
162 + ),
163 + 'ultp_yoast' => array(
164 + 'name' => __( 'Yoast Meta', 'ultimate-post' ),
165 + 'desc' => __( 'Show Yoast meta description in the excerpt.', 'ultimate-post' ),
166 + 'img' => ULTP_URL.'/assets/img/addons/yoast.svg',
167 + 'is_pro' => true,
168 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/seo-meta/',
169 + 'live' => 'https://www.wpxpo.com/postx/addons/yoast/',
170 + 'required' => array(
171 + 'name' => 'Yoast',
172 + 'slug' => 'wordpress-seo/wp-seo.php'
173 + )
174 + ),
175 + 'ultp_aioseo' => array(
176 + 'name' => __( 'All in One SEO Meta', 'ultimate-post' ),
177 + 'desc' => __( 'Show All in One SEO meta description in the excerpt.', 'ultimate-post' ),
178 + 'img' => ULTP_URL.'/assets/img/addons/aioseo.svg',
179 + 'is_pro' => true,
180 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/seo-meta/',
181 + 'live' => 'https://www.wpxpo.com/postx/addons/all-in-one-seo-meta/',
182 + 'required' => array(
183 + 'name' => 'All in One SEO',
184 + 'slug' => 'all-in-one-seo-pack/all_in_one_seo_pack.php'
185 + )
186 + ),
187 + 'ultp_rankmath' => array(
188 + 'name' => __( 'RankMath Meta', 'ultimate-post' ),
189 + 'desc' => __( 'Show RankMath meta description in the excerpt.', 'ultimate-post' ),
190 + 'img' => ULTP_URL.'/assets/img/addons/rankmath.svg',
191 + 'is_pro' => true,
192 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/seo-meta/',
193 + 'live' => 'https://www.wpxpo.com/postx/addons/rankmath/',
194 + 'required' => array(
195 + 'name' => 'RankMath',
196 + 'slug' => 'seo-by-rank-math/rank-math.php'
197 + )
198 + ),
199 + 'ultp_seopress' => array(
200 + 'name' => __( 'SEOPress Meta', 'ultimate-post' ),
201 + 'desc' => __( 'Show SEOPress meta description in the excerpt.', 'ultimate-post' ),
202 + 'img' => ULTP_URL.'/assets/img/addons/seopress.svg',
203 + 'is_pro' => true,
204 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/seo-meta/',
205 + 'live' => 'https://www.wpxpo.com/postx/addons/seopress/',
206 + 'required' => array(
207 + 'name' => 'SEOPress',
208 + 'slug' => 'wp-seopress/seopress.php'
209 + )
210 + ),
211 + 'ultp_squirrly' => array(
212 + 'name' => __( 'Squirrly Meta', 'ultimate-post' ),
213 + 'desc' => __( 'Show Squirrly meta description in the excerpt.', 'ultimate-post' ),
214 + 'img' => ULTP_URL.'/assets/img/addons/squirrly.svg',
215 + 'is_pro' => true,
216 + 'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/seo-meta/',
217 + 'live' => 'https://www.wpxpo.com/postx/addons/squirrly/',
218 + 'required' => array(
219 + 'name' => 'Squirrly',
220 + 'slug' => 'squirrly-seo/squirrly.php'
221 + ),
222 + ),
223 + );
224 + return apply_filters('ultp_addons_config', $all_addons);
21 225 }
22 226
227 +
23 228 /**
24 229 * Settings page output
25 230 */
26 231 public function create_admin_page() { ?>
27 - <style>
28 - .style-css{
29 - background-color: #f2f2f2;
30 - -webkit-font-smoothing: subpixel-antialiased;
31 - }
32 - </style>
33 232
34 - <div class="ultp-option-body">
233 + <div class="ultp-dashboard-container">
35 234
36 - <?php require_once ULTP_PATH . 'classes/options/Heading.php'; ?>
235 + <!-- addons content -->
236 + <div class="ultp-dashboard-body ultp-addons-content is-blank">
237 +
238 + <!-- Pro Popup Container -->
239 + <div class="ultp-popup-container popup-center">
240 + <div class="ultp-unlock-popup ultp-unlock-modal">
241 + <img src="<?php echo esc_url(ULTP_URL . '/assets/img/admin/dashboard/unlock-super-icon.svg'); ?>" alt="lock icon">
242 + <div class="ultp-popup-heading"><?php esc_html_e('Unlock 11+ Addons', 'ultimate-post'); ?></div>
243 + <div class="ultp-popup-desc">
244 + <?php esc_html_e('We’re sorry, PostX Addons are not available on PostX free. Please upgrade to a PRO plan to unlock the add ons of your choice.', 'ultimate-post'); ?>
245 + </div>
246 + <a href="<?php echo esc_url(ultimate_post()->get_premium_link('', 'postx_dashboard_addons_popup')); ?>" class="ultp-popup-planbtn"><?php esc_html_e('Upgrade Plan', 'ultimate-post'); ?></a>
247 + <button class="ultp-popup-close"></button>
248 + </div>
249 + </div>
37 250
38 - <div class="ultp-content-wrap ultp-addons-wrap">
39 - <div class="ultp-text-center"><h2 class="ultp-admin-title"><?php _e('All Addons', 'ultimate-post'); ?></h2></div>
40 - <div class="ultp-addons-items">
41 - <?php
42 - $option_value = ultimate_post()->get_setting();
43 - $addons_data = self::all_addons();
44 - foreach ($addons_data as $key => $val) {
45 - echo '<div class="ultp-addons-item ultp-admin-card">';
46 - echo '<div class="ultp-addons-item-content">';
47 - echo '<img src="'.$val['img'].'" />';
48 - echo '<h4>'.$val['name'].'</h4>';
49 - echo '<div class="ultp-addons-desc">'.$val['desc'].'</div>';
50 - echo '</div>';
51 - if( $val['is_pro'] && !defined('ULTP_PRO_VER') ){
52 - echo '<div class="ultp-addons-btn">';
53 - echo '<a class="ultp-btn ultp-btn-default" target="_blank" href="https://www.wpxpo.com/gutenberg-post-blocks/?utm_campaign=go_premium">'.__("Get Pro", "ultimate-post").'</a>';
54 - echo '</div>';
55 - } else {
56 - echo '<div class="ultp-addons-btn">';
57 - echo '<label class="ultp-switch">';
58 - echo '<input class="ultp-addons-enable" '.(($val['is_pro'] && (!defined('ULTP_PRO_VER'))) ? 'disabled' : '').' data-addon="'.$key.'" type="checkbox" '.( isset($option_value[$key]) && $option_value[$key] == 'true' ? 'checked' : '' ).'>';
59 - echo '<span class="ultp-slider ultp-round"></span>';
60 - echo '</label>';
61 - echo '</div>';
62 - }
63 - echo '</div>';
64 - }
65 - ?>
66 - </div>
251 + <div class="ultp-addon-heading">
252 + <?php _e('All Addons', 'ultimate-post'); ?>
253 + </div>
254 +
255 + <div class="ultp-addons-grid">
256 + <?php
257 + $settings = apply_filters('ultp_settings', []);
258 + $option_value = ultimate_post()->get_setting();
259 + $addons_data = self::all_addons();
260 + foreach ($addons_data as $key => $val) {
261 + $require_plugin = '';
262 + if (isset($val['required'])) {
263 + $active_plugins = get_option( 'active_plugins', array() );
264 + if (is_multisite()) {
265 + $active_plugins = array_merge($active_plugins, array_keys(get_site_option( 'active_sitewide_plugins', array() )));
266 + }
267 + if ( !in_array($val['required']['slug'], apply_filters('active_plugins', $active_plugins)) ) {
268 + $require_plugin = $val['required']['name'];
269 + }
270 + }
271 + ?>
272 + <div class="ultp-content-addon">
273 + <div class="ultp-content-addon-container">
274 + <div class="ultp-content-meta">
275 + <img src="<?php echo esc_url($val['img']); ?>" alt="<?php echo esc_attr($val['name']); ?>">
276 + </div>
277 + <div class="ultp-addons-option-wrapper">
278 + <div class="ultp-addons-option-control">
279 + <span class="ultp-mid-title"><?php echo esc_html($val['name']); ?></span>
280 + <div class="ultp-control-option">
281 + <?php
282 + if (isset($val['docs'])) { ?>
283 + <a href="<?php echo esc_url($val['docs']); ?>" class="ultp-option-tooltip" target="_blank">
284 + <span><?php esc_html_e('Documentation', 'ultimate-post'); ?></span>
285 + <div class="dashicons dashicons-book"></div>
286 + </a>
287 + <?php } ?>
288 +
289 + <?php
290 + if (isset($val['live'])) { ?>
291 + <a href="<?php echo esc_url($val['live']); ?>" class="ultp-option-tooltip" target="_blank">
292 + <span><?php esc_html_e('Live View', 'ultimate-post'); ?></span>
293 + <div class="dashicons dashicons-visibility"></div>
294 + </a>
295 + <?php } ?>
296 +
297 + <input type="checkbox" data-type="<?php echo esc_attr($key); ?>" class="ultp-addons-enable <?php echo (($val['is_pro'] && (!defined('ULTP_PRO_VER'))) ? 'disabled' : ''); ?>" id="<?php echo esc_attr($key); ?>" <?php echo ( isset($option_value[$key]) && $option_value[$key] == 'true' ? 'checked' : '' ); ?>/>
298 + <label for="<?php echo esc_attr($key); ?>">
299 + <?php if ($val['is_pro'] && (!defined('ULTP_PRO_VER'))) { ?>
300 + <span class="dashicons dashicons-lock"></span>
301 + <?php } ?>
302 + </label>
303 +
304 + <?php
305 + if (isset($settings[$key])) { ?>
306 + <span class="ultp-block-settings dashicons dashicons-admin-generic"></span>
307 + <div class="ultp-popup-container blocks-settings">
308 + <div class="ultp-unlock-popup">
309 + <form action="">
310 + <?php
311 + require_once ULTP_PATH.'classes/options/Settings.php';
312 + $obj = new \ULTP\Option_Settings();
313 + $obj->get_settings_data($settings[$key]['attr']);
314 + ?>
315 + <div class="ultp-data-message"></div>
316 + <div>
317 + <button class="ultp-addons-setting-save"><?php esc_html_e('Save Settings', 'ultimate-post'); ?></button>
318 + </div>
319 + </form>
320 + <button class="ultp-popup-close"></button>
321 + </div>
322 + </div>
323 + <?php } ?>
324 + </div>
325 + </div>
326 + <div class="ultp-addon-desc ultp-addon-desc"><?php echo esc_html($val['desc']); ?></div>
327 + </div>
328 + </div>
329 + <?php if ($require_plugin) { ?>
330 + <div class="ultp-plugin-required">
331 + <?php esc_html_e('This addon required this plugin:', 'ultimate-post'); ?> <b><?php echo wp_kses($require_plugin, 'post'); ?></b>
332 + </div>
333 + <?php } ?>
334 + </div>
335 + <?php } ?>
336 + </div>
67 337 </div>
68 338 </div>
69 -
70 339 <?php }
71 340 }