PluginProbe
WP Ultimate Post Grid / 4.1.1
WP Ultimate Post Grid v4.1.1
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / includes / class-wp-ultimate-post-grid.php

class-wp-ultimate-post-grid.php in WP Ultimate Post Grid 4.1.1, at includes/class-wp-ultimate-post-grid.php

161 lines 6.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The core plugin class.
4 *
5 * @link https://bootstrapped.ventures
6 * @since 3.0.0
7 *
8 * @package WP_Ultimate_Post_Grid
9 * @subpackage WP_Ultimate_Post_Grid/includes
10 */
11
12 /**
13 * The core plugin class.
14 *
15 * This is used to define internationalization, admin-specific hooks, and
16 * public-facing site hooks.
17 *
18 * Also maintains the unique identifier of this plugin as well as the current
19 * version of the plugin.
20 *
21 * @since 3.0.0
22 * @package WP_Ultimate_Post_Grid
23 * @subpackage WP_Ultimate_Post_Grid/includes
24 * @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
25 */
26 class WP_Ultimate_Post_Grid {
27
28 /**
29 * Define any constants to be used in the plugin.
30 *
31 * @since 3.0.0
32 */
33 private function define_constants() {
34 define( 'WPUPG_VERSION', '4.1.1' );
35 define( 'WPUPG_PREMIUM_VERSION_REQUIRED', '3.0.0' );
36 define( 'WPUPG_POST_TYPE', 'wpupg_grid' );
37 define( 'WPUPG_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
38 define( 'WPUPG_URL', plugin_dir_url( dirname( __FILE__ ) ) );
39 }
40
41 /**
42 * Make sure all is set up for the plugin to load.
43 *
44 * @since 3.0.0
45 */
46 public function __construct() {
47 $this->define_constants();
48 $this->load_dependencies();
49 add_action( 'plugins_loaded', array( $this, 'wpupg_init' ), 1 );
50 add_action( 'admin_notices', array( $this, 'admin_notice_required_version' ) );
51 }
52
53 /**
54 * Init WPUPG for Premium add-ons.
55 *
56 * @since 3.0.0
57 */
58 public function wpupg_init() {
59 do_action( 'wpupg_init' );
60 }
61
62 /**
63 * Load all plugin dependencies.
64 *
65 * @since 3.0.0
66 */
67 private function load_dependencies() {
68 // General.
69 require_once( WPUPG_DIR . 'includes/class-wpupg-i18n.php' );
70
71 // Priority.
72 require_once( WPUPG_DIR . 'includes/public/class-wpupg-settings.php' );
73
74 // Api.
75 require_once( WPUPG_DIR . 'includes/public/api/class-wpupg-api-grids.php' );
76 require_once( WPUPG_DIR . 'includes/public/api/class-wpupg-api-items.php' );
77 require_once( WPUPG_DIR . 'includes/public/api/class-wpupg-api-manage-grids.php' );
78 require_once( WPUPG_DIR . 'includes/public/api/class-wpupg-api-notices.php' );
79 require_once( WPUPG_DIR . 'includes/public/api/class-wpupg-api-preview-grid.php' );
80 require_once( WPUPG_DIR . 'includes/public/api/class-wpupg-api-templates.php' );
81
82 // // Public.
83 require_once( WPUPG_DIR . 'includes/public/class-wpupg-addons.php' );
84 require_once( WPUPG_DIR . 'includes/public/class-wpupg-assets.php' );
85 require_once( WPUPG_DIR . 'includes/public/class-wpupg-blocks.php' );
86 require_once( WPUPG_DIR . 'includes/public/class-wpupg-button.php' );
87 require_once( WPUPG_DIR . 'includes/public/class-wpupg-filter.php' );
88 require_once( WPUPG_DIR . 'includes/public/class-wpupg-filter-clear.php' );
89 require_once( WPUPG_DIR . 'includes/public/class-wpupg-filter-isotope.php' );
90 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid.php' );
91 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-layout.php' );
92 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-manager.php' );
93 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-output.php' );
94 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-sanitizer.php' );
95 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-saver.php' );
96 require_once( WPUPG_DIR . 'includes/public/class-wpupg-icon.php' );
97 require_once( WPUPG_DIR . 'includes/public/class-wpupg-item.php' );
98 require_once( WPUPG_DIR . 'includes/public/class-wpupg-item-manager.php' );
99 require_once( WPUPG_DIR . 'includes/public/class-wpupg-item-post.php' );
100 require_once( WPUPG_DIR . 'includes/public/class-wpupg-meta-box.php' );
101 require_once( WPUPG_DIR . 'includes/public/class-wpupg-migrations.php' );
102 require_once( WPUPG_DIR . 'includes/public/class-wpupg-multilingual.php' );
103 require_once( WPUPG_DIR . 'includes/public/class-wpupg-order.php' );
104 require_once( WPUPG_DIR . 'includes/public/class-wpupg-pagination.php' );
105 require_once( WPUPG_DIR . 'includes/public/class-wpupg-pagination-pages.php' );
106 require_once( WPUPG_DIR . 'includes/public/class-wpupg-post-type.php' );
107 require_once( WPUPG_DIR . 'includes/public/class-wpupg-shortcode-takeover.php' );
108 require_once( WPUPG_DIR . 'includes/public/class-wpupg-shortcode.php' );
109 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-editor.php' );
110 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-helper.php' );
111 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-manager.php' );
112 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-shortcode.php' );
113 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-shortcodes.php' );
114
115 // Admin.
116 if ( is_admin() ) {
117 require_once( WPUPG_DIR . 'includes/admin/class-wpupg-manage-modal.php' );
118 require_once( WPUPG_DIR . 'includes/admin/class-wpupg-marketing.php' );
119 require_once( WPUPG_DIR . 'includes/admin/class-wpupg-notices.php' );
120
121 // Menu.
122 require_once( WPUPG_DIR . 'includes/admin/menu/class-wpupg-admin-menu.php' );
123 require_once( WPUPG_DIR . 'includes/admin/menu/class-wpupg-admin-menu-addons.php' );
124 require_once( WPUPG_DIR . 'includes/admin/menu/class-wpupg-admin-menu-faq.php' );
125 }
126 }
127
128 /**
129 * Admin notice to show when the required version is not met.
130 *
131 * @since 3.0.0
132 */
133 public function admin_notice_required_version() {
134 if ( defined( 'WPUPGP_VERSION' ) && version_compare( WPUPGP_VERSION, WPUPG_PREMIUM_VERSION_REQUIRED ) < 0 ) {
135 echo '<div class="notice notice-error"><p>';
136 echo '<strong>WP Ultimate Post Grid</strong></br>';
137 esc_html_e( 'Please update to at least the following plugin versions:', 'wp-ultimate-post-grid-premium' );
138 echo '<br/>WP Ultimate Post Grid Premium ' . esc_html( WPUPG_PREMIUM_VERSION_REQUIRED );
139 echo '</p><p>';
140 echo '<a href="https://help.bootstrapped.ventures/article/214-updating-wp-ultimate-post-grid" target="_blank">';
141 esc_html_e( 'More information on updating the plugin', 'wp-ultimate-post-grid' );
142 echo '</a>';
143 echo '</p></div>';
144 }
145 }
146
147 /**
148 * Adjust action links on the plugins page.
149 *
150 * @since 3.0.0
151 * @param array $links Current plugin action links.
152 */
153 public function plugin_action_links( $links ) {
154 if ( ! WPUPG_Addons::is_active( 'premium' ) ) {
155 return array_merge( array( '<a href="https://bootstrapped.ventures/wp-ultimate-post-grid/get-the-plugin/" target="_blank">Upgrade to Premium</a>' ), $links );
156 } else {
157 return $links;
158 }
159 }
160 }
161