PluginProbe
Post Grid Gutenberg Blocks – PostX / 3.1.5
Post Grid Gutenberg Blocks – PostX v3.1.5
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 2.1.2 All 237 releases
ultimate-post / classes / Options.php

Options.php in Post Grid Gutenberg Blocks – PostX 3.1.5, at classes/Options.php

186 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Options Action.
4 *
5 * @package ULTP\Notice
6 * @since v.1.0.0
7 */
8 namespace ULTP;
9
10 defined('ABSPATH') || exit;
11
12 /**
13 * Options class.
14 */
15 class Options{
16
17 /**
18 * Setup class.
19 *
20 * @since v.1.0.0
21 */
22 public function __construct() {
23 add_action( 'admin_init', array( $this, 'handle_external_redirects' ) );
24 add_action( 'admin_menu', array( $this, 'menu_page_callback' ) );
25 add_action( 'in_admin_header', array($this, 'remove_all_notices') );
26 add_filter( 'plugin_row_meta', array( $this, 'plugin_settings_meta' ), 10, 2 );
27 add_filter( 'plugin_action_links_'.ULTP_BASE, array( $this, 'plugin_action_links_callback' ) );
28 }
29
30
31 /**
32 * Plugin Page Menu Add
33 *
34 * @since v.1.0.0
35 * @return ARRAY
36 */
37 public function plugin_settings_meta( $links, $file ) {
38 if (strpos( $file, 'ultimate-post.php' ) !== false ) {
39 $new_links = array(
40 'ultp_docs' => '<a href="https://wpxpo.com/docs/" target="_blank">'.esc_html__('Docs', 'ultimate-post').'</a>',
41 'ultp_tutorial' => '<a href="https://www.youtube.com/watch?v=JZxIflYKOuM&list=PLPidnGLSR4qcAwVwIjMo1OVaqXqjUp_s4" target="_blank">'.esc_html__('Tutorials', 'ultimate-post').'</a>',
42 'ultp_support' => '<a href="'.esc_url(ultimate_post()->get_premium_link( 'https://www.wpxpo.com/contact/', 'plugin_dir_support')).'" target="_blank">'.esc_html__('Support', 'ultimate-post').'</a>'
43 );
44 $links = array_merge( $links, $new_links );
45 }
46 return $links;
47 }
48
49
50 /**
51 * Settings Pro Update Link
52 *
53 * @since v.1.0.0
54 * @return ARRAY
55 */
56 public function plugin_action_links_callback( $links ) {
57 $upgrade_link = array();
58 $setting_link = array();
59 if (!defined('ULTP_PRO_VER')) {
60 $upgrade_link = array(
61 'ultp_pro' => '<a href="'.esc_url(ultimate_post()->get_premium_link('', 'plugin_dir_pro')).'" target="_blank"><span style="color: #e83838; font-weight: bold;">'.esc_html__('Get PostX Pro', 'ultimate-post').'</span></a>'
62 );
63 $notice = ultimate_post()->get_notice_data('plugin');
64 if (count($notice) > 0) {
65 $current_time = date('U');
66 if ($current_time > strtotime($notice['start']) && $current_time < strtotime($notice['end'])) {
67 $upgrade_link['ultp_pro'] = '<a href="'.esc_url(ultimate_post()->get_premium_link('', 'plugin_dir_pro')).'" target="_blank"><span style="color: #e83838; font-weight: bold;">'.$notice['content'].'</span></a>';
68 }
69 }
70 }
71 $setting_link['ultp_settings'] = '<a href="'. esc_url(admin_url('admin.php?page=ultp-settings#settings')) .'">'. esc_html__('Settings', 'ultimate-post') .'</a>';
72 return array_merge( $setting_link, $links, $upgrade_link);
73 }
74
75
76 /**
77 * Admin Menu Option Page
78 *
79 * @since v.1.0.0
80 * @return NULL
81 */
82 public static function menu_page_callback() {
83 $ultp_menu_icon = 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MCA0OC4zIj4NCiAgPGRlZnM+DQogICAgPHN0eWxlPg0KICAgICAgLmNscy0xIHsNCiAgICAgICAgZmlsbDogI2E3YWFhZDsNCiAgICAgIH0NCiAgICA8L3N0eWxlPg0KICA8L2RlZnM+DQogIDx0aXRsZT5Qb3N0eCBJY29uIG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sMy4xNS0zSDI1YTMuMTIsMy4xMiwwLDAsMSwxLjE0LjIyLDMuMjQsMy4yNCwwLDAsMSwxLjksMi4xQTMuNjMsMy42MywwLDAsMSwyOC4xNiwyNC4xM1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTAuODUpIi8+DQogIDwvZz4NCjwvc3ZnPg0K';
84 add_menu_page(
85 __( 'PostX', 'ultimate-post' ),
86 __( 'PostX', 'ultimate-post' ),
87 'manage_options',
88 'ultp-settings',
89 array(self::class, 'tab_page_content'),
90 $ultp_menu_icon,
91 58.5
92 );
93
94 add_submenu_page(
95 'ultp-settings',
96 __( 'PostX Dashboard', 'ultimate-post' ),
97 __( 'Getting Started', 'ultimate-post' ),
98 'manage_options',
99 'ultp-settings'
100 );
101
102 $menu_lists = array(
103 'builder' => __( 'Site Builder', 'ultimate-post' ),
104 'templatekit' => __( 'Template Kits', 'ultimate-post' ),
105 'saved-templates' => __( 'Saved Templates', 'ultimate-post' ),
106 'custom-font' => __( 'Custom Font', 'ultimate-post' ),
107 'addons' => __( 'Addons', 'ultimate-post' ),
108 'blocks' => __( 'Blocks', 'ultimate-post' ),
109 'settings' => __( 'Settings', 'ultimate-post' ),
110 'tutorials' => __( 'Tutorials', 'ultimate-post' ),
111 'license' => __( 'License', 'ultimate-post' ),
112 );
113 foreach ($menu_lists as $key => $val) {
114 add_submenu_page(
115 'ultp-settings',
116 $val,
117 $val,
118 'manage_options',
119 'ultp-settings#' . $key,
120 array(__CLASS__, 'render_main')
121 );
122 }
123 // if (ultimate_post()->get_setting('init_setup') == 'yes') {
124 add_submenu_page(
125 'ultp-settings',
126 esc_html__('Initial Setup', 'ultimate-post'),
127 esc_html__('Initial Setup', 'ultimate-post'),
128 'manage_options',
129 'ultp-initial-setup-wizard',
130 array(__CLASS__, 'initial_setup')
131 );
132 // }
133 if (!ultimate_post()->is_lc_active()) {
134 add_submenu_page(
135 'ultp-settings',
136 '',
137 '<span class="dashicons dashicons-star-filled" style="font-size: 17px"></span> ' . esc_html__( 'Upgrade to Pro', 'ultimate-post' ),
138 'manage_options',
139 'go_postx_pro',
140 array(self::class, 'handle_external_redirects')
141 );
142 }
143 }
144
145 public function handle_external_redirects() {
146 if ( empty( $_GET['page'] ) ) {
147 return;
148 }
149 if ( 'go_postx_pro' === $_GET['page'] ) {
150 wp_redirect( ultimate_post()->get_premium_link('', 'dashboard_go_pro'));
151 die();
152 }
153 }
154
155 /**
156 * Initial Plugin Setting
157 *
158 * * @since v.2.4.4
159 * @return STRING
160 */
161 public static function initial_setup() { ?>
162 <div class="ultp-initial-setting-wrap" id="ultp-initial-setting"></div>
163 <?php }
164
165 public static function tab_page_content() {
166 echo '<div id="ultp-dashboard"></div>';
167 }
168
169 /**
170 * Remove All Notification From Menu Page
171 *
172 * @since v.1.0.0
173 * @return NULL
174 */
175 public static function remove_all_notices() {
176 if ( isset($_GET['page']) ) {
177 $page = sanitize_key($_GET['page']);
178 if ( $page === 'ultp-settings' ||
179 $page === 'ultp-license' ||
180 $page === 'ultp-initial-setup-wizard' ) {
181 remove_all_actions( 'admin_notices' );
182 remove_all_actions( 'all_admin_notices' );
183 }
184 }
185 }
186 }