@@ -146,20 +146,20 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | if( !empty( $field['custom_class'] ) ) { |
| 148 | 148 | |
| 149 | - $custom_class = $field['custom_class']; |
|
| 149 | + $custom_class = $field['custom_class']; |
|
| 150 | 150 | |
| 151 | - if( !empty( $entry ) ) { |
|
| 151 | + if( !empty( $entry ) ) { |
|
| 152 | 152 | |
| 153 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
| 154 | - // replaced by a multiple-word value that should be output as a single class. |
|
| 155 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
| 156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 153 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
| 154 | + // replaced by a multiple-word value that should be output as a single class. |
|
| 155 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
| 156 | + add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 157 | 157 | |
| 158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 159 | 159 | |
| 160 | - // And then we want life to return to normal |
|
| 161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 162 | - } |
|
| 160 | + // And then we want life to return to normal |
|
| 161 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | // And now we want the spaces to be handled nicely. |
| 165 | 165 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | 'format' => $format, |
| 293 | 293 | 'entry' => $entry, |
| 294 | 294 | 'field_type' => $field_type, /** {@since 1.6} */ |
| 295 | - 'field_path' => $field_path, /** {@since 1.16} */ |
|
| 295 | + 'field_path' => $field_path, /** {@since 1.16} */ |
|
| 296 | 296 | )); |
| 297 | 297 | |
| 298 | 298 | if( ! empty( $field_path ) ) { |
@@ -603,29 +603,29 @@ discard block |
||
| 603 | 603 | return sanitize_title( $slug ); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - /** |
|
| 607 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
| 608 | - * |
|
| 609 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 610 | - * |
|
| 611 | - * @param $entry array Gravity Forms entry object |
|
| 612 | - * @param $form array Gravity Forms form object |
|
| 613 | - */ |
|
| 614 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
| 615 | - /** |
|
| 616 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
| 617 | - * @param boolean $custom Should we process the custom entry slug? |
|
| 618 | - */ |
|
| 619 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 620 | - if( $custom ) { |
|
| 621 | - // create the gravityview_unique_id and save it |
|
| 606 | + /** |
|
| 607 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
| 608 | + * |
|
| 609 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 610 | + * |
|
| 611 | + * @param $entry array Gravity Forms entry object |
|
| 612 | + * @param $form array Gravity Forms form object |
|
| 613 | + */ |
|
| 614 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
| 615 | + /** |
|
| 616 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
| 617 | + * @param boolean $custom Should we process the custom entry slug? |
|
| 618 | + */ |
|
| 619 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 620 | + if( $custom ) { |
|
| 621 | + // create the gravityview_unique_id and save it |
|
| 622 | 622 | |
| 623 | - // Get the entry hash |
|
| 624 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 625 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
| 623 | + // Get the entry hash |
|
| 624 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 625 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
| 626 | 626 | |
| 627 | - } |
|
| 628 | - } |
|
| 627 | + } |
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | 630 | |
| 631 | 631 | |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | |
| 890 | 890 | // If there was an error, continue to the next term. |
| 891 | 891 | if ( is_wp_error( $term_link ) ) { |
| 892 | - continue; |
|
| 892 | + continue; |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -30,29 +30,29 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $label = ''; |
| 32 | 32 | |
| 33 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
| 33 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
| 34 | 34 | |
| 35 | - $label = $field['label']; |
|
| 35 | + $label = $field[ 'label' ]; |
|
| 36 | 36 | |
| 37 | 37 | // Support Gravity Forms 1.9+ |
| 38 | - if( class_exists( 'GF_Field' ) ) { |
|
| 38 | + if ( class_exists( 'GF_Field' ) ) { |
|
| 39 | 39 | |
| 40 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 40 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 41 | 41 | |
| 42 | - if( $field_object ) { |
|
| 42 | + if ( $field_object ) { |
|
| 43 | 43 | |
| 44 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
| 44 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
| 45 | 45 | |
| 46 | 46 | // This is a complex field, with labels on a per-input basis |
| 47 | - if( $input ) { |
|
| 47 | + if ( $input ) { |
|
| 48 | 48 | |
| 49 | 49 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
| 50 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
| 50 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
| 51 | 51 | |
| 52 | 52 | } else { |
| 53 | 53 | |
| 54 | 54 | // This is a field with one label |
| 55 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
| 55 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
| 64 | - if ( !empty( $field['custom_label'] ) ) { |
|
| 64 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 65 | 65 | |
| 66 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
| 66 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | $width = NULL; |
| 119 | 119 | |
| 120 | - if( !empty( $field['width'] ) ) { |
|
| 121 | - $width = absint( $field['width'] ); |
|
| 120 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
| 121 | + $width = absint( $field[ 'width' ] ); |
|
| 122 | 122 | |
| 123 | 123 | // If using percentages, limit to 100% |
| 124 | - if( '%d%%' === $format && $width > 100 ) { |
|
| 124 | + if ( '%d%%' === $format && $width > 100 ) { |
|
| 125 | 125 | $width = 100; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -144,39 +144,39 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $classes = array(); |
| 146 | 146 | |
| 147 | - if( !empty( $field['custom_class'] ) ) { |
|
| 147 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
| 148 | 148 | |
| 149 | - $custom_class = $field['custom_class']; |
|
| 149 | + $custom_class = $field[ 'custom_class' ]; |
|
| 150 | 150 | |
| 151 | - if( !empty( $entry ) ) { |
|
| 151 | + if ( ! empty( $entry ) ) { |
|
| 152 | 152 | |
| 153 | 153 | // We want the merge tag to be formatted as a class. The merge tag may be |
| 154 | 154 | // replaced by a multiple-word value that should be output as a single class. |
| 155 | 155 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
| 156 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 156 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 157 | 157 | |
| 158 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 158 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
| 159 | 159 | |
| 160 | 160 | // And then we want life to return to normal |
| 161 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 161 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // And now we want the spaces to be handled nicely. |
| 165 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
| 165 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if(!empty($field['id'])) { |
|
| 170 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
| 171 | - $form_id = '-'.$form['id']; |
|
| 169 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
| 170 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 171 | + $form_id = '-' . $form[ 'id' ]; |
|
| 172 | 172 | } else { |
| 173 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
| 173 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
| 176 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - return esc_attr(implode(' ', $classes)); |
|
| 179 | + return esc_attr( implode( ' ', $classes ) ); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -193,16 +193,16 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
| 195 | 195 | $gravityview_view = GravityView_View::getInstance(); |
| 196 | - $id = $field['id']; |
|
| 196 | + $id = $field[ 'id' ]; |
|
| 197 | 197 | |
| 198 | 198 | if ( ! empty( $id ) ) { |
| 199 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
| 200 | - $form_id = '-' . $form['id']; |
|
| 199 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 200 | + $form_id = '-' . $form[ 'id' ]; |
|
| 201 | 201 | } else { |
| 202 | 202 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
| 205 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | return esc_attr( $id ); |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
| 221 | 221 | |
| 222 | - if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
| 222 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
| 223 | 223 | return NULL; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $gravityview_view = GravityView_View::getInstance(); |
| 227 | 227 | |
| 228 | - $field_id = $field_settings['id']; |
|
| 228 | + $field_id = $field_settings[ 'id' ]; |
|
| 229 | 229 | $form = $gravityview_view->getForm(); |
| 230 | 230 | $field = gravityview_get_field( $form, $field_id ); |
| 231 | 231 | |
| 232 | - if( $field && is_numeric( $field_id ) ) { |
|
| 232 | + if ( $field && is_numeric( $field_id ) ) { |
|
| 233 | 233 | // Used as file name of field template in GV. |
| 234 | 234 | // Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field |
| 235 | 235 | $field_type = $field->type; |
@@ -240,12 +240,12 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // If a Gravity Forms Field is found, get the field display |
| 243 | - if( $field ) { |
|
| 243 | + if ( $field ) { |
|
| 244 | 244 | |
| 245 | 245 | // Prevent any PHP warnings that may be generated |
| 246 | 246 | ob_start(); |
| 247 | 247 | |
| 248 | - $display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format ); |
|
| 248 | + $display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format ); |
|
| 249 | 249 | |
| 250 | 250 | if ( $errors = ob_get_clean() ) { |
| 251 | 251 | do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors ); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form ); |
| 255 | 255 | |
| 256 | 256 | // prevent the use of merge_tags for non-admin fields |
| 257 | - if( !empty( $field->adminOnly ) ) { |
|
| 257 | + if ( ! empty( $field->adminOnly ) ) { |
|
| 258 | 258 | $display_value = self::replace_variables( $display_value, $form, $entry ); |
| 259 | 259 | } |
| 260 | 260 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | // Check whether the field exists in /includes/fields/{$field_type}.php |
| 266 | 266 | // This can be overridden by user template files. |
| 267 | - $field_path = $gravityview_view->locate_template("fields/{$field_type}.php"); |
|
| 267 | + $field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" ); |
|
| 268 | 268 | |
| 269 | 269 | // Set the field data to be available in the templates |
| 270 | 270 | $gravityview_view->setCurrentField( array( |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | 'entry' => $entry, |
| 279 | 279 | 'field_type' => $field_type, /** {@since 1.6} */ |
| 280 | 280 | 'field_path' => $field_path, /** {@since 1.16} */ |
| 281 | - )); |
|
| 281 | + ) ); |
|
| 282 | 282 | |
| 283 | - if( ! empty( $field_path ) ) { |
|
| 283 | + if ( ! empty( $field_path ) ) { |
|
| 284 | 284 | |
| 285 | - do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) ); |
|
| 285 | + do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) ); |
|
| 286 | 286 | |
| 287 | 287 | ob_start(); |
| 288 | 288 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // Get the field settings again so that the field template can override the settings |
| 301 | - $field_settings = $gravityview_view->getCurrentField('field_settings'); |
|
| 301 | + $field_settings = $gravityview_view->getCurrentField( 'field_settings' ); |
|
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | 304 | * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link` |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example. |
| 317 | 317 | * |
| 318 | 318 | */ |
| 319 | - if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) { |
|
| 319 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) { |
|
| 320 | 320 | |
| 321 | - $link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' ); |
|
| 321 | + $link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' ); |
|
| 322 | 322 | |
| 323 | 323 | $output = self::entry_link_html( $entry, $output, $link_atts, $field_settings ); |
| 324 | 324 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * @param array $field_settings Settings for the particular GV field |
| 333 | 333 | * @param array $field Current field being displayed |
| 334 | 334 | */ |
| 335 | - $output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
| 335 | + $output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() ); |
|
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | 338 | * @filter `gravityview_field_entry_value` Modify the field value output for all field types |
@@ -361,14 +361,14 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) { |
| 363 | 363 | |
| 364 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
| 364 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
| 365 | 365 | do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry ); |
| 366 | 366 | return NULL; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | $href = self::entry_link( $entry ); |
| 370 | 370 | |
| 371 | - if( '' === $href ) { |
|
| 371 | + if ( '' === $href ) { |
|
| 372 | 372 | return NULL; |
| 373 | 373 | } |
| 374 | 374 | |
@@ -391,19 +391,19 @@ discard block |
||
| 391 | 391 | * @param boolean $wpautop Apply wpautop() to the output? |
| 392 | 392 | * @return string HTML of "no results" text |
| 393 | 393 | */ |
| 394 | - public static function no_results($wpautop = true) { |
|
| 394 | + public static function no_results( $wpautop = true ) { |
|
| 395 | 395 | $gravityview_view = GravityView_View::getInstance(); |
| 396 | 396 | |
| 397 | 397 | $is_search = false; |
| 398 | 398 | |
| 399 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 399 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 400 | 400 | $is_search = true; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - if($is_search) { |
|
| 404 | - $output = __('This search returned no results.', 'gravityview'); |
|
| 403 | + if ( $is_search ) { |
|
| 404 | + $output = __( 'This search returned no results.', 'gravityview' ); |
|
| 405 | 405 | } else { |
| 406 | - $output = __('No entries match your request.', 'gravityview'); |
|
| 406 | + $output = __( 'No entries match your request.', 'gravityview' ); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -411,9 +411,9 @@ discard block |
||
| 411 | 411 | * @param string $output The existing "No Entries" text |
| 412 | 412 | * @param boolean $is_search Is the current page a search result, or just a multiple entries screen? |
| 413 | 413 | */ |
| 414 | - $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search); |
|
| 414 | + $output = apply_filters( 'gravitview_no_entries_text', $output, $is_search ); |
|
| 415 | 415 | |
| 416 | - return $wpautop ? wpautop($output) : $output; |
|
| 416 | + return $wpautop ? wpautop( $output ) : $output; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /** |
@@ -430,37 +430,37 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | $gravityview_view = GravityView_View::getInstance(); |
| 432 | 432 | |
| 433 | - if( empty( $post_id ) ) { |
|
| 433 | + if ( empty( $post_id ) ) { |
|
| 434 | 434 | |
| 435 | 435 | $post_id = false; |
| 436 | 436 | |
| 437 | 437 | // DataTables passes the Post ID |
| 438 | - if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
| 438 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 439 | 439 | |
| 440 | - $post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false; |
|
| 440 | + $post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false; |
|
| 441 | 441 | |
| 442 | 442 | } else { |
| 443 | 443 | |
| 444 | 444 | // The Post ID has been passed via the shortcode |
| 445 | - if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
| 445 | + if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) { |
|
| 446 | 446 | |
| 447 | 447 | $post_id = $gravityview_view->getPostId(); |
| 448 | 448 | |
| 449 | 449 | } else { |
| 450 | 450 | |
| 451 | 451 | // This is a GravityView post type |
| 452 | - if( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
| 452 | + if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) { |
|
| 453 | 453 | |
| 454 | 454 | $post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID; |
| 455 | 455 | |
| 456 | 456 | } else { |
| 457 | 457 | |
| 458 | 458 | // This is an embedded GravityView; use the embedded post's ID as the base. |
| 459 | - if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
| 459 | + if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) { |
|
| 460 | 460 | |
| 461 | 461 | $post_id = $post->ID; |
| 462 | 462 | |
| 463 | - } elseif( $gravityview_view->getViewId() ) { |
|
| 463 | + } elseif ( $gravityview_view->getViewId() ) { |
|
| 464 | 464 | |
| 465 | 465 | // The GravityView has been embedded in a widget or in a template, and |
| 466 | 466 | // is not in the current content. Thus, we defer to the View's own ID. |
@@ -475,36 +475,36 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | // No post ID, get outta here. |
| 478 | - if( empty( $post_id ) ) { |
|
| 478 | + if ( empty( $post_id ) ) { |
|
| 479 | 479 | return NULL; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | // If we've saved the permalink in memory, use it |
| 483 | 483 | // @since 1.3 |
| 484 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
| 484 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
| 485 | 485 | |
| 486 | - if( empty( $link ) ) { |
|
| 486 | + if ( empty( $link ) ) { |
|
| 487 | 487 | |
| 488 | 488 | $link = get_permalink( $post_id ); |
| 489 | 489 | |
| 490 | 490 | // If not yet saved, cache the permalink. |
| 491 | 491 | // @since 1.3 |
| 492 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
| 492 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
| 493 | 493 | |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | // Deal with returning to proper pagination for embedded views |
| 497 | - if( $link && $add_query_args ) { |
|
| 497 | + if ( $link && $add_query_args ) { |
|
| 498 | 498 | |
| 499 | 499 | $args = array(); |
| 500 | 500 | |
| 501 | - if( $pagenum = rgget('pagenum') ) { |
|
| 502 | - $args['pagenum'] = intval( $pagenum ); |
|
| 501 | + if ( $pagenum = rgget( 'pagenum' ) ) { |
|
| 502 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if( $sort = rgget('sort') ) { |
|
| 506 | - $args['sort'] = $sort; |
|
| 507 | - $args['dir'] = rgget('dir'); |
|
| 505 | + if ( $sort = rgget( 'sort' ) ) { |
|
| 506 | + $args[ 'sort' ] = $sort; |
|
| 507 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | $link = add_query_arg( $args, $link ); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 528 | 528 | |
| 529 | 529 | // Generate an unique hash to use as the default value |
| 530 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 530 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 531 | 531 | |
| 532 | 532 | /** |
| 533 | 533 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 539 | 539 | |
| 540 | 540 | // Make sure we have something - use the original ID as backup. |
| 541 | - if( empty( $slug ) ) { |
|
| 541 | + if ( empty( $slug ) ) { |
|
| 542 | 542 | $slug = $id; |
| 543 | 543 | } |
| 544 | 544 | |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
| 568 | 568 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
| 569 | 569 | */ |
| 570 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
| 570 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 571 | 571 | |
| 572 | 572 | // If we're using custom slug... |
| 573 | 573 | if ( $custom ) { |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | // If it does have a hash set, and the hash is expected, use it. |
| 582 | 582 | // This check allows users to change the hash structure using the |
| 583 | 583 | // gravityview_entry_hash filter and have the old hashes expire. |
| 584 | - if( empty( $value ) || $value !== $hash ) { |
|
| 584 | + if ( empty( $value ) || $value !== $hash ) { |
|
| 585 | 585 | |
| 586 | 586 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash ); |
| 587 | 587 | |
@@ -609,12 +609,12 @@ discard block |
||
| 609 | 609 | * @param boolean $custom Should we process the custom entry slug? |
| 610 | 610 | */ |
| 611 | 611 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 612 | - if( $custom ) { |
|
| 612 | + if ( $custom ) { |
|
| 613 | 613 | // create the gravityview_unique_id and save it |
| 614 | 614 | |
| 615 | 615 | // Get the entry hash |
| 616 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 617 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash ); |
|
| 616 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 617 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash ); |
|
| 618 | 618 | |
| 619 | 619 | } |
| 620 | 620 | } |
@@ -631,14 +631,14 @@ discard block |
||
| 631 | 631 | */ |
| 632 | 632 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
| 633 | 633 | |
| 634 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
| 634 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
| 635 | 635 | $entry = GVCommon::get_entry( $entry ); |
| 636 | - } else if( empty( $entry ) ) { |
|
| 636 | + } else if ( empty( $entry ) ) { |
|
| 637 | 637 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | // Second parameter used to be passed as $field; this makes sure it's not an array |
| 641 | - if( !is_numeric( $post_id ) ) { |
|
| 641 | + if ( ! is_numeric( $post_id ) ) { |
|
| 642 | 642 | $post_id = NULL; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -646,19 +646,19 @@ discard block |
||
| 646 | 646 | $directory_link = self::directory_link( $post_id, false ); |
| 647 | 647 | |
| 648 | 648 | // No post ID? Get outta here. |
| 649 | - if( empty( $directory_link ) ) { |
|
| 649 | + if ( empty( $directory_link ) ) { |
|
| 650 | 650 | return ''; |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
| 654 | 654 | |
| 655 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
| 655 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 656 | 656 | |
| 657 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
| 657 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 658 | 658 | |
| 659 | 659 | $args = array(); |
| 660 | 660 | |
| 661 | - $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/'; |
|
| 661 | + $directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/'; |
|
| 662 | 662 | |
| 663 | 663 | } else { |
| 664 | 664 | |
@@ -668,18 +668,18 @@ discard block |
||
| 668 | 668 | /** |
| 669 | 669 | * @since 1.7.3 |
| 670 | 670 | */ |
| 671 | - if( $add_directory_args ) { |
|
| 671 | + if ( $add_directory_args ) { |
|
| 672 | 672 | |
| 673 | - if( !empty( $_GET['pagenum'] ) ) { |
|
| 674 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 673 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 674 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | /** |
| 678 | 678 | * @since 1.7 |
| 679 | 679 | */ |
| 680 | - if( $sort = rgget('sort') ) { |
|
| 681 | - $args['sort'] = $sort; |
|
| 682 | - $args['dir'] = rgget('dir'); |
|
| 680 | + if ( $sort = rgget( 'sort' ) ) { |
|
| 681 | + $args[ 'sort' ] = $sort; |
|
| 682 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | } |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
| 690 | 690 | * @see GravityView_frontend::get_context_view_id() |
| 691 | 691 | */ |
| 692 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 693 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 692 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 693 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | return add_query_arg( $args, $directory_link ); |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 711 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 711 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | /** |
@@ -730,15 +730,15 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
| 732 | 732 | |
| 733 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 733 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 734 | 734 | $default_css_class .= ' hidden'; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 737 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 738 | 738 | $default_css_class .= ' gv-container-no-results'; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 741 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 742 | 742 | |
| 743 | 743 | /** |
| 744 | 744 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 751 | 751 | |
| 752 | - if( $echo ) { |
|
| 752 | + if ( $echo ) { |
|
| 753 | 753 | echo $css_class; |
| 754 | 754 | } |
| 755 | 755 | |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | $value = GravityView_API::field_value( $entry, $field ); |
| 762 | 762 | |
| 763 | - if( $value === '' ) { |
|
| 763 | + if ( $value === '' ) { |
|
| 764 | 764 | /** |
| 765 | 765 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 766 | 766 | * @param string $value (empty string) |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | return GravityView_API::entry_link( $entry, $post_id ); |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | -function gv_no_results($wpautop = true) { |
|
| 782 | +function gv_no_results( $wpautop = true ) { |
|
| 783 | 783 | return GravityView_API::no_results( $wpautop ); |
| 784 | 784 | } |
| 785 | 785 | |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | |
| 793 | 793 | $href = gv_directory_link(); |
| 794 | 794 | |
| 795 | - if( empty( $href ) ) { return NULL; } |
|
| 795 | + if ( empty( $href ) ) { return NULL; } |
|
| 796 | 796 | |
| 797 | 797 | // calculate link label |
| 798 | 798 | $gravityview_view = GravityView_View::getInstance(); |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | |
| 809 | 809 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
| 810 | 810 | 'data-viewid' => $gravityview_view->getViewId() |
| 811 | - )); |
|
| 811 | + ) ); |
|
| 812 | 812 | |
| 813 | 813 | return $link; |
| 814 | 814 | } |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | */ |
| 828 | 828 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 829 | 829 | |
| 830 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 830 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 831 | 831 | |
| 832 | 832 | // For the complete field value as generated by Gravity Forms |
| 833 | 833 | return $display_value; |
@@ -857,16 +857,16 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | $terms = explode( ', ', $value ); |
| 859 | 859 | |
| 860 | - foreach ($terms as $term_name ) { |
|
| 860 | + foreach ( $terms as $term_name ) { |
|
| 861 | 861 | |
| 862 | 862 | // If we're processing a category, |
| 863 | - if( $taxonomy === 'category' ) { |
|
| 863 | + if ( $taxonomy === 'category' ) { |
|
| 864 | 864 | |
| 865 | 865 | // Use rgexplode to prevent errors if : doesn't exist |
| 866 | 866 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
| 867 | 867 | |
| 868 | 868 | // The explode was succesful; we have the category ID |
| 869 | - if( !empty( $term_id )) { |
|
| 869 | + if ( ! empty( $term_id ) ) { |
|
| 870 | 870 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 871 | 871 | } else { |
| 872 | 872 | // We have to fall back to the name |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | // There's still a tag/category here. |
| 882 | - if( $term ) { |
|
| 882 | + if ( $term ) { |
|
| 883 | 883 | |
| 884 | 884 | $term_link = get_term_link( $term, $taxonomy ); |
| 885 | 885 | |
@@ -888,11 +888,11 @@ discard block |
||
| 888 | 888 | continue; |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 891 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 892 | 892 | } |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - return implode(', ', $output ); |
|
| 895 | + return implode( ', ', $output ); |
|
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | /** |
@@ -906,8 +906,8 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 908 | 908 | |
| 909 | - if( empty( $link ) ) { |
|
| 910 | - return strip_tags( $output); |
|
| 909 | + if ( empty( $link ) ) { |
|
| 910 | + return strip_tags( $output ); |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | return $output; |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | $fe = GravityView_frontend::getInstance(); |
| 927 | 927 | |
| 928 | 928 | // Solve problem when loading content via admin-ajax.php |
| 929 | - if( ! $fe->getGvOutputData() ) { |
|
| 929 | + if ( ! $fe->getGvOutputData() ) { |
|
| 930 | 930 | |
| 931 | 931 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
| 932 | 932 | |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | // Make 100% sure that we're dealing with a properly called situation |
| 937 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 937 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 938 | 938 | |
| 939 | 939 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
| 940 | 940 | |
@@ -954,10 +954,10 @@ discard block |
||
| 954 | 954 | |
| 955 | 955 | $fe = GravityView_frontend::getInstance(); |
| 956 | 956 | |
| 957 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
| 957 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
| 958 | 958 | |
| 959 | 959 | // If not set, grab the current view ID |
| 960 | - if( empty( $view_id ) ) { |
|
| 960 | + if ( empty( $view_id ) ) { |
|
| 961 | 961 | $view_id = $fe->get_context_view_id(); |
| 962 | 962 | } |
| 963 | 963 | |
@@ -1022,11 +1022,11 @@ discard block |
||
| 1022 | 1022 | */ |
| 1023 | 1023 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
| 1024 | 1024 | |
| 1025 | - if( $is_edit_entry ) { |
|
| 1025 | + if ( $is_edit_entry ) { |
|
| 1026 | 1026 | $context = 'edit'; |
| 1027 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1027 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1028 | 1028 | $context = 'single'; |
| 1029 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
| 1029 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
| 1030 | 1030 | $context = GravityView_View::getInstance()->getContext(); |
| 1031 | 1031 | } |
| 1032 | 1032 | |
@@ -1054,12 +1054,12 @@ discard block |
||
| 1054 | 1054 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
| 1055 | 1055 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1056 | 1056 | |
| 1057 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1058 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1057 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1058 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1062 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
| 1061 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1062 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1137,12 +1137,12 @@ discard block |
||
| 1137 | 1137 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
| 1138 | 1138 | |
| 1139 | 1139 | // Required fields. |
| 1140 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1140 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1141 | 1141 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
| 1142 | 1142 | return ''; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1145 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1146 | 1146 | |
| 1147 | 1147 | /** |
| 1148 | 1148 | * Create the content variables for replacing. |
@@ -1158,37 +1158,37 @@ discard block |
||
| 1158 | 1158 | 'field_id' => '', |
| 1159 | 1159 | ); |
| 1160 | 1160 | |
| 1161 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
| 1161 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
| 1162 | 1162 | |
| 1163 | 1163 | // If the value is empty and we're hiding empty, return empty. |
| 1164 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1164 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1165 | 1165 | return ''; |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1169 | - $context['value'] = wpautop( $context['value'] ); |
|
| 1168 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1169 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | // Get width setting, if exists |
| 1173 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
| 1173 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
| 1174 | 1174 | |
| 1175 | 1175 | // If replacing with CSS inline formatting, let's do it. |
| 1176 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
| 1176 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
| 1177 | 1177 | |
| 1178 | 1178 | // Grab the Class using `gv_class` |
| 1179 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
| 1180 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
| 1179 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1180 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1181 | 1181 | |
| 1182 | 1182 | // Get field label if needed |
| 1183 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
| 1184 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
| 1183 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
| 1184 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | // Default Label value |
| 1188 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
| 1188 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
| 1189 | 1189 | |
| 1190 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
| 1191 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1190 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
| 1191 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | /** |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | * @param string $markup The HTML for the markup |
| 1198 | 1198 | * @param array $args All args for the field output |
| 1199 | 1199 | */ |
| 1200 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
| 1200 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
| 1201 | 1201 | |
| 1202 | 1202 | /** |
| 1203 | 1203 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | foreach ( $context as $tag => $value ) { |
| 1221 | 1221 | |
| 1222 | 1222 | // If the tag doesn't exist just skip it |
| 1223 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1223 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1224 | 1224 | continue; |
| 1225 | 1225 | } |
| 1226 | 1226 | |