These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | /** |
||
3 | * Plugin Name: GravityView |
||
4 | * Plugin URI: https://gravityview.co |
||
5 | * Description: The best, easiest way to display Gravity Forms entries on your website. |
||
6 | * Version: 2.3.2 |
||
7 | * Author: GravityView |
||
8 | * Author URI: https://gravityview.co |
||
9 | * Text Domain: gravityview |
||
10 | * License: GPLv2 or later |
||
11 | * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
||
12 | * Domain Path: /languages |
||
13 | */ |
||
14 | |||
15 | /** If this file is called directly, abort. */ |
||
16 | if ( ! defined( 'ABSPATH' ) ) { |
||
17 | die; |
||
18 | } |
||
19 | |||
20 | /** Constants */ |
||
21 | |||
22 | /** |
||
23 | * The plugin version. |
||
24 | */ |
||
25 | define( 'GV_PLUGIN_VERSION', '2.3.2' ); |
||
26 | |||
27 | /** |
||
28 | * Full path to the GravityView file |
||
29 | * @define "GRAVITYVIEW_FILE" "./gravityview.php" |
||
30 | */ |
||
31 | define( 'GRAVITYVIEW_FILE', __FILE__ ); |
||
32 | |||
33 | /** |
||
34 | * The URL to this file, with trailing slash |
||
35 | */ |
||
36 | define( 'GRAVITYVIEW_URL', plugin_dir_url( __FILE__ ) ); |
||
37 | |||
38 | |||
39 | /** @define "GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory, with trailing slash */ |
||
40 | define( 'GRAVITYVIEW_DIR', plugin_dir_path( __FILE__ ) ); |
||
41 | |||
42 | /** |
||
43 | * GravityView requires at least this version of Gravity Forms to function properly. |
||
44 | */ |
||
45 | define( 'GV_MIN_GF_VERSION', '2.3' ); |
||
46 | |||
47 | /** |
||
48 | * GravityView requires at least this version of WordPress to function properly. |
||
49 | * @since 1.12 |
||
50 | */ |
||
51 | define( 'GV_MIN_WP_VERSION', '4.4' ); |
||
52 | |||
53 | /** |
||
54 | * GravityView requires at least this version of PHP to function properly. |
||
55 | * @since 1.12 |
||
56 | */ |
||
57 | define( 'GV_MIN_PHP_VERSION', '5.3.0' ); |
||
58 | |||
59 | /** |
||
60 | * GravityView will require this version of PHP soon. False if no future PHP version changes are planned. |
||
61 | * @since 1.19.2 |
||
62 | * @var string|false |
||
63 | */ |
||
64 | define( 'GV_FUTURE_MIN_PHP_VERSION', '5.6.0' ); |
||
65 | |||
66 | /** |
||
67 | * GravityView will soon require at least this version of Gravity Forms to function properly. |
||
68 | * @since 1.19.4 |
||
69 | */ |
||
70 | define( 'GV_FUTURE_MIN_GF_VERSION', '2.4.0' ); |
||
71 | |||
72 | /** |
||
73 | * The future is here and now. |
||
74 | */ |
||
75 | require GRAVITYVIEW_DIR . 'future/loader.php'; |
||
76 | |||
77 | /** |
||
78 | * GravityView_Plugin main class. |
||
79 | * |
||
80 | * @deprecated see `gravityview()->plugin` and `\GV\Plugin` |
||
81 | */ |
||
82 | final class GravityView_Plugin { |
||
83 | |||
84 | /** |
||
85 | * @deprecated Use \GV\Plugin::$version |
||
86 | */ |
||
87 | const version = GV_PLUGIN_VERSION; |
||
88 | |||
89 | private static $instance; |
||
90 | |||
91 | /** |
||
92 | * Singleton instance |
||
93 | * |
||
94 | * @deprecated See \GV\Plugin |
||
95 | * |
||
96 | * @return GravityView_Plugin GravityView_Plugin object |
||
97 | */ |
||
98 | public static function getInstance() { |
||
0 ignored issues
–
show
|
|||
99 | if ( empty( self::$instance ) ) { |
||
100 | self::$instance = new self; |
||
101 | } |
||
102 | |||
103 | return self::$instance; |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * @deprecated See \GV\Plugin |
||
108 | */ |
||
109 | private function __construct() { |
||
110 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Include global plugin files |
||
115 | * |
||
116 | * @deprecated Use gravityview()->plugin->include_legacy_core |
||
117 | * |
||
118 | * @since 1.12 |
||
119 | */ |
||
120 | public function include_files() { |
||
121 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
122 | gravityview()->plugin->include_legacy_core(); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * Check whether GravityView is network activated |
||
127 | * |
||
128 | * @deprecated See \GV\Plugin |
||
129 | * |
||
130 | * @since 1.7.6 |
||
131 | * @return bool |
||
132 | */ |
||
133 | public static function is_network_activated() { |
||
134 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
135 | return gravityview()->plugin->is_network_activated(); |
||
136 | } |
||
137 | |||
138 | |||
139 | /** |
||
140 | * Plugin activate function. |
||
141 | * |
||
142 | * @access public |
||
143 | * @static |
||
144 | * @return void |
||
145 | */ |
||
146 | public static function activate() { |
||
147 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
148 | } |
||
149 | |||
150 | |||
151 | /** |
||
152 | * Plugin deactivate function. |
||
153 | * |
||
154 | * @access public |
||
155 | * @deprecated see \GV\Plugin::deactivate() |
||
156 | * @return void |
||
157 | */ |
||
158 | public static function deactivate() { |
||
159 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * Include the extension class |
||
164 | * |
||
165 | * @deprecated The extension framework is included by default now. |
||
166 | * |
||
167 | * @since 1.5.1 |
||
168 | * @return void |
||
169 | */ |
||
170 | public static function include_extension_framework() { |
||
171 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * Load GravityView_Widget class |
||
176 | * |
||
177 | * @deprecated The widget class is loaded elsewhere in legacy core. |
||
178 | * |
||
179 | * @since 1.7.5.1 |
||
180 | */ |
||
181 | public static function include_widget_class() { |
||
182 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
183 | } |
||
184 | |||
185 | |||
186 | /** |
||
187 | * Loads the plugin's translated strings. |
||
188 | * |
||
189 | * @deprecated Use \GV\Plugin::load_textdomain() |
||
190 | * |
||
191 | * @access public |
||
192 | * @return void |
||
193 | */ |
||
194 | public function load_plugin_textdomain() { |
||
195 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
196 | gravityview()->plugin->load_textdomain(); |
||
197 | } |
||
198 | |||
199 | /** |
||
200 | * Check if is_admin(), and make sure not DOING_AJAX |
||
201 | * @since 1.7.5 |
||
202 | * @deprecated |
||
203 | * @see \GV\Frontend_Request::is_admin via gravityview()->request->is_admin() |
||
204 | * @return bool |
||
205 | */ |
||
206 | public static function is_admin() { |
||
207 | gravityview()->log->notice( '\GravityView_Plugin::is_admin() is deprecated. Use \GV\Request::is_admin() instead.' ); |
||
208 | return gravityview()->request->is_admin(); |
||
209 | } |
||
210 | |||
211 | /** |
||
212 | * Function to launch frontend objects |
||
213 | * |
||
214 | * @since 1.17 Added $force param |
||
215 | * |
||
216 | * @access public |
||
217 | * |
||
218 | * @param bool $force Whether to force loading |
||
219 | * |
||
220 | * @return void |
||
221 | */ |
||
222 | public function frontend_actions( $force = false ) { |
||
223 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
224 | gravityview()->plugin->include_legacy_frontend( $force ); |
||
225 | } |
||
226 | |||
227 | /** |
||
228 | * Helper function to define the default widget areas. |
||
229 | * |
||
230 | * @deprecated Moved to GravityView_Widget::get_default_widget_areas() |
||
231 | * |
||
232 | * @return array definition for default widget areas |
||
233 | */ |
||
234 | public static function get_default_widget_areas() { |
||
235 | return GravityView_Widget::get_default_widget_areas(); |
||
236 | } |
||
237 | |||
238 | /** DEBUG */ |
||
239 | |||
240 | /** |
||
241 | * Logs messages using Gravity Forms logging add-on |
||
242 | * @param string $message log message |
||
243 | * @param mixed $data Additional data to display |
||
244 | * @deprecated use gravityview()->log |
||
245 | * @return void |
||
246 | */ |
||
247 | public static function log_debug( $message, $data = null ){ |
||
248 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
249 | gravityview()->log->debug( $message, $data ); |
||
250 | } |
||
251 | |||
252 | /** |
||
253 | * Logs messages using Gravity Forms logging add-on |
||
254 | * @param string $message log message |
||
255 | * @deprecated use gravityview()->log |
||
256 | * @return void |
||
257 | */ |
||
258 | public static function log_error( $message, $data = null ){ |
||
259 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
||
260 | gravityview()->log->error( $message, $data ); |
||
261 | } |
||
262 | } // end class GravityView_Plugin |
||
263 |
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.