PluginProbe
Post Grid / 2.3.9
Post Grid v2.3.9
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.9, at post-grid.php

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