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

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