@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | // hold widget View options |
| 52 | 52 | private $widget_options; |
| 53 | 53 | |
| 54 | - function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) { |
|
| 54 | + function __construct( $widget_label, $widget_id, $defaults = array(), $settings = array() ) { |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * The shortcode name is set to the lowercase name of the widget class, unless overridden by the class specifying a different value for $shortcode_name |
| 59 | 59 | * @var string |
| 60 | 60 | */ |
| 61 | - $this->shortcode_name = !isset( $this->shortcode_name ) ? strtolower( get_class($this) ) : $this->shortcode_name; |
|
| 61 | + $this->shortcode_name = ! isset( $this->shortcode_name ) ? strtolower( get_class( $this ) ) : $this->shortcode_name; |
|
| 62 | 62 | |
| 63 | 63 | $this->widget_label = $widget_label; |
| 64 | 64 | $this->widget_id = $widget_id; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->settings = wp_parse_args( $settings, $this->settings ); |
| 70 | 70 | |
| 71 | 71 | // register widgets to be listed in the View Configuration |
| 72 | - add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget') ); |
|
| 72 | + add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget' ) ); |
|
| 73 | 73 | |
| 74 | 74 | // widget options |
| 75 | 75 | add_filter( 'gravityview_template_widget_options', array( $this, 'assign_widget_options' ), 10, 3 ); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | add_action( "gravityview_render_widget_{$widget_id}", array( $this, 'render_frontend' ), 10, 1 ); |
| 79 | 79 | |
| 80 | 80 | // register shortcodes |
| 81 | - add_action( 'wp', array( $this, 'add_shortcode') ); |
|
| 81 | + add_action( 'wp', array( $this, 'add_shortcode' ) ); |
|
| 82 | 82 | |
| 83 | 83 | // Use shortcodes in text widgets. |
| 84 | - add_filter('widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
| 84 | + add_filter( 'widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | * @param boolean $enable_custom_class False by default. Return true if you want to enable. |
| 100 | 100 | * @param GravityView_Widget $this Current instance of GravityView_Widget |
| 101 | 101 | */ |
| 102 | - $enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this ); |
|
| 102 | + $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
|
| 103 | 103 | |
| 104 | - if( $enable_custom_class ) { |
|
| 104 | + if ( $enable_custom_class ) { |
|
| 105 | 105 | |
| 106 | - $settings['custom_class'] = array( |
|
| 106 | + $settings[ 'custom_class' ] = array( |
|
| 107 | 107 | 'type' => 'text', |
| 108 | 108 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 109 | - 'desc' => __( 'This class will be added to the widget container', 'gravityview'), |
|
| 109 | + 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
|
| 110 | 110 | 'value' => '', |
| 111 | 111 | 'merge_tags' => true, |
| 112 | 112 | ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @return array|null Settings array; NULL if not set |
| 129 | 129 | */ |
| 130 | 130 | public function get_settings() { |
| 131 | - return !empty( $this->settings ) ? $this->settings : NULL; |
|
| 131 | + return ! empty( $this->settings ) ? $this->settings : NULL; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function get_setting( $key ) { |
| 140 | 140 | $setting = NULL; |
| 141 | 141 | |
| 142 | - if( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
| 142 | + if ( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
| 143 | 143 | $setting = isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : NULL; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | function maybe_do_shortcode( $text, $widget = NULL ) { |
| 156 | 156 | |
| 157 | - if( !empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
| 157 | + if ( ! empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
| 158 | 158 | return do_shortcode( $text ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -183,26 +183,26 @@ discard block |
||
| 183 | 183 | return; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if( empty( $this->shortcode_name ) ) { return; } |
|
| 186 | + if ( empty( $this->shortcode_name ) ) { return; } |
|
| 187 | 187 | |
| 188 | 188 | // If the widget shouldn't output on single entries, don't show it |
| 189 | - if( empty( $this->show_on_single ) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry() ) { |
|
| 190 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)) ); |
|
| 189 | + if ( empty( $this->show_on_single ) && class_exists( 'GravityView_frontend' ) && GravityView_frontend::is_single_entry() ) { |
|
| 190 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class( $this ) ) ); |
|
| 191 | 191 | |
| 192 | 192 | add_shortcode( $this->shortcode_name, '__return_null' ); |
| 193 | 193 | return; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
| 197 | - if( !has_gravityview_shortcode( $post ) ) { |
|
| 197 | + if ( ! has_gravityview_shortcode( $post ) ) { |
|
| 198 | 198 | |
| 199 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)) ); |
|
| 199 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class( $this ) ) ); |
|
| 200 | 200 | |
| 201 | 201 | add_shortcode( $this->shortcode_name, '__return_null' ); |
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
| 205 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function register_widget( $widgets ) { |
| 214 | 214 | $widgets[ $this->widget_id ] = array( |
| 215 | - 'label' => $this->widget_label , |
|
| 215 | + 'label' => $this->widget_label, |
|
| 216 | 216 | 'description' => $this->widget_description, |
| 217 | 217 | 'subtitle' => $this->widget_subtitle, |
| 218 | 218 | ); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
| 231 | 231 | |
| 232 | - if( $this->widget_id === $widget ) { |
|
| 232 | + if ( $this->widget_id === $widget ) { |
|
| 233 | 233 | $options = array_merge( $options, $this->settings ); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @return void |
| 244 | 244 | */ |
| 245 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 245 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 246 | 246 | // to be defined by child class |
| 247 | - if( !$this->pre_render_frontend() ) { |
|
| 247 | + if ( ! $this->pre_render_frontend() ) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | public function pre_render_frontend() { |
| 257 | 257 | $gravityview_view = GravityView_View::getInstance(); |
| 258 | 258 | |
| 259 | - if( empty( $gravityview_view ) ) { |
|
| 260 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)) ); |
|
| 259 | + if ( empty( $gravityview_view ) ) { |
|
| 260 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class( $this ) ) ); |
|
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | $hide_until_search = apply_filters( 'gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this ); |
| 270 | 270 | |
| 271 | - if( $hide_until_search ) { |
|
| 272 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class($this)) ); |
|
| 271 | + if ( $hide_until_search ) { |
|
| 272 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class( $this ) ) ); |
|
| 273 | 273 | return false; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | * Does the if and the comparison match? |
| 233 | 233 | * @uses GVCommon::matches_operation |
| 234 | 234 | * |
| 235 | - * @return boolean True: yep; false: nope |
|
| 235 | + * @return boolean|null True: yep; false: nope |
|
| 236 | 236 | */ |
| 237 | 237 | private function set_is_match() { |
| 238 | 238 | $this->is_match = GVCommon::matches_operation( $this->if, $this->comparison, $this->operation ); |
@@ -245,7 +245,7 @@ |
||
| 245 | 245 | * @param bool $url_encode Whether to URL-encode output |
| 246 | 246 | * @param bool $esc_html Whether to apply `esc_html()` to output |
| 247 | 247 | * |
| 248 | - * @return mixed |
|
| 248 | + * @return string |
|
| 249 | 249 | */ |
| 250 | 250 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 251 | 251 | |
@@ -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 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | /** |
| 78 | 78 | * Alias for get_instance() |
| 79 | 79 | * |
| 80 | - * @param $field_name |
|
| 80 | + * @param string $field_name |
|
| 81 | 81 | * |
| 82 | 82 | * @return GravityView_Field|false |
| 83 | 83 | */ |
@@ -40,7 +40,6 @@ |
||
| 40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
| 41 | 41 | * |
| 42 | 42 | * @since 1.16.4 |
| 43 | - |
|
| 44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
| 45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
| 46 | 45 | * |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains" |
| 14 | 14 | * @var array |
| 15 | 15 | */ |
| 16 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 16 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 17 | 17 | |
| 18 | 18 | var $is_searchable = true; |
| 19 | 19 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | var $is_searchable = true; |
| 13 | 13 | |
| 14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 15 | 15 | |
| 16 | 16 | var $_gf_field_class_name = 'GF_Field_Radio'; |
| 17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | // Set the $_field_id var |
| 41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
| 42 | 42 | |
| 43 | - if( $this->is_choice_value_enabled() ) { |
|
| 44 | - $field_options['choice_display'] = array( |
|
| 43 | + if ( $this->is_choice_value_enabled() ) { |
|
| 44 | + $field_options[ 'choice_display' ] = array( |
|
| 45 | 45 | 'type' => 'radio', |
| 46 | 46 | 'value' => 'value', |
| 47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | var $is_searchable = true; |
| 13 | 13 | |
| 14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 15 | 15 | |
| 16 | 16 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
| 17 | 17 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $entry = GFAPI::get_entry( $entry_id ); |
| 45 | 45 | $post_id = rgar( $entry, 'post_id' ); |
| 46 | 46 | |
| 47 | - if( empty( $post_id ) ) { |
|
| 47 | + if ( empty( $post_id ) ) { |
|
| 48 | 48 | return false; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $post_category_fields = GFAPI::get_fields_by_type( $form, 'post_category' ); |
| 54 | 54 | |
| 55 | - if( $post_category_fields ) { |
|
| 55 | + if ( $post_category_fields ) { |
|
| 56 | 56 | |
| 57 | 57 | $updated_categories = array(); |
| 58 | 58 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return mixed |
| 121 | 121 | */ |
| 122 | - function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
| 122 | + function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
| 123 | 123 | |
| 124 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
| 124 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
| 125 | 125 | |
| 126 | 126 | // $entry['post_id'] should always be set, but we check to make sure. |
| 127 | - if( $entry && isset( $entry['post_id'] ) && $post_id = $entry['post_id'] ) { |
|
| 127 | + if ( $entry && isset( $entry[ 'post_id' ] ) && $post_id = $entry[ 'post_id' ] ) { |
|
| 128 | 128 | |
| 129 | 129 | $post_categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) ); |
| 130 | 130 | |
| 131 | 131 | // Always use the live value |
| 132 | 132 | foreach ( $choices as &$choice ) { |
| 133 | - $choice['isSelected'] = in_array( $choice['value'], array_values( $post_categories ) ); |
|
| 133 | + $choice[ 'isSelected' ] = in_array( $choice[ 'value' ], array_values( $post_categories ) ); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 141 | 141 | |
| 142 | - if( 'edit' === $context ) { |
|
| 142 | + if ( 'edit' === $context ) { |
|
| 143 | 143 | return $field_options; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 147 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 146 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 147 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 148 | 148 | |
| 149 | 149 | return $field_options; |
| 150 | 150 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | var $is_searchable = true; |
| 16 | 16 | |
| 17 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 17 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 18 | 18 | |
| 19 | 19 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
| 20 | 20 | |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 29 | 29 | |
| 30 | - if( 'edit' === $context ) { |
|
| 30 | + if ( 'edit' === $context ) { |
|
| 31 | 31 | return $field_options; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 35 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 34 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 35 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 36 | 36 | |
| 37 | 37 | return $field_options; |
| 38 | 38 | } |