@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @type array |
| 70 | 70 | * @since 1.15.2 |
| 71 | 71 | */ |
| 72 | - var $contexts = array( 'single', 'multiple', 'edit', 'export' ); |
|
| 72 | + var $contexts = array('single', 'multiple', 'edit', 'export'); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @internal Not yet implemented |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | function __construct() { |
| 94 | 94 | |
| 95 | 95 | // Modify the field options based on the name of the field type |
| 96 | - add_filter( sprintf( 'gravityview_template_%s_options', $this->name ), array( &$this, 'field_options' ), 10, 5 ); |
|
| 96 | + add_filter(sprintf('gravityview_template_%s_options', $this->name), array(&$this, 'field_options'), 10, 5); |
|
| 97 | 97 | |
| 98 | - add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
|
| 98 | + add_filter('gravityview/sortable/field_blacklist', array($this, '_filter_sortable_fields'), 1); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return array |
| 110 | 110 | */ |
| 111 | - public function _filter_sortable_fields( $not_sortable ) { |
|
| 111 | + public function _filter_sortable_fields($not_sortable) { |
|
| 112 | 112 | |
| 113 | - if( ! $this->is_sortable ) { |
|
| 113 | + if (!$this->is_sortable) { |
|
| 114 | 114 | $not_sortable[] = $this->name; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -121,35 +121,35 @@ discard block |
||
| 121 | 121 | $options = array( |
| 122 | 122 | 'link_to_post' => array( |
| 123 | 123 | 'type' => 'checkbox', |
| 124 | - 'label' => __( 'Link to the post', 'gravityview' ), |
|
| 125 | - 'desc' => __( 'Link to the post created by the entry.', 'gravityview' ), |
|
| 124 | + 'label' => __('Link to the post', 'gravityview'), |
|
| 125 | + 'desc' => __('Link to the post created by the entry.', 'gravityview'), |
|
| 126 | 126 | 'value' => false, |
| 127 | 127 | ), |
| 128 | 128 | 'link_to_term' => array( |
| 129 | 129 | 'type' => 'checkbox', |
| 130 | - 'label' => __( 'Link to the category or tag', 'gravityview' ), |
|
| 131 | - 'desc' => __( 'Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview' ), |
|
| 130 | + 'label' => __('Link to the category or tag', 'gravityview'), |
|
| 131 | + 'desc' => __('Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview'), |
|
| 132 | 132 | 'value' => false, |
| 133 | 133 | ), |
| 134 | 134 | 'dynamic_data' => array( |
| 135 | 135 | 'type' => 'checkbox', |
| 136 | - 'label' => __( 'Use the live post data', 'gravityview' ), |
|
| 137 | - 'desc' => __( 'Instead of using the entry data, instead use the current post data.', 'gravityview' ), |
|
| 136 | + 'label' => __('Use the live post data', 'gravityview'), |
|
| 137 | + 'desc' => __('Instead of using the entry data, instead use the current post data.', 'gravityview'), |
|
| 138 | 138 | 'value' => true, |
| 139 | 139 | ), |
| 140 | 140 | 'date_display' => array( |
| 141 | 141 | 'type' => 'text', |
| 142 | - 'label' => __( 'Override Date Format', 'gravityview' ), |
|
| 143 | - '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>' ), |
|
| 142 | + 'label' => __('Override Date Format', 'gravityview'), |
|
| 143 | + '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>'), |
|
| 144 | 144 | /** |
| 145 | 145 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
| 146 | 146 | * @param[in,out] null|string $date_format Date Format (default: null) |
| 147 | 147 | */ |
| 148 | - 'value' => apply_filters( 'gravityview_date_format', null ) |
|
| 148 | + 'value' => apply_filters('gravityview_date_format', null) |
|
| 149 | 149 | ), |
| 150 | 150 | 'new_window' => array( |
| 151 | 151 | 'type' => 'checkbox', |
| 152 | - 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
|
| 152 | + 'label' => __('Open link in a new tab or window?', 'gravityview'), |
|
| 153 | 153 | 'value' => false, |
| 154 | 154 | ), |
| 155 | 155 | ); |
@@ -158,15 +158,15 @@ discard block |
||
| 158 | 158 | * @filter `gravityview_field_support_options` Modify the settings that a field supports |
| 159 | 159 | * @param array $options Options multidimensional array with each key being the input name, with each array setting having `type`, `label`, `desc` and `value` (default values) keys |
| 160 | 160 | */ |
| 161 | - return apply_filters( 'gravityview_field_support_options', $options ); |
|
| 161 | + return apply_filters('gravityview_field_support_options', $options); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - function add_field_support( $key = '', &$field_options ) { |
|
| 164 | + function add_field_support($key = '', &$field_options) { |
|
| 165 | 165 | |
| 166 | 166 | $options = $this->field_support_options(); |
| 167 | 167 | |
| 168 | - if( isset( $options[ $key ] ) ) { |
|
| 169 | - $field_options[ $key ] = $options[ $key ]; |
|
| 168 | + if (isset($options[$key])) { |
|
| 169 | + $field_options[$key] = $options[$key]; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return $field_options; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @param [type] $input_type [description] |
| 203 | 203 | * @return [type] [description] |
| 204 | 204 | */ |
| 205 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
| 205 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
| 206 | 206 | |
| 207 | 207 | $this->_field_options = $field_options; |
| 208 | 208 | $this->_field_id = $field_id; |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @return bool true: $mixed is *not* an empty string; false: $mixed *is* an empty string |
| 17 | 17 | */ |
| 18 | -function gravityview_is_not_empty_string( $mixed = '' ) { |
|
| 19 | - return ( $mixed !== '' ); |
|
| 18 | +function gravityview_is_not_empty_string($mixed = '') { |
|
| 19 | + return ($mixed !== ''); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -32,22 +32,22 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return array URL args, if exists. Empty array if not. |
| 34 | 34 | */ |
| 35 | -function gravityview_get_permalink_query_args( $id = 0 ) { |
|
| 35 | +function gravityview_get_permalink_query_args($id = 0) { |
|
| 36 | 36 | |
| 37 | - $parsed_permalink = parse_url( get_permalink( $id ) ); |
|
| 37 | + $parsed_permalink = parse_url(get_permalink($id)); |
|
| 38 | 38 | |
| 39 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
| 39 | + $permalink_args = isset($parsed_permalink['query']) ? $parsed_permalink['query'] : false; |
|
| 40 | 40 | |
| 41 | - if( empty( $permalink_args ) ) { |
|
| 41 | + if (empty($permalink_args)) { |
|
| 42 | 42 | return array(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - parse_str( $permalink_args, $args ); |
|
| 45 | + parse_str($permalink_args, $args); |
|
| 46 | 46 | |
| 47 | 47 | return $args; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 50 | +if (!function_exists('gravityview_sanitize_html_class')) { |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -58,20 +58,20 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return string Sanitized CSS string |
| 60 | 60 | */ |
| 61 | - function gravityview_sanitize_html_class( $classes ) { |
|
| 61 | + function gravityview_sanitize_html_class($classes) { |
|
| 62 | 62 | |
| 63 | - if ( is_string( $classes ) ) { |
|
| 64 | - $classes = explode( ' ', $classes ); |
|
| 63 | + if (is_string($classes)) { |
|
| 64 | + $classes = explode(' ', $classes); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // If someone passes something not string or array, we get outta here. |
| 68 | - if ( ! is_array( $classes ) ) { |
|
| 68 | + if (!is_array($classes)) { |
|
| 69 | 69 | return $classes; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $classes = array_map( 'sanitize_html_class', $classes ); |
|
| 72 | + $classes = array_map('sanitize_html_class', $classes); |
|
| 73 | 73 | |
| 74 | - return implode( ' ', $classes ); |
|
| 74 | + return implode(' ', $classes); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return string Stripped string! |
| 91 | 91 | */ |
| 92 | -function gravityview_strip_whitespace( $string ) { |
|
| 93 | - $string = normalize_whitespace( $string ); |
|
| 94 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
| 92 | +function gravityview_strip_whitespace($string) { |
|
| 93 | + $string = normalize_whitespace($string); |
|
| 94 | + return preg_replace('/[\r\n\t ]+/', ' ', $string); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | * @param mixed $object Pass pseudo-global to the included file |
| 105 | 105 | * @return string Included file contents |
| 106 | 106 | */ |
| 107 | -function gravityview_ob_include( $file_path, $object = NULL ) { |
|
| 108 | - if( ! file_exists( $file_path ) ) { |
|
| 109 | - do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
|
| 107 | +function gravityview_ob_include($file_path, $object = NULL) { |
|
| 108 | + if (!file_exists($file_path)) { |
|
| 109 | + do_action('gravityview_log_error', __FUNCTION__.': File path does not exist. ', $file_path); |
|
| 110 | 110 | return ''; |
| 111 | 111 | } |
| 112 | 112 | ob_start(); |
| 113 | - include( $file_path ); |
|
| 113 | + include($file_path); |
|
| 114 | 114 | return ob_get_clean(); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | function gravityview_get_floaty() { |
| 123 | 123 | |
| 124 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
| 124 | + if (function_exists('is_rtl') && is_rtl()) { |
|
| 125 | 125 | $style = 'margin:10px 10px 10px 0;'; |
| 126 | 126 | $class = 'alignright'; |
| 127 | 127 | } else { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $class = 'alignleft'; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 132 | + return '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -149,21 +149,21 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @return string Converted number in string format. |
| 151 | 151 | */ |
| 152 | -function gravityview_number_format( $number, $decimals = '' ) { |
|
| 152 | +function gravityview_number_format($number, $decimals = '') { |
|
| 153 | 153 | global $wp_locale; |
| 154 | 154 | |
| 155 | - if( '' === $decimals ) { |
|
| 155 | + if ('' === $decimals) { |
|
| 156 | 156 | |
| 157 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 157 | + $decimal_point = isset($wp_locale) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * Calculate the position of the decimal point in the number |
| 161 | 161 | * @see http://stackoverflow.com/a/2430144/480856 |
| 162 | 162 | */ |
| 163 | - $decimals = strlen( substr( strrchr( $number, $decimal_point ), 1 ) ); |
|
| 163 | + $decimals = strlen(substr(strrchr($number, $decimal_point), 1)); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $number = number_format_i18n( $number, (int)$decimals ); |
|
| 166 | + $number = number_format_i18n($number, (int)$decimals); |
|
| 167 | 167 | |
| 168 | 168 | return $number; |
| 169 | 169 | } |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | * @param string $value Existing URL |
| 178 | 178 | * @return string If parse_url doesn't find a 'host', returns original value. Otherwise, returns formatted link. |
| 179 | 179 | */ |
| 180 | -function gravityview_format_link( $value = null ) { |
|
| 180 | +function gravityview_format_link($value = null) { |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | - $parts = parse_url( $value ); |
|
| 183 | + $parts = parse_url($value); |
|
| 184 | 184 | |
| 185 | 185 | // No domain? Strange...show the original text. |
| 186 | - if( empty( $parts['host'] ) ) { |
|
| 186 | + if (empty($parts['host'])) { |
|
| 187 | 187 | return $value; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
| 197 | 197 | * If true: `http://example.com => example.com` |
| 198 | 198 | */ |
| 199 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
| 199 | + if (false === apply_filters('gravityview_anchor_text_striphttp', true)) { |
|
| 200 | 200 | |
| 201 | - if( isset( $parts['scheme'] ) ) { |
|
| 201 | + if (isset($parts['scheme'])) { |
|
| 202 | 202 | $return .= $parts['scheme']; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
| 214 | 214 | * If true: `www.example.com => example.com` |
| 215 | 215 | */ |
| 216 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
| 216 | + $strip_www = apply_filters('gravityview_anchor_text_stripwww', true); |
|
| 217 | 217 | |
| 218 | - if( $strip_www ) { |
|
| 219 | - $domain = str_replace('www.', '', $domain ); |
|
| 218 | + if ($strip_www) { |
|
| 219 | + $domain = str_replace('www.', '', $domain); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
| 230 | 230 | |
| 231 | - if( $strip_subdomains ) { |
|
| 231 | + if ($strip_subdomains) { |
|
| 232 | 232 | |
| 233 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
| 233 | + $domain = _gravityview_strip_subdomain($parts['host']); |
|
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
| 248 | 248 | |
| 249 | - if( empty( $root_only ) ) { |
|
| 249 | + if (empty($root_only)) { |
|
| 250 | 250 | |
| 251 | - if( isset( $parts['path'] ) ) { |
|
| 251 | + if (isset($parts['path'])) { |
|
| 252 | 252 | $return .= $parts['path']; |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
| 260 | 260 | * If true: `http://example.com/?query=example => example.com` |
| 261 | 261 | */ |
| 262 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
| 262 | + $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true); |
|
| 263 | 263 | |
| 264 | - if( empty( $strip_query_string ) ) { |
|
| 264 | + if (empty($strip_query_string)) { |
|
| 265 | 265 | |
| 266 | - if( isset( $parts['query'] ) ) { |
|
| 266 | + if (isset($parts['query'])) { |
|
| 267 | 267 | $return .= '?'.$parts['query']; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | * @param string $domain Domain to check if it's a TLD or subdomain |
| 280 | 280 | * @return string Extracted domain if it has a subdomain |
| 281 | 281 | */ |
| 282 | -function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
|
| 282 | +function _gravityview_strip_subdomain($string_maybe_has_subdomain) { |
|
| 283 | 283 | |
| 284 | - 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 ) ) { |
|
| 284 | + 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)) { |
|
| 285 | 285 | return $matches['domain']; |
| 286 | 286 | } else { |
| 287 | 287 | return $string_maybe_has_subdomain; |
@@ -301,37 +301,37 @@ discard block |
||
| 301 | 301 | * @param boolean $allow_string_booleans Whether to check if 'yes', 'true' => `true` and 'no', 'false' => `false` |
| 302 | 302 | * @return boolean True: empty; false: not empty |
| 303 | 303 | */ |
| 304 | -function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
|
| 304 | +function gv_empty($value, $zero_is_empty = true, $allow_string_booleans = true) { |
|
| 305 | 305 | |
| 306 | - if( |
|
| 307 | - ! isset( $value ) // If it's not set, it's empty! |
|
| 306 | + if ( |
|
| 307 | + !isset($value) // If it's not set, it's empty! |
|
| 308 | 308 | || false === $value |
| 309 | 309 | || null === $value |
| 310 | 310 | || '' === $value // Empty string |
| 311 | 311 | || array() === $value // Empty array |
| 312 | - || ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object |
|
| 312 | + || (is_object($value) && !get_object_vars($value)) // Empty object |
|
| 313 | 313 | ) { |
| 314 | 314 | return true; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
| 317 | + if (is_string($value) && $allow_string_booleans) { |
|
| 318 | 318 | |
| 319 | - $value = trim( $value ); |
|
| 320 | - $value = strtolower( $value ); |
|
| 319 | + $value = trim($value); |
|
| 320 | + $value = strtolower($value); |
|
| 321 | 321 | |
| 322 | - if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
|
| 322 | + if (in_array($value, array('yes', 'true'), true)) { |
|
| 323 | 323 | $value = true; |
| 324 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 324 | + } else if (in_array($value, array('no', 'false'), true)) { |
|
| 325 | 325 | $value = false; |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
| 330 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 330 | + if (!$zero_is_empty && is_numeric($value) && empty($value)) { |
|
| 331 | 331 | return false; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - return empty( $value ); |
|
| 334 | + return empty($value); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -344,17 +344,17 @@ discard block |
||
| 344 | 344 | * |
| 345 | 345 | * @return bool True: it's a valid datetime, formatted as expected. False: it's not a date formatted as expected. |
| 346 | 346 | */ |
| 347 | -function gravityview_is_valid_datetime( $datetime, $expected_format = 'Y-m-d' ) { |
|
| 347 | +function gravityview_is_valid_datetime($datetime, $expected_format = 'Y-m-d') { |
|
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | 350 | * @var bool|DateTime False if not a valid date, (like a relative date). DateTime if a date was created. |
| 351 | 351 | */ |
| 352 | - $formatted_date = DateTime::createFromFormat( $expected_format, $datetime ); |
|
| 352 | + $formatted_date = DateTime::createFromFormat($expected_format, $datetime); |
|
| 353 | 353 | |
| 354 | 354 | /** |
| 355 | 355 | * @see http://stackoverflow.com/a/19271434/480856 |
| 356 | 356 | */ |
| 357 | - return ( $formatted_date && $formatted_date->format( $expected_format ) === $datetime ); |
|
| 357 | + return ($formatted_date && $formatted_date->format($expected_format) === $datetime); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * |
| 373 | 373 | * @return array Multidimensional array with `text` (Category Name) and `value` (Category ID) keys. |
| 374 | 374 | */ |
| 375 | -function gravityview_get_terms_choices( $args = array() ) { |
|
| 375 | +function gravityview_get_terms_choices($args = array()) { |
|
| 376 | 376 | |
| 377 | 377 | $defaults = array( |
| 378 | 378 | 'type' => 'post', |
@@ -386,21 +386,21 @@ discard block |
||
| 386 | 386 | 'fields' => 'id=>name', |
| 387 | 387 | ); |
| 388 | 388 | |
| 389 | - $args = wp_parse_args( $args, $defaults ); |
|
| 389 | + $args = wp_parse_args($args, $defaults); |
|
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | 392 | * @filter `gravityview_get_terms_choices_args` Modify the arguments passed to `get_terms()` |
| 393 | 393 | * @see get_terms() |
| 394 | 394 | * @since 1.15.3 |
| 395 | 395 | */ |
| 396 | - $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
|
| 396 | + $args = apply_filters('gravityview_get_terms_choices_args', $args); |
|
| 397 | 397 | |
| 398 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
| 398 | + $terms = get_terms($args['taxonomy'], $args); |
|
| 399 | 399 | |
| 400 | 400 | $choices = array(); |
| 401 | 401 | |
| 402 | - if ( is_array( $terms ) ) { |
|
| 403 | - foreach ( $terms as $term_id => $term_name ) { |
|
| 402 | + if (is_array($terms)) { |
|
| 403 | + foreach ($terms as $term_id => $term_name) { |
|
| 404 | 404 | $choices[] = array( |
| 405 | 405 | 'text' => $term_name, |
| 406 | 406 | 'value' => $term_id |