PluginProbe
WP Ultimate Post Grid / 3.3.0
WP Ultimate Post Grid v3.3.0
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 3.3.0, at includes/class-wp-ultimate-post-grid.php

155 lines 5.9 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', '3.3.0' );
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
81 // // Public.
82 require_once( WPUPG_DIR . 'includes/public/class-wpupg-addons.php' );
83 require_once( WPUPG_DIR . 'includes/public/class-wpupg-assets.php' );
84 require_once( WPUPG_DIR . 'includes/public/class-wpupg-blocks.php' );
85 require_once( WPUPG_DIR . 'includes/public/class-wpupg-button.php' );
86 require_once( WPUPG_DIR . 'includes/public/class-wpupg-filter.php' );
87 require_once( WPUPG_DIR . 'includes/public/class-wpupg-filter-isotope.php' );
88 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid.php' );
89 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-layout.php' );
90 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-manager.php' );
91 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-output.php' );
92 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-sanitizer.php' );
93 require_once( WPUPG_DIR . 'includes/public/class-wpupg-grid-saver.php' );
94 require_once( WPUPG_DIR . 'includes/public/class-wpupg-icon.php' );
95 require_once( WPUPG_DIR . 'includes/public/class-wpupg-item.php' );
96 require_once( WPUPG_DIR . 'includes/public/class-wpupg-item-manager.php' );
97 require_once( WPUPG_DIR . 'includes/public/class-wpupg-item-post.php' );
98 require_once( WPUPG_DIR . 'includes/public/class-wpupg-meta-box.php' );
99 require_once( WPUPG_DIR . 'includes/public/class-wpupg-migrations.php' );
100 require_once( WPUPG_DIR . 'includes/public/class-wpupg-pagination.php' );
101 require_once( WPUPG_DIR . 'includes/public/class-wpupg-pagination-pages.php' );
102 require_once( WPUPG_DIR . 'includes/public/class-wpupg-post-type.php' );
103 require_once( WPUPG_DIR . 'includes/public/class-wpupg-shortcode.php' );
104 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-helper.php' );
105 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-manager.php' );
106 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-shortcode.php' );
107 require_once( WPUPG_DIR . 'includes/public/class-wpupg-template-shortcodes.php' );
108
109 // Admin.
110 if ( is_admin() ) {
111 require_once( WPUPG_DIR . 'includes/admin/class-wpupg-manage-modal.php' );
112 require_once( WPUPG_DIR . 'includes/admin/class-wpupg-marketing.php' );
113 require_once( WPUPG_DIR . 'includes/admin/class-wpupg-notices.php' );
114
115 // Menu.
116 require_once( WPUPG_DIR . 'includes/admin/menu/class-wpupg-admin-menu.php' );
117 require_once( WPUPG_DIR . 'includes/admin/menu/class-wpupg-admin-menu-addons.php' );
118 require_once( WPUPG_DIR . 'includes/admin/menu/class-wpupg-admin-menu-faq.php' );
119 }
120 }
121
122 /**
123 * Admin notice to show when the required version is not met.
124 *
125 * @since 3.0.0
126 */
127 public function admin_notice_required_version() {
128 if ( defined( 'WPUPGP_VERSION' ) && version_compare( WPUPGP_VERSION, WPUPG_PREMIUM_VERSION_REQUIRED ) < 0 ) {
129 echo '<div class="notice notice-error"><p>';
130 echo '<strong>WP Ultimate Post Grid</strong></br>';
131 esc_html_e( 'Please update to at least the following plugin versions:', 'wp-ultimate-post-grid-premium' );
132 echo '<br/>WP Ultimate Post Grid Premium ' . esc_html( WPUPG_PREMIUM_VERSION_REQUIRED );
133 echo '</p><p>';
134 echo '<a href="https://help.bootstrapped.ventures/article/214-updating-wp-ultimate-post-grid" target="_blank">';
135 esc_html_e( 'More information on updating the plugin', 'wp-ultimate-post-grid' );
136 echo '</a>';
137 echo '</p></div>';
138 }
139 }
140
141 /**
142 * Adjust action links on the plugins page.
143 *
144 * @since 3.0.0
145 * @param array $links Current plugin action links.
146 */
147 public function plugin_action_links( $links ) {
148 if ( ! WPUPG_Addons::is_active( 'premium' ) ) {
149 return array_merge( array( '<a href="https://bootstrapped.ventures/wp-ultimate-post-grid/get-the-plugin/" target="_blank">Upgrade to Premium</a>' ), $links );
150 } else {
151 return $links;
152 }
153 }
154 }
155