@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
34 | 34 | |
35 | - if( file_exists( $template_css_path ) ) { |
|
35 | + if ( file_exists( $template_css_path ) ) { |
|
36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
37 | 37 | gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) ); |
38 | 38 | } else { |
39 | 39 | // Default: use GravityView CSS file |
40 | 40 | |
41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
42 | - if( '' === $dir_path ) { |
|
42 | + if ( '' === $dir_path ) { |
|
43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
84 | 84 | |
85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
86 | 86 | |
87 | - if( empty( $permalink_args ) ) { |
|
87 | + if ( empty( $permalink_args ) ) { |
|
88 | 88 | return array(); |
89 | 89 | } |
90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
110 | 110 | |
111 | 111 | $output = ''; |
112 | - if( is_array( $current ) ) { |
|
113 | - if( in_array( $value, $current ) ) { |
|
112 | + if ( is_array( $current ) ) { |
|
113 | + if ( in_array( $value, $current ) ) { |
|
114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
118 | 118 | } |
119 | 119 | |
120 | - if( $echo ) { |
|
120 | + if ( $echo ) { |
|
121 | 121 | echo $output; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function gravityview_strip_whitespace( $string ) { |
173 | 173 | $string = normalize_whitespace( $string ); |
174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string Included file contents |
186 | 186 | */ |
187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
188 | - if( ! file_exists( $file_path ) ) { |
|
188 | + if ( ! file_exists( $file_path ) ) { |
|
189 | 189 | gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) ); |
190 | 190 | return ''; |
191 | 191 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $width = $height * 0.7586206897; |
205 | 205 | |
206 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
206 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
207 | 207 | $style = 'margin:10px 10px 10px 0;'; |
208 | 208 | $class = 'alignright'; |
209 | 209 | } else { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $class = 'alignleft'; |
212 | 212 | } |
213 | 213 | |
214 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
214 | + return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | function gravityview_number_format( $number, $decimals = '' ) { |
235 | 235 | global $wp_locale; |
236 | 236 | |
237 | - if( '' === $decimals ) { |
|
237 | + if ( '' === $decimals ) { |
|
238 | 238 | |
239 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
239 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
240 | 240 | |
241 | 241 | /** |
242 | 242 | * Calculate the position of the decimal point in the number |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $parts = parse_url( $value ); |
266 | 266 | |
267 | 267 | // No domain? Strange...show the original text. |
268 | - if( empty( $parts['host'] ) ) { |
|
268 | + if ( empty( $parts[ 'host' ] ) ) { |
|
269 | 269 | return $value; |
270 | 270 | } |
271 | 271 | |
@@ -278,16 +278,16 @@ discard block |
||
278 | 278 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
279 | 279 | * If true: `http://example.com => example.com` |
280 | 280 | */ |
281 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
281 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
282 | 282 | |
283 | - if( isset( $parts['scheme'] ) ) { |
|
284 | - $return .= $parts['scheme']; |
|
283 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
284 | + $return .= $parts[ 'scheme' ]; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | } |
288 | 288 | |
289 | 289 | // The domain, which may contain a subdomain |
290 | - $domain = $parts['host']; |
|
290 | + $domain = $parts[ 'host' ]; |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
296 | 296 | * If true: `www.example.com => example.com` |
297 | 297 | */ |
298 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
298 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
299 | 299 | |
300 | - if( $strip_www ) { |
|
301 | - $domain = str_replace('www.', '', $domain ); |
|
300 | + if ( $strip_www ) { |
|
301 | + $domain = str_replace( 'www.', '', $domain ); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | * If true: `http://demo.example.com => example.com` \n |
309 | 309 | * If false: `http://demo.example.com => demo.example.com` |
310 | 310 | */ |
311 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
311 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
312 | 312 | |
313 | - if( $strip_subdomains ) { |
|
313 | + if ( $strip_subdomains ) { |
|
314 | 314 | |
315 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
315 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
316 | 316 | |
317 | 317 | } |
318 | 318 | |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
327 | 327 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
328 | 328 | */ |
329 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
329 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
330 | 330 | |
331 | - if( empty( $root_only ) ) { |
|
331 | + if ( empty( $root_only ) ) { |
|
332 | 332 | |
333 | - if( isset( $parts['path'] ) ) { |
|
334 | - $return .= $parts['path']; |
|
333 | + if ( isset( $parts[ 'path' ] ) ) { |
|
334 | + $return .= $parts[ 'path' ]; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
342 | 342 | * If true: `http://example.com/?query=example => example.com` |
343 | 343 | */ |
344 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
344 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
345 | 345 | |
346 | - if( empty( $strip_query_string ) ) { |
|
346 | + if ( empty( $strip_query_string ) ) { |
|
347 | 347 | |
348 | - if( isset( $parts['query'] ) ) { |
|
349 | - $return .= '?'.$parts['query']; |
|
348 | + if ( isset( $parts[ 'query' ] ) ) { |
|
349 | + $return .= '?' . $parts[ 'query' ]; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | */ |
364 | 364 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
365 | 365 | |
366 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
367 | - return $matches['domain']; |
|
366 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
367 | + return $matches[ 'domain' ]; |
|
368 | 368 | } else { |
369 | 369 | return $string_maybe_has_subdomain; |
370 | 370 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
435 | 435 | $value = true; |
436 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
436 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
437 | 437 | $value = false; |
438 | 438 | } |
439 | 439 | } |
@@ -462,19 +462,19 @@ discard block |
||
462 | 462 | */ |
463 | 463 | function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) { |
464 | 464 | |
465 | - if( ! is_string( $value ) ) { |
|
465 | + if ( ! is_string( $value ) ) { |
|
466 | 466 | return $value; |
467 | 467 | } |
468 | 468 | |
469 | 469 | $decoded = json_decode( $value ); |
470 | 470 | |
471 | 471 | // There was a JSON error (PHP 5.3+) |
472 | - if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) { |
|
472 | + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { |
|
473 | 473 | return $value; |
474 | 474 | } |
475 | 475 | |
476 | 476 | // It wasn't JSON (PHP < 5.3 fallback) |
477 | - if( is_null( $decoded ) ) { |
|
477 | + if ( is_null( $decoded ) ) { |
|
478 | 478 | return $value; |
479 | 479 | } |
480 | 480 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | |
498 | 498 | // Use the original function, if exists. |
499 | 499 | // Requires WP 4.4+ |
500 | - if( function_exists( 'map_deep') ) { |
|
500 | + if ( function_exists( 'map_deep' ) ) { |
|
501 | 501 | return map_deep( $value, $callback ); |
502 | 502 | } |
503 | 503 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | |
563 | 563 | $exploded = explode( '.', "{$field_id}" ); |
564 | 564 | |
565 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
565 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | */ |
604 | 604 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
605 | 605 | |
606 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
606 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
607 | 607 | |
608 | 608 | $choices = array(); |
609 | 609 | |
610 | 610 | if ( is_array( $terms ) ) { |
611 | 611 | foreach ( $terms as $term_id => $term_name ) { |
612 | - $choices[] = array( |
|
612 | + $choices[ ] = array( |
|
613 | 613 | 'text' => $term_name, |
614 | 614 | 'value' => $term_id |
615 | 615 | ); |
@@ -633,21 +633,21 @@ discard block |
||
633 | 633 | function _gravityview_process_posted_fields() { |
634 | 634 | $fields = array(); |
635 | 635 | |
636 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
637 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
636 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
637 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
638 | 638 | |
639 | 639 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
640 | 640 | $fields_holder = array(); |
641 | - GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder ); |
|
641 | + GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder ); |
|
642 | 642 | |
643 | - if ( isset( $fields_holder['fields'] ) ) { |
|
644 | - $fields = $fields_holder['fields']; |
|
643 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
644 | + $fields = $fields_holder[ 'fields' ]; |
|
645 | 645 | } else { |
646 | 646 | gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) ); |
647 | 647 | } |
648 | 648 | |
649 | 649 | } else { |
650 | - $fields = $_POST['gv_fields']; |
|
650 | + $fields = $_POST[ 'gv_fields' ]; |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 |
@@ -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; |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
139 | 139 | // show the notice, but not load any post types or process shortcodes. |
140 | 140 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
141 | - if( ! self::is_valid() ) { |
|
141 | + if ( ! self::is_valid() ) { |
|
142 | 142 | |
143 | 143 | // If the plugin's not loaded, might as well hide the shortcode for people. |
144 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
144 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | } |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
169 | 169 | |
170 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
170 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
171 | 171 | return null; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $notices = self::get_notices(); |
175 | 175 | |
176 | - $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>'; |
|
177 | - foreach( (array)$notices as $notice ) { |
|
178 | - $message .= wpautop( $notice['message'] ); |
|
176 | + $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>'; |
|
177 | + foreach ( (array)$notices as $notice ) { |
|
178 | + $message .= wpautop( $notice[ 'message' ] ); |
|
179 | 179 | } |
180 | 180 | $message .= '</div>'; |
181 | 181 | |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | |
196 | 196 | if ( ! gravityview()->plugin->is_compatible_php() ) { |
197 | 197 | |
198 | - self::$notices['php_version'] = array( |
|
198 | + self::$notices[ 'php_version' ] = array( |
|
199 | 199 | 'class' => 'error', |
200 | - '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>' ), |
|
200 | + '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>' ), |
|
201 | 201 | 'cap' => 'manage_options', |
202 | 202 | 'dismiss' => 'php_version', |
203 | 203 | ); |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | if ( ! gravityview()->plugin->is_compatible_future_php() ) { |
209 | 209 | |
210 | 210 | // Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking. |
211 | - $key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
211 | + $key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
212 | 212 | |
213 | 213 | self::$notices[ $key ] = array( |
214 | 214 | 'class' => 'error', |
215 | - '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>' ), |
|
215 | + '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>' ), |
|
216 | 216 | 'cap' => 'manage_options', |
217 | 217 | 'dismiss' => $key, |
218 | 218 | ); |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | |
234 | 234 | if ( ! gravityview()->plugin->is_compatible_wordpress() ) { |
235 | 235 | |
236 | - self::$notices['wp_version'] = array( |
|
236 | + self::$notices[ 'wp_version' ] = array( |
|
237 | 237 | 'class' => 'error', |
238 | - '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>' ), |
|
238 | + '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>' ), |
|
239 | 239 | 'cap' => 'update_core', |
240 | 240 | 'dismiss' => 'wp_version', |
241 | 241 | ); |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | public static function check_gravityforms() { |
259 | 259 | |
260 | 260 | // Bypass other checks: if the class exists |
261 | - if( class_exists( 'GFCommon' ) ) { |
|
261 | + if ( class_exists( 'GFCommon' ) ) { |
|
262 | 262 | |
263 | 263 | // Does the version meet future requirements? |
264 | - if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
264 | + if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
265 | 265 | return true; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // Does it meet minimum requirements? |
269 | 269 | $meets_minimum = gravityview()->plugin->is_compatible_gravityforms(); |
270 | 270 | |
271 | - if( $meets_minimum ) { |
|
271 | + if ( $meets_minimum ) { |
|
272 | 272 | /* translators: first placeholder is the future required version of Gravity Forms. The second placeholder is the current version of Gravity Forms. */ |
273 | 273 | $title = __( 'In the future, GravityView will require Gravity Forms Version %s or newer.', 'gravityview' ); |
274 | 274 | $version = GV_FUTURE_MIN_GF_VERSION; |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | $message = '<h3>' . esc_html( sprintf( $title, $version ) ) . '</h3>'; |
284 | 284 | |
285 | 285 | /* translators: the placeholder is the current version of Gravity Forms. */ |
286 | - $message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>' ) . '</p>'; |
|
286 | + $message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>' ) . '</p>'; |
|
287 | 287 | |
288 | 288 | /* translators: In this context, "get" means purchase */ |
289 | 289 | $message .= '<p><a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' . esc_html__( 'Get the Latest Gravity Forms', 'gravityview' ) . '</a></p>'; |
290 | 290 | |
291 | 291 | |
292 | 292 | // Show the notice even if the future version requirements aren't met |
293 | - self::$notices['gf_version'] = array( |
|
293 | + self::$notices[ 'gf_version' ] = array( |
|
294 | 294 | 'class' => $class, |
295 | 295 | 'message' => $message, |
296 | 296 | 'cap' => 'update_plugins', |
@@ -308,42 +308,42 @@ discard block |
||
308 | 308 | * OR |
309 | 309 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
310 | 310 | */ |
311 | - if( true === $gf_status || is_network_admin() ) { |
|
311 | + if ( true === $gf_status || is_network_admin() ) { |
|
312 | 312 | return true; |
313 | 313 | } |
314 | 314 | |
315 | 315 | // If GFCommon doesn't exist, assume GF not active |
316 | 316 | $return = false; |
317 | 317 | |
318 | - switch( $gf_status ) { |
|
318 | + switch ( $gf_status ) { |
|
319 | 319 | case 'inactive': |
320 | 320 | |
321 | 321 | // Required for multisite |
322 | - if( ! function_exists('wp_create_nonce') ) { |
|
322 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
323 | 323 | require_once ABSPATH . WPINC . '/pluggable.php'; |
324 | 324 | } |
325 | 325 | |
326 | 326 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
327 | - if( is_multisite() ) { |
|
327 | + if ( is_multisite() ) { |
|
328 | 328 | wp_cookie_constants(); |
329 | 329 | } |
330 | 330 | |
331 | 331 | $return = false; |
332 | 332 | |
333 | - $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">'; |
|
333 | + $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">'; |
|
334 | 334 | |
335 | - self::$notices['gf_inactive'] = array( |
|
335 | + self::$notices[ 'gf_inactive' ] = array( |
|
336 | 336 | 'class' => 'error', |
337 | - '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>' ), |
|
337 | + '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>' ), |
|
338 | 338 | 'cap' => 'activate_plugins', |
339 | 339 | 'dismiss' => 'gf_inactive', |
340 | 340 | ); |
341 | 341 | |
342 | 342 | break; |
343 | 343 | default: |
344 | - self::$notices['gf_installed'] = array( |
|
344 | + self::$notices[ 'gf_installed' ] = array( |
|
345 | 345 | 'class' => 'error', |
346 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
346 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
347 | 347 | 'cap' => 'install_plugins', |
348 | 348 | 'dismiss' => 'gf_installed', |
349 | 349 | ); |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | */ |
361 | 361 | private static function check_gf_directory() { |
362 | 362 | |
363 | - if( class_exists( 'GFDirectory' ) ) { |
|
364 | - self::$notices['gf_directory'] = array( |
|
363 | + if ( class_exists( 'GFDirectory' ) ) { |
|
364 | + self::$notices[ 'gf_directory' ] = array( |
|
365 | 365 | 'class' => 'error is-dismissible', |
366 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
366 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
367 | 367 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
368 | 368 | 'dismiss' => 'gf_directory', |
369 | 369 | 'cap' => 'activate_plugins', |
@@ -382,21 +382,21 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public static function get_plugin_status( $location = '' ) { |
384 | 384 | |
385 | - if( ! function_exists('is_plugin_active') ) { |
|
385 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
386 | 386 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
387 | 387 | } |
388 | 388 | |
389 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
389 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
390 | 390 | return true; |
391 | 391 | } |
392 | 392 | |
393 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
393 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
394 | 394 | return true; |
395 | 395 | } |
396 | 396 | |
397 | - if( |
|
398 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
399 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
397 | + if ( |
|
398 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
399 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
400 | 400 | ) { |
401 | 401 | return false; |
402 | 402 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | private function add_hooks() { |
38 | 38 | /** @see \GV\Field::get_value_filters */ |
39 | 39 | add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 ); |
40 | - add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 ); |
|
40 | + add_action( 'gravityview/template/after', array( $this, 'print_script' ), 10, 1 ); |
|
41 | 41 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
42 | 42 | } |
43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function add_default_field( $entry_default_fields = array(), $form = array(), $zone = '' ) { |
54 | 54 | |
55 | - if( 'edit' !== $zone ) { |
|
55 | + if ( 'edit' !== $zone ) { |
|
56 | 56 | $entry_default_fields[ $this->name ] = array( |
57 | 57 | 'label' => $this->label, |
58 | 58 | 'desc' => $this->description, |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function get_content( $output, $template ) { |
77 | 77 | $entry = $template->entry; |
78 | 78 | |
79 | - $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
79 | + $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png'; |
|
80 | 80 | |
81 | 81 | $entry_id = ''; |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // if( $show_as_star ) |
88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'. intval( $entry['is_starred'] ) .'" src="'. esc_attr( $star_url ) .'" />'; |
|
88 | + $output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />'; |
|
89 | 89 | |
90 | 90 | self::$has_star_field = true; |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function print_script( $context ) { |
104 | 104 | |
105 | - if( ! self::$has_star_field ) { |
|
105 | + if ( ! self::$has_star_field ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | |
32 | 32 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
33 | 33 | |
34 | - if( 'edit' === $context ) { |
|
34 | + if ( 'edit' === $context ) { |
|
35 | 35 | return $field_options; |
36 | 36 | } |
37 | 37 | |
38 | - $this->add_field_support('date_display', $field_options ); |
|
38 | + $this->add_field_support( 'date_display', $field_options ); |
|
39 | 39 | |
40 | 40 | return $field_options; |
41 | 41 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
84 | 84 | |
85 | 85 | $date_field_output = ''; |
86 | - switch( $field_input_id ) { |
|
86 | + switch ( $field_input_id ) { |
|
87 | 87 | case 1: |
88 | 88 | $date_field_output = \GV\Utils::get( $parsed_date, 'day' ); |
89 | 89 | break; |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | |
25 | 25 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
26 | 26 | |
27 | - unset( $field_options['search_filter'] ); |
|
27 | + unset( $field_options[ 'search_filter' ] ); |
|
28 | 28 | |
29 | - if( 'edit' === $context ) { |
|
29 | + if ( 'edit' === $context ) { |
|
30 | 30 | return $field_options; |
31 | 31 | } |
32 | 32 | |
33 | - $add_options['link_to_file'] = array( |
|
33 | + $add_options[ 'link_to_file' ] = array( |
|
34 | 34 | 'type' => 'checkbox', |
35 | 35 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
36 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
36 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
37 | 37 | 'value' => false, |
38 | 38 | 'merge_tags' => false, |
39 | 39 | ); |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | $base_id = null; |
117 | 117 | |
118 | 118 | $is_single = gravityview_get_context() === 'single'; |
119 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
119 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
120 | 120 | $field_compat = $gravityview_view->getCurrentField(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $output_arr = array(); |
124 | 124 | |
125 | 125 | // Get an array of file paths for the field. |
126 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
126 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
127 | 127 | |
128 | 128 | // The $value JSON was probably truncated; let's check lead_detail_long. |
129 | 129 | if ( ! is_array( $file_paths ) ) { |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | // Process each file path |
140 | - foreach( $file_paths as $file_path ) { |
|
140 | + foreach ( $file_paths as $file_path ) { |
|
141 | 141 | |
142 | 142 | // If the site is HTTPS, use HTTPS |
143 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme( $file_path ); } |
|
143 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
144 | 144 | |
145 | 145 | // This is from Gravity Forms's code |
146 | 146 | $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $file_path_info = pathinfo( $file_path ); |
161 | 161 | |
162 | 162 | // If the field is set to link to the single entry, link to it. |
163 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field, $base_id ) : $file_path; |
|
163 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field, $base_id ) : $file_path; |
|
164 | 164 | |
165 | 165 | $html_format = NULL; |
166 | 166 | |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | |
171 | 171 | $image_atts = array( |
172 | 172 | 'src' => $file_path, |
173 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
174 | - 'alt' => $field_settings['label'], |
|
173 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
174 | + 'alt' => $field_settings[ 'label' ], |
|
175 | 175 | 'width' => ( $is_single ? NULL : 250 ) |
176 | 176 | ); |
177 | 177 | |
@@ -189,20 +189,20 @@ discard block |
||
189 | 189 | $content = $image->html(); |
190 | 190 | |
191 | 191 | // The new default content is the image, if it exists. If not, use the file name as the content. |
192 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
192 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
193 | 193 | |
194 | 194 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
195 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
195 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
196 | 196 | |
197 | 197 | |
198 | - switch( true ) { |
|
198 | + switch ( true ) { |
|
199 | 199 | |
200 | 200 | // Audio file |
201 | 201 | case in_array( $extension, wp_get_audio_extensions() ): |
202 | 202 | |
203 | 203 | $disable_lightbox = true; |
204 | 204 | |
205 | - if( shortcode_exists( 'audio' ) ) { |
|
205 | + if ( shortcode_exists( 'audio' ) ) { |
|
206 | 206 | |
207 | 207 | $disable_wrapped_link = true; |
208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
217 | 217 | 'src' => $file_path, |
218 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
218 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
219 | 219 | ), $context ); |
220 | 220 | |
221 | 221 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | $disable_lightbox = true; |
236 | 236 | |
237 | - if( shortcode_exists( 'video' ) ) { |
|
237 | + if ( shortcode_exists( 'video' ) ) { |
|
238 | 238 | |
239 | 239 | $disable_wrapped_link = true; |
240 | 240 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
249 | 249 | 'src' => $file_path, |
250 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
250 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
251 | 251 | ), $context ); |
252 | 252 | |
253 | 253 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | break; |
271 | 271 | |
272 | 272 | // if not image, do not set the lightbox (@since 1.5.3) |
273 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
273 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
274 | 274 | |
275 | 275 | $disable_lightbox = true; |
276 | 276 | |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | // If using Link to File, override the content. |
282 | 282 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
283 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
283 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
284 | 284 | |
285 | 285 | // Force the content to be the file name |
286 | - $content = $file_path_info["basename"]; |
|
286 | + $content = $file_path_info[ "basename" ]; |
|
287 | 287 | |
288 | 288 | // Restore the wrapped link |
289 | 289 | $disable_wrapped_link = false; |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | // Whether to use lightbox or not |
294 | - if ( $disable_lightbox || ! $lightbox || ! empty( $field_settings['show_as_link'] ) ) { |
|
294 | + if ( $disable_lightbox || ! $lightbox || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
295 | 295 | |
296 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
296 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
297 | 297 | |
298 | 298 | } else { |
299 | 299 | |
300 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
300 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
301 | 301 | |
302 | 302 | $link_atts = array( |
303 | 303 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $field_compat, $context ); |
328 | 328 | |
329 | 329 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
330 | - if ( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
330 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Modify the link text (defaults to the file name) |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $content = gravityview_get_link( $link, $content, $link_atts ); |
345 | 345 | } |
346 | 346 | |
347 | - $output_arr[] = array( |
|
347 | + $output_arr[ ] = array( |
|
348 | 348 | 'file_path' => $file_path, |
349 | 349 | 'content' => $content |
350 | 350 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
50 | 50 | |
51 | 51 | /** Overridden by a template. */ |
52 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
52 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
53 | 53 | |
54 | 54 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
55 | 55 | $return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) ); |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
90 | 90 | */ |
91 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
91 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
92 | 92 | |
93 | 93 | $return = $text; |
94 | 94 | |
95 | 95 | foreach ( $matches as $match ) { |
96 | 96 | |
97 | - $full_tag = $match[0]; |
|
98 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
97 | + $full_tag = $match[ 0 ]; |
|
98 | + $modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false; |
|
99 | 99 | |
100 | 100 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
101 | 101 |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | function add_default_field( $entry_default_fields, $form, $zone ) { |
94 | 94 | |
95 | - if( 'edit' !== $zone ) { |
|
95 | + if ( 'edit' !== $zone ) { |
|
96 | 96 | $entry_default_fields[ $this->name ] = array( |
97 | 97 | 'label' => $this->label, |
98 | 98 | 'desc' => $this->description, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $merge_tags = array( |
119 | 119 | array( |
120 | - 'label' => __('Approval Status', 'gravityview'), |
|
120 | + 'label' => __( 'Approval Status', 'gravityview' ), |
|
121 | 121 | 'tag' => '{approval_status}' |
122 | 122 | ), |
123 | 123 | ); |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | gravityview()->log->error( 'No entry data available. Returning empty string.' ); |
158 | 158 | $replacement = ''; |
159 | 159 | } else { |
160 | - $replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[1] ); |
|
160 | + $replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[ 1 ] ); |
|
161 | 161 | } |
162 | 162 | |
163 | - $return = str_replace( $match[0], $replacement, $return ); |
|
163 | + $return = str_replace( $match[ 0 ], $replacement, $return ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $return; |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | |
169 | 169 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
170 | 170 | |
171 | - $field_options['approved_label'] = array( |
|
171 | + $field_options[ 'approved_label' ] = array( |
|
172 | 172 | 'type' => 'text', |
173 | 173 | 'label' => __( 'Approved Label', 'gravityview' ), |
174 | 174 | 'desc' => __( 'If the entry is approved, display this value', 'gravityview' ), |
175 | - 'placeholder' => GravityView_Entry_Approval_Status::get_label('approved'), |
|
175 | + 'placeholder' => GravityView_Entry_Approval_Status::get_label( 'approved' ), |
|
176 | 176 | ); |
177 | 177 | |
178 | - $field_options['disapproved_label'] = array( |
|
178 | + $field_options[ 'disapproved_label' ] = array( |
|
179 | 179 | 'type' => 'text', |
180 | 180 | 'label' => __( 'Disapproved Label', 'gravityview' ), |
181 | 181 | 'desc' => __( 'If the entry is not approved, display this value', 'gravityview' ), |
182 | - 'placeholder' => GravityView_Entry_Approval_Status::get_label('disapproved'), |
|
182 | + 'placeholder' => GravityView_Entry_Approval_Status::get_label( 'disapproved' ), |
|
183 | 183 | ); |
184 | 184 | |
185 | - $field_options['unapproved_label'] = array( |
|
185 | + $field_options[ 'unapproved_label' ] = array( |
|
186 | 186 | 'type' => 'text', |
187 | 187 | 'label' => __( 'Unapproved Label', 'gravityview' ), |
188 | 188 | 'desc' => __( 'If the entry has not yet been approved or disapproved, display this value', 'gravityview' ), |
189 | - 'placeholder' => GravityView_Entry_Approval_Status::get_label('unapproved'), |
|
189 | + 'placeholder' => GravityView_Entry_Approval_Status::get_label( 'unapproved' ), |
|
190 | 190 | ); |
191 | 191 | |
192 | 192 | return $field_options; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $this->label = esc_attr__( 'Approve Entries', 'gravityview' ); |
26 | 26 | |
27 | - $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
27 | + $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
28 | 28 | |
29 | 29 | $this->add_hooks(); |
30 | 30 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
48 | 48 | |
49 | - unset( $field_options['only_loggedin'] ); |
|
49 | + unset( $field_options[ 'only_loggedin' ] ); |
|
50 | 50 | |
51 | - unset( $field_options['new_window'] ); |
|
51 | + unset( $field_options[ 'new_window' ] ); |
|
52 | 52 | |
53 | - unset( $field_options['show_as_link'] ); |
|
53 | + unset( $field_options[ 'show_as_link' ] ); |
|
54 | 54 | |
55 | 55 | return $field_options; |
56 | 56 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) ); |
72 | 72 | |
73 | - add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
73 | + add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
74 | 74 | |
75 | 75 | add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 ); |
76 | 76 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function maybe_prevent_field_render( $html, $args ) { |
93 | 93 | |
94 | 94 | // If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render. |
95 | - if( $this->name === \GV\Utils::get( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
95 | + if ( $this->name === \GV\Utils::get( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
96 | 96 | return ''; |
97 | 97 | } |
98 | 98 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function modify_search_parameters( $parameters ) { |
123 | 123 | |
124 | 124 | if ( $this->name === \GV\Utils::get( $parameters, 'sorting/key' ) ) { |
125 | - $parameters['sorting']['key'] = 'is_approved'; |
|
125 | + $parameters[ 'sorting' ][ 'key' ] = 'is_approved'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | return $parameters; |
@@ -138,18 +138,18 @@ discard block |
||
138 | 138 | function register_scripts_and_styles() { |
139 | 139 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
140 | 140 | |
141 | - wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
141 | + wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
142 | 142 | |
143 | 143 | $style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css'; |
144 | 144 | |
145 | - if( class_exists( 'GravityView_View' ) ) { |
|
145 | + if ( class_exists( 'GravityView_View' ) ) { |
|
146 | 146 | /** |
147 | 147 | * Override CSS file by placing in your theme's /gravityview/css/ sub-directory. |
148 | 148 | */ |
149 | 149 | $style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false ); |
150 | 150 | } |
151 | 151 | |
152 | - $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
152 | + $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file. |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | $style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url ); |
160 | 160 | |
161 | - if( ! empty( $style_url ) ) { |
|
161 | + if ( ! empty( $style_url ) ) { |
|
162 | 162 | wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' ); |
163 | 163 | } |
164 | 164 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function enqueue_and_localize_script() { |
174 | 174 | |
175 | 175 | // The script is already registered and enqueued |
176 | - if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
176 | + if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | |
184 | 184 | wp_localize_script( 'gravityview-field-approval', 'gvApproval', array( |
185 | 185 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
186 | - 'nonce' => wp_create_nonce('gravityview_entry_approval'), |
|
186 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
187 | 187 | 'status' => GravityView_Entry_Approval_Status::get_all(), |
188 | - )); |
|
188 | + ) ); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) { |
204 | 204 | |
205 | - if ( ! isset( $entry_default_fields["{$this->name}"] ) && 'edit' !== $context ) { |
|
206 | - $entry_default_fields["{$this->name}"] = array( |
|
205 | + if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) && 'edit' !== $context ) { |
|
206 | + $entry_default_fields[ "{$this->name}" ] = array( |
|
207 | 207 | 'label' => $this->label, |
208 | 208 | 'desc' => $this->description, |
209 | 209 | 'type' => $this->name, |