PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.2.5
Post Grid Gutenberg Blocks – PostX v2.2.5
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.php +63 -324 5.0.302.2.5 View file →
@@ -1,338 +1,77 @@
1 1 <?php
2 -
3 -/**
4 - * Options Action.
5 - *
6 - * @package ULTP\Notice
7 - * @since v.1.0.0
8 - */
9 -
10 2 namespace ULTP;
11 3
12 -use ULTP\Includes\Durbin\Xpo;
4 +defined('ABSPATH') || exit;
13 5
14 -defined( 'ABSPATH' ) || exit;
6 +class Options{
7 + public function __construct() {
8 + add_action( 'admin_menu', array( $this, 'menu_page_callback' ) );
9 + add_action( 'in_admin_header', array($this, 'remove_all_notices') );
10 + add_filter( 'plugin_row_meta', array( $this, 'plugin_settings_meta' ), 10, 2 );
11 + add_filter( 'plugin_action_links_'.ULTP_BASE, array( $this, 'plugin_action_links_callback' ) );
12 + }
15 13
16 -/**
17 - * Options class.
18 - *
19 - * Handles plugin options and settings for Ultimate Post.
20 - *
21 - * @package ULTP\Options
22 - * @since 4.0.0
23 - */
24 -class Options {
25 14
26 - /**
27 - * Setup class.
28 - *
29 - * @since v.1.0.0
30 - */
31 - public function __construct() {
32 - add_action( 'admin_init', array( $this, 'handle_external_redirects' ) );
33 - add_action( 'admin_menu', array( $this, 'menu_page_callback' ) );
34 - add_action( 'in_admin_header', array( $this, 'remove_all_notices' ) );
35 - add_filter( 'plugin_row_meta', array( $this, 'plugin_settings_meta' ), 10, 2 );
36 - add_filter( 'plugin_action_links_' . ULTP_BASE, array( $this, 'plugin_action_links_callback' ) );
37 - }
15 + public function plugin_settings_meta( $links, $file ) {
16 + if ( strpos( $file, 'ultimate-post.php' ) !== false ) {
17 + $new_links = array(
18 + 'ultp_docs' => '<a href="https://docs.wpxpo.com/" target="_blank">'.__('Docs', 'ultimate-post').'</a>',
19 + 'ultp_tutorial' => '<a href="https://www.youtube.com/watch?v=JZxIflYKOuM&list=PLPidnGLSR4qcAwVwIjMo1OVaqXqjUp_s4" target="_blank">'.__('Tutorials', 'ultimate-post').'</a>',
20 + 'ultp_support' => '<a href="'.ultimate_post()->get_premium_link( 'https://www.wpxpo.com/contact/' ).'" target="_blank">'.__('Support', 'ultimate-post').'</a>'
21 + );
22 + $links = array_merge( $links, $new_links );
23 + }
24 + return $links;
25 + }
38 26
39 27
40 - /**
41 - * Adds extra links to the plugin row meta on the plugins page.
42 - *
43 - * @param array $links Existing plugin meta links.
44 - * @param string $file Plugin file path.
45 - * @return array Modified plugin meta links.
46 - */
47 - public function plugin_settings_meta( $links, $file ) {
48 - if ( strpos( $file, 'ultimate-post.php' ) !== false ) {
49 - $new_links = array(
50 - 'ultp_docs' => '<a href="https://wpxpo.com/docs/" target="_blank">' . esc_html__( 'Docs', 'ultimate-post' ) . '</a>',
51 - 'ultp_tutorial' => '<a href="https://www.youtube.com/watch?v=JZxIflYKOuM&list=PLPidnGLSR4qcAwVwIjMo1OVaqXqjUp_s4" target="_blank">' . esc_html__( 'Tutorials', 'ultimate-post' ) . '</a>',
52 - 'ultp_support' => '<a href="' . esc_url(
53 - Xpo::generate_utm_link(
54 - array(
55 - 'url' => 'https://www.wpxpo.com/contact/',
56 - 'utmKey' => 'plugin_dir_support',
57 - )
58 - )
59 - ) . '" target="_blank">' . esc_html__( 'Support', 'ultimate-post' ) . '</a>',
60 - );
61 - $links = array_merge( $links, $new_links );
62 - }
63 - return $links;
64 - }
28 + public function plugin_action_links_callback ( $links ) {
29 + $upgrade_link = array();
30 + $setting_link = array();
31 + if(!defined('ULTP_PRO_VER')){
32 + $upgrade_link = array(
33 + 'ultp_pro' => '<a href="'.ultimate_post()->get_premium_link().'" target="_blank"><span style="color: #e83838; font-weight: bold;">'.__('Go Pro', 'ultimate-post').'</span></a>'
34 + );
35 + }
36 + $setting_link['ultp_settings'] = '<a href="'. menu_page_url('ultp-option-settings', false) .'">'. __('Settings', 'wp-megamenu') .'</a>';
37 + return array_merge( $setting_link, $links, $upgrade_link);
38 + }
65 39
66 - /**
67 - * Adds quick action links below the plugin name.
68 - *
69 - * @param array $links Default plugin action links.
70 - * @return array Modified plugin action links.
71 - */
72 - public function plugin_action_links_callback( $links ) {
73 - $offer_config = array(
74 - // Flash sale
75 - array(
76 - 'start' => '2026-05-07 00:00 Asia/Dhaka',
77 - 'end' => '2026-05-21 23:59 Asia/Dhaka',
78 - 'text' => __(
79 - 'Flash Sale - Up to 45% OFF',
80 - 'ultimate-post'
81 - ),
82 - 'utmKey' => 'flash_sale_meta',
83 - ),
84 40
85 - // Surprise Sale
86 - array(
87 - 'start' => '2026-05-22 00:00 Asia/Dhaka',
88 - 'end' => '2026-06-01 23:59 Asia/Dhaka',
89 - 'text' => __(
90 - 'Surprise Sale - Up to 50% OFF',
91 - 'ultimate-post'
92 - ),
93 - 'utmKey' => 'surprise_sale_meta',
94 - ),
41 + public static function menu_page_callback() {
42 + add_menu_page(
43 + esc_html__( 'Post Blocks', 'ultimate-post' ),
44 + esc_html__( 'Post Blocks', 'ultimate-post' ),
45 + 'manage_options',
46 + 'ultp-settings',
47 + '',
48 + ULTP_URL.'assets/img/menu-panel.svg'
49 + );
95 50
96 - // Massive Sale
97 - array(
98 - 'start' => '2026-06-02 00:00 Asia/Dhaka',
99 - 'end' => '2026-06-20 23:59 Asia/Dhaka',
100 - 'text' => __(
101 - 'Massive Sale - Up to 50% OFF',
102 - 'ultimate-post'
103 - ),
104 - 'utmKey' => 'massive_sale_meta',
105 - ),
51 + require_once ULTP_PATH . 'classes/options/Overview.php';
52 + require_once ULTP_PATH . 'classes/options/Features.php';
53 + require_once ULTP_PATH . 'classes/options/Addons.php';
54 + require_once ULTP_PATH . 'classes/options/Settings.php';
55 + require_once ULTP_PATH . 'classes/options/Contact.php';
56 + new \ULTP\Options_Overview();
57 + new \ULTP\Options_Features();
58 + new \ULTP\Options_Addons();
59 + new \ULTP\Options_Settings();
60 + new \ULTP\Options_Contact();
106 61
107 - // Final hours sale
108 - array(
109 - 'start' => '2026-06-21 00:00 Asia/Dhaka',
110 - 'end' => '2026-06-30 23:59 Asia/Dhaka',
111 - 'text' => __(
112 - 'Final Hours Sale - Up to 50% OFF',
113 - 'ultimate-post'
114 - ),
115 - 'utmKey' => 'final_hour_meta',
116 - ),
117 - );
62 + if( !function_exists('ultimate_post_pro') ){
63 + global $submenu;
64 + $upgrade_link = ultimate_post()->get_premium_link( 'https://www.wpxpo.com/postx/?ultp=plugins' );
65 + $submenu['ultp-settings'][] = array( '<span class="ultp-dashboard-upgrade"><span class="dashicons dashicons-update"></span> Upgrade</span>', 'manage_options', $upgrade_link );
66 + }
67 + }
118 68
119 - $setting_link = array(
120 - 'ultp_options' => '<a href="' . esc_url( admin_url( 'admin.php?page=ultp-settings#startersites' ) ) . '">' . esc_html__( 'Starter Sites', 'ultimate-post' ) . '</a>',
121 - );
69 + // Remove All Notification From Menu Page
70 + public static function remove_all_notices() {
71 + if ( isset( $_GET['page'] ) && ( $_GET['page'] === 'ultp-settings' || $_GET['page'] === 'ultp-features' || $_GET['page'] === 'ultp-addons' || $_GET['page'] === 'ultp-option-settings' || $_GET['page'] === 'ultp-contact' || $_GET['page'] === 'ultp-license' ) ) {
72 + remove_all_actions( 'admin_notices' );
73 + remove_all_actions( 'all_admin_notices' );
74 + }
75 + }
76 +}
122 77
123 - $upgrade_link = array();
124 -
125 - // Free user or expired license user.
126 - if ( ! defined( 'ULTP_PRO_VER' ) || Xpo::is_lc_expired() ) {
127 -
128 - $license_key = Xpo::get_lc_key() ?? '';
129 -
130 - if ( Xpo::is_lc_expired() ) {
131 - $text = esc_html__( 'Renew License', 'ultimate-post' );
132 - $url = 'https://account.wpxpo.com/checkout/?edd_license_key=' . $license_key;
133 - } else {
134 -
135 - $text = esc_html__( 'Upgrade to Pro', 'ultimate-post' );
136 - $url = Xpo::generate_utm_link();
137 -
138 - foreach ( $offer_config as $offer ) {
139 - $current_time = gmdate( 'U' );
140 - $notice_start = gmdate( 'U', strtotime( $offer['start'] ) );
141 - $notice_end = gmdate( 'U', strtotime( $offer['end'] ) );
142 - if ( $current_time >= $notice_start && $current_time <= $notice_end ) {
143 - $url = Xpo::generate_utm_link(
144 - array(
145 - 'utmKey' => $offer['utmKey'],
146 - )
147 - );
148 - $text = $offer['text'];
149 - break;
150 - }
151 - }
152 - }
153 -
154 - $upgrade_link['ultp_pro'] = '<a style="color: #0062ff; font-weight: bold;" target="_blank" href="' . esc_url( $url ) . '">' . esc_html( $text ) . '</a>';
155 - }
156 -
157 - return array_merge( $setting_link, $links, $upgrade_link );
158 - }
159 -
160 -
161 - /**
162 - * Add admin menu option page and submenus.
163 - *
164 - * @since v.1.0.0
165 - * @return void No return value.
166 - */
167 - public static function menu_page_callback() {
168 - $ultp_menu_icon = 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MCA0OC4zIj4NCiAgPGRlZnM+DQogICAgPHN0eWxlPg0KICAgICAgLmNscy0xIHsNCiAgICAgICAgZmlsbDogI2E3YWFhZDsNCiAgICAgIH0NCiAgICA8L3N0eWxlPg0KICA8L2RlZnM+DQogIDx0aXRsZT5Qb3N0eCBJY29uIGNtcHJzc2QgU1ZHPC90aXRsZT4NCiAgPGc+DQogICAgPHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMTguODEsOXY4LjlIOC4xOUE2LjE5LDYuMTksMCwwLDAsMiwyMy43N2EzLjE2LDMuMTYsMCwwLDEtMi0yLjk0VjRBMy4xNiwzLjE2LDAsMCwxLDMuMTUuODVIMjBhMy4xOCwzLjE4LDAsMCwxLDMsMi4zMUE2LjIxLDYuMjEsMCwwLD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'PostX', 'ultimate-post' ),
172 - __( 'PostX', 'ultimate-post' ),
173 - $menupage_cap,
174 - 'ultp-settings',
175 - array( self::class, 'ultp_dashboard' ),
176 - $ultp_menu_icon,
177 - 58.5
178 - );
179 -
180 - add_submenu_page(
181 - 'ultp-settings',
182 - __( 'PostX Dashboard', 'ultimate-post' ),
183 - __( 'Getting Started', 'ultimate-post' ),
184 - $menupage_cap,
185 - 'ultp-settings'
186 - );
187 -
188 - $menu_lists = array(
189 - 'startersites' => esc_html__( 'Starter Sites', 'ultimate-post' ),
190 - 'builder' => esc_html__( 'Site Builder', 'ultimate-post' ),
191 - 'saved-templates' => esc_html__( 'Saved Templates', 'ultimate-post' ),
192 - 'custom-font' => esc_html__( 'Custom Font', 'ultimate-post' ),
193 - 'addons' => esc_html__( 'Add-ons', 'ultimate-post' ),
194 - 'blocks' => esc_html__( 'Blocks', 'ultimate-post' ),
195 - 'settings' => esc_html__( 'Settings', 'ultimate-post' ),
196 - );
197 - if ( defined( 'ULTP_PRO_VER' ) ) {
198 - $menu_lists['license'] = esc_html__( 'License ', 'ultimate-post' );
199 - }
200 -
201 - foreach ( $menu_lists as $key => $val ) {
202 - add_submenu_page(
203 - 'ultp-settings',
204 - $val,
205 - $val,
206 - $menupage_cap,
207 - 'ultp-settings#' . $key,
208 - array( __CLASS__, 'render_main' )
209 - );
210 - }
211 - add_submenu_page(
212 - 'ultp-settings',
213 - esc_html__( 'Initial Setup', 'ultimate-post' ),
214 - esc_html__( 'Initial Setup', 'ultimate-post' ),
215 - $menupage_cap,
216 - 'ultp-setup-wizard',
217 - array( __CLASS__, 'ultp_wizard_page' )
218 - );
219 -
220 - $pro_link = '';
221 - $pro_link_text = '';
222 -
223 - // Check if current date is between November 5th and December 10th
224 - $current_date = current_time( 'Y-m-d' );
225 - $start_date = date( 'Y' ) . '-01-01'; // January 1st of current year
226 - $end_date = date( 'Y' ) . '-02-15'; // February 15th of current year
227 - $menu_pro_text_period = ( $current_date >= $start_date && $current_date <= $end_date );
228 -
229 - if ( ! Xpo::is_lc_active() ) {
230 - $pro_link = Xpo::generate_utm_link(
231 - array(
232 - 'utmKey' => 'sub_menu',
233 - )
234 - );
235 - $pro_link_text = $menu_pro_text_period ? __( 'New Year Offer!', 'ultimate-post' ) : __( 'Upgrade to Pro', 'ultimate-post' );
236 - } elseif ( Xpo::is_lc_expired() ) {
237 - $license_key = Xpo::get_lc_key();
238 - $pro_link = 'https://account.wpxpo.com/checkout/?edd_license_key=' . $license_key;
239 - $pro_link_text = __( 'Renew License', 'ultimate-post' );
240 - }
241 -
242 - if ( ! empty( $pro_link ) ) {
243 - ob_start();
244 - ?>
245 - <a href="<?php echo esc_url( $pro_link ); ?>" target="_blank" class="ultp-go-pro">
246 - <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
247 - <path d="M2.86 6.553a.5.5 0 01.823-.482l3.02 2.745c.196.178.506.13.64-.098L9.64 4.779a.417.417 0 01.72 0l2.297 3.939a.417.417 0 00.64.098l3.02-2.745a.5.5 0 01.823.482l-1.99 8.63a.833.833 0 01-.813.646H5.663a.833.833 0 01-.812-.646L2.86 6.553z" stroke="currentColor" stroke-width="1.5"></path>
248 - </svg>
249 - <span><?php echo esc_html( $pro_link_text ); ?></span>
250 - </a>
251 - <?php
252 - $submenu_content = ob_get_clean();
253 -
254 - add_submenu_page(
255 - 'ultp-settings',
256 - '',
257 - $submenu_content,
258 - 'manage_options',
259 - 'ultp-pro',
260 - array( self::class, 'handle_external_redirects' )
261 - );
262 - }
263 -
264 - add_theme_page(
265 - __( 'Starter Sites', 'ultimate-post' ),
266 - __( 'Starter Sites', 'ultimate-post' ),
267 - $menupage_cap,
268 - 'ultp-startersites',
269 - array( self::class, 'handle_external_redirects' )
270 - );
271 - }
272 -
273 - /**
274 - * Handle external redirects for menu and pro links.
275 - *
276 - * @since v.1.0.0
277 - * @return void No return value.
278 - */
279 - public function handle_external_redirects() {
280 - if (empty($_GET['page'])) { // @codingStandardsIgnoreLine
281 - return;
282 - }
283 - $_page = sanitize_key( $_GET['page'] );
284 - if ('ultp-startersites' === $_page) { // @codingStandardsIgnoreLine
285 - exit( wp_safe_redirect( admin_url( 'admin.php?page=ultp-settings#startersites' ) ) );
286 - } else if ('go_postx_pro' === $_page) { // @codingStandardsIgnoreLine
287 - wp_redirect(
288 - Xpo::generate_utm_link(
289 - array(
290 - 'utmKey' => 'dashboard_go_pro',
291 - )
292 - )
293 - );
294 - die();
295 - }
296 - }
297 -
298 - /**
299 - * Render the wizard page.
300 - *
301 - * @since v.2.4.4
302 - */
303 - public static function ultp_wizard_page() {
304 - ?>
305 - <div class="ultp-wizard-page-wrap" id="ultp-wizard-page"></div>
306 - <?php
307 - }
308 -
309 - /**
310 - * Render the dashboard page.
311 - *
312 - * @since v.1.0.0
313 - * @return void No return value.
314 - */
315 - public static function ultp_dashboard() {
316 - echo '<div id="ultp-dashboard"></div>';
317 - }
318 -
319 - /**
320 - * Remove all notifications from menu page.
321 - *
322 - * @since v.1.0.0
323 - * @return void No return value.
324 - */
325 - public static function remove_all_notices() {
326 - if (isset($_GET['page'])) { // @codingStandardsIgnoreLine
327 - $page = sanitize_key($_GET['page']); // @codingStandardsIgnoreLine
328 - if (
329 - $page === 'ultp-settings' ||
330 - $page === 'ultp-license' ||
331 - $page === 'ultp-setup-wizard'
332 - ) {
333 - remove_all_actions( 'admin_notices' );
334 - remove_all_actions( 'all_admin_notices' );
335 - }
336 - }
337 - }
338 -}