1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/* |
3
|
|
|
Plugin Name: Pods - Custom Content Types and Fields |
4
|
|
|
Plugin URI: https://pods.io/ |
5
|
|
|
Description: Pods is a framework for creating, managing, and deploying customized content types and fields |
6
|
|
|
Version: 2.7.4-a-1 |
7
|
|
|
Author: Pods Framework Team |
8
|
|
|
Author URI: https://pods.io/about/ |
9
|
|
|
Text Domain: pods |
10
|
|
|
GitHub Plugin URI: https://github.com/pods-framework/pods |
11
|
|
|
|
12
|
|
|
Copyright 2009-2018 Pods Foundation, Inc (email : [email protected]) |
13
|
|
|
|
14
|
|
|
This program is free software; you can redistribute it and/or modify |
15
|
|
|
it under the terms of the GNU General Public License as published by |
16
|
|
|
the Free Software Foundation; either version 2 of the License, or |
17
|
|
|
(at your option) any later version. |
18
|
|
|
|
19
|
|
|
This program is distributed in the hope that it will be useful, |
20
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
|
|
|
GNU General Public License for more details. |
23
|
|
|
|
24
|
|
|
You should have received a copy of the GNU General Public License |
25
|
|
|
along with this program; if not, write to the Free Software |
26
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @package Pods\Global |
31
|
|
|
*/ |
32
|
|
|
|
33
|
|
|
// Prevent conflicts with Pods 1.x |
34
|
|
|
if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) { |
35
|
|
|
add_action( 'init', 'pods_deactivate_pods_1_x' ); |
36
|
|
|
add_action( 'init', 'pods_deactivate_pods_ui' ); |
37
|
|
|
} else { |
38
|
|
|
// Current version |
39
|
|
|
define( 'PODS_VERSION', '2.7.4-a-1' ); |
40
|
|
|
|
41
|
|
|
// Version tracking between DB updates themselves |
42
|
|
|
define( 'PODS_DB_VERSION', '2.3.5' ); |
43
|
|
|
|
44
|
|
|
// This should always be -2 versions behind the latest WP release |
45
|
|
|
// To be updated each Major x.x Pods release |
46
|
|
|
if ( ! defined( 'PODS_WP_VERSION_MINIMUM' ) ) { |
47
|
|
|
define( 'PODS_WP_VERSION_MINIMUM', '4.5' ); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
// This should match minimum WP requirements or usage (90%+) |
51
|
|
|
// Found at: https://wordpress.org/about/stats/ |
52
|
|
|
if ( ! defined( 'PODS_PHP_VERSION_MINIMUM' ) ) { |
53
|
|
|
define( 'PODS_PHP_VERSION_MINIMUM', '5.3' ); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
// This should match minimum WP requirements or usage (90%+) |
57
|
|
|
// Found at: https://wordpress.org/about/stats/ |
58
|
|
|
// Using 5.1 for now, many RedHat servers aren't EOL yet and they backport security releases |
59
|
|
|
if ( ! defined( 'PODS_MYSQL_VERSION_MINIMUM' ) ) { |
60
|
|
|
define( 'PODS_MYSQL_VERSION_MINIMUM', '5.1' ); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
define( 'PODS_SLUG', plugin_basename( __FILE__ ) ); |
64
|
|
|
define( 'PODS_URL', plugin_dir_url( __FILE__ ) ); |
65
|
|
|
define( 'PODS_DIR', plugin_dir_path( __FILE__ ) ); |
66
|
|
|
|
67
|
|
|
// Prevent conflicts with old Pods UI plugin |
68
|
|
|
if ( function_exists( 'pods_ui_manage' ) ) { |
69
|
|
|
add_action( 'init', 'pods_deactivate_pods_ui' ); |
70
|
|
|
} else { |
71
|
|
|
global $pods, $pods_init, $pods_form; |
|
|
|
|
72
|
|
|
|
73
|
|
|
require_once PODS_DIR . 'includes/classes.php'; |
74
|
|
|
require_once PODS_DIR . 'includes/data.php'; |
75
|
|
|
require_once PODS_DIR . 'includes/general.php'; |
76
|
|
|
|
77
|
|
|
if ( ! defined( 'PODS_MEDIA' ) || PODS_MEDIA ) { |
78
|
|
|
require_once PODS_DIR . 'includes/media.php'; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
if ( ! defined( 'SHORTINIT' ) || ! SHORTINIT ) { |
82
|
|
|
if ( pods_allow_deprecated() ) { |
83
|
|
|
require_once PODS_DIR . 'deprecated/deprecated.php'; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
if ( false !== pods_compatibility_check() ) { |
87
|
|
|
$pods_form = pods_form(); |
88
|
|
|
|
89
|
|
|
if ( ! is_network_admin() ) { |
90
|
|
|
$pods_init = pods_init(); |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Deactivate Pods 1.x or other Pods plugins |
99
|
|
|
*/ |
100
|
|
|
function pods_deactivate_pods_1_x() { |
101
|
|
|
|
102
|
|
|
if ( defined( 'PODS_VERSION' ) && defined( 'PODS_DIR' ) && file_exists( untrailingslashit( PODS_DIR ) . '/init.php' ) ) { |
103
|
|
|
if ( ! function_exists( 'deactivate_plugins' ) ) { |
104
|
|
|
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
deactivate_plugins( realpath( untrailingslashit( PODS_DIR ) . '/init.php' ) ); |
108
|
|
|
|
109
|
|
|
if ( ! headers_sent() && ( ! function_exists( 'pods_ui_manage' ) && ! file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) ) { |
110
|
|
|
wp_redirect( $_SERVER['REQUEST_URI'] ); |
111
|
|
|
die(); |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Deactivate Pods UI plugin |
119
|
|
|
*/ |
120
|
|
|
function pods_deactivate_pods_ui() { |
121
|
|
|
|
122
|
|
|
if ( function_exists( 'pods_ui_manage' ) && file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) { |
123
|
|
|
if ( ! function_exists( 'deactivate_plugins' ) ) { |
124
|
|
|
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
deactivate_plugins( realpath( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ); |
128
|
|
|
|
129
|
|
|
if ( ! headers_sent() ) { |
130
|
|
|
wp_redirect( $_SERVER['REQUEST_URI'] ); |
131
|
|
|
die(); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
} |
136
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.