PluginProbe
Post Grid / 2.3.23
Post Grid v2.3.23
2.3.23 2.2.57 2.2.58 2.2.59 2.2.6 2.2.60 2.2.61 2.2.62 2.2.63 2.2.63a 2.2.64 2.2.65 2.2.66 2.2.67 2.2.67-a 2.2.68 2.2.69 2.2.7 2.2.70 2.2.71 2.2.72 2.2.73 2.2.74 2.2.75 2.2.75a All 208 releases
post-grid / post-grid.php

post-grid.php in Post Grid 2.3.23, at post-grid.php

352 lines 11.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Post Grid
4 Plugin URI: https://pickplugins.com/post-grid/
5 Description: Post Grid is extremely easy to use for creating grid-layout and post-layout.
6 Version: 2.3.23
7 Author: PickPlugins
8 Text Domain: post-grid
9 Author URI: https://www.pickplugins.com/
10 License: GPLv2 or later
11 License URI: http://www.gnu.org/licenses/gpl-2.0.html
12 */
13
14
15
16 if (!defined('ABSPATH'))
17 exit; // if direct access
18
19 if (!class_exists('PostGrid')) {
20 class PostGrid
21 {
22
23 public function __construct()
24 {
25
26
27 define('post_grid_plugin_url', plugins_url('/', __FILE__));
28 define('post_grid_plugin_dir', plugin_dir_path(__FILE__));
29 define('post_grid_plugin_basename', plugin_basename(__FILE__));
30 define('post_grid_plugin_name', 'Post Grid');
31 define('post_grid_version', '2.3.23');
32 define('post_grid_server_url', 'https://demo.pickplugins.com/post-grid/');
33
34 $postGridFonts = [];
35
36
37 global $PostGridBuilderCss;
38 global $postGridFonts;
39
40
41
42
43
44
45
46 include('includes/classes/class-post-types.php');
47 include('includes/classes/class-meta-boxes.php');
48 include('includes/classes/class-functions.php');
49 include('includes/classes/class-shortcodes.php');
50 include('includes/classes/class-settings.php');
51 include('includes/classes/class-settings-tabs.php');
52
53
54 include('includes/classes/class-admin-notices.php');
55
56 include('includes/metabox-post-grid-layout-hook.php');
57 include('includes/metabox-post-grid-hook.php');
58 include('includes/metabox-post-options-hook.php');
59
60 include('includes/settings-hook.php');
61 include('templates/post-grid-hook.php');
62 include('includes/shortcodes/shortcode-today-date.php');
63
64 include('includes/post-grid-layout-elements.php');
65 include('includes/media-source-options.php');
66 include('includes/layout-elements/3rd-party.php');
67 include('includes/functions-layout-api.php');
68 include('includes/functions-ajax.php');
69 include('includes/functions-rest.php');
70
71
72
73 include('includes/functions-data-upgrade.php');
74 //include('includes/functions-single.php');
75
76
77 include('includes/classes/class-post-grid-support.php');
78 include('includes/data-update/class-post-grid-data-update.php');
79
80 include('includes/functions-post-grid.php');
81 include('includes/functions.php');
82 include('includes/shortcodes/shortcode-current_user_id.php');
83 include('includes/duplicate-post.php');
84
85 include('includes/functions-builder.php');
86 include('templates/view-grid/index.php');
87 include('templates/view-slider/index.php');
88 include('templates/view-masonry/index.php');
89
90
91
92 add_action('wp_enqueue_scripts', array($this, '_scripts_front'));
93 add_action('admin_enqueue_scripts', array($this, '_scripts_admin'));
94 add_action('admin_enqueue_scripts', 'wp_enqueue_media');
95 add_action('admin_enqueue_scripts', 'wp_enqueue_media');
96
97 add_action('plugins_loaded', array($this, '_textdomain'));
98
99 register_activation_hook(__FILE__, array($this, '_activation'));
100 register_deactivation_hook(__FILE__, array($this, '_deactivation'));
101
102
103 add_action('activated_plugin', array($this, 'redirect_welcome'));
104
105
106 // $args = array(
107 // 'post_types' => array('post_grid', 'post_grid_layout', 'post_grid_template'),
108 // );
109
110 // new PPduplicatePost($args);
111 }
112
113
114
115
116
117
118
119
120
121 public function _textdomain()
122 {
123
124 $locale = apply_filters('plugin_locale', get_locale(), 'post-grid');
125 load_textdomain('post-grid', WP_LANG_DIR . '/post-grid/post-grid-' . $locale . '.mo');
126 }
127
128
129 public function redirect_welcome($plugin)
130 {
131
132
133 if ($plugin == 'post-grid/post-grid.php') {
134 wp_safe_redirect(admin_url('edit.php?post_type=post_grid&page=post-grid-builder'));
135 exit;
136 }
137 }
138
139 public function _activation()
140 {
141
142
143 $class_post_grid_functions = new class_post_grid_functions();
144
145
146 // $post_grid_info = get_option('post_grid_info');
147 // $post_grid_info['current_version'] = post_grid_version;
148 // $post_grid_info['last_version'] = '2.2.14';
149 // $post_grid_info['data_update_status'] = isset($post_grid_info['data_update_status']) ? $post_grid_info['data_update_status'] : 'pending';
150 // update_option('post_grid_info', $post_grid_info);
151
152
153 $class_post_grid_post_types = new class_post_grid_post_types();
154 $class_post_grid_post_types->_posttype_post_grid();
155 $class_post_grid_post_types->_posttype_post_grid_layout();
156
157
158 flush_rewrite_rules();
159
160 /*
161 * Custom action hook for plugin activation.
162 * Action hook: post_grid_activation
163 * */
164 do_action('post_grid_activation');
165 }
166
167 public function post_grid_uninstall()
168 {
169
170 /*
171 * Custom action hook for plugin uninstall/delete.
172 * Action hook: post_grid_uninstall
173 * */
174 do_action('post_grid_uninstall');
175 }
176
177 public function _deactivation()
178 {
179
180 /*
181 * Custom action hook for plugin deactivation.
182 * Action hook: post_grid_deactivation
183 * */
184 do_action('post_grid_deactivation');
185 }
186
187
188 public function _scripts_front()
189 {
190
191
192
193 wp_enqueue_script('jquery');
194
195 // Register Scripts & JS
196 wp_register_script('post-grid-shortcode-scripts', post_grid_plugin_url . 'assets/js/post-grid-shortcode-scripts.js', array('jquery'));
197
198
199
200 wp_register_script('justifiedGallery', post_grid_plugin_url . 'assets/js/jquery.justifiedGallery.min.js', array('jquery'));
201
202
203 wp_register_style('justifiedGallery', post_grid_plugin_url . 'assets/css/justifiedGallery.min.css');
204
205 // Register CSS & Styles
206 wp_register_style('post-grid-shortcode-style', post_grid_plugin_url . 'assets/css/post-grid-shortcode-style.css');
207
208 wp_register_style('font-awesome-4', post_grid_plugin_url . 'assets/css/fontawesome-old/css/font-awesome-4.css');
209 wp_register_style('font-awesome-5', post_grid_plugin_url . 'assets/css/fontawesome-old/css/font-awesome-5.css');
210
211 wp_register_style('bootstrap-icons', post_grid_plugin_url . 'assets/css/bootstrap-icons/bootstrap-icons.css');
212 wp_register_style('fontawesome-icons', post_grid_plugin_url . 'assets/css/fontawesome/css/all.min.css');
213 wp_register_style('icofont-icons', post_grid_plugin_url . 'assets/css/icofont/icofont.min.css');
214 wp_register_style('splide_core', post_grid_plugin_url . 'assets/css/splide-core.min.css');
215
216
217 wp_register_script('imagesloaded', post_grid_plugin_url . 'assets/js/imagesloaded.pkgd.min.js', [], '5.0.0', ['in_footer' => true, 'strategy' => 'defer']);
218 wp_register_script('fslightbox', post_grid_plugin_url . 'assets/js/fslightbox.js', [], '3.7.4', true);
219 wp_register_script('lazyLoad', post_grid_plugin_url . 'assets/js/lazy-load.js', [], '1.0.0', ['in_footer' => true, 'strategy' => 'defer']);
220 wp_register_script('splide.min', post_grid_plugin_url . 'assets/js/splide.min.js', [], '4.1.6', ['in_footer' => true, 'strategy' => 'defer']);
221
222
223 wp_register_script('pgpostgrid_builder-js', post_grid_plugin_url . 'assets/js/builder-js.js', [], '1.0.0', []);
224
225 wp_register_script('post-grid-slider-front', post_grid_plugin_url . 'templates/view-slider/front-scripts.js', [], '1.0.0', ['in_footer' => true, 'strategy' => 'defer']);
226
227 wp_register_script('scrollto', post_grid_plugin_url . 'assets/js/jquery-scrollto.js', array('jquery'));
228
229 //wp_register_style('pg_block_styles', post_grid_plugin_url . 'assets/block-css/block-styles.min.css');
230 wp_register_style('pg_block_styles', post_grid_plugin_url . 'assets/block-css/block-styles.css');
231 wp_register_style('animate', post_grid_plugin_url . 'assets/css/animate.min.css');
232
233 // if (is_singular()) {
234 // $upload_dir = wp_upload_dir();
235
236
237 // $post_id = get_the_ID();
238 // $combo_blocks_css_file_id = get_post_meta($post_id, 'combo_blocks_css_file_id', true);
239 // $combo_blocks_generate_css = get_post_meta($post_id, 'combo_blocks_generate_css', true);
240
241 // if ($combo_blocks_generate_css) {
242 // wp_enqueue_style('block-styles-' . $post_id, $upload_dir['baseurl'] . '/combo-blocks/block-styles-' . $post_id . '.css');
243 // }
244 // }
245 }
246
247
248 public function _scripts_admin()
249 {
250
251 $screen = get_current_screen();
252
253
254 wp_register_script('post_grid_admin_js', post_grid_plugin_url . 'assets/js/post-grid-admin.js', array('jquery'));
255
256 wp_register_script('select2', post_grid_plugin_url . 'assets/js/select2.full.js', array('jquery'));
257 wp_register_style('select2', post_grid_plugin_url . 'assets/css/select2.min.css');
258
259 wp_register_script('jquery.lazy', post_grid_plugin_url . 'assets/js/jquery.lazy.js', array('jquery'));
260
261 wp_register_script('pgpostgrid_builder-js', post_grid_plugin_url . 'assets/js/builder-js.js', []);
262 // wp_enqueue_style('post_grid_skin', post_grid_plugin_url . 'assets/global/css/style.skins.css');
263
264 wp_register_style('jquery-ui', post_grid_plugin_url . 'assets/css/jquery-ui.css');
265 wp_register_style('font-awesome-4', post_grid_plugin_url . 'assets/css/fontawesome-old/css/font-awesome-4.css');
266 wp_register_style('font-awesome-5', post_grid_plugin_url . 'assets/css/fontawesome-old/css/font-awesome-5.css');
267 wp_register_style('pg-admin-g-fonts', 'https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
268
269 wp_enqueue_style('pg-admin-g-fonts');
270 wp_enqueue_style('font-awesome-5');
271
272
273 wp_register_style('icofont-icons', post_grid_plugin_url . 'assets/css/icofont/icofont.min.css');
274 wp_enqueue_style('icofont-icons');
275
276 wp_register_style('bootstrap-icons', post_grid_plugin_url . 'assets/css/bootstrap-icons/bootstrap-icons.css');
277
278 wp_enqueue_style('bootstrap-icons');
279
280
281
282 wp_register_style('settings-tabs', post_grid_plugin_url . 'assets/settings-tabs/settings-tabs.css');
283 wp_register_script('settings-tabs', post_grid_plugin_url . 'assets/settings-tabs/settings-tabs.js', array('jquery'));
284
285
286
287
288 wp_register_script('post_grid_layouts', post_grid_plugin_url . 'assets/js/scripts-layouts.js', array('jquery'));
289
290
291
292
293
294
295
296
297 if ($screen->id == 'post_grid') {
298
299 wp_enqueue_script('post_grid_admin_js');
300 wp_localize_script('post_grid_admin_js', 'post_grid_ajax', array('post_grid_ajaxurl' => admin_url('admin-ajax.php')));
301
302 wp_enqueue_style('post_grid_skin');
303
304
305
306
307 wp_enqueue_style('select2');
308 wp_enqueue_script('select2');
309
310 $settings_tabs_field = new settings_tabs_field();
311 $settings_tabs_field->admin_scripts();
312 }
313
314 if ($screen->id == 'post_grid_layout') {
315
316 wp_enqueue_style('select2');
317 wp_enqueue_script('select2');
318
319
320
321 $settings_tabs_field = new settings_tabs_field();
322 $settings_tabs_field->admin_scripts();
323 }
324
325
326
327 if ($screen->id == 'post_grid_page_post-grid-settings') {
328
329 wp_enqueue_script('post_grid_admin_js');
330 wp_localize_script('post_grid_admin_js', 'post_grid_ajax', array('post_grid_ajaxurl' => admin_url('admin-ajax.php')));
331 wp_enqueue_style('select2');
332 wp_enqueue_script('select2');
333
334 $settings_tabs_field = new settings_tabs_field();
335 $settings_tabs_field->admin_scripts();
336
337 wp_enqueue_style(
338 'prefix-editor',
339 post_grid_plugin_url . 'dist/output.css',
340 [],
341 time(),
342 'all'
343 );
344
345 $settings_tabs_field = new settings_tabs_field();
346 $settings_tabs_field->admin_scripts();
347 }
348 }
349 }
350 }
351 new PostGrid();
352