@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | $hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data ); |
55 | 55 | |
56 | - return (bool) $hide_coupon_fields; |
|
56 | + return (bool)$hide_coupon_fields; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) { |
70 | 70 | |
71 | 71 | if ( $this->should_hide_coupon_fields( $entry ) ) { |
72 | - $blacklist[] = 'coupon'; |
|
72 | + $blacklist[ ] = 'coupon'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $blacklist; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // No coupons match the codes provided |
108 | 108 | $discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form ); |
109 | 109 | |
110 | - if( ! $discounts ) { |
|
110 | + if ( ! $discounts ) { |
|
111 | 111 | return $value; |
112 | 112 | } |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @see GF_Field_Coupon::get_field_input |
117 | 117 | */ |
118 | 118 | $_POST = ! isset( $_POST ) ? array() : $_POST; |
119 | - $_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts ); |
|
119 | + $_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts ); |
|
120 | 120 | $_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes ); |
121 | 121 | |
122 | 122 | return $value; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return GravityView_Compatibility |
77 | 77 | */ |
78 | 78 | public static function getInstance() { |
79 | - if( self::$instance ) { |
|
79 | + if ( self::$instance ) { |
|
80 | 80 | return self::$instance; |
81 | 81 | } |
82 | 82 | return new self; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
155 | 155 | // show the notice, but not load any post types or process shortcodes. |
156 | 156 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
157 | - if( ! self::is_valid() ) { |
|
157 | + if ( ! self::is_valid() ) { |
|
158 | 158 | |
159 | 159 | // If the plugin's not loaded, might as well hide the shortcode for people. |
160 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
160 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | } |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
185 | 185 | |
186 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
186 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
187 | 187 | return null; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $notices = self::get_notices(); |
191 | 191 | |
192 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
193 | - foreach( (array)$notices as $notice ) { |
|
194 | - $message .= wpautop( $notice['message'] ); |
|
192 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>'; |
|
193 | + foreach ( (array)$notices as $notice ) { |
|
194 | + $message .= wpautop( $notice[ 'message' ] ); |
|
195 | 195 | } |
196 | 196 | $message .= '</div>'; |
197 | 197 | |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | |
212 | 212 | if ( |
213 | 213 | ( function_exists( 'gravityview' ) && ! gravityview()->plugin->is_compatible_php() ) |
214 | - || ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) |
|
214 | + || ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) |
|
215 | 215 | ) { |
216 | 216 | |
217 | - self::$notices['php_version'] = array( |
|
217 | + self::$notices[ 'php_version' ] = array( |
|
218 | 218 | 'class' => 'error', |
219 | - 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
219 | + 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
220 | 220 | 'cap' => 'manage_options', |
221 | 221 | 'dismiss' => 'php_version', |
222 | 222 | ); |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | |
227 | - if( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION , '>=' ) ) { |
|
227 | + if ( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION, '>=' ) ) { |
|
228 | 228 | |
229 | 229 | // Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking. |
230 | - $key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
230 | + $key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
231 | 231 | |
232 | 232 | self::$notices[ $key ] = array( |
233 | 233 | 'class' => 'error', |
234 | - 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
234 | + 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
235 | 235 | 'cap' => 'manage_options', |
236 | 236 | 'dismiss' => $key, |
237 | 237 | ); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | || ( false === version_compare( $wp_version, GV_MIN_WP_VERSION, '>=' ) ) |
256 | 256 | ) { |
257 | 257 | |
258 | - self::$notices['wp_version'] = array( |
|
258 | + self::$notices[ 'wp_version' ] = array( |
|
259 | 259 | 'class' => 'error', |
260 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
260 | + 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ), |
|
261 | 261 | 'cap' => 'update_core', |
262 | 262 | 'dismiss' => 'wp_version', |
263 | 263 | ); |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | public static function check_gravityforms() { |
281 | 281 | |
282 | 282 | // Bypass other checks: if the class exists |
283 | - if( class_exists( 'GFCommon' ) ) { |
|
283 | + if ( class_exists( 'GFCommon' ) ) { |
|
284 | 284 | |
285 | 285 | // Does the version meet future requirements? |
286 | - if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
286 | + if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
287 | 287 | return true; |
288 | 288 | } |
289 | 289 | |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | $class = $meets_minimum ? 'notice-warning' : 'error'; |
298 | 298 | |
299 | 299 | // Show the notice even if the future version requirements aren't met |
300 | - self::$notices['gf_version'] = array( |
|
300 | + self::$notices[ 'gf_version' ] = array( |
|
301 | 301 | 'class' => $class, |
302 | - 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="https://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
302 | + 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="https://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
303 | 303 | 'cap' => 'update_plugins', |
304 | 304 | 'dismiss' => 'gf_version_' . GV_FUTURE_MIN_GF_VERSION, |
305 | 305 | ); |
@@ -315,42 +315,42 @@ discard block |
||
315 | 315 | * OR |
316 | 316 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
317 | 317 | */ |
318 | - if( true === $gf_status || is_network_admin() ) { |
|
318 | + if ( true === $gf_status || is_network_admin() ) { |
|
319 | 319 | return true; |
320 | 320 | } |
321 | 321 | |
322 | 322 | // If GFCommon doesn't exist, assume GF not active |
323 | 323 | $return = false; |
324 | 324 | |
325 | - switch( $gf_status ) { |
|
325 | + switch ( $gf_status ) { |
|
326 | 326 | case 'inactive': |
327 | 327 | |
328 | 328 | // Required for multisite |
329 | - if( ! function_exists('wp_create_nonce') ) { |
|
329 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
330 | 330 | require_once ABSPATH . WPINC . '/pluggable.php'; |
331 | 331 | } |
332 | 332 | |
333 | 333 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
334 | - if( is_multisite() ) { |
|
334 | + if ( is_multisite() ) { |
|
335 | 335 | wp_cookie_constants(); |
336 | 336 | } |
337 | 337 | |
338 | 338 | $return = false; |
339 | 339 | |
340 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
340 | + $button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">'; |
|
341 | 341 | |
342 | - self::$notices['gf_inactive'] = array( |
|
342 | + self::$notices[ 'gf_inactive' ] = array( |
|
343 | 343 | 'class' => 'error', |
344 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
344 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ), |
|
345 | 345 | 'cap' => 'activate_plugins', |
346 | 346 | 'dismiss' => 'gf_inactive', |
347 | 347 | ); |
348 | 348 | |
349 | 349 | break; |
350 | 350 | default: |
351 | - self::$notices['gf_installed'] = array( |
|
351 | + self::$notices[ 'gf_installed' ] = array( |
|
352 | 352 | 'class' => 'error', |
353 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
353 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
354 | 354 | 'cap' => 'install_plugins', |
355 | 355 | 'dismiss' => 'gf_installed', |
356 | 356 | ); |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | */ |
368 | 368 | private static function check_gf_directory() { |
369 | 369 | |
370 | - if( class_exists( 'GFDirectory' ) ) { |
|
371 | - self::$notices['gf_directory'] = array( |
|
370 | + if ( class_exists( 'GFDirectory' ) ) { |
|
371 | + self::$notices[ 'gf_directory' ] = array( |
|
372 | 372 | 'class' => 'error is-dismissible', |
373 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
373 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
374 | 374 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
375 | 375 | 'dismiss' => 'gf_directory', |
376 | 376 | 'cap' => 'activate_plugins', |
@@ -389,21 +389,21 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public static function get_plugin_status( $location = '' ) { |
391 | 391 | |
392 | - if( ! function_exists('is_plugin_active') ) { |
|
392 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
393 | 393 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
394 | 394 | } |
395 | 395 | |
396 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
396 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
397 | 397 | return true; |
398 | 398 | } |
399 | 399 | |
400 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
400 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
401 | 401 | return true; |
402 | 402 | } |
403 | 403 | |
404 | - if( |
|
405 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
406 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
404 | + if ( |
|
405 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
406 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
407 | 407 | ) { |
408 | 408 | return false; |
409 | 409 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | ?> |
14 | 14 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
15 | 15 | |
16 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
16 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
17 | 17 | |
18 | 18 | echo $this->get_tooltip() . $this->get_field_desc(); |
19 | 19 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | |
27 | 27 | function render_input( $override_input = null ) { |
28 | 28 | |
29 | - if( isset( $override_input ) ) { |
|
29 | + if ( isset( $override_input ) ) { |
|
30 | 30 | echo $override_input; |
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | 34 | ?> |
35 | 35 | <select name="<?php echo esc_attr( $this->name ); ?>[]" id="<?php echo $this->get_field_id(); ?>" multiple="multiple"> |
36 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
36 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
37 | 37 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( in_array( $value, (array)$this->value ), true, true ); ?>><?php echo esc_html( $label ); ?></option> |
38 | 38 | <?php endforeach; ?> |
39 | 39 | </select> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $widget_ops = array( |
13 | 13 | 'classname' => 'widget_gravityview_search', |
14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | private function load_required_files() { |
37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
38 | 38 | gravityview_register_gravityview_widgets(); |
39 | 39 | } |
40 | 40 | } |
@@ -53,30 +53,30 @@ discard block |
||
53 | 53 | public function widget( $args, $instance ) { |
54 | 54 | |
55 | 55 | // Don't show unless a View ID has been set. |
56 | - if( empty( $instance['view_id'] ) ) { |
|
56 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
57 | 57 | |
58 | - do_action('gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance ); |
|
58 | + do_action( 'gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class( $this ) ), $instance ); |
|
59 | 59 | |
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | /** This filter is documented in wp-includes/default-widgets.php */ |
64 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
64 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
65 | 65 | |
66 | - echo $args['before_widget']; |
|
66 | + echo $args[ 'before_widget' ]; |
|
67 | 67 | |
68 | 68 | if ( $title ) { |
69 | - echo $args['before_title'] . $title . $args['after_title']; |
|
69 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // @todo Add to the widget configuration form |
73 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
73 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
74 | 74 | |
75 | - $instance['context'] = 'wp_widget'; |
|
75 | + $instance[ 'context' ] = 'wp_widget'; |
|
76 | 76 | |
77 | 77 | // form |
78 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
79 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
78 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
79 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
80 | 80 | |
81 | 81 | // We don't want to overwrite existing context, etc. |
82 | 82 | $previous_view = GravityView_View::getInstance(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | new GravityView_View( $previous_view ); |
94 | 94 | |
95 | - echo $args['after_widget']; |
|
95 | + echo $args[ 'after_widget' ]; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | |
103 | 103 | $instance = $old_instance; |
104 | 104 | |
105 | - if( $this->is_preview() ) { |
|
105 | + if ( $this->is_preview() ) { |
|
106 | 106 | //Oh! Sorry but still not fully compatible with customizer |
107 | 107 | return $instance; |
108 | 108 | } |
109 | 109 | |
110 | - $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); |
|
110 | + $new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() ); |
|
111 | 111 | |
112 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
113 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
114 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
115 | - $instance['post_id'] = $new_instance['post_id']; |
|
116 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
117 | - $instance['search_mode'] = $new_instance['search_mode']; |
|
112 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
113 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
114 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
115 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
116 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
117 | + $instance[ 'search_mode' ] = $new_instance[ 'search_mode' ]; |
|
118 | 118 | |
119 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance['post_id'], $instance['view_id'] ); |
|
119 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
120 | 120 | |
121 | 121 | //check if post_id is a valid post with embedded View |
122 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
122 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
123 | 123 | |
124 | 124 | // Share that the widget isn't brand new |
125 | - $instance['updated'] = 1; |
|
125 | + $instance[ 'updated' ] = 1; |
|
126 | 126 | |
127 | 127 | return $instance; |
128 | 128 | } |
@@ -133,28 +133,28 @@ discard block |
||
133 | 133 | public function form( $instance ) { |
134 | 134 | |
135 | 135 | // @todo Make compatible with Customizer |
136 | - if( $this->is_preview() ) { |
|
136 | + if ( $this->is_preview() ) { |
|
137 | 137 | |
138 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
138 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
139 | 139 | |
140 | 140 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
141 | 141 | |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - $instance = wp_parse_args( (array) $instance, self::get_defaults() ); |
|
145 | + $instance = wp_parse_args( (array)$instance, self::get_defaults() ); |
|
146 | 146 | |
147 | - $title = $instance['title']; |
|
148 | - $view_id = $instance['view_id']; |
|
149 | - $post_id = $instance['post_id']; |
|
150 | - $search_fields = $instance['search_fields']; |
|
151 | - $search_clear = $instance['search_clear']; |
|
152 | - $search_mode = $instance['search_mode']; |
|
147 | + $title = $instance[ 'title' ]; |
|
148 | + $view_id = $instance[ 'view_id' ]; |
|
149 | + $post_id = $instance[ 'post_id' ]; |
|
150 | + $search_fields = $instance[ 'search_fields' ]; |
|
151 | + $search_clear = $instance[ 'search_clear' ]; |
|
152 | + $search_mode = $instance[ 'search_mode' ]; |
|
153 | 153 | |
154 | 154 | $views = GVCommon::get_all_views(); |
155 | 155 | |
156 | 156 | // If there are no views set up yet, we get outta here. |
157 | - if( empty( $views ) ) { ?> |
|
157 | + if ( empty( $views ) ) { ?> |
|
158 | 158 | <div id="select_gravityview_view"> |
159 | 159 | <div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div> |
160 | 160 | </div> |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | } |
163 | 163 | ?> |
164 | 164 | |
165 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
165 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
166 | 166 | |
167 | 167 | <?php |
168 | 168 | /** |
169 | 169 | * Display errors generated for invalid embed IDs |
170 | 170 | * @see GravityView_View_Data::is_valid_embed_id |
171 | 171 | */ |
172 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
172 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
173 | 173 | ?> |
174 | 174 | <div class="error inline hide-on-view-change"> |
175 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
175 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
176 | 176 | </div> |
177 | 177 | <?php |
178 | 178 | unset ( $error ); |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | |
182 | 182 | <p> |
183 | 183 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
184 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
184 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
185 | 185 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
186 | 186 | <?php |
187 | - foreach( $views as $view_option ) { |
|
188 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
189 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
187 | + foreach ( $views as $view_option ) { |
|
188 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
189 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | </select> |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | * Display errors generated for invalid embed IDs |
199 | 199 | * @see GravityView_View_Data::is_valid_embed_id |
200 | 200 | */ |
201 | - if( !empty( $instance['error_post_id'] ) ) { |
|
201 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
202 | 202 | ?> |
203 | 203 | <div class="error inline"> |
204 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
204 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
205 | 205 | </div> |
206 | 206 | <?php |
207 | 207 | unset ( $error ); |
@@ -209,40 +209,40 @@ discard block |
||
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <p> |
212 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
213 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
212 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
213 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
214 | 214 | <span class="howto"><?php |
215 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
216 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
215 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
216 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
217 | 217 | ?></span> |
218 | 218 | </p> |
219 | 219 | |
220 | 220 | <p> |
221 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
222 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
223 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
221 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
222 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
223 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
224 | 224 | </p> |
225 | 225 | |
226 | 226 | <p> |
227 | 227 | <label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label> |
228 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_any"> |
|
229 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
228 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any"> |
|
229 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
230 | 230 | <?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?> |
231 | 231 | </label> |
232 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_all"> |
|
233 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
232 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all"> |
|
233 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
234 | 234 | <?php esc_html_e( 'Match All Fields', 'gravityview' ); ?> |
235 | 235 | </label> |
236 | - <span class="howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
236 | + <span class="howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
237 | 237 | </p> |
238 | 238 | |
239 | 239 | <hr /> |
240 | 240 | |
241 | 241 | <?php // @todo: move style to CSS ?> |
242 | 242 | <div style="margin-bottom: 1em;"> |
243 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
244 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
245 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
243 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
244 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
245 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
246 | 246 | </div> |
247 | 247 | |
248 | 248 | </div> |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
54 | 54 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
55 | 55 | |
56 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
56 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
57 | 57 | |
58 | 58 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
59 | 59 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function no_views_text() { |
70 | 70 | |
71 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
71 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
72 | 72 | return __( 'No Views found in Trash', 'gravityview' ); |
73 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
73 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
74 | 74 | return __( 'No Views found.', 'gravityview' ); |
75 | 75 | } |
76 | 76 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
115 | 115 | } |
116 | 116 | |
117 | - if( $error ) { |
|
117 | + if ( $error ) { |
|
118 | 118 | ?> |
119 | 119 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
120 | 120 | <?php echo gravityview_get_floaty(); ?> |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | public function backend_actions() { |
134 | 134 | |
135 | 135 | /** @define "GRAVITYVIEW_DIR" "../" */ |
136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
140 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
143 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
144 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
140 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
143 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
144 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
148 | 148 | * |
149 | 149 | * Nice place to insert extensions' backend stuff |
150 | 150 | */ |
151 | - do_action('gravityview_include_backend_actions'); |
|
151 | + do_action( 'gravityview_include_backend_actions' ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | |
165 | 165 | $actions = array(); |
166 | 166 | |
167 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
168 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
167 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
168 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
169 | 169 | } |
170 | 170 | |
171 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
172 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
171 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
172 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return array_merge( $actions, $links ); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | // By default, there will only be one item being modified. |
198 | 198 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
199 | 199 | // of modified items that will override this array. |
200 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
200 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
201 | 201 | |
202 | 202 | // If we're starting fresh, a new form was created. |
203 | 203 | // We should let the user know this is the case. |
@@ -205,60 +205,60 @@ discard block |
||
205 | 205 | |
206 | 206 | $new_form_text = ''; |
207 | 207 | |
208 | - if( !empty( $start_fresh ) ) { |
|
208 | + if ( ! empty( $start_fresh ) ) { |
|
209 | 209 | |
210 | 210 | // Get the form that was created |
211 | 211 | $connected_form = gravityview_get_form_id( $post_id ); |
212 | 212 | |
213 | - if( !empty( $connected_form ) ) { |
|
213 | + if ( ! empty( $connected_form ) ) { |
|
214 | 214 | $form = gravityview_get_form( $connected_form ); |
215 | - $form_name = esc_attr( $form['title'] ); |
|
215 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
216 | 216 | $image = self::get_floaty(); |
217 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
218 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
217 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
218 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
219 | 219 | |
220 | 220 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
221 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
221 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
222 | 222 | $new_form_text = wpautop( $new_form_text ); |
223 | 223 | |
224 | 224 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - $messages['gravityview'] = array( |
|
228 | + $messages[ 'gravityview' ] = array( |
|
229 | 229 | 0 => '', // Unused. Messages start at index 1. |
230 | 230 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
231 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
231 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
232 | 232 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
233 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
233 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
234 | 234 | 3 => __( 'View deleted.', 'gravityview' ), |
235 | 235 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
236 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
236 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
237 | 237 | /* translators: %s: date and time of the revision */ |
238 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
238 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
239 | 239 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
240 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
240 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
241 | 241 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
242 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
242 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
243 | 243 | 8 => __( 'View submitted.', 'gravityview' ), |
244 | 244 | 9 => sprintf( |
245 | 245 | /* translators: Date and time the View is scheduled to be published */ |
246 | 246 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
247 | 247 | // translators: Publish box date format, see http://php.net/date |
248 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
248 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
249 | 249 | ) . $new_form_text, |
250 | 250 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
251 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
251 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
252 | 252 | |
253 | 253 | /** |
254 | 254 | * These apply to `bulk_post_updated_messages` |
255 | 255 | * @file wp-admin/edit.php |
256 | 256 | */ |
257 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
258 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
259 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
260 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
261 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
257 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
258 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
259 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
260 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
261 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
262 | 262 | ); |
263 | 263 | |
264 | 264 | return $messages; |
@@ -318,29 +318,29 @@ discard block |
||
318 | 318 | static function is_admin_page( $hook = '', $page = NULL ) { |
319 | 319 | global $current_screen, $plugin_page, $pagenow, $post; |
320 | 320 | |
321 | - if( ! is_admin() ) { return false; } |
|
321 | + if ( ! is_admin() ) { return false; } |
|
322 | 322 | |
323 | 323 | $is_page = false; |
324 | 324 | |
325 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
325 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
326 | 326 | |
327 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
327 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
328 | 328 | |
329 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
329 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
330 | 330 | |
331 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
332 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
333 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
331 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
332 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
333 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
334 | 334 | } else { |
335 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
335 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
336 | 336 | } |
337 | 337 | |
338 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
338 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
339 | 339 | |
340 | 340 | // $_GET `post_type` variable |
341 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
341 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
342 | 342 | $is_page = 'single'; |
343 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
343 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
344 | 344 | $is_page = 'settings'; |
345 | 345 | } else { |
346 | 346 | $is_page = 'views'; |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
356 | 356 | |
357 | 357 | // If the current page is the same as the compared page |
358 | - if( !empty( $page ) ) { |
|
358 | + if ( ! empty( $page ) ) { |
|
359 | 359 | return $is_page === $page; |
360 | 360 | } |
361 | 361 | |
@@ -376,6 +376,6 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
378 | 378 | */ |
379 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
379 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
380 | 380 | return GravityView_Admin::is_admin_page( $hook, $page ); |
381 | 381 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | * @return string The version of PHP. |
212 | 212 | */ |
213 | 213 | private function get_php_version() { |
214 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
215 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
214 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
215 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | * @return string The version of WordPress. |
224 | 224 | */ |
225 | 225 | private function get_wordpress_version() { |
226 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
227 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
226 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
227 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @return string The version of Gravity Forms. |
237 | 237 | */ |
238 | 238 | private function get_gravityforms_version() { |
239 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) |
|
239 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) |
|
240 | 240 | throw new \ErrorException( 'Gravity Forms is inactive or not installed.' ); |
241 | 241 | |
242 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
243 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
242 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
243 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | private function __clone() { } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | public function append( $value ) { |
27 | - $this->storage []= $value; |
|
27 | + $this->storage [ ] = $value; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | $form = false; |
128 | 128 | |
129 | - if( $entry ) { |
|
130 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
129 | + if ( $entry ) { |
|
130 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $form; |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | |
194 | 194 | $has_transaction_data = rgar( $entry, $meta, false ); |
195 | 195 | |
196 | - if( ! empty( $has_transaction_data ) ) { |
|
196 | + if ( ! empty( $has_transaction_data ) ) { |
|
197 | 197 | break; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
201 | - return (bool) $has_transaction_data; |
|
201 | + return (bool)$has_transaction_data; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
238 | 238 | |
239 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
239 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
240 | 240 | |
241 | 241 | return $result; |
242 | 242 | } |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
255 | 255 | */ |
256 | - public static function get_forms( $active = true, $trash = false ) { |
|
256 | + public static function get_forms( $active = true, $trash = false ) { |
|
257 | 257 | $forms = array(); |
258 | 258 | if ( class_exists( 'GFAPI' ) ) { |
259 | - if( 'any' === $active ) { |
|
259 | + if ( 'any' === $active ) { |
|
260 | 260 | $active_forms = GFAPI::get_forms( true, $trash ); |
261 | 261 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
262 | 262 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $has_post_fields = false; |
288 | 288 | |
289 | 289 | if ( $form ) { |
290 | - foreach ( $form['fields'] as $field ) { |
|
291 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
292 | - $fields["{$field['id']}"] = array( |
|
290 | + foreach ( $form[ 'fields' ] as $field ) { |
|
291 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
292 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
293 | 293 | 'label' => rgar( $field, 'label' ), |
294 | 294 | 'parent' => null, |
295 | 295 | 'type' => rgar( $field, 'type' ), |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | ); |
299 | 299 | } |
300 | 300 | |
301 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
302 | - foreach ( $field['inputs'] as $input ) { |
|
301 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
302 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
303 | 303 | |
304 | - if( ! empty( $input['isHidden'] ) ) { |
|
304 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | * @hack |
310 | 310 | * In case of email/email confirmation, the input for email has the same id as the parent field |
311 | 311 | */ |
312 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
312 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
313 | 313 | continue; |
314 | 314 | } |
315 | - $fields["{$input['id']}"] = array( |
|
315 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
316 | 316 | 'label' => rgar( $input, 'label' ), |
317 | 317 | 'customLabel' => rgar( $input, 'customLabel' ), |
318 | 318 | 'parent' => $field, |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
327 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
328 | 328 | $has_product_fields = true; |
329 | 329 | } |
330 | 330 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @since 1.7 |
339 | 339 | */ |
340 | 340 | if ( $has_post_fields ) { |
341 | - $fields['post_id'] = array( |
|
341 | + $fields[ 'post_id' ] = array( |
|
342 | 342 | 'label' => __( 'Post ID', 'gravityview' ), |
343 | 343 | 'type' => 'post_id', |
344 | 344 | ); |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | foreach ( $payment_fields as $payment_field ) { |
352 | 352 | |
353 | 353 | // Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key |
354 | - if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
354 | + if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - $fields["{$payment_field->name}"] = array( |
|
358 | + $fields[ "{$payment_field->name}" ] = array( |
|
359 | 359 | 'label' => $payment_field->label, |
360 | 360 | 'desc' => $payment_field->description, |
361 | 361 | 'type' => $payment_field->name, |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | |
388 | 388 | $fields = array(); |
389 | 389 | |
390 | - foreach ( $extra_fields as $key => $field ){ |
|
391 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
392 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
390 | + foreach ( $extra_fields as $key => $field ) { |
|
391 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
392 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -429,32 +429,32 @@ discard block |
||
429 | 429 | 'search_criteria' => null, |
430 | 430 | 'sorting' => null, |
431 | 431 | 'paging' => null, |
432 | - 'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true), |
|
432 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
433 | 433 | ); |
434 | 434 | |
435 | 435 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
436 | 436 | |
437 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
438 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
437 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
438 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
439 | 439 | |
440 | 440 | if ( ! is_array( $filter ) ) { |
441 | 441 | continue; |
442 | 442 | } |
443 | 443 | |
444 | 444 | // By default, we want searches to be wildcard for each field. |
445 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
445 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
449 | 449 | * @param string $operator Existing search operator |
450 | 450 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
451 | 451 | */ |
452 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
452 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | // don't send just the [mode] without any field filter. |
456 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
457 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
456 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
457 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
@@ -465,36 +465,36 @@ discard block |
||
465 | 465 | * Prepare date formats to be in Gravity Forms DB format; |
466 | 466 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
467 | 467 | */ |
468 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
468 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
469 | 469 | |
470 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
470 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
471 | 471 | |
472 | 472 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
473 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
473 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
474 | 474 | |
475 | 475 | if ( $date ) { |
476 | 476 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
477 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
477 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
478 | 478 | } else { |
479 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
479 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
480 | 480 | |
481 | 481 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
482 | - unset( $criteria['search_criteria'][ $key ] ); |
|
482 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | 487 | |
488 | 488 | // Calculate the context view id and send it to the advanced filter |
489 | - if( GravityView_frontend::getInstance()->getSingleEntry() ) { |
|
490 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
489 | + if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
|
490 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
491 | 491 | } elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
492 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
492 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
493 | 493 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
494 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
495 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
494 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
495 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
496 | 496 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
497 | - $criteria['context_view_id'] = null; |
|
497 | + $criteria[ 'context_view_id' ] = null; |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | /** |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param array $form_ids Forms to search |
504 | 504 | * @param int $view_id ID of the view being used to search |
505 | 505 | */ |
506 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
506 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
507 | 507 | |
508 | 508 | return (array)$criteria; |
509 | 509 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | /** Reduce # of database calls */ |
534 | 534 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
535 | 535 | |
536 | - if ( ! empty( $criteria['cache'] ) ) { |
|
536 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
537 | 537 | |
538 | 538 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
539 | 539 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | // Still update the total count when using cached results |
543 | 543 | if ( ! is_null( $total ) ) { |
544 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
544 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | $return = $entries; |
@@ -561,9 +561,9 @@ discard block |
||
561 | 561 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
562 | 562 | |
563 | 563 | // No entries returned from gravityview_before_get_entries |
564 | - if( is_null( $entries ) ) { |
|
564 | + if ( is_null( $entries ) ) { |
|
565 | 565 | |
566 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
566 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
567 | 567 | |
568 | 568 | if ( is_wp_error( $entries ) ) { |
569 | 569 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
575 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
575 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
576 | 576 | |
577 | 577 | // Cache results |
578 | 578 | $Cache->set( $entries, 'entries' ); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | */ |
678 | 678 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
679 | 679 | |
680 | - if( $check_entry_display ) { |
|
680 | + if ( $check_entry_display ) { |
|
681 | 681 | // Is the entry allowed |
682 | 682 | $entry = self::check_entry_display( $entry ); |
683 | 683 | } |
@@ -710,12 +710,12 @@ discard block |
||
710 | 710 | |
711 | 711 | $value = false; |
712 | 712 | |
713 | - if( 'context' === $val1 ) { |
|
713 | + if ( 'context' === $val1 ) { |
|
714 | 714 | |
715 | 715 | $matching_contexts = array( $val2 ); |
716 | 716 | |
717 | 717 | // We allow for non-standard contexts. |
718 | - switch( $val2 ) { |
|
718 | + switch ( $val2 ) { |
|
719 | 719 | // Check for either single or edit |
720 | 720 | case 'singular': |
721 | 721 | $matching_contexts = array( 'single', 'edit' ); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | return false; |
777 | 777 | } |
778 | 778 | |
779 | - if ( empty( $entry['form_id'] ) ) { |
|
779 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
780 | 780 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
781 | 781 | return false; |
782 | 782 | } |
@@ -784,26 +784,26 @@ discard block |
||
784 | 784 | $criteria = self::calculate_get_entries_criteria(); |
785 | 785 | |
786 | 786 | // Make sure the current View is connected to the same form as the Entry |
787 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
788 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
787 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
788 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
789 | 789 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
790 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
791 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
790 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
791 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
792 | 792 | return false; |
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
796 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
796 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
797 | 797 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
798 | 798 | return $entry; |
799 | 799 | } |
800 | 800 | |
801 | - $search_criteria = $criteria['search_criteria']; |
|
801 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
802 | 802 | unset( $criteria ); |
803 | 803 | |
804 | 804 | // check entry status |
805 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
806 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
805 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
806 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
@@ -811,41 +811,41 @@ discard block |
||
811 | 811 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
812 | 812 | |
813 | 813 | // field_filters |
814 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
814 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
815 | 815 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
816 | 816 | return $entry; |
817 | 817 | } |
818 | 818 | |
819 | - $filters = $search_criteria['field_filters']; |
|
819 | + $filters = $search_criteria[ 'field_filters' ]; |
|
820 | 820 | unset( $search_criteria ); |
821 | 821 | |
822 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
823 | - unset( $filters['mode'] ); |
|
822 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
823 | + unset( $filters[ 'mode' ] ); |
|
824 | 824 | |
825 | - $form = self::get_form( $entry['form_id'] ); |
|
825 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
826 | 826 | |
827 | 827 | foreach ( $filters as $filter ) { |
828 | 828 | |
829 | - if ( ! isset( $filter['key'] ) ) { |
|
829 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
830 | 830 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter ); |
831 | 831 | continue; |
832 | 832 | } |
833 | 833 | |
834 | - $k = $filter['key']; |
|
834 | + $k = $filter[ 'key' ]; |
|
835 | 835 | |
836 | 836 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
837 | 837 | $field_value = $entry[ $k ]; |
838 | 838 | $field = null; |
839 | 839 | } else { |
840 | 840 | $field = self::get_field( $form, $k ); |
841 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
841 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
842 | 842 | // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it |
843 | 843 | $field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value; |
844 | 844 | } |
845 | 845 | |
846 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
846 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
847 | 847 | |
848 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
848 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
849 | 849 | |
850 | 850 | // verify if we are already free to go! |
851 | 851 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -903,18 +903,18 @@ discard block |
||
903 | 903 | * Gravity Forms code to adjust date to locally-configured Time Zone |
904 | 904 | * @see GFCommon::format_date() for original code |
905 | 905 | */ |
906 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
906 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
907 | 907 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
908 | 908 | |
909 | - $format = rgar( $atts, 'format' ); |
|
910 | - $is_human = ! empty( $atts['human'] ); |
|
911 | - $is_diff = ! empty( $atts['diff'] ); |
|
912 | - $is_raw = ! empty( $atts['raw'] ); |
|
913 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
914 | - $include_time = ! empty( $atts['time'] ); |
|
909 | + $format = rgar( $atts, 'format' ); |
|
910 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
911 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
912 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
913 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
914 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
915 | 915 | |
916 | 916 | // If we're using time diff, we want to have a different default format |
917 | - if( empty( $format ) ) { |
|
917 | + if ( empty( $format ) ) { |
|
918 | 918 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
919 | 919 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
920 | 920 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | // If raw was specified, don't modify the stored value |
923 | 923 | if ( $is_raw ) { |
924 | 924 | $formatted_date = $date_string; |
925 | - } elseif( $is_timestamp ) { |
|
925 | + } elseif ( $is_timestamp ) { |
|
926 | 926 | $formatted_date = $date_local_timestamp; |
927 | 927 | } elseif ( $is_diff ) { |
928 | 928 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | |
957 | 957 | $label = rgar( $field, 'label' ); |
958 | 958 | |
959 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
959 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
960 | 960 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
961 | 961 | } |
962 | 962 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $form = GFAPI::get_form( $form ); |
985 | 985 | } |
986 | 986 | |
987 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
987 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
988 | 988 | return GFFormsModel::get_field( $form, $field_id ); |
989 | 989 | } else { |
990 | 990 | return null; |
@@ -1031,19 +1031,19 @@ discard block |
||
1031 | 1031 | $shortcodes = array(); |
1032 | 1032 | |
1033 | 1033 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1034 | - if ( empty( $matches ) ){ |
|
1034 | + if ( empty( $matches ) ) { |
|
1035 | 1035 | return false; |
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | foreach ( $matches as $shortcode ) { |
1039 | - if ( $tag === $shortcode[2] ) { |
|
1039 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1040 | 1040 | |
1041 | 1041 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1042 | - $shortcodes[] = $shortcode; |
|
1042 | + $shortcodes[ ] = $shortcode; |
|
1043 | 1043 | |
1044 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1045 | - foreach( $results as $result ) { |
|
1046 | - $shortcodes[] = $result; |
|
1044 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1045 | + foreach ( $results as $result ) { |
|
1046 | + $shortcodes[ ] = $result; |
|
1047 | 1047 | } |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | public static function get_directory_fields( $post_id, $apply_filter = true ) { |
1188 | 1188 | $fields = get_post_meta( $post_id, '_gravityview_directory_fields', true ); |
1189 | 1189 | |
1190 | - if( $apply_filter ) { |
|
1190 | + if ( $apply_filter ) { |
|
1191 | 1191 | /** |
1192 | 1192 | * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
1193 | 1193 | * @since 1.6.5 |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | * @return string html |
1211 | 1211 | */ |
1212 | 1212 | public static function get_sortable_fields( $formid, $current = '' ) { |
1213 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1213 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1214 | 1214 | |
1215 | 1215 | if ( empty( $formid ) ) { |
1216 | 1216 | return $output; |
@@ -1223,11 +1223,11 @@ discard block |
||
1223 | 1223 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1224 | 1224 | |
1225 | 1225 | foreach ( $fields as $id => $field ) { |
1226 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1226 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1227 | 1227 | continue; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1230 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1262,9 +1262,9 @@ discard block |
||
1262 | 1262 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1263 | 1263 | |
1264 | 1264 | // TODO: Convert to using array_filter |
1265 | - foreach( $fields as $id => $field ) { |
|
1265 | + foreach ( $fields as $id => $field ) { |
|
1266 | 1266 | |
1267 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1267 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1268 | 1268 | unset( $fields[ $id ] ); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1305,14 +1305,14 @@ discard block |
||
1305 | 1305 | * @param int|array $field field key or field array |
1306 | 1306 | * @return boolean |
1307 | 1307 | */ |
1308 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1308 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1309 | 1309 | |
1310 | 1310 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1311 | 1311 | $form = self::get_form( $form ); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | // If entry meta, it's a string. Otherwise, numeric |
1315 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1315 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1316 | 1316 | $type = $field; |
1317 | 1317 | } else { |
1318 | 1318 | $type = self::get_field_type( $form, $field ); |
@@ -1326,9 +1326,9 @@ discard block |
||
1326 | 1326 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1327 | 1327 | |
1328 | 1328 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1329 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1330 | - if( true === $gv_field->is_numeric ) { |
|
1331 | - $numeric_types[] = $gv_field->is_numeric; |
|
1329 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1330 | + if ( true === $gv_field->is_numeric ) { |
|
1331 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1332 | 1332 | } |
1333 | 1333 | } |
1334 | 1334 | |
@@ -1478,18 +1478,18 @@ discard block |
||
1478 | 1478 | $final_atts = array_filter( $final_atts ); |
1479 | 1479 | |
1480 | 1480 | // If the href wasn't passed as an attribute, use the value passed to the function |
1481 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1482 | - $final_atts['href'] = $href; |
|
1481 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1482 | + $final_atts[ 'href' ] = $href; |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1485 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1486 | 1486 | |
1487 | 1487 | /** |
1488 | 1488 | * Fix potential security issue with target=_blank |
1489 | 1489 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1490 | 1490 | */ |
1491 | - if( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1492 | - $final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1491 | + if ( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1492 | + $final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | // Sort the attributes alphabetically, to help testing |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1502 | 1502 | } |
1503 | 1503 | |
1504 | - if( '' !== $output ) { |
|
1504 | + if ( '' !== $output ) { |
|
1505 | 1505 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1506 | 1506 | } |
1507 | 1507 | |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1529 | 1529 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1530 | 1530 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1531 | - $merged[] = $value; |
|
1531 | + $merged[ ] = $value; |
|
1532 | 1532 | } else { |
1533 | 1533 | $merged[ $key ] = $value; |
1534 | 1534 | } |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1562 | 1562 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1563 | 1563 | */ |
1564 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1564 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1565 | 1565 | |
1566 | 1566 | return get_users( $get_users_settings ); |
1567 | 1567 | } |
@@ -1581,11 +1581,11 @@ discard block |
||
1581 | 1581 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1582 | 1582 | |
1583 | 1583 | // If $cap is defined, only show notice if user has capability |
1584 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1584 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1585 | 1585 | return ''; |
1586 | 1586 | } |
1587 | 1587 | |
1588 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1588 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1589 | 1589 | } |
1590 | 1590 | |
1591 | 1591 | /** |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
136 | 136 | |
137 | - if( $this->entry_meta_key ) { |
|
137 | + if ( $this->entry_meta_key ) { |
|
138 | 138 | add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
139 | 139 | add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
140 | 140 | } |
141 | 141 | |
142 | - if( $this->_custom_merge_tag ) { |
|
142 | + if ( $this->_custom_merge_tag ) { |
|
143 | 143 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
144 | 144 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
145 | 145 | } |
146 | 146 | |
147 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
147 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
148 | 148 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
149 | 149 | } |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Auto-assign label from Gravity Forms label, if exists |
153 | 153 | * @since 1.20 |
154 | 154 | */ |
155 | - if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
155 | + if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
156 | 156 | $this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() ); |
157 | 157 | } |
158 | 158 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 'type' => $this->name |
176 | 176 | ); |
177 | 177 | |
178 | - $fields["{$this->entry_meta_key}"] = $added_field; |
|
178 | + $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
179 | 179 | |
180 | 180 | return $fields; |
181 | 181 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
197 | 197 | |
198 | - if( $this->name === $field['field'] && '' === $label ) { |
|
198 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
199 | 199 | $label = esc_html( $this->default_search_label ); |
200 | 200 | } |
201 | 201 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
218 | 218 | */ |
219 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
219 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
220 | 220 | |
221 | 221 | // Is there is field merge tag? Strip whitespace off the ned, too. |
222 | 222 | preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
249 | 249 | |
250 | - foreach( $matches as $match ) { |
|
250 | + foreach ( $matches as $match ) { |
|
251 | 251 | |
252 | - $full_tag = $match[0]; |
|
252 | + $full_tag = $match[ 0 ]; |
|
253 | 253 | |
254 | 254 | // Strip the Merge Tags |
255 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
255 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
256 | 256 | |
257 | 257 | // Replace the value from the entry, if exists |
258 | - if( isset( $entry[ $tag ] ) ) { |
|
258 | + if ( isset( $entry[ $tag ] ) ) { |
|
259 | 259 | |
260 | 260 | $value = $entry[ $tag ]; |
261 | 261 | |
262 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
262 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
263 | 263 | $value = $this->get_content( $value ); |
264 | 264 | } |
265 | 265 | |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function _filter_sortable_fields( $not_sortable ) { |
334 | 334 | |
335 | - if( ! $this->is_sortable ) { |
|
336 | - $not_sortable[] = $this->name; |
|
335 | + if ( ! $this->is_sortable ) { |
|
336 | + $not_sortable[ ] = $this->name; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | return $not_sortable; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | function add_entry_meta( $entry_meta ) { |
352 | 352 | |
353 | - if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
353 | + if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
354 | 354 | |
355 | 355 | $added_meta = array( |
356 | 356 | 'label' => $this->label, |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | ); |
360 | 360 | |
361 | 361 | if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
362 | - $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
362 | + $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
363 | 363 | } |
364 | 364 | |
365 | - $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
365 | + $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
366 | 366 | |
367 | 367 | } else { |
368 | - do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta["{$this->entry_meta_key}"] ); |
|
368 | + do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta[ "{$this->entry_meta_key}" ] ); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | return $entry_meta; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | 'date_display' => array( |
395 | 395 | 'type' => 'text', |
396 | 396 | 'label' => __( 'Override Date Format', 'gravityview' ), |
397 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
397 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
398 | 398 | /** |
399 | 399 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
400 | 400 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | $options = $this->field_support_options(); |
421 | 421 | |
422 | - if( isset( $options[ $key ] ) ) { |
|
422 | + if ( isset( $options[ $key ] ) ) { |
|
423 | 423 | $field_options[ $key ] = $options[ $key ]; |
424 | 424 | } |
425 | 425 | |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | $connected_form = rgpost( 'form_id' ); |
484 | 484 | |
485 | 485 | // Otherwise, get the Form ID from the Post page |
486 | - if( empty( $connected_form ) ) { |
|
486 | + if ( empty( $connected_form ) ) { |
|
487 | 487 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
488 | 488 | } |
489 | 489 | |
490 | - if( empty( $connected_form ) ) { |
|
490 | + if ( empty( $connected_form ) ) { |
|
491 | 491 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
492 | 492 | return false; |
493 | 493 | } |