PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.1.1
Post Grid Gutenberg Blocks – PostX v5.1.1
5.1.1 5.1.0 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 All 240 releases
← All changes | classes/Options.php +47 -127 5.0.25 → 5.1.1 View file →
@@ -30,8 +30,9 @@
30 30 */
31 31 public function __construct() {
32 32 add_action( 'admin_init', array( $this, 'handle_external_redirects' ) );
33 33 add_action( 'admin_menu', array( $this, 'menu_page_callback' ) );
34 + add_action( 'admin_footer', array( $this, 'sync_addon_submenu_visibility' ) );
34 35 add_action( 'in_admin_header', array( $this, 'remove_all_notices' ) );
35 36 add_filter( 'plugin_row_meta', array( $this, 'plugin_settings_meta' ), 10, 2 );
36 37 add_filter( 'plugin_action_links_' . ULTP_BASE, array( $this, 'plugin_action_links_callback' ) );
37 38 }
@@ -69,93 +70,15 @@
69 70 * @param array $links Default plugin action links.
70 71 * @return array Modified plugin action links.
71 72 */
72 73 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 -
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 - ),
95 -
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 - ),
106 -
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 - );
118 -
119 74 $setting_link = array(
120 75 'ultp_options' => '<a href="' . esc_url( admin_url( 'admin.php?page=ultp-settings#startersites' ) ) . '">' . esc_html__( 'Starter Sites', 'ultimate-post' ) . '</a>',
121 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 );
78 + // The "Upgrade to Pro" / "Renew License" link is added after this by
79 + // includes/notice/class-promo-links.php.
80 + return array_merge( $setting_link, $links );
158 81 }
159 82
160 83
161 84 /**
@@ -216,52 +139,10 @@
216 139 'ultp-setup-wizard',
217 140 array( __CLASS__, 'ultp_wizard_page' )
218 141 );
219 142
220 - $pro_link = '';
221 - $pro_link_text = '';
143 + // The "Upgrade to Pro" / "Renew License" item is added last by includes/notice/class-promo-links.php.
222 144
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 145 add_theme_page(
265 146 __( 'Starter Sites', 'ultimate-post' ),
266 147 __( 'Starter Sites', 'ultimate-post' ),
267 148 $menupage_cap,
@@ -270,8 +151,46 @@
270 151 );
271 152 }
272 153
273 154 /**
155 + * Sync addon-backed WordPress submenu items with addon enabled status.
156 + *
157 + * @since v.4.1.7
158 + * @return void No return value.
159 + */
160 + public function sync_addon_submenu_visibility() {
161 + $settings = ultimate_post()->get_setting();
162 + $submenus = array(
163 + 'builder' => 'ultp_builder',
164 + 'saved-templates' => 'ultp_templates',
165 + 'custom-font' => 'ultp_custom_font',
166 + );
167 +
168 + foreach ( $submenus as $slug => $setting_key ) {
169 + $submenus[ $slug ] = isset( $settings[ $setting_key ] ) && $settings[ $setting_key ] !== 'false';
170 + }
171 + ?>
172 + <script>
173 + ( function() {
174 + const postxAddonSubmenus = <?php echo wp_json_encode( $submenus ); ?>;
175 +
176 + Object.keys( postxAddonSubmenus ).forEach( function( slug ) {
177 + const link = document.querySelector( '#adminmenu a[href*="page=ultp-settings#' + slug + '"]' );
178 + const item = link ? link.closest( 'li' ) : null;
179 +
180 + if ( ! item ) {
181 + return;
182 + }
183 +
184 + item.id = 'postx-submenu-' + slug;
185 + item.style.display = postxAddonSubmenus[ slug ] ? '' : 'none';
186 + } );
187 + }() );
188 + </script>
189 + <?php
190 + }
191 +
192 + /**
274 193 * Handle external redirects for menu and pro links.
275 194 *
276 195 * @since v.1.0.0
277 196 * @return void No return value.
@@ -279,13 +198,14 @@
279 198 public function handle_external_redirects() {
280 199 if (empty($_GET['page'])) { // @codingStandardsIgnoreLine
281 200 return;
282 201 }
283 - $_page = sanitize_key( $_GET['page'] );
202 + $_page = sanitize_key( $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin page slug.
284 203 if ('ultp-startersites' === $_page) { // @codingStandardsIgnoreLine
285 - exit( wp_safe_redirect( admin_url( 'admin.php?page=ultp-settings#startersites' ) ) );
204 + wp_safe_redirect( admin_url( 'admin.php?page=ultp-settings#startersites' ) );
205 + exit;
286 206 } else if ('go_postx_pro' === $_page) { // @codingStandardsIgnoreLine
287 - wp_redirect(
207 + wp_redirect( // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- Intentional redirect to the fixed wpxpo.com pricing URL.
288 208 Xpo::generate_utm_link(
289 209 array(
290 210 'utmKey' => 'dashboard_go_pro',
291 211 )