PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.7
Pods – Custom Content Types and Fields v3.3.7
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / init.php
pods Last commit date
classes 4 months ago components 4 months ago deprecated 4 months ago includes 4 months ago sql 4 months ago src 4 months ago ui 4 months ago vendor 4 months ago changelog.txt 4 months ago init.php 4 months ago license.txt 10 years ago readme.txt 4 months ago
init.php
261 lines
1 <?php
2 /**
3 * Pods - Custom Content Types and Fields
4 *
5 * @package Pods
6 * @author Pods Framework Team
7 * @copyright 2026 Pods Foundation, Inc
8 * @license GPL v2 or later
9 *
10 * Plugin Name: Pods - Custom Content Types and Fields
11 * Plugin URI: https://pods.io/
12 * Description: Pods is a framework for creating, managing, and deploying customized content types and fields
13 * Version: 3.3.7
14 * Author: Pods Framework Team
15 * Author URI: https://pods.io/about/
16 * Text Domain: pods
17 * License: GPL v2 or later
18 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
19 * Requires at least: 6.3
20 * Requires PHP: 7.2
21 * GitHub Plugin URI: https://github.com/pods-framework/pods
22 * Primary Branch: main
23 * Plugin ID: did:plc:e3rm6t7cspgpzaf47kn3nnsl
24 */
25
26 /*
27 * This program is free software: you can redistribute it and/or modify
28 * it under the terms of the GNU General Public License as published by
29 * the Free Software Foundation, either version 2 of the License, or
30 * any later version.
31 *
32 * This program is distributed in the hope that it will be useful,
33 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 * GNU General Public License for more details.
36 *
37 * You should have received a copy of the GNU General Public License
38 * along with this program. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
39 */
40
41 // Don't load directly.
42 if ( ! defined( 'ABSPATH' ) ) {
43 die( '-1' );
44 }
45
46 if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
47 // Prevent conflicts with Pods 1.x and Pods UI plugins.
48 add_action( 'init', 'pods_deactivate_pods_duplicate' );
49 add_action( 'init', 'pods_deactivate_pods_ui' );
50 } else {
51 // Current version.
52 define( 'PODS_VERSION', '3.3.7' );
53
54 // Current database version, this is the last version the database changed.
55 define( 'PODS_DB_VERSION', '2.3.5' );
56
57 /**
58 * We aim to keep this as recent as possible to avoid ongoing React/Gutenberg compatibility problems.
59 *
60 * This should always be -2 versions behind the latest WP release. Example: 5.5 if 5.7 is current.
61 *
62 * To be updated each Major x.x Pods release.
63 *
64 * Next planned minimum WP version: 6.6
65 */
66 if ( ! defined( 'PODS_WP_VERSION_MINIMUM' ) ) {
67 $pods_wp_version_minimum = getenv( 'PODS_WP_VERSION_MINIMUM' ) ?: '6.3';
68 define( 'PODS_WP_VERSION_MINIMUM', $pods_wp_version_minimum );
69 }
70
71 /**
72 * This should match minimum WP requirements or usage of 90%+.
73 *
74 * Found at: https://wordpress.org/about/stats/
75 *
76 * Next planned minimum PHP version: 7.3
77 */
78 if ( ! defined( 'PODS_PHP_VERSION_MINIMUM' ) ) {
79 define( 'PODS_PHP_VERSION_MINIMUM', '7.2' );
80 }
81
82 /**
83 * This should match minimum WP requirements or usage of 90%+.
84 *
85 * Found at: https://wordpress.org/about/stats/
86 *
87 * Next planned minimum MySQL version: 5.6
88 */
89 if ( ! defined( 'PODS_MYSQL_VERSION_MINIMUM' ) ) {
90 define( 'PODS_MYSQL_VERSION_MINIMUM', '5.5' );
91 }
92
93 define( 'PODS_FILE', __FILE__ );
94 define( 'PODS_SLUG', plugin_basename( __FILE__ ) );
95 define( 'PODS_URL', plugin_dir_url( __FILE__ ) );
96 define( 'PODS_DIR', plugin_dir_path( __FILE__ ) );
97
98 // Prevent conflicts with old Pods UI plugin
99 if ( function_exists( 'pods_ui_manage' ) ) {
100 add_action( 'init', 'pods_deactivate_pods_ui' );
101 } else {
102 // If there was an install/update failure and the sub directories do not exist. Bail to avoid fatal errors.
103 if (
104 ! file_exists( PODS_DIR . 'classes/PodsInit.php' )
105 || ! file_exists( PODS_DIR . 'vendor/vendor-prefixed/autoload.php' )
106 ) {
107 return;
108 }
109
110 global $pods, $pods_init, $pods_form;
111
112 // Init custom autoloader.
113 require_once PODS_DIR . 'classes/PodsInit.php';
114
115 spl_autoload_register( array( 'PodsInit', 'autoload_class' ) );
116
117 require_once PODS_DIR . 'vendor/vendor-prefixed/autoload.php';
118
119 // Include global functions.
120 require_once PODS_DIR . 'includes/access.php';
121 require_once PODS_DIR . 'includes/classes.php';
122 require_once PODS_DIR . 'includes/data.php';
123 require_once PODS_DIR . 'includes/forms.php';
124 require_once PODS_DIR . 'includes/general.php';
125
126 // Maybe include media functions.
127 if ( ! defined( 'PODS_MEDIA' ) || PODS_MEDIA ) {
128 require_once PODS_DIR . 'includes/media.php';
129 }
130
131 // Maybe run full init.
132 if ( ! defined( 'SHORTINIT' ) || ! SHORTINIT ) {
133 // Maybe include deprecated classes / functions.
134 if ( pods_allow_deprecated() ) {
135 require_once PODS_DIR . 'deprecated/deprecated.php';
136 }
137
138 // Check if minimum required versions are met.
139 if ( false !== pods_compatibility_check() ) {
140 $pods_form = pods_form();
141
142 // If not on network admin, run full init.
143 if ( ! is_network_admin() ) {
144 $pods_init = pods_init();
145 }
146 }
147 }
148 }
149 }
150
151 /**
152 * Deactivate this version of Pods if Pods is already included.
153 *
154 * @since 2.8.0
155 */
156 function pods_deactivate_pods_duplicate() {
157 if ( defined( 'PODS_VERSION' ) && defined( 'PODS_DIR' ) && file_exists( untrailingslashit( PODS_DIR ) . '/init.php' ) ) {
158 if ( ! function_exists( 'deactivate_plugins' ) ) {
159 include_once ABSPATH . 'wp-admin/includes/plugin.php';
160 }
161
162 deactivate_plugins( realpath( untrailingslashit( PODS_DIR ) . '/init.php' ) );
163
164 if ( ! headers_sent() && ( ! function_exists( 'pods_ui_manage' ) && ! file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) ) {
165 wp_safe_redirect( add_query_arg( [ 'refresh' => 1 ] ) );
166 die();
167 }
168 }
169 }
170
171 /**
172 * Deactivate Pods UI plugin if already included.
173 *
174 * @since 2.0.0
175 */
176 function pods_deactivate_pods_ui() {
177 if ( function_exists( 'pods_ui_manage' ) && file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) {
178 if ( ! function_exists( 'deactivate_plugins' ) ) {
179 include_once ABSPATH . 'wp-admin/includes/plugin.php';
180 }
181
182 deactivate_plugins( realpath( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) );
183
184 if ( ! headers_sent() ) {
185 wp_safe_redirect( add_query_arg( [ 'refresh' => 1 ] ) );
186 die();
187 }
188 }
189 }
190
191 add_filter( 'wp_plugin_check_ignore_files', static function( $ignored_files ) {
192 $pods_dev_files = [
193 'ui/js/dfv/pods-dfv.min.js.map',
194 'ui/js/codemirror/lib/codemirror.js',
195 '.babelrc',
196 '.distignore',
197 '.DS_Store',
198 '.editorconfig',
199 '.env',
200 '.env.example',
201 '.env.testing.slic',
202 '.eslintignore',
203 '.eslintrc.json',
204 '.gitattributes',
205 '.gitignore',
206 '.jshintrc',
207 '.nvmrc',
208 '.phpcs.compat.xml',
209 '.phpcs.xml',
210 '.phpstorm.meta.php',
211 '.scrutinizer.yml',
212 '.travis.yml',
213 'babel.config.js',
214 'CODE_OF_CONDUCT.md',
215 'codeception.dist.yml',
216 'codeception.example.yml',
217 'codeception.slic.yml',
218 'CODEOWNERS',
219 'composer.json',
220 'composer.lock',
221 'Gruntfile.js',
222 'jest.config.json',
223 'jest.config.js',
224 'jest-setup-wordpress-globals.js',
225 'package.json',
226 'package-lock.json',
227 'phpcs.xml',
228 'phpcs.xml.dist',
229 'phpstan.neon',
230 'phpunit.xml.dist',
231 'README.md',
232 'rollup.config.js',
233 'slic.json',
234 'TESTS.md',
235 'webpack.common.js',
236 'webpack.dev.js',
237 'webpack.prod.js',
238 ];
239
240 return array_merge( $ignored_files, $pods_dev_files );
241 } );
242
243 add_filter( 'wp_plugin_check_ignore_directories', static function( $ignored_dirs ) {
244 $pods_dev_dirs = [
245 '.git',
246 '.github',
247 '.wordpress-org',
248 'bin',
249 'dev',
250 'docs',
251 'github',
252 'tests',
253 'workspace',
254 'ui/js/blocks/src',
255 'ui/js/dfv/src',
256 'ui/styles/src',
257 ];
258
259 return array_merge( $ignored_dirs, $pods_dev_dirs );
260 } );
261