@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | /** If this file is called directly, abort. */ |
29 | -if ( ! defined( 'ABSPATH' ) ) { |
|
29 | +if (!defined('ABSPATH')) { |
|
30 | 30 | die; |
31 | 31 | } |
32 | 32 | |
@@ -36,52 +36,52 @@ discard block |
||
36 | 36 | * Full path to the GravityView file |
37 | 37 | * @define "GRAVITYVIEW_FILE" "./gravityview.php" |
38 | 38 | */ |
39 | -define( 'GRAVITYVIEW_FILE', __FILE__ ); |
|
39 | +define('GRAVITYVIEW_FILE', __FILE__); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * The URL to this file |
43 | 43 | */ |
44 | -define( 'GRAVITYVIEW_URL', plugin_dir_url( __FILE__ ) ); |
|
44 | +define('GRAVITYVIEW_URL', plugin_dir_url(__FILE__)); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | /** @define "GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory */ |
48 | -define( 'GRAVITYVIEW_DIR', plugin_dir_path( __FILE__ ) ); |
|
48 | +define('GRAVITYVIEW_DIR', plugin_dir_path(__FILE__)); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * GravityView requires at least this version of Gravity Forms to function properly. |
52 | 52 | */ |
53 | -define( 'GV_MIN_GF_VERSION', '1.9.9.10' ); |
|
53 | +define('GV_MIN_GF_VERSION', '1.9.9.10'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * GravityView requires at least this version of WordPress to function properly. |
57 | 57 | * @since 1.12 |
58 | 58 | */ |
59 | -define( 'GV_MIN_WP_VERSION', '3.3' ); |
|
59 | +define('GV_MIN_WP_VERSION', '3.3'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * GravityView requires at least this version of PHP to function properly. |
63 | 63 | * @since 1.12 |
64 | 64 | */ |
65 | -define( 'GV_MIN_PHP_VERSION', '5.2.4' ); |
|
65 | +define('GV_MIN_PHP_VERSION', '5.2.4'); |
|
66 | 66 | |
67 | 67 | /** Load common & connector functions */ |
68 | -require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
|
69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
71 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
|
72 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
|
73 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
|
68 | +require_once(GRAVITYVIEW_DIR.'includes/helper-functions.php'); |
|
69 | +require_once(GRAVITYVIEW_DIR.'includes/class-common.php'); |
|
70 | +require_once(GRAVITYVIEW_DIR.'includes/connector-functions.php'); |
|
71 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-compatibility.php'); |
|
72 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-roles-capabilities.php'); |
|
73 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-notices.php'); |
|
74 | 74 | |
75 | 75 | /** Register Post Types and Rewrite Rules */ |
76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
76 | +require_once(GRAVITYVIEW_DIR.'includes/class-post-types.php'); |
|
77 | 77 | |
78 | 78 | /** Add Cache Class */ |
79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
79 | +require_once(GRAVITYVIEW_DIR.'includes/class-cache.php'); |
|
80 | 80 | |
81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
82 | -if( is_admin() ) { |
|
83 | - register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
|
84 | - register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
|
82 | +if (is_admin()) { |
|
83 | + register_activation_hook(__FILE__, array('GravityView_Plugin', 'activate')); |
|
84 | + register_deactivation_hook(__FILE__, array('GravityView_Plugin', 'deactivate')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public static function getInstance() { |
102 | 102 | |
103 | - if( empty( self::$instance ) ) { |
|
103 | + if (empty(self::$instance)) { |
|
104 | 104 | self::$instance = new self; |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function __construct() { |
111 | 111 | |
112 | 112 | |
113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
113 | + if (!GravityView_Compatibility::is_valid()) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | function add_hooks() { |
128 | 128 | // Load plugin text domain |
129 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ), 1 ); |
|
129 | + add_action('init', array($this, 'load_plugin_textdomain'), 1); |
|
130 | 130 | |
131 | 131 | // Load frontend files |
132 | - add_action( 'init', array( $this, 'frontend_actions' ), 20 ); |
|
132 | + add_action('init', array($this, 'frontend_actions'), 20); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,47 +139,47 @@ discard block |
||
139 | 139 | */ |
140 | 140 | function include_files() { |
141 | 141 | |
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
142 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin.php'); |
|
143 | 143 | |
144 | 144 | // Load fields |
145 | - include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
145 | + include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php'); |
|
146 | 146 | |
147 | 147 | // Load all field files automatically |
148 | - foreach ( glob( GRAVITYVIEW_DIR . 'includes/fields/*.php' ) as $gv_field_filename ) { |
|
149 | - include_once( $gv_field_filename ); |
|
148 | + foreach (glob(GRAVITYVIEW_DIR.'includes/fields/*.php') as $gv_field_filename) { |
|
149 | + include_once($gv_field_filename); |
|
150 | 150 | } |
151 | 151 | |
152 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
153 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
152 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-notes.php'); |
|
153 | + include_once(GRAVITYVIEW_DIR.'includes/load-plugin-and-theme-hooks.php'); |
|
154 | 154 | |
155 | 155 | // Load Extensions |
156 | 156 | // @todo: Convert to a scan of the directory or a method where this all lives |
157 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
157 | + include_once(GRAVITYVIEW_DIR.'includes/extensions/edit-entry/class-edit-entry.php'); |
|
158 | + include_once(GRAVITYVIEW_DIR.'includes/extensions/delete-entry/class-delete-entry.php'); |
|
159 | 159 | |
160 | 160 | // Load WordPress Widgets |
161 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
161 | + include_once(GRAVITYVIEW_DIR.'includes/wordpress-widgets/register-wordpress-widgets.php'); |
|
162 | 162 | |
163 | 163 | // Load GravityView Widgets |
164 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
164 | + include_once(GRAVITYVIEW_DIR.'includes/widgets/register-gravityview-widgets.php'); |
|
165 | 165 | |
166 | 166 | // Add oEmbed |
167 | - include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
|
167 | + include_once(GRAVITYVIEW_DIR.'includes/class-oembed.php'); |
|
168 | 168 | |
169 | 169 | // Add logging |
170 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-logging.php' ); |
|
171 | - |
|
172 | - include_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' ); |
|
173 | - include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php'); |
|
174 | - include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
175 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
|
176 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
|
177 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
178 | - include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
|
179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
|
180 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
|
181 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gvlogic-shortcode.php' ); |
|
182 | - include_once( GRAVITYVIEW_DIR . 'includes/presets/register-default-templates.php' ); |
|
170 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-logging.php'); |
|
171 | + |
|
172 | + include_once(GRAVITYVIEW_DIR.'includes/class-ajax.php'); |
|
173 | + include_once(GRAVITYVIEW_DIR.'includes/class-settings.php'); |
|
174 | + include_once(GRAVITYVIEW_DIR.'includes/class-frontend-views.php'); |
|
175 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-bar.php'); |
|
176 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-list.php'); |
|
177 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
178 | + include_once(GRAVITYVIEW_DIR.'includes/class-data.php'); |
|
179 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-shortcode.php'); |
|
180 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-link-shortcode.php'); |
|
181 | + include_once(GRAVITYVIEW_DIR.'includes/class-gvlogic-shortcode.php'); |
|
182 | + include_once(GRAVITYVIEW_DIR.'includes/presets/register-default-templates.php'); |
|
183 | 183 | |
184 | 184 | } |
185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return bool |
190 | 190 | */ |
191 | 191 | public static function is_network_activated() { |
192 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
192 | + return is_multisite() && (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('gravityview/gravityview.php')); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param mixed $network_wide |
202 | 202 | * @return void |
203 | 203 | */ |
204 | - public static function activate( $network_wide = false ) { |
|
204 | + public static function activate($network_wide = false) { |
|
205 | 205 | |
206 | 206 | // register post types |
207 | 207 | GravityView_Post_Types::init_post_types(); |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | flush_rewrite_rules(); |
213 | 213 | |
214 | 214 | // Update the current GV version |
215 | - update_option( 'gv_version', self::version ); |
|
215 | + update_option('gv_version', self::version); |
|
216 | 216 | |
217 | 217 | // Add the transient to redirect to configuration page |
218 | - set_transient( '_gv_activation_redirect', true, 60 ); |
|
218 | + set_transient('_gv_activation_redirect', true, 60); |
|
219 | 219 | |
220 | 220 | // Clear settings transient |
221 | - delete_transient( 'redux_edd_license_license_valid' ); |
|
221 | + delete_transient('redux_edd_license_license_valid'); |
|
222 | 222 | |
223 | 223 | GravityView_Roles_Capabilities::get_instance()->add_caps(); |
224 | 224 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @param mixed $network_wide |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - public static function deactivate( $network_wide ) { |
|
235 | + public static function deactivate($network_wide) { |
|
236 | 236 | |
237 | 237 | flush_rewrite_rules(); |
238 | 238 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @return void |
246 | 246 | */ |
247 | 247 | public static function include_extension_framework() { |
248 | - if ( ! class_exists( 'GravityView_Extension' ) ) { |
|
249 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-extension.php' ); |
|
248 | + if (!class_exists('GravityView_Extension')) { |
|
249 | + require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-extension.php'); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @since 1.7.5.1 |
257 | 257 | */ |
258 | 258 | public static function include_widget_class() { |
259 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
259 | + include_once(GRAVITYVIEW_DIR.'includes/widgets/class-gravityview-widget.php'); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function load_plugin_textdomain() { |
270 | 270 | |
271 | - $loaded = load_plugin_textdomain( 'gravityview', false, '/languages/' ); |
|
272 | - if ( ! $loaded ) { |
|
273 | - $loaded = load_muplugin_textdomain( 'gravityview', '/languages/' ); |
|
271 | + $loaded = load_plugin_textdomain('gravityview', false, '/languages/'); |
|
272 | + if (!$loaded) { |
|
273 | + $loaded = load_muplugin_textdomain('gravityview', '/languages/'); |
|
274 | 274 | } |
275 | - if ( ! $loaded ) { |
|
276 | - $loaded = load_theme_textdomain( 'gravityview', '/languages/' ); |
|
275 | + if (!$loaded) { |
|
276 | + $loaded = load_theme_textdomain('gravityview', '/languages/'); |
|
277 | 277 | } |
278 | - if ( ! $loaded ) { |
|
279 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
|
280 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
281 | - load_textdomain( 'gravityview', $mofile ); |
|
278 | + if (!$loaded) { |
|
279 | + $locale = apply_filters('plugin_locale', get_locale(), 'gravityview'); |
|
280 | + $mofile = dirname(__FILE__).'/languages/gravityview-'.$locale.'.mo'; |
|
281 | + load_textdomain('gravityview', $mofile); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | } |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | */ |
291 | 291 | public static function is_admin() { |
292 | 292 | |
293 | - $doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false; |
|
293 | + $doing_ajax = defined('DOING_AJAX') ? DOING_AJAX : false; |
|
294 | 294 | |
295 | - return is_admin() && ! $doing_ajax; |
|
295 | + return is_admin() && !$doing_ajax; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -303,27 +303,27 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function frontend_actions() { |
305 | 305 | |
306 | - if( self::is_admin() ) { return; } |
|
306 | + if (self::is_admin()) { return; } |
|
307 | 307 | |
308 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
|
309 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
310 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
311 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
312 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
|
308 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-image.php'); |
|
309 | + include_once(GRAVITYVIEW_DIR.'includes/class-template.php'); |
|
310 | + include_once(GRAVITYVIEW_DIR.'includes/class-api.php'); |
|
311 | + include_once(GRAVITYVIEW_DIR.'includes/class-frontend-views.php'); |
|
312 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-change-entry-creator.php'); |
|
313 | 313 | |
314 | 314 | |
315 | 315 | /** |
316 | 316 | * When an entry is created, check if we need to update the custom slug meta |
317 | 317 | * todo: move this to its own class.. |
318 | 318 | */ |
319 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
319 | + add_action('gform_entry_created', array('GravityView_API', 'entry_create_custom_slug'), 10, 2); |
|
320 | 320 | |
321 | 321 | /** |
322 | 322 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
323 | 323 | * |
324 | 324 | * Nice place to insert extensions' frontend stuff |
325 | 325 | */ |
326 | - do_action( 'gravityview_include_frontend_actions' ); |
|
326 | + do_action('gravityview_include_frontend_actions'); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public static function get_default_widget_areas() { |
335 | 335 | $default_areas = array( |
336 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
337 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
336 | + array('1-1' => array(array('areaid' => 'top', 'title' => __('Top', 'gravityview'), 'subtitle' => ''))), |
|
337 | + array('1-2' => array(array('areaid' => 'left', 'title' => __('Left', 'gravityview'), 'subtitle' => '')), '2-2' => array(array('areaid' => 'right', 'title' => __('Right', 'gravityview'), 'subtitle' => ''))), |
|
338 | 338 | //array( '1-1' => array( array( 'areaid' => 'bottom', 'title' => __('Full Width Bottom', 'gravityview') , 'subtitle' => '' ) ) ) |
339 | 339 | ); |
340 | 340 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @filter `gravityview_widget_active_areas` Array of zones available for widgets to be dropped into |
343 | 343 | * @param array $default_areas Definition for default widget areas |
344 | 344 | */ |
345 | - return apply_filters( 'gravityview_widget_active_areas', $default_areas ); |
|
345 | + return apply_filters('gravityview_widget_active_areas', $default_areas); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** DEBUG */ |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * @param mixed $data Additional data to display |
354 | 354 | * @return void |
355 | 355 | */ |
356 | - public static function log_debug( $message, $data = null ){ |
|
356 | + public static function log_debug($message, $data = null) { |
|
357 | 357 | /** |
358 | 358 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
359 | 359 | * @param string $message Message to display |
360 | 360 | * @param mixed $data Supporting data to print alongside it |
361 | 361 | */ |
362 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
362 | + do_action('gravityview_log_debug', $message, $data); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | * @param string $message log message |
368 | 368 | * @return void |
369 | 369 | */ |
370 | - public static function log_error( $message, $data = null ){ |
|
370 | + public static function log_error($message, $data = null) { |
|
371 | 371 | /** |
372 | 372 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
373 | 373 | * @param string $message Error message to display |
374 | 374 | * @param mixed $data Supporting data to print alongside it |
375 | 375 | */ |
376 | - do_action( 'gravityview_log_error', $message, $data ); |
|
376 | + do_action('gravityview_log_error', $message, $data); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | } // end class GravityView_Plugin |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | * @since 1.15 |
26 | 26 | */ |
27 | 27 | function add_hooks() { |
28 | - add_action( 'personal_options', array( $this, 'user_field' ) ); |
|
29 | - add_action( 'personal_options_update', array( $this, 'update_user_meta_value' ) ); |
|
30 | - add_action( 'edit_user_profile_update', array( $this, 'update_user_meta_value' ) ); |
|
31 | - add_action( 'admin_enqueue_scripts', array( $this, 'maybe_enqueue_script' ), 1000 ); |
|
32 | - add_action( 'update_option_active_plugins', array( $this, 'flush_related_plugins_transient' ) ); |
|
33 | - add_action( 'update_option_active_sitewide_plugins', array( $this, 'flush_related_plugins_transient' ) ); |
|
28 | + add_action('personal_options', array($this, 'user_field')); |
|
29 | + add_action('personal_options_update', array($this, 'update_user_meta_value')); |
|
30 | + add_action('edit_user_profile_update', array($this, 'update_user_meta_value')); |
|
31 | + add_action('admin_enqueue_scripts', array($this, 'maybe_enqueue_script'), 1000); |
|
32 | + add_action('update_option_active_plugins', array($this, 'flush_related_plugins_transient')); |
|
33 | + add_action('update_option_active_sitewide_plugins', array($this, 'flush_related_plugins_transient')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - static function maybe_enqueue_script( $hook ) { |
|
45 | + static function maybe_enqueue_script($hook) { |
|
46 | 46 | global $pagenow; |
47 | 47 | |
48 | 48 | // Don't show if not GravityView page, or if we're on the Widgets page |
49 | - if ( ! gravityview_is_admin_page( $hook ) || $pagenow === 'widgets.php' ) { |
|
49 | + if (!gravityview_is_admin_page($hook) || $pagenow === 'widgets.php') { |
|
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | * @since 1.15 |
56 | 56 | * @param boolean $display_beacon Default: `true` |
57 | 57 | */ |
58 | - $display_support_port = apply_filters( 'gravityview/support_port/display', self::show_for_user() ); |
|
58 | + $display_support_port = apply_filters('gravityview/support_port/display', self::show_for_user()); |
|
59 | 59 | |
60 | - if ( empty( $display_support_port ) ) { |
|
61 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Not showing Support Port' ); |
|
60 | + if (empty($display_support_port)) { |
|
61 | + do_action('gravityview_log_debug', __METHOD__.' - Not showing Support Port'); |
|
62 | 62 | |
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
66 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
67 | 67 | |
68 | - wp_enqueue_script( 'gravityview-support', plugins_url( 'assets/js/support' . $script_debug . '.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version, true ); |
|
68 | + wp_enqueue_script('gravityview-support', plugins_url('assets/js/support'.$script_debug.'.js', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version, true); |
|
69 | 69 | |
70 | 70 | self::_localize_script(); |
71 | 71 | } |
@@ -80,30 +80,30 @@ discard block |
||
80 | 80 | private static function _localize_script() { |
81 | 81 | |
82 | 82 | $translation = array( |
83 | - 'agentLabel' => __( 'GravityView Support', 'gravityview' ), |
|
84 | - 'searchLabel' => __( 'Search GravityView Docs', 'gravityview' ), |
|
85 | - 'searchErrorLabel' => __( 'Your search timed out. Please double-check your internet connection and try again.', 'gravityview' ), |
|
86 | - 'noResultsLabel' => _x( 'No results found for', 'a support form search has returned empty for the following word', 'gravityview' ), |
|
87 | - 'contactLabel' => __( 'Contact Support', 'gravityview' ), |
|
88 | - 'attachFileLabel' => __( 'Attach a screenshot or file', 'gravityview' ), |
|
89 | - 'attachFileError' => __( 'The maximum file size is 10 MB', 'gravityview' ), |
|
90 | - 'nameLabel' => __( 'Your Name', 'gravityview' ), |
|
91 | - 'nameError' => __( 'Please enter your name', 'gravityview' ), |
|
92 | - 'emailLabel' => __( 'Email address', 'gravityview' ), |
|
93 | - 'emailError' => __( 'Please enter a valid email address', 'gravityview' ), |
|
94 | - 'subjectLabel' => __( 'Subject', 'gravityview' ), |
|
95 | - 'subjectError' => _x( 'Please enter a subject', 'Error shown when submitting support request and there is no subject provided', 'gravityview' ), |
|
96 | - 'messageLabel' => __( 'How can we help you?', 'gravityview' ), |
|
97 | - 'messageError' => _x( 'Please enter a message', 'Error shown when submitting support request and there is no message provided', 'gravityview' ), |
|
98 | - 'contactSuccessLabel' => __( 'Message sent!', 'gravityview' ), |
|
99 | - 'contactSuccessDescription' => __( 'Thanks for reaching out! Someone from the GravityView team will get back to you soon.', 'gravityview' ), |
|
83 | + 'agentLabel' => __('GravityView Support', 'gravityview'), |
|
84 | + 'searchLabel' => __('Search GravityView Docs', 'gravityview'), |
|
85 | + 'searchErrorLabel' => __('Your search timed out. Please double-check your internet connection and try again.', 'gravityview'), |
|
86 | + 'noResultsLabel' => _x('No results found for', 'a support form search has returned empty for the following word', 'gravityview'), |
|
87 | + 'contactLabel' => __('Contact Support', 'gravityview'), |
|
88 | + 'attachFileLabel' => __('Attach a screenshot or file', 'gravityview'), |
|
89 | + 'attachFileError' => __('The maximum file size is 10 MB', 'gravityview'), |
|
90 | + 'nameLabel' => __('Your Name', 'gravityview'), |
|
91 | + 'nameError' => __('Please enter your name', 'gravityview'), |
|
92 | + 'emailLabel' => __('Email address', 'gravityview'), |
|
93 | + 'emailError' => __('Please enter a valid email address', 'gravityview'), |
|
94 | + 'subjectLabel' => __('Subject', 'gravityview'), |
|
95 | + 'subjectError' => _x('Please enter a subject', 'Error shown when submitting support request and there is no subject provided', 'gravityview'), |
|
96 | + 'messageLabel' => __('How can we help you?', 'gravityview'), |
|
97 | + 'messageError' => _x('Please enter a message', 'Error shown when submitting support request and there is no message provided', 'gravityview'), |
|
98 | + 'contactSuccessLabel' => __('Message sent!', 'gravityview'), |
|
99 | + 'contactSuccessDescription' => __('Thanks for reaching out! Someone from the GravityView team will get back to you soon.', 'gravityview'), |
|
100 | 100 | #'topicLabel' => __('Select a topic', 'gravityview' ), // Not yet implemented |
101 | 101 | #'topicError' => __('Please select a topic from the list', 'gravityview' ), // Not yet implemented |
102 | 102 | ); |
103 | 103 | |
104 | - $response = GravityView_Settings::getSetting( 'license_key_response' ); |
|
104 | + $response = GravityView_Settings::getSetting('license_key_response'); |
|
105 | 105 | |
106 | - $response = wp_parse_args( $response, array( |
|
106 | + $response = wp_parse_args($response, array( |
|
107 | 107 | 'license' => '', |
108 | 108 | 'message' => '', |
109 | 109 | 'license_key' => '', |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | 'payment_id' => '', |
115 | 115 | 'customer_name' => '', |
116 | 116 | 'customer_email' => '', |
117 | - ) ); |
|
117 | + )); |
|
118 | 118 | |
119 | 119 | // This is just HTML we don't need. |
120 | - unset( $response['message'] ); |
|
120 | + unset($response['message']); |
|
121 | 121 | |
122 | - switch ( intval( $response['license_limit'] ) ) { |
|
122 | + switch (intval($response['license_limit'])) { |
|
123 | 123 | case 1: |
124 | 124 | $package = 'Sol'; |
125 | 125 | break; |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | $package = 'Interstellar'; |
131 | 131 | break; |
132 | 132 | default: |
133 | - $package = sprintf( '%d-Site License', $response['license_limit'] ); |
|
133 | + $package = sprintf('%d-Site License', $response['license_limit']); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $data = array( |
137 | - 'email' => GravityView_Settings::getSetting( 'support-email' ), |
|
137 | + 'email' => GravityView_Settings::getSetting('support-email'), |
|
138 | 138 | 'name' => $response['customer_name'], |
139 | - 'Valid License?' => ucwords( $response['license'] ), |
|
139 | + 'Valid License?' => ucwords($response['license']), |
|
140 | 140 | 'License Key' => $response['license_key'], |
141 | 141 | 'License Level' => $package, |
142 | - 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
|
143 | - 'Support Email' => GravityView_Settings::getSetting( 'support-email' ), |
|
142 | + 'Site Admin Email' => get_bloginfo('admin_email'), |
|
143 | + 'Support Email' => GravityView_Settings::getSetting('support-email'), |
|
144 | 144 | 'License Limit' => $response['license_limit'], |
145 | 145 | 'Site Count' => $response['site_count'], |
146 | 146 | 'License Expires' => $response['expires'], |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'Payment ID' => $response['payment_id'], |
149 | 149 | 'Payment Name' => $response['customer_name'], |
150 | 150 | 'Payment Email' => $response['customer_email'], |
151 | - 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
|
151 | + 'WordPress Version' => get_bloginfo('version', 'display'), |
|
152 | 152 | 'PHP Version' => phpversion(), |
153 | 153 | 'GravityView Version' => GravityView_Plugin::version, |
154 | 154 | 'Gravity Forms Version' => GFForms::$version, |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | ); |
157 | 157 | |
158 | 158 | $localization_data = array( |
159 | - 'contactEnabled' => (int)current_user_can( 'gravityview_contact_support' ), // @todo use GVCommon::has_cap() after merge |
|
160 | - 'protocol' => ( is_ssl() ? 'https' : 'http' ), |
|
159 | + 'contactEnabled' => (int)current_user_can('gravityview_contact_support'), // @todo use GVCommon::has_cap() after merge |
|
160 | + 'protocol' => (is_ssl() ? 'https' : 'http'), |
|
161 | 161 | 'data' => $data, |
162 | 162 | 'translation' => $translation, |
163 | 163 | ); |
164 | 164 | |
165 | - wp_localize_script( 'gravityview-support', 'gvSupport', $localization_data ); |
|
165 | + wp_localize_script('gravityview-support', 'gvSupport', $localization_data); |
|
166 | 166 | |
167 | - unset( $localization_data, $data, $translation, $response, $package ); |
|
167 | + unset($localization_data, $data, $translation, $response, $package); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -175,36 +175,36 @@ discard block |
||
175 | 175 | */ |
176 | 176 | static private function get_related_plugins_and_extensions() { |
177 | 177 | |
178 | - if ( ! function_exists( 'wp_get_active_and_valid_plugins' ) ) { |
|
178 | + if (!function_exists('wp_get_active_and_valid_plugins')) { |
|
179 | 179 | return 'Running < WP 3.0'; |
180 | 180 | } |
181 | 181 | |
182 | - $extensions = get_site_transient( self::related_plugins_key ); |
|
182 | + $extensions = get_site_transient(self::related_plugins_key); |
|
183 | 183 | |
184 | - if ( empty( $extensions ) ) { |
|
184 | + if (empty($extensions)) { |
|
185 | 185 | |
186 | 186 | $active_plugins = wp_get_active_and_valid_plugins(); |
187 | 187 | $extensions = array(); |
188 | - foreach ( $active_plugins as $active_plugin ) { |
|
188 | + foreach ($active_plugins as $active_plugin) { |
|
189 | 189 | |
190 | 190 | // Match gravityview, gravity-forms, gravityforms, gravitate |
191 | - if ( ! preg_match( '/(gravityview|gravity-?forms|gravitate)/ism', $active_plugin ) ) { |
|
191 | + if (!preg_match('/(gravityview|gravity-?forms|gravitate)/ism', $active_plugin)) { |
|
192 | 192 | continue; |
193 | 193 | } |
194 | 194 | |
195 | - $plugin_data = get_plugin_data( $active_plugin ); |
|
195 | + $plugin_data = get_plugin_data($active_plugin); |
|
196 | 196 | |
197 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
197 | + $extensions[] = sprintf('%s %s', $plugin_data['Name'], $plugin_data['Version']); |
|
198 | 198 | } |
199 | 199 | |
200 | - if( $extensions ) { |
|
201 | - set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS ); |
|
200 | + if ($extensions) { |
|
201 | + set_site_transient(self::related_plugins_key, $extensions, HOUR_IN_SECONDS); |
|
202 | 202 | } else { |
203 | 203 | return 'There was an error fetching related plugins.'; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - return implode( '<br />', $extensions ); |
|
207 | + return implode('<br />', $extensions); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @since 1.15 |
215 | 215 | */ |
216 | 216 | public function flush_related_plugins_transient() { |
217 | - if ( function_exists( 'delete_site_transient' ) ) { |
|
218 | - delete_site_transient( self::related_plugins_key ); |
|
217 | + if (function_exists('delete_site_transient')) { |
|
218 | + delete_site_transient(self::related_plugins_key); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
@@ -231,20 +231,20 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return bool Whether to show GravityView support |
233 | 233 | */ |
234 | - static public function show_for_user( $user = 0 ) { |
|
234 | + static public function show_for_user($user = 0) { |
|
235 | 235 | |
236 | - if ( ! GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
236 | + if (!GVCommon::has_cap('gravityview_support_port')) { |
|
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | |
240 | - $pref = get_user_option( self::user_pref_name, $user ); |
|
240 | + $pref = get_user_option(self::user_pref_name, $user); |
|
241 | 241 | |
242 | 242 | // Not set; default to plugin setting |
243 | - if ( false === $pref ) { |
|
244 | - return GravityView_Settings::getSetting( 'support_port' ); |
|
243 | + if (false === $pref) { |
|
244 | + return GravityView_Settings::getSetting('support_port'); |
|
245 | 245 | } |
246 | 246 | |
247 | - return ! empty( $pref ); |
|
247 | + return !empty($pref); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return void |
259 | 259 | */ |
260 | - public function update_user_meta_value( $user_id ) { |
|
261 | - if ( current_user_can( 'edit_user', $user_id ) && isset( $_POST[ self::user_pref_name ] ) ) { |
|
262 | - update_user_meta( $user_id, self::user_pref_name, intval( $_POST[ self::user_pref_name ] ) ); |
|
260 | + public function update_user_meta_value($user_id) { |
|
261 | + if (current_user_can('edit_user', $user_id) && isset($_POST[self::user_pref_name])) { |
|
262 | + update_user_meta($user_id, self::user_pref_name, intval($_POST[self::user_pref_name])); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return void |
276 | 276 | */ |
277 | - function user_field( $user ) { |
|
277 | + function user_field($user) { |
|
278 | 278 | |
279 | 279 | /** |
280 | 280 | * @filter `gravityview/support_port/show_profile_setting` Should the "GravityView Support Port" setting be shown on user profiles? |
@@ -284,21 +284,21 @@ discard block |
||
284 | 284 | * @param boolean $allow_profile_setting Default: `true`, if the user has the `gravityview_support_port` capability, which defaults to true for Contributors and higher |
285 | 285 | * @param WP_User $user Current user object |
286 | 286 | */ |
287 | - $allow_profile_setting = apply_filters( 'gravityview/support_port/show_profile_setting', current_user_can( 'gravityview_support_port' ), $user ); |
|
287 | + $allow_profile_setting = apply_filters('gravityview/support_port/show_profile_setting', current_user_can('gravityview_support_port'), $user); |
|
288 | 288 | |
289 | - if ( $allow_profile_setting && current_user_can( 'edit_user', $user->ID ) ) { |
|
289 | + if ($allow_profile_setting && current_user_can('edit_user', $user->ID)) { |
|
290 | 290 | ?> |
291 | 291 | <table class="form-table"> |
292 | 292 | <tbody> |
293 | 293 | <tr class="user-gravityview-support-button-wrap"> |
294 | - <th scope="row"><?php _e( 'GravityView Support Port', 'gravityview' ); ?></th> |
|
294 | + <th scope="row"><?php _e('GravityView Support Port', 'gravityview'); ?></th> |
|
295 | 295 | <td> |
296 | 296 | <fieldset> |
297 | - <legend class="screen-reader-text"><span><?php _e( 'GravityView Support Port', 'gravityview' ) ?></span></legend> |
|
297 | + <legend class="screen-reader-text"><span><?php _e('GravityView Support Port', 'gravityview') ?></span></legend> |
|
298 | 298 | <label> |
299 | - <input name="<?php echo esc_attr( self::user_pref_name ); ?>" type="hidden" value="0"/> |
|
300 | - <input name="<?php echo esc_attr( self::user_pref_name ); ?>" type="checkbox" value="1" <?php checked( self::show_for_user( $user->ID ) ); ?> /> |
|
301 | - <?php esc_html_e( 'Show GravityView Support Port when on a GravityView-related page', 'gravityview' ); ?> |
|
299 | + <input name="<?php echo esc_attr(self::user_pref_name); ?>" type="hidden" value="0"/> |
|
300 | + <input name="<?php echo esc_attr(self::user_pref_name); ?>" type="checkbox" value="1" <?php checked(self::show_for_user($user->ID)); ?> /> |
|
301 | + <?php esc_html_e('Show GravityView Support Port when on a GravityView-related page', 'gravityview'); ?> |
|
302 | 302 | </label> |
303 | 303 | </fieldset> |
304 | 304 | </td> |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | */ |
27 | 27 | protected $value; |
28 | 28 | |
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
29 | + function __construct($name = '', $field = array(), $curr_value = NULL) { |
|
30 | 30 | |
31 | 31 | $this->name = $name; |
32 | 32 | |
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
36 | + if (!empty($field['choices'])) { |
|
37 | 37 | $field['options'] = $field['choices']; |
38 | - unset( $field['choices'] ); |
|
38 | + unset($field['choices']); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args($field, $defaults); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null($curr_value) ? $this->field['value'] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | |
79 | 79 | function get_tooltip() { |
80 | - if( !function_exists('gform_tooltip') ) { |
|
80 | + if (!function_exists('gform_tooltip')) { |
|
81 | 81 | return NULL; |
82 | 82 | } |
83 | 83 | |
84 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
84 | + return !empty($this->field['tooltip']) ? ' '.gform_tooltip($this->field['tooltip'], false, true) : NULL; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * @return string |
90 | 90 | */ |
91 | 91 | function get_field_id() { |
92 | - if( isset( $this->field['id'] ) ) { |
|
93 | - return esc_attr( $this->field['id'] ); |
|
92 | + if (isset($this->field['id'])) { |
|
93 | + return esc_attr($this->field['id']); |
|
94 | 94 | } |
95 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
95 | + return esc_attr(sanitize_html_class($this->name)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return string |
101 | 101 | */ |
102 | 102 | function get_field_label() { |
103 | - return esc_html( trim( $this->field['label'] ) ); |
|
103 | + return esc_html(trim($this->field['label'])); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return string |
112 | 112 | */ |
113 | 113 | function get_field_left_label() { |
114 | - return isset( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
114 | + return isset($this->field['left_label']) ? esc_html(trim($this->field['left_label'])) : NULL; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | function get_label_class() { |
122 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
122 | + return 'gv-label-'.sanitize_html_class($this->field['type']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | function get_field_desc() { |
131 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
131 | + return !empty($this->field['desc']) ? '<span class="howto">'.$this->field['desc'].'</span>' : ''; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function show_merge_tags() { |
140 | 140 | // Show the merge tags if the field is a list view |
141 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
141 | + $is_list = preg_match('/_list-/ism', $this->name); |
|
142 | 142 | // Or is a single entry view |
143 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
143 | + $is_single = preg_match('/single_/ism', $this->name); |
|
144 | 144 | |
145 | - return ( $is_single || $is_list ); |
|
145 | + return ($is_single || $is_list); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | * important! Override this class if needed |
160 | 160 | * outputs the field setting html |
161 | 161 | */ |
162 | - function render_setting( $override_input = NULL ) { |
|
162 | + function render_setting($override_input = NULL) { |
|
163 | 163 | |
164 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
164 | + if (!empty($this->field['full_width'])) { ?> |
|
165 | 165 | <th scope="row" colspan="2"> |
166 | 166 | <div> |
167 | 167 | <label for="<?php echo $this->get_field_id(); ?>"> |
168 | - <?php echo $this->get_field_label() . $this->get_tooltip(); ?> |
|
168 | + <?php echo $this->get_field_label().$this->get_tooltip(); ?> |
|
169 | 169 | </label> |
170 | 170 | </div> |
171 | - <?php $this->render_input( $override_input ); ?> |
|
171 | + <?php $this->render_input($override_input); ?> |
|
172 | 172 | </th> |
173 | 173 | <?php } else { ?> |
174 | 174 | <th scope="row"> |
175 | 175 | <label for="<?php echo $this->get_field_id(); ?>"> |
176 | - <?php echo $this->get_field_label() . $this->get_tooltip(); ?> |
|
176 | + <?php echo $this->get_field_label().$this->get_tooltip(); ?> |
|
177 | 177 | </label> |
178 | 178 | </th> |
179 | 179 | <td> |
180 | - <?php $this->render_input( $override_input ); ?> |
|
180 | + <?php $this->render_input($override_input); ?> |
|
181 | 181 | </td> |
182 | 182 | <?php } |
183 | 183 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * important! Override this class |
188 | 188 | * outputs the input html part |
189 | 189 | */ |
190 | - function render_input( $override_input ) { |
|
190 | + function render_input($override_input) { |
|
191 | 191 | echo ''; |
192 | 192 | } |
193 | 193 |
@@ -23,53 +23,53 @@ discard block |
||
23 | 23 | * @param string $input_type (textarea, list, select, etc.) |
24 | 24 | * @return array Array of field options with `label`, `value`, `type`, `default` keys |
25 | 25 | */ |
26 | - public static function get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type ) { |
|
26 | + public static function get_default_field_options($field_type, $template_id, $field_id, $context, $input_type) { |
|
27 | 27 | |
28 | 28 | $field_options = array(); |
29 | 29 | |
30 | - if( 'field' === $field_type ) { |
|
30 | + if ('field' === $field_type) { |
|
31 | 31 | |
32 | 32 | // Default options - fields |
33 | 33 | $field_options = array( |
34 | 34 | 'show_label' => array( |
35 | 35 | 'type' => 'checkbox', |
36 | - 'label' => __( 'Show Label', 'gravityview' ), |
|
36 | + 'label' => __('Show Label', 'gravityview'), |
|
37 | 37 | 'value' => true, |
38 | 38 | ), |
39 | 39 | 'custom_label' => array( |
40 | 40 | 'type' => 'text', |
41 | - 'label' => __( 'Custom Label:', 'gravityview' ), |
|
41 | + 'label' => __('Custom Label:', 'gravityview'), |
|
42 | 42 | 'value' => '', |
43 | 43 | 'merge_tags' => true, |
44 | 44 | ), |
45 | 45 | 'custom_class' => array( |
46 | 46 | 'type' => 'text', |
47 | - 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
|
48 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
47 | + 'label' => __('Custom CSS Class:', 'gravityview'), |
|
48 | + 'desc' => __('This class will be added to the field container', 'gravityview'), |
|
49 | 49 | 'value' => '', |
50 | 50 | 'merge_tags' => true, |
51 | 51 | 'tooltip' => 'gv_css_merge_tags', |
52 | 52 | ), |
53 | 53 | 'only_loggedin' => array( |
54 | 54 | 'type' => 'checkbox', |
55 | - 'label' => __( 'Make visible only to logged-in users?', 'gravityview' ), |
|
55 | + 'label' => __('Make visible only to logged-in users?', 'gravityview'), |
|
56 | 56 | 'value' => '' |
57 | 57 | ), |
58 | 58 | 'only_loggedin_cap' => array( |
59 | 59 | 'type' => 'select', |
60 | - 'label' => __( 'Make visible for:', 'gravityview' ), |
|
61 | - 'options' => self::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
60 | + 'label' => __('Make visible for:', 'gravityview'), |
|
61 | + 'options' => self::get_cap_choices($template_id, $field_id, $context, $input_type), |
|
62 | 62 | 'class' => 'widefat', |
63 | 63 | 'value' => 'read', |
64 | 64 | ), |
65 | 65 | ); |
66 | 66 | |
67 | 67 | // Match Table as well as DataTables |
68 | - if( preg_match( '/table/ism', $template_id ) && 'single' !== $context ) { |
|
68 | + if (preg_match('/table/ism', $template_id) && 'single' !== $context) { |
|
69 | 69 | $field_options['width'] = array( |
70 | 70 | 'type' => 'number', |
71 | 71 | 'label' => __('Percent Width', 'gravityview'), |
72 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
72 | + 'desc' => __('Leave blank for column width to be based on the field content.', 'gravityview'), |
|
73 | 73 | 'class' => 'code widefat', |
74 | 74 | 'value' => '', |
75 | 75 | ); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param[in] string $context What context are we in? Example: `single` or `directory` |
86 | 86 | * @param[in] string $input_type (textarea, list, select, etc.) |
87 | 87 | */ |
88 | - $field_options = apply_filters( "gravityview_template_{$field_type}_options", $field_options, $template_id, $field_id, $context, $input_type ); |
|
88 | + $field_options = apply_filters("gravityview_template_{$field_type}_options", $field_options, $template_id, $field_id, $context, $input_type); |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @filter `gravityview_template_{$input_type}_options` Filter the field options by input type (`$input_type` examples: `textarea`, `list`, `select`, etc.) |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param[in] string $context What context are we in? Example: `single` or `directory` |
96 | 96 | * @param[in] string $input_type (textarea, list, select, etc.) |
97 | 97 | */ |
98 | - $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type ); |
|
98 | + $field_options = apply_filters("gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type); |
|
99 | 99 | |
100 | 100 | return $field_options; |
101 | 101 | } |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | * @param string $input_type Optional. (textarea, list, select, etc.) |
112 | 112 | * @return array Associative array, with the key being the capability and the value being the label shown. |
113 | 113 | */ |
114 | - static public function get_cap_choices( $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
114 | + static public function get_cap_choices($template_id = '', $field_id = '', $context = '', $input_type = '') { |
|
115 | 115 | |
116 | 116 | $select_cap_choices = array( |
117 | - 'read' => __( 'Any Logged-In User', 'gravityview' ), |
|
118 | - 'publish_posts' => __( 'Author Or Higher', 'gravityview' ), |
|
119 | - 'gravityforms_view_entries' => __( 'Can View Gravity Forms Entries', 'gravityview' ), |
|
120 | - 'delete_others_posts' => __( 'Editor Or Higher', 'gravityview' ), |
|
121 | - 'gravityforms_edit_entries' => __( 'Can Edit Gravity Forms Entries', 'gravityview' ), |
|
122 | - 'manage_options' => __( 'Administrator', 'gravityview' ), |
|
117 | + 'read' => __('Any Logged-In User', 'gravityview'), |
|
118 | + 'publish_posts' => __('Author Or Higher', 'gravityview'), |
|
119 | + 'gravityforms_view_entries' => __('Can View Gravity Forms Entries', 'gravityview'), |
|
120 | + 'delete_others_posts' => __('Editor Or Higher', 'gravityview'), |
|
121 | + 'gravityforms_edit_entries' => __('Can Edit Gravity Forms Entries', 'gravityview'), |
|
122 | + 'manage_options' => __('Administrator', 'gravityview'), |
|
123 | 123 | ); |
124 | 124 | |
125 | - if( is_multisite() ) { |
|
126 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
125 | + if (is_multisite()) { |
|
126 | + $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
137 | 137 | * @param string $input_type Optional. (textarea, list, select, etc.) |
138 | 138 | */ |
139 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
139 | + $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type); |
|
140 | 140 | |
141 | 141 | return $select_cap_choices; |
142 | 142 | } |
@@ -161,26 +161,26 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return string HTML of dialog box |
163 | 163 | */ |
164 | - public static function render_field_options( $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
|
164 | + public static function render_field_options($field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array()) { |
|
165 | 165 | |
166 | - if( empty( $uniqid ) ) { |
|
166 | + if (empty($uniqid)) { |
|
167 | 167 | //generate a unique field id |
168 | 168 | $uniqid = uniqid('', false); |
169 | 169 | } |
170 | 170 | |
171 | 171 | // get field/widget options |
172 | - $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type ); |
|
172 | + $options = self::get_default_field_options($field_type, $template_id, $field_id, $context, $input_type); |
|
173 | 173 | |
174 | 174 | // two different post arrays, depending of the field type |
175 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
175 | + $name_prefix = $field_type.'s'.'['.$area.']['.$uniqid.']'; |
|
176 | 176 | |
177 | 177 | // build output |
178 | 178 | $output = ''; |
179 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
180 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
179 | + $output .= '<input type="hidden" class="field-key" name="'.$name_prefix.'[id]" value="'.esc_attr($field_id).'">'; |
|
180 | + $output .= '<input type="hidden" class="field-label" name="'.$name_prefix.'[label]" value="'.esc_attr($field_label).'">'; |
|
181 | 181 | |
182 | 182 | // If there are no options, return what we got. |
183 | - if(empty($options)) { |
|
183 | + if (empty($options)) { |
|
184 | 184 | |
185 | 185 | // This is here for checking if the output is empty in render_label() |
186 | 186 | $output .= '<!-- No Options -->'; |
@@ -188,33 +188,33 @@ discard block |
||
188 | 188 | return $output; |
189 | 189 | } |
190 | 190 | |
191 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
191 | + $output .= '<div class="gv-dialog-options" title="'.esc_attr(sprintf(__('Options: %s', 'gravityview'), strip_tags(html_entity_decode($field_label)))).'">'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @since 1.8 |
195 | 195 | */ |
196 | - if( !empty( $item['subtitle'] ) ) { |
|
197 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
196 | + if (!empty($item['subtitle'])) { |
|
197 | + $output .= '<div class="subtitle">'.$item['subtitle'].'</div>'; |
|
198 | 198 | } |
199 | 199 | |
200 | - foreach( $options as $key => $option ) { |
|
200 | + foreach ($options as $key => $option) { |
|
201 | 201 | |
202 | - $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
|
202 | + $value = isset($current[$key]) ? $current[$key] : NULL; |
|
203 | 203 | |
204 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
204 | + $field_output = self::render_field_option($name_prefix.'['.$key.']', $option, $value); |
|
205 | 205 | |
206 | 206 | // The setting is empty |
207 | - if( empty( $field_output ) ) { |
|
207 | + if (empty($field_output)) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | |
211 | - switch( $option['type'] ) { |
|
211 | + switch ($option['type']) { |
|
212 | 212 | // Hide hidden fields |
213 | 213 | case 'hidden': |
214 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
214 | + $output .= '<div class="gv-setting-container gv-setting-container-'.esc_attr($key).' screen-reader-text">'.$field_output.'</div>'; |
|
215 | 215 | break; |
216 | 216 | default: |
217 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
217 | + $output .= '<div class="gv-setting-container gv-setting-container-'.esc_attr($key).'">'.$field_output.'</div>'; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param mixed $curr_value Current value of option |
236 | 236 | * @return string HTML output of option |
237 | 237 | */ |
238 | - public static function render_field_option( $name = '', $option, $curr_value = NULL ) { |
|
238 | + public static function render_field_option($name = '', $option, $curr_value = NULL) { |
|
239 | 239 | |
240 | 240 | $output = ''; |
241 | 241 | |
@@ -243,19 +243,19 @@ discard block |
||
243 | 243 | * @deprecated setting index 'default' was replaced by 'value' |
244 | 244 | * @see GravityView_FieldType::get_field_defaults |
245 | 245 | */ |
246 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
246 | + if (!empty($option['default']) && empty($option['value'])) { |
|
247 | 247 | $option['value'] = $option['default']; |
248 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
248 | + _deprecated_function('GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '.$name.' details'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // prepare to render option field type |
252 | - if( isset( $option['type'] ) ) { |
|
252 | + if (isset($option['type'])) { |
|
253 | 253 | |
254 | - $type_class = self::load_type_class( $option ); |
|
254 | + $type_class = self::load_type_class($option); |
|
255 | 255 | |
256 | - if( class_exists( $type_class ) ) { |
|
256 | + if (class_exists($type_class)) { |
|
257 | 257 | |
258 | - $render_type = new $type_class( $name, $option, $curr_value ); |
|
258 | + $render_type = new $type_class($name, $option, $curr_value); |
|
259 | 259 | |
260 | 260 | ob_start(); |
261 | 261 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param[in,out] string $output field class name |
270 | 270 | * @param[in] array $option option field data |
271 | 271 | */ |
272 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
272 | + $output = apply_filters("gravityview/option/output/{$option['type']}", $output, $option); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | } // isset option[type] |
@@ -291,35 +291,35 @@ discard block |
||
291 | 291 | * @param string $id [description] |
292 | 292 | * @return [type] [description] |
293 | 293 | */ |
294 | - public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
|
294 | + public static function render_setting_row($key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s') { |
|
295 | 295 | |
296 | - $setting = GravityView_View_Data::get_default_arg( $key, true ); |
|
296 | + $setting = GravityView_View_Data::get_default_arg($key, true); |
|
297 | 297 | |
298 | 298 | // If the key doesn't exist, there's something wrong. |
299 | - if( empty( $setting ) ) { return; } |
|
299 | + if (empty($setting)) { return; } |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * @deprecated setting index 'name' was replaced by 'label' |
303 | 303 | * @see GravityView_FieldType::get_field_defaults |
304 | 304 | */ |
305 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
305 | + if (isset($setting['name']) && empty($setting['label'])) { |
|
306 | 306 | $setting['label'] = $setting['name']; |
307 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
307 | + _deprecated_function('GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '.$key.' details'); |
|
308 | 308 | } |
309 | 309 | |
310 | - $name = esc_attr( sprintf( $name, $key ) ); |
|
311 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
312 | - $setting['tooltip'] = 'gv_' . $key; |
|
310 | + $name = esc_attr(sprintf($name, $key)); |
|
311 | + $setting['id'] = esc_attr(sprintf($id, $key)); |
|
312 | + $setting['tooltip'] = 'gv_'.$key; |
|
313 | 313 | |
314 | 314 | // Use default if current setting isn't set. |
315 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
315 | + $curr_value = isset($current_settings[$key]) ? $current_settings[$key] : $setting['value']; |
|
316 | 316 | |
317 | 317 | // default setting type = text |
318 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
318 | + $setting['type'] = empty($setting['type']) ? 'text' : $setting['type']; |
|
319 | 319 | |
320 | 320 | // merge tags |
321 | - if( !isset( $setting['merge_tags'] ) ) { |
|
322 | - if( $setting['type'] === 'text' ) { |
|
321 | + if (!isset($setting['merge_tags'])) { |
|
322 | + if ($setting['type'] === 'text') { |
|
323 | 323 | $setting['merge_tags'] = true; |
324 | 324 | } else { |
325 | 325 | $setting['merge_tags'] = false; |
@@ -327,26 +327,26 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | // render the setting |
330 | - $type_class = self::load_type_class( $setting ); |
|
331 | - if( class_exists( $type_class ) ) { |
|
332 | - $render_type = new $type_class( $name, $setting, $curr_value ); |
|
330 | + $type_class = self::load_type_class($setting); |
|
331 | + if (class_exists($type_class)) { |
|
332 | + $render_type = new $type_class($name, $setting, $curr_value); |
|
333 | 333 | ob_start(); |
334 | - $render_type->render_setting( $override_input ); |
|
334 | + $render_type->render_setting($override_input); |
|
335 | 335 | $output = ob_get_clean(); |
336 | 336 | } |
337 | 337 | |
338 | 338 | // Check if setting is specific for a template |
339 | - if( !empty( $setting['show_in_template'] ) ) { |
|
340 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
341 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
339 | + if (!empty($setting['show_in_template'])) { |
|
340 | + if (!is_array($setting['show_in_template'])) { |
|
341 | + $setting['show_in_template'] = array($setting['show_in_template']); |
|
342 | 342 | } |
343 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
343 | + $show_if = ' data-show-if="'.implode(' ', $setting['show_in_template']).'"'; |
|
344 | 344 | } else { |
345 | 345 | $show_if = ''; |
346 | 346 | } |
347 | 347 | |
348 | 348 | // output |
349 | - echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>'; |
|
349 | + echo '<tr valign="top" '.$show_if.'>'.$output.'</tr>'; |
|
350 | 350 | |
351 | 351 | } |
352 | 352 | |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * @param array $field |
357 | 357 | * @return string type class name |
358 | 358 | */ |
359 | - public static function load_type_class( $field = NULL ) { |
|
359 | + public static function load_type_class($field = NULL) { |
|
360 | 360 | |
361 | - if( empty( $field['type'] ) ) { |
|
361 | + if (empty($field['type'])) { |
|
362 | 362 | return NULL; |
363 | 363 | } |
364 | 364 | |
@@ -367,20 +367,20 @@ discard block |
||
367 | 367 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
368 | 368 | * @param array $field field data |
369 | 369 | */ |
370 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
370 | + $type_class = apply_filters("gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_'.$field['type'], $field); |
|
371 | 371 | |
372 | - if( !class_exists( $type_class ) ) { |
|
372 | + if (!class_exists($type_class)) { |
|
373 | 373 | |
374 | 374 | /** |
375 | 375 | * @filter `gravityview/setting/class_file/{field_type}` |
376 | 376 | * @param string $field_type_include_path field class file path |
377 | 377 | * @param array $field field data |
378 | 378 | */ |
379 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
379 | + $class_file = apply_filters("gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR."includes/admin/field-types/type_{$field['type']}.php", $field); |
|
380 | 380 | |
381 | - if( $class_file ) { |
|
382 | - if( file_exists( $class_file ) ) { |
|
383 | - require_once( $class_file ); |
|
381 | + if ($class_file) { |
|
382 | + if (file_exists($class_file)) { |
|
383 | + require_once($class_file); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
@@ -400,10 +400,10 @@ discard block |
||
400 | 400 | * @param string $current current value |
401 | 401 | * @return string html tags |
402 | 402 | */ |
403 | - public static function render_checkbox_option( $name = '', $id = '', $current = '' ) { |
|
403 | + public static function render_checkbox_option($name = '', $id = '', $current = '') { |
|
404 | 404 | |
405 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
406 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
405 | + $output = '<input name="'.esc_attr($name).'" type="hidden" value="0">'; |
|
406 | + $output .= '<input name="'.esc_attr($name).'" id="'.esc_attr($id).'" type="checkbox" value="1" '.checked($current, '1', false).' >'; |
|
407 | 407 | |
408 | 408 | return $output; |
409 | 409 | } |
@@ -418,25 +418,25 @@ discard block |
||
418 | 418 | * @param string $add_merge_tags Add merge tags to the input? |
419 | 419 | * @return string [html tags] |
420 | 420 | */ |
421 | - public static function render_text_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) { |
|
421 | + public static function render_text_option($name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array()) { |
|
422 | 422 | |
423 | 423 | // Show the merge tags if the field is a list view |
424 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
424 | + $is_list = (preg_match('/_list-/ism', $name)); |
|
425 | 425 | |
426 | 426 | // Or is a single entry view |
427 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
428 | - $show = ( $is_single || $is_list ); |
|
427 | + $is_single = (preg_match('/single_/ism', $name)); |
|
428 | + $show = ($is_single || $is_list); |
|
429 | 429 | |
430 | 430 | $class = ''; |
431 | 431 | // and $add_merge_tags is not false |
432 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
432 | + if ($show && $add_merge_tags !== false || $add_merge_tags === 'force') { |
|
433 | 433 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
434 | 434 | } |
435 | 435 | |
436 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
437 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
436 | + $class .= !empty($args['class']) ? $args['class'] : 'widefat'; |
|
437 | + $type = !empty($args['type']) ? $args['type'] : 'text'; |
|
438 | 438 | |
439 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
439 | + return '<input name="'.esc_attr($name).'" id="'.esc_attr($id).'" type="'.esc_attr($type).'" value="'.esc_attr($current).'" class="'.esc_attr($class).'">'; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -448,25 +448,25 @@ discard block |
||
448 | 448 | * @param string $add_merge_tags Add merge tags to the input? |
449 | 449 | * @return string [html tags] |
450 | 450 | */ |
451 | - public static function render_textarea_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) { |
|
451 | + public static function render_textarea_option($name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array()) { |
|
452 | 452 | |
453 | 453 | // Show the merge tags if the field is a list view |
454 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
454 | + $is_list = (preg_match('/_list-/ism', $name)); |
|
455 | 455 | |
456 | 456 | // Or is a single entry view |
457 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
458 | - $show = ( $is_single || $is_list ); |
|
457 | + $is_single = (preg_match('/single_/ism', $name)); |
|
458 | + $show = ($is_single || $is_list); |
|
459 | 459 | |
460 | 460 | $class = ''; |
461 | 461 | // and $add_merge_tags is not false |
462 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
462 | + if ($show && $add_merge_tags !== false || $add_merge_tags === 'force') { |
|
463 | 463 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
464 | 464 | } |
465 | 465 | |
466 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
467 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
466 | + $class .= !empty($args['class']) ? 'widefat '.$args['class'] : 'widefat'; |
|
467 | + $type = !empty($args['type']) ? $args['type'] : 'text'; |
|
468 | 468 | |
469 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
469 | + return '<textarea name="'.esc_attr($name).'" id="'.esc_attr($id).'" class="'.esc_attr($class).'">'.esc_textarea($current).'</textarea>'; |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | * @param string $current [current value] |
479 | 479 | * @return string [html tags] |
480 | 480 | */ |
481 | - public static function render_select_option( $name = '', $id = '', $choices, $current = '' ) { |
|
481 | + public static function render_select_option($name = '', $id = '', $choices, $current = '') { |
|
482 | 482 | |
483 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
484 | - foreach( $choices as $value => $label ) { |
|
485 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
483 | + $output = '<select name="'.$name.'" id="'.$id.'">'; |
|
484 | + foreach ($choices as $value => $label) { |
|
485 | + $output .= '<option value="'.esc_attr($value).'" '.selected($value, $current, false).'>'.esc_html($label).'</option>'; |
|
486 | 486 | } |
487 | 487 | $output .= '</select>'; |
488 | 488 |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | function __construct() { |
9 | 9 | |
10 | 10 | // Add Edit link to the entry actions |
11 | - add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 ); |
|
11 | + add_action('gform_entries_first_column_actions', array($this, 'add_edit_link'), 10, 5); |
|
12 | 12 | |
13 | 13 | // Add script to enable edit link |
14 | - add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script') ); |
|
14 | + add_action('admin_head-forms_page_gf_entries', array($this, 'add_edit_script')); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function add_edit_script() { |
27 | 27 | |
28 | 28 | // We're on a single entry page, or at least not the Entries page. |
29 | - if( !empty( $_GET['view'] ) && $_GET['view'] !== 'entries' ) { return; } |
|
29 | + if (!empty($_GET['view']) && $_GET['view'] !== 'entries') { return; } |
|
30 | 30 | ?> |
31 | 31 | <script> |
32 | 32 | jQuery( document ).ready( function( $ ) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param array $lead The current entry data |
51 | 51 | * @param string $query_string URL query string for a link to the current entry. Missing the `?page=` part, which is strange. Example: `gf_entries&view=entry&id=35&lid=5212&filter=&paged=1` |
52 | 52 | */ |
53 | - function add_edit_link( $form_id = NULL, $field_id = NULL, $value = NULL, $lead = array(), $query_string = NULL ) { |
|
53 | + function add_edit_link($form_id = NULL, $field_id = NULL, $value = NULL, $lead = array(), $query_string = NULL) { |
|
54 | 54 | |
55 | 55 | $params = array( |
56 | 56 | 'page' => 'gf_entries', |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | <span class="edit edit_entry"> |
65 | 65 | | |
66 | - <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
66 | + <a title="<?php esc_attr_e('Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url(add_query_arg($params, admin_url('admin.php?page='.$query_string))); ?>"><?php esc_html_e('Edit', 'gravityview'); ?></a> |
|
67 | 67 | </span> |
68 | 68 | <?php |
69 | 69 | } |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"> |
10 | 10 | <?php $this->render_input(); ?> |
11 | - <?php echo $this->get_field_label() . $this->get_tooltip() . $this->get_field_desc(); ?> |
|
11 | + <?php echo $this->get_field_label().$this->get_tooltip().$this->get_field_desc(); ?> |
|
12 | 12 | </label> |
13 | 13 | <?php |
14 | 14 | } |
15 | 15 | |
16 | - function render_setting( $override_input = NULL ) { |
|
16 | + function render_setting($override_input = NULL) { |
|
17 | 17 | |
18 | - if( $this->get_field_left_label() ) { ?> |
|
18 | + if ($this->get_field_left_label()) { ?> |
|
19 | 19 | |
20 | 20 | <td scope="row"> |
21 | 21 | <label for="<?php echo $this->get_field_id(); ?>"> |
22 | - <?php echo $this->get_field_left_label() . $this->get_tooltip(); ?> |
|
22 | + <?php echo $this->get_field_left_label().$this->get_tooltip(); ?> |
|
23 | 23 | </label> |
24 | 24 | </td> |
25 | 25 | <td> |
26 | 26 | <label> |
27 | - <?php $this->render_input( $override_input ); ?> |
|
28 | - <?php echo $this->get_field_label() . $this->get_tooltip() . $this->get_field_desc(); ?> |
|
27 | + <?php $this->render_input($override_input); ?> |
|
28 | + <?php echo $this->get_field_label().$this->get_tooltip().$this->get_field_desc(); ?> |
|
29 | 29 | </label> |
30 | 30 | </td> |
31 | 31 | |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | |
34 | 34 | <td scope="row" colspan="2"> |
35 | 35 | <label for="<?php echo $this->get_field_id(); ?>"> |
36 | - <?php $this->render_input( $override_input ); ?> |
|
37 | - <?php echo $this->get_field_label() . $this->get_tooltip() . $this->get_field_desc(); ?> |
|
36 | + <?php $this->render_input($override_input); ?> |
|
37 | + <?php echo $this->get_field_label().$this->get_tooltip().$this->get_field_desc(); ?> |
|
38 | 38 | </label> |
39 | 39 | </td> |
40 | 40 | |
41 | 41 | <?php } |
42 | 42 | } |
43 | 43 | |
44 | - function render_input( $override_input = NULL ) { |
|
45 | - if( isset( $override_input ) ) { |
|
44 | + function render_input($override_input = NULL) { |
|
45 | + if (isset($override_input)) { |
|
46 | 46 | echo $override_input; |
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | ?> |
51 | - <input name="<?php echo esc_attr( $this->name ); ?>" type="hidden" value="0" /> |
|
52 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="checkbox" value="1" <?php checked( $this->value, '1', true ); ?> /> |
|
51 | + <input name="<?php echo esc_attr($this->name); ?>" type="hidden" value="0" /> |
|
52 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="checkbox" value="1" <?php checked($this->value, '1', true); ?> /> |
|
53 | 53 | <?php |
54 | 54 | } |
55 | 55 |
@@ -8,17 +8,17 @@ |
||
8 | 8 | $this->render_input(); |
9 | 9 | } |
10 | 10 | |
11 | - function render_input( $override_input = null ) { |
|
11 | + function render_input($override_input = null) { |
|
12 | 12 | |
13 | - if( isset( $override_input ) ) { |
|
13 | + if (isset($override_input)) { |
|
14 | 14 | echo $override_input; |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
18 | + $class = !empty($this->field['class']) ? $this->field['class'] : 'widefat'; |
|
19 | 19 | |
20 | 20 | ?> |
21 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
|
21 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr($this->value); ?>" class="<?php echo esc_attr($class); ?>" /> |
|
22 | 22 | <?php |
23 | 23 | } |
24 | 24 |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | * number input type |
4 | 4 | */ |
5 | 5 | |
6 | -if( !class_exists('GravityView_FieldType_text') ) { |
|
7 | - include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' ); |
|
6 | +if (!class_exists('GravityView_FieldType_text')) { |
|
7 | + include_once(GRAVITYVIEW_DIR.'includes/admin/field-types/type_text.php'); |
|
8 | 8 | } |
9 | 9 | class GravityView_FieldType_number extends GravityView_FieldType_text { |
10 | 10 | |
11 | - function render_input( $override_input = null ) { |
|
12 | - if( isset( $override_input ) ) { |
|
11 | + function render_input($override_input = null) { |
|
12 | + if (isset($override_input)) { |
|
13 | 13 | echo $override_input; |
14 | 14 | return; |
15 | 15 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | $show_mt = $this->show_merge_tags(); |
20 | 20 | |
21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
21 | + if ($show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force') { |
|
22 | 22 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
23 | 23 | } |
24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
24 | + $class .= !empty($this->field['class']) ? $this->field['class'] : 'widefat'; |
|
25 | 25 | |
26 | 26 | ?> |
27 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
27 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr($this->value); ?>" class="<?php echo esc_attr($class); ?>"> |
|
28 | 28 | <?php |
29 | 29 | } |
30 | 30 |
@@ -18,15 +18,15 @@ |
||
18 | 18 | |
19 | 19 | } |
20 | 20 | |
21 | - function render_input( $override_input = null ) { |
|
22 | - if( isset( $override_input ) ) { |
|
21 | + function render_input($override_input = null) { |
|
22 | + if (isset($override_input)) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $this->field['options'] as $value => $label ) : ?> |
|
27 | + foreach ($this->field['options'] as $value => $label) : ?> |
|
28 | 28 | <label class="<?php echo $this->get_label_class(); ?>"> |
29 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> /> <?php echo esc_html( $label ); ?> |
|
29 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr($value); ?>" type="radio" value="<?php echo esc_attr($value); ?>" <?php checked($value, $this->value, true); ?> /> <?php echo esc_html($label); ?> |
|
30 | 30 | </label> |
31 | 31 | <?php |
32 | 32 | endforeach; |