PluginProbe
Post Grid Gutenberg Blocks – PostX / 4.0.2
Post Grid Gutenberg Blocks – PostX v4.0.2
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 4.0.2, at classes/Options.php

190 lines 8.1 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 // add_filter( 'ultp_plugin_notice', array( $this, 'plugin_notice_callback' ) );
29 }
30
31 /**
32 * Dashboard Notice Data
33 *
34 * @since v.3.1.8
35 * @param NULL
36 * @return NULL
37 */
38 public function plugin_notice_callback() {
39 return array(
40 'start' => '12-2-2023', // Date format "d-m-Y" [08-02-2019]
41 'end' => '22-3-2023',
42 'content' => 'Upgrade 30% off Sale!!!'
43 );
44 }
45
46
47 /**
48 * Plugin Page Menu Add
49 *
50 * @since v.1.0.0
51 * @return ARRAY
52 */
53 public function plugin_settings_meta( $links, $file ) {
54 if (strpos( $file, 'ultimate-post.php' ) !== false ) {
55 $new_links = array(
56 'ultp_docs' => '<a href="https://wpxpo.com/docs/" target="_blank">'.esc_html__('Docs', 'ultimate-post').'</a>',
57 'ultp_tutorial' => '<a href="https://www.youtube.com/watch?v=JZxIflYKOuM&list=PLPidnGLSR4qcAwVwIjMo1OVaqXqjUp_s4" target="_blank">'.esc_html__('Tutorials', 'ultimate-post').'</a>',
58 '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>'
59 );
60 $links = array_merge( $links, $new_links );
61 }
62 return $links;
63 }
64
65
66 /**
67 * Settings Pro Update Link
68 *
69 * @since v.1.0.0
70 * @return ARRAY
71 */
72 public function plugin_action_links_callback( $links ) {
73 $setting_link = array();
74 $setting_link['ultp_starter_sites'] = '<a href="'. esc_url(admin_url('admin.php?page=ultp-settings#startersites')) .'">'. esc_html__('Starter Sites', 'ultimate-post') .'</a>';
75 $setting_link['ultp_docs'] = '<a href="https://wpxpo.com/docs/postx/" target="_blank">'.esc_html__('Docs', 'ultimate-post').'</a>';
76 if ( !defined('ULTP_PRO_VER') ) {
77 $setting_link['ultp_pro'] = '<a href="'.esc_url(ultimate_post()->get_premium_link('', 'plugin_dir_pro')).'" target="_blank">'.esc_html__('Get PostX Pro', 'ultimate-post').'</a>';
78
79 }
80 $support_link['ultp_support'] = '<a href="'. esc_url(admin_url('admin.php?page=ultp-settings#support')) .'">'. esc_html__('Quick Support', 'ultimate-post') .'</a>';
81 return array_merge( $setting_link, $links, $support_link);
82 }
83
84
85 /**
86 * Admin Menu Option Page
87 *
88 * @since v.1.0.0
89 * @return NULL
90 */
91 public static function menu_page_callback() {
92 $ultp_menu_icon = 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MCA0OC4zIj4NCiAgPGRlZnM+DQogICAgPHN0eWx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FhMy4xMywzLjEzLDAsMCwxLTEuMjksMi41NCwzLDMsMCwwLDEtMS40Ny41OGwwLDBIOC4xOUEzLjE1LDMuMTUsMCwwLDEsNSw0MVYyNGEzLjE3LDMuMTcsMCwwLDEsMy4xNS0zSDI1YTMuMTIsMy4xMiwwLDAsMSwxLjE0LjIyLDMuMjQsMy4yNCwwLDAsMSwxLjksMi4xQTMuNjMsMy42MywwLDAsMSwyOC4xNiwyNC4xM1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTAuODUpIi8+DQogIDwvZz4NCjwvc3ZnPg0K';
93 add_menu_page(
94 __( 'PostX', 'ultimate-post' ),
95 __( 'PostX', 'ultimate-post' ),
96 'manage_options',
97 'ultp-settings',
98 array(self::class, 'tab_page_content'),
99 $ultp_menu_icon,
100 58.5
101 );
102
103 add_submenu_page(
104 'ultp-settings',
105 __( 'PostX Dashboard', 'ultimate-post' ),
106 __( 'Getting Started', 'ultimate-post' ),
107 'manage_options',
108 'ultp-settings'
109 );
110
111 $menu_lists = array(
112 'builder' => esc_html__( 'Site Builder', 'ultimate-post' ),
113 'startersites' => esc_html__( 'Starter Sites', 'ultimate-post' ),
114 'blocks' => esc_html__( 'Blocks', 'ultimate-post' ),
115 'integrations' => esc_html__( 'Integrations', 'ultimate-post' ),
116 'license' => esc_html__( 'License', 'ultimate-post' ),
117 'support' => esc_html__( 'Quick Support', 'ultimate-post' )
118 );
119 foreach ( $menu_lists as $key => $val ) {
120 add_submenu_page(
121 'ultp-settings',
122 $val,
123 $val,
124 'manage_options',
125 'ultp-settings#' . $key,
126 array(__CLASS__, 'render_main')
127 );
128 }
129 add_submenu_page(
130 'ultp-settings',
131 esc_html__( 'Initial Setup', 'ultimate-post' ),
132 esc_html__( 'Initial Setup', 'ultimate-post' ),
133 'manage_options',
134 'ultp-initial-setup-wizard',
135 array(__CLASS__, 'initial_setup')
136 );
137 if ( !ultimate_post()->is_lc_active() ) {
138 add_submenu_page(
139 'ultp-settings',
140 '',
141 esc_html__( 'Upgrade to Pro', 'ultimate-post' ),
142 'manage_options',
143 'go_postx_pro',
144 array(self::class, 'handle_external_redirects')
145 );
146 }
147 }
148
149 public function handle_external_redirects() {
150 if ( empty( $_GET['page'] ) ) { // @codingStandardsIgnoreLine
151 return;
152 }
153 if ( 'go_postx_pro' === sanitize_key($_GET['page']) ) { // @codingStandardsIgnoreLine
154 wp_redirect( ultimate_post()->get_premium_link('', 'dashboard_go_pro'));
155 die();
156 }
157 }
158
159 /**
160 * Initial Plugin Setting
161 *
162 * * @since v.2.4.4
163 * @return STRING
164 */
165 public static function initial_setup() { ?>
166 <div class="ultp-initial-setting-wrap" id="ultp-initial-setting"></div>
167 <?php }
168
169 public static function tab_page_content() {
170 echo '<div id="ultp-dashboard"></div>';
171 }
172
173 /**
174 * Remove All Notification From Menu Page
175 *
176 * @since v.1.0.0
177 * @return NULL
178 */
179 public static function remove_all_notices() {
180 if ( isset($_GET['page']) ) { // @codingStandardsIgnoreLine
181 $page = sanitize_key($_GET['page']); // @codingStandardsIgnoreLine
182 if ( $page === 'ultp-settings' ||
183 $page === 'ultp-license' ||
184 $page === 'ultp-initial-setup-wizard' ) {
185 remove_all_actions( 'admin_notices' );
186 remove_all_actions( 'all_admin_notices' );
187 }
188 }
189 }
190 }