PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.1.0
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.1.0
4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 All 146 releases
ultimate-post-kit / admin / admin.php

admin.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.1.0, at admin/admin.php

210 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit;
4
5 if (!defined('ABSPATH')) {
6 exit;
7 } // Exit if accessed directly
8
9
10 require_once BDTUPK_ADMIN_PATH . 'class-settings-api.php';
11
12 if (current_user_can('manage_options')) {
13 require_once BDTUPK_ADMIN_PATH . 'admin-feeds.php';
14 }
15
16 // element pack admin settings here
17 require_once BDTUPK_ADMIN_PATH . 'admin-settings.php';
18
19 /**
20 * Admin class
21 */
22
23 class Admin
24 {
25
26 public function __construct()
27 {
28
29 // Embed the Script on our Plugin's Option Page Only
30 if (isset($_GET['page']) && ($_GET['page'] == 'ultimate_post_kit_options')) {
31 add_action('admin_enqueue_scripts', [$this, 'enqueue_styles']);
32 }
33 add_action('admin_init', [$this, 'enqueue_admin_script']);
34
35 // Admin settings controller
36 require_once BDTUPK_ADMIN_PATH . 'module-settings.php';
37
38 // register_activation_hook(BDTUPK__FILE__, 'install_and_activate');
39
40 add_action('admin_init', [$this, 'admin_notice_styles']);
41
42 add_filter('plugin_action_links_' . BDTUPK_PBNAME, [$this, 'plugin_action_links']);
43
44 }
45
46 public function admin_notice_styles(){
47 wp_enqueue_style('upk-admin-biggopti', BDTUPK_ADMIN_ASSETS_URL . 'css/upk-admin-biggopti.css', [], BDTUPK_VER);
48 }
49
50
51 function install_and_activate()
52 {
53
54 // I don't know of any other redirect function, so this'll have to do.
55 wp_redirect(admin_url('admin.php?page=ultimate_post_kit_options'));
56 // You could use a header(sprintf('Location: %s', admin_url(...)); here instead too.
57 }
58
59 /**
60 * Enqueue styles
61 * @access public
62 */
63
64 public function enqueue_styles()
65 {
66
67 $direction_suffix = is_rtl() ? '.rtl' : '';
68 // $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
69
70 wp_enqueue_style('upk-admin', BDTUPK_ADMIN_ASSETS_URL . 'css/upk-admin' . $direction_suffix . '.css', [], BDTUPK_VER);
71 wp_enqueue_script('upk-admin', BDTUPK_ASSETS_URL . 'js/upk-admin.min.js', ['jquery'], BDTUPK_VER, true);
72 wp_enqueue_style('upk-editor', BDTUPK_ASSETS_URL . 'css/upk-editor' . $direction_suffix . '.css', [], BDTUPK_VER);
73
74 wp_enqueue_style('bdt-uikit', BDTUPK_ADMIN_ASSETS_URL . 'css/bdt-uikit' . $direction_suffix . '.css', [], '3.17.0');
75 wp_enqueue_style('upk-font', BDTUPK_ASSETS_URL . 'css/upk-font' . $direction_suffix . '.css', [], BDTUPK_VER);
76
77 wp_enqueue_script('bdt-uikit', BDTUPK_ADMIN_ASSETS_URL . 'js/bdt-uikit.min.js', ['jquery'], '3.17.0');
78 }
79
80 /**
81 * Row meta
82 * @access public
83 * @return array
84 */
85
86 public function plugin_row_meta($plugin_meta, $plugin_file)
87 {
88 if (BDTUPK_PBNAME === $plugin_file) {
89 $row_meta = [
90 'docs' => '<a href="https://postkit.pro/contact/" aria-label="' . esc_attr(__('Go for Get Support', 'ultimate-post-kit')) . '" target="_blank">' . __('Get Support', 'ultimate-post-kit') . '</a>',
91 'video' => '<a href="https://www.youtube.com/playlist?list=PLP0S85GEw7DOJf_cbgUIL20qqwqb5x8KA" aria-label="' . esc_attr(__('View Ultimate Post Kit Video Tutorials', 'ultimate-post-kit')) . '" target="_blank">' . __('Video Tutorials', 'ultimate-post-kit') . '</a>',
92 ];
93
94 $plugin_meta = array_merge($plugin_meta, $row_meta);
95 }
96
97 return $plugin_meta;
98 }
99
100 /**
101 * Action meta
102 * @access public
103 * @return array
104 */
105
106
107 public function plugin_action_meta($links)
108 {
109
110 $links = array_merge([sprintf('<a href="%s">%s</a>', ultimate_post_kit_dashboard_link('#ultimate_post_kit_welcome'), esc_html__('Settings', 'ultimate-post-kit'))], $links);
111
112 $links = array_merge($links, [
113 sprintf(
114 '<a href="%s">%s</a>',
115 ultimate_post_kit_dashboard_link('#license'),
116 esc_html__('License', 'ultimate-post-kit')
117 )
118 ]);
119
120 return $links;
121 }
122
123 /**
124 * Plugin action links
125 * @access public
126 * @return array
127 */
128
129 public function plugin_action_links( $plugin_meta ) {
130
131 if ( true !== _is_upk_pro_activated() ) {
132 $row_meta = [
133 'settings' => '<a href="'.admin_url( 'admin.php?page=ultimate_post_kit_options' ) .'" aria-label="' . esc_attr(__('Go to settings', 'ultimate-post-kit')) . '" >' . __('Settings', 'ultimate-post-kit') . '</b></a>',
134 'gopro' => '<a href="https://bdthemes.com/deals/?utm_source=WordPress_org&utm_medium=bfcm_cta&utm_campaign=ultimate_post_kit" aria-label="' . esc_attr(__('Go get the pro version', 'ultimate-post-kit')) . '" target="_blank" title="When you purchase through this link you will get 87% discount!" class="upk-go-pro">' . __('Black Friday Limited Offer Up To 87% Off!', 'ultimate-post-kit') . '</a>',
135 ];
136 } else {
137 $row_meta = [
138 'settings' => '<a href="'.admin_url( 'admin.php?page=ultimate_post_kit_options' ) .'" aria-label="' . esc_attr(__('Go to settings', 'ultimate-post-kit')) . '" >' . __('Settings', 'ultimate-post-kit') . '</b></a>',
139 ];
140 }
141
142 $plugin_meta = array_merge($plugin_meta, $row_meta);
143
144 return $plugin_meta;
145 }
146
147 /**
148 * Change Ultimate Post Kit Name
149 * @access public
150 * @return string
151 */
152
153 public function ultimate_post_kit_name_change($translated_text, $text, $domain)
154 {
155 switch ($translated_text) {
156 case 'Ultimate Post Kit Pro':
157 $translated_text = BDTUPK_TITLE;
158 break;
159 }
160
161 return $translated_text;
162 }
163
164 /**
165 * Hiding plugins //still in testing purpose
166 * @access public
167 */
168
169 public function hide_ultimate_post_kit()
170 {
171 global $wp_list_table;
172 $hide_plg_array = array('ultimate-post-kit/ultimate-post-kit.php');
173 $all_plugins = $wp_list_table->items;
174
175 foreach ($all_plugins as $key => $val) {
176 if (in_array($key, $hide_plg_array)) {
177 unset($wp_list_table->items[$key]);
178 }
179 }
180 }
181
182 /**
183 * Register admin script
184 * @access public
185 */
186
187 public function enqueue_admin_script()
188 {
189
190 // $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
191 wp_enqueue_script('jquery');
192 wp_enqueue_script('jquery-form');
193 wp_enqueue_script('upk-biggopti', BDTUPK_ADMIN_ASSETS_URL . 'js/upk-biggopti.min.js', ['jquery'], BDTUPK_VER, true);
194
195 $script_config = [
196 'ajaxurl' => admin_url('admin-ajax.php'),
197 'nonce' => wp_create_nonce('ultimate-post-kit'),
198 ];
199 wp_localize_script('upk-biggopti', 'UltimatePostKitBiggoptiConfig', $script_config);
200
201 if (isset($_GET['page']) && ($_GET['page'] == 'ultimate_post_kit_options')) {
202 wp_enqueue_script('chart', BDTUPK_ADMIN_ASSETS_URL . 'js/chart.min.js', ['jquery'], '3.9.1', true);
203 wp_enqueue_script('upk-admin', BDTUPK_ADMIN_ASSETS_URL . 'js/upk-admin.min.js', ['jquery', 'chart'], BDTUPK_VER, true);
204 }else{
205 wp_enqueue_script('upk-admin', BDTUPK_ADMIN_ASSETS_URL . 'js/upk-admin.min.js', ['jquery'], BDTUPK_VER, true);
206 }
207
208 }
209 }
210