@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package GravityView |
|
| 4 | - * @subpackage Gravityview/admin/metaboxes/views |
|
| 5 | - * @since 1.8 |
|
| 6 | - * @global WP_Post $post |
|
| 7 | - */ |
|
| 3 | + * @package GravityView |
|
| 4 | + * @subpackage Gravityview/admin/metaboxes/views |
|
| 5 | + * @since 1.8 |
|
| 6 | + * @global WP_Post $post |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | // Use nonce for verification |
@@ -26,22 +26,22 @@ |
||
| 26 | 26 | ?> |
| 27 | 27 | <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Start Fresh', 'gravityview' ); ?>"><?php esc_html_e( 'Start Fresh', 'gravityview' ); ?></a> |
| 28 | 28 | |
| 29 | - <?php if( !empty( $forms ) ) { ?> |
|
| 29 | + <?php if ( ! empty( $forms ) ) { ?> |
|
| 30 | 30 | <span> <?php esc_html_e( 'or use an existing form', 'gravityview' ); ?> </span> |
| 31 | 31 | <?php } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // If there are no forms to select, show no forms. |
| 35 | - if( !empty( $forms ) ) { ?> |
|
| 35 | + if ( ! empty( $forms ) ) { ?> |
|
| 36 | 36 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 37 | 37 | <option value="" <?php selected( '', $current_form, true ); ?>>— <?php esc_html_e( 'list of forms', 'gravityview' ); ?> —</option> |
| 38 | - <?php foreach( $forms as $form ) { ?> |
|
| 39 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 38 | + <?php foreach ( $forms as $form ) { ?> |
|
| 39 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 40 | 40 | <?php } ?> |
| 41 | 41 | </select> |
| 42 | 42 | <?php } ?> |
| 43 | 43 | |
| 44 | - <a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
| 44 | + <a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
| 45 | 45 | </p> |
| 46 | 46 | |
| 47 | 47 | <?php // confirm dialog box ?> |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Display the search CHECKBOX input field (supports multi-select) |
|
| 4 | - * |
|
| 5 | - * @see class-search-widget.php |
|
| 6 | - */ |
|
| 3 | + * Display the search CHECKBOX input field (supports multi-select) |
|
| 4 | + * |
|
| 5 | + * @see class-search-widget.php |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 14 | - do_action('gravityview_log_debug', 'search-field-checkbox.php - No choices for field' ); |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | + do_action( 'gravityview_log_debug', 'search-field-checkbox.php - No choices for field' ); |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | 19 | <div class="gv-search-box"> |
| 20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 22 | 22 | <?php } ?> |
| 23 | 23 | <p> |
| 24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
| 24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
| 25 | 25 | |
| 26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
| 27 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>[]" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true, 'checked' ); ?>> |
|
| 28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
| 26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
| 27 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true, 'checked' ); ?>> |
|
| 28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
| 29 | 29 | </label> |
| 30 | 30 | |
| 31 | 31 | <?php } ?> |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * GravityView Defining Post Types and Rewrite rules |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @license GPL2+ |
|
| 7 | - * @author Katz Web Services, Inc. |
|
| 8 | - * @link http://gravityview.co |
|
| 9 | - * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 10 | - * |
|
| 11 | - * @since 1.0.9 |
|
| 12 | - */ |
|
| 3 | + * GravityView Defining Post Types and Rewrite rules |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @license GPL2+ |
|
| 7 | + * @author Katz Web Services, Inc. |
|
| 8 | + * @link http://gravityview.co |
|
| 9 | + * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 10 | + * |
|
| 11 | + * @since 1.0.9 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | class GravityView_Post_Types { |
| 15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | // Load even when invalid to allow for export |
| 20 | 20 | add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) ); |
| 21 | 21 | |
| 22 | - if( GravityView_Compatibility::is_valid() ) { |
|
| 22 | + if ( GravityView_Compatibility::is_valid() ) { |
|
| 23 | 23 | add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) ); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $supports = array( 'title', 'revisions' ); |
| 45 | 45 | |
| 46 | - if( $is_hierarchical ) { |
|
| 47 | - $supports[] = 'page-attributes'; |
|
| 46 | + if ( $is_hierarchical ) { |
|
| 47 | + $supports[ ] = 'page-attributes'; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -159,14 +159,14 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | static function no_views_text() { |
| 161 | 161 | |
| 162 | - if( !class_exists( 'GravityView_Admin' ) ) { |
|
| 163 | - require_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
| 162 | + if ( ! class_exists( 'GravityView_Admin' ) ) { |
|
| 163 | + require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Floaty the astronaut |
| 167 | 167 | $image = GravityView_Admin::get_floaty(); |
| 168 | 168 | |
| 169 | - if( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
|
| 169 | + if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
|
| 170 | 170 | $output = sprintf( esc_attr__( "%sYou don't have any active views. Let’s go %screate one%s!%s\n\nIf you feel like you're lost in space and need help getting started, check out the %sGetting Started%s page.", 'gravityview' ), '<h3>', '<a href="' . admin_url( 'post-new.php?post_type=gravityview' ) . '">', '</a>', '</h3>', '<a href="' . admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) . '">', '</a>' ); |
| 171 | 171 | } else { |
| 172 | 172 | $output = esc_attr__( 'There are no active Views', 'gravityview' ); |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * |
| 70 | 70 | * @since 1.16 |
| 71 | 71 | * |
| 72 | - * @param int|string $value Number value for the field |
|
| 72 | + * @param string $value Number value for the field |
|
| 73 | 73 | * |
| 74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
| 75 | 75 | */ |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function get_content( $output, $entry, $field_settings, $field ) { |
| 60 | 60 | |
| 61 | 61 | /** Overridden by a template. */ |
| 62 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 62 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 63 | 63 | |
| 64 | 64 | return $this->get_string_from_value( $output ); |
| 65 | 65 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | switch ( intval( $value ) ) { |
| 79 | 79 | case self::ONE_TIME_PAYMENT: |
| 80 | 80 | default: |
| 81 | - $return = __('One-Time Payment', 'gravityview'); |
|
| 81 | + $return = __( 'One-Time Payment', 'gravityview' ); |
|
| 82 | 82 | break; |
| 83 | 83 | |
| 84 | 84 | case self::SUBSCRIPTION: |
| 85 | - $return = __('Subscription', 'gravityview'); |
|
| 85 | + $return = __( 'Subscription', 'gravityview' ); |
|
| 86 | 86 | break; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -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 ) ); |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | // Default Label value |
| 1192 | 1192 | $context['label_value'] = gv_label( $args['field'], $entry ); |
| 1193 | 1193 | |
| 1194 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
| 1194 | + if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ) { |
|
| 1195 | 1195 | $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
| 1196 | 1196 | } |
| 1197 | 1197 | |
@@ -1224,7 +1224,7 @@ discard block |
||
| 1224 | 1224 | foreach ( $context as $tag => $value ) { |
| 1225 | 1225 | |
| 1226 | 1226 | // If the tag doesn't exist just skip it |
| 1227 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1227 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1228 | 1228 | continue; |
| 1229 | 1229 | } |
| 1230 | 1230 | |
@@ -214,7 +214,6 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @access public |
| 216 | 216 | * @param array $entry |
| 217 | - * @param array $field |
|
| 218 | 217 | * @return null|string |
| 219 | 218 | */ |
| 220 | 219 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
@@ -1000,7 +999,7 @@ discard block |
||
| 1000 | 999 | * Get the current View ID being rendered |
| 1001 | 1000 | * |
| 1002 | 1001 | * @global GravityView_View $gravityview_view |
| 1003 | - * @return string View context "directory" or "single" |
|
| 1002 | + * @return integer View context "directory" or "single" |
|
| 1004 | 1003 | */ |
| 1005 | 1004 | function gravityview_get_view_id() { |
| 1006 | 1005 | return GravityView_View::getInstance()->getViewId(); |
@@ -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,15 +646,15 @@ 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 | |
@@ -664,9 +664,9 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | $link_parts = explode( '?', $directory_link ); |
| 666 | 666 | |
| 667 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
| 667 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 668 | 668 | |
| 669 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
| 669 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
| 670 | 670 | |
| 671 | 671 | } else { |
| 672 | 672 | |
@@ -676,18 +676,18 @@ discard block |
||
| 676 | 676 | /** |
| 677 | 677 | * @since 1.7.3 |
| 678 | 678 | */ |
| 679 | - if( $add_directory_args ) { |
|
| 679 | + if ( $add_directory_args ) { |
|
| 680 | 680 | |
| 681 | - if( !empty( $_GET['pagenum'] ) ) { |
|
| 682 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 681 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 682 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | /** |
| 686 | 686 | * @since 1.7 |
| 687 | 687 | */ |
| 688 | - if( $sort = rgget('sort') ) { |
|
| 689 | - $args['sort'] = $sort; |
|
| 690 | - $args['dir'] = rgget('dir'); |
|
| 688 | + if ( $sort = rgget( 'sort' ) ) { |
|
| 689 | + $args[ 'sort' ] = $sort; |
|
| 690 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | } |
@@ -697,8 +697,8 @@ discard block |
||
| 697 | 697 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
| 698 | 698 | * @see GravityView_frontend::get_context_view_id() |
| 699 | 699 | */ |
| 700 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 701 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 700 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 701 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | return add_query_arg( $args, $directory_link ); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 719 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 719 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -738,15 +738,15 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
| 740 | 740 | |
| 741 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 741 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 742 | 742 | $default_css_class .= ' hidden'; |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 745 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 746 | 746 | $default_css_class .= ' gv-container-no-results'; |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 749 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | 752 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | |
| 758 | 758 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 759 | 759 | |
| 760 | - if( $echo ) { |
|
| 760 | + if ( $echo ) { |
|
| 761 | 761 | echo $css_class; |
| 762 | 762 | } |
| 763 | 763 | |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $value = GravityView_API::field_value( $entry, $field ); |
| 770 | 770 | |
| 771 | - if( $value === '' ) { |
|
| 771 | + if ( $value === '' ) { |
|
| 772 | 772 | /** |
| 773 | 773 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 774 | 774 | * @param string $value (empty string) |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | return GravityView_API::entry_link( $entry, $post_id ); |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | -function gv_no_results($wpautop = true) { |
|
| 790 | +function gv_no_results( $wpautop = true ) { |
|
| 791 | 791 | return GravityView_API::no_results( $wpautop ); |
| 792 | 792 | } |
| 793 | 793 | |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | |
| 801 | 801 | $href = gv_directory_link(); |
| 802 | 802 | |
| 803 | - if( empty( $href ) ) { return NULL; } |
|
| 803 | + if ( empty( $href ) ) { return NULL; } |
|
| 804 | 804 | |
| 805 | 805 | // calculate link label |
| 806 | 806 | $gravityview_view = GravityView_View::getInstance(); |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | |
| 817 | 817 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
| 818 | 818 | 'data-viewid' => $gravityview_view->getViewId() |
| 819 | - )); |
|
| 819 | + ) ); |
|
| 820 | 820 | |
| 821 | 821 | return $link; |
| 822 | 822 | } |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | */ |
| 836 | 836 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 837 | 837 | |
| 838 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 838 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 839 | 839 | |
| 840 | 840 | // For the complete field value as generated by Gravity Forms |
| 841 | 841 | return $display_value; |
@@ -865,16 +865,16 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | $terms = explode( ', ', $value ); |
| 867 | 867 | |
| 868 | - foreach ($terms as $term_name ) { |
|
| 868 | + foreach ( $terms as $term_name ) { |
|
| 869 | 869 | |
| 870 | 870 | // If we're processing a category, |
| 871 | - if( $taxonomy === 'category' ) { |
|
| 871 | + if ( $taxonomy === 'category' ) { |
|
| 872 | 872 | |
| 873 | 873 | // Use rgexplode to prevent errors if : doesn't exist |
| 874 | 874 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
| 875 | 875 | |
| 876 | 876 | // The explode was succesful; we have the category ID |
| 877 | - if( !empty( $term_id )) { |
|
| 877 | + if ( ! empty( $term_id ) ) { |
|
| 878 | 878 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 879 | 879 | } else { |
| 880 | 880 | // We have to fall back to the name |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | // There's still a tag/category here. |
| 890 | - if( $term ) { |
|
| 890 | + if ( $term ) { |
|
| 891 | 891 | |
| 892 | 892 | $term_link = get_term_link( $term, $taxonomy ); |
| 893 | 893 | |
@@ -896,11 +896,11 @@ discard block |
||
| 896 | 896 | continue; |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 899 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | - return implode(', ', $output ); |
|
| 903 | + return implode( ', ', $output ); |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -914,8 +914,8 @@ discard block |
||
| 914 | 914 | |
| 915 | 915 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 916 | 916 | |
| 917 | - if( empty( $link ) ) { |
|
| 918 | - return strip_tags( $output); |
|
| 917 | + if ( empty( $link ) ) { |
|
| 918 | + return strip_tags( $output ); |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | return $output; |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | $fe = GravityView_frontend::getInstance(); |
| 935 | 935 | |
| 936 | 936 | // Solve problem when loading content via admin-ajax.php |
| 937 | - if( ! $fe->getGvOutputData() ) { |
|
| 937 | + if ( ! $fe->getGvOutputData() ) { |
|
| 938 | 938 | |
| 939 | 939 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
| 940 | 940 | |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | // Make 100% sure that we're dealing with a properly called situation |
| 945 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 945 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 946 | 946 | |
| 947 | 947 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
| 948 | 948 | |
@@ -962,10 +962,10 @@ discard block |
||
| 962 | 962 | |
| 963 | 963 | $fe = GravityView_frontend::getInstance(); |
| 964 | 964 | |
| 965 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
| 965 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
| 966 | 966 | |
| 967 | 967 | // If not set, grab the current view ID |
| 968 | - if( empty( $view_id ) ) { |
|
| 968 | + if ( empty( $view_id ) ) { |
|
| 969 | 969 | $view_id = $fe->get_context_view_id(); |
| 970 | 970 | } |
| 971 | 971 | |
@@ -1030,11 +1030,11 @@ discard block |
||
| 1030 | 1030 | */ |
| 1031 | 1031 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
| 1032 | 1032 | |
| 1033 | - if( $is_edit_entry ) { |
|
| 1033 | + if ( $is_edit_entry ) { |
|
| 1034 | 1034 | $context = 'edit'; |
| 1035 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1035 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1036 | 1036 | $context = 'single'; |
| 1037 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
| 1037 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
| 1038 | 1038 | $context = GravityView_View::getInstance()->getContext(); |
| 1039 | 1039 | } |
| 1040 | 1040 | |
@@ -1062,12 +1062,12 @@ discard block |
||
| 1062 | 1062 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
| 1063 | 1063 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1064 | 1064 | |
| 1065 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1066 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1065 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1066 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1070 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
| 1069 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1070 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1145,12 +1145,12 @@ discard block |
||
| 1145 | 1145 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
| 1146 | 1146 | |
| 1147 | 1147 | // Required fields. |
| 1148 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1148 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1149 | 1149 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
| 1150 | 1150 | return ''; |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1153 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1154 | 1154 | |
| 1155 | 1155 | /** |
| 1156 | 1156 | * Create the content variables for replacing. |
@@ -1166,37 +1166,37 @@ discard block |
||
| 1166 | 1166 | 'field_id' => '', |
| 1167 | 1167 | ); |
| 1168 | 1168 | |
| 1169 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
| 1169 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
| 1170 | 1170 | |
| 1171 | 1171 | // If the value is empty and we're hiding empty, return empty. |
| 1172 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1172 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1173 | 1173 | return ''; |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1177 | - $context['value'] = wpautop( $context['value'] ); |
|
| 1176 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1177 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | // Get width setting, if exists |
| 1181 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
| 1181 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
| 1182 | 1182 | |
| 1183 | 1183 | // If replacing with CSS inline formatting, let's do it. |
| 1184 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
| 1184 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
| 1185 | 1185 | |
| 1186 | 1186 | // Grab the Class using `gv_class` |
| 1187 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
| 1188 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
| 1187 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1188 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1189 | 1189 | |
| 1190 | 1190 | // Get field label if needed |
| 1191 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
| 1192 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
| 1191 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
| 1192 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | // Default Label value |
| 1196 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
| 1196 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
| 1197 | 1197 | |
| 1198 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
| 1199 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1198 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
| 1199 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | /** |
@@ -1205,7 +1205,7 @@ discard block |
||
| 1205 | 1205 | * @param string $markup The HTML for the markup |
| 1206 | 1206 | * @param array $args All args for the field output |
| 1207 | 1207 | */ |
| 1208 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
| 1208 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | 1211 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | foreach ( $context as $tag => $value ) { |
| 1229 | 1229 | |
| 1230 | 1230 | // If the tag doesn't exist just skip it |
| 1231 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1231 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1232 | 1232 | continue; |
| 1233 | 1233 | } |
| 1234 | 1234 | |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Display the tab navigation for the Settings metabox |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @subpackage Gravityview/admin/metaboxes/views |
|
| 7 | - * @since 1.8 |
|
| 8 | - * |
|
| 9 | - * @global GravityView_Metabox_Tab[] $metaboxes |
|
| 10 | - * @global WP_Post $post |
|
| 11 | - */ |
|
| 3 | + * Display the tab navigation for the Settings metabox |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @subpackage Gravityview/admin/metaboxes/views |
|
| 7 | + * @since 1.8 |
|
| 8 | + * |
|
| 9 | + * @global GravityView_Metabox_Tab[] $metaboxes |
|
| 10 | + * @global WP_Post $post |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | - foreach( $metaboxes as $metabox ) { |
|
| 18 | - $class = !isset( $class ) ? 'nav-tab-active' : ''; |
|
| 17 | + foreach ( $metaboxes as $metabox ) { |
|
| 18 | + $class = ! isset( $class ) ? 'nav-tab-active' : ''; |
|
| 19 | 19 | ?> |
| 20 | 20 | <li class="ui-state-default"> |
| 21 | 21 | <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr( $metabox->id ); ?>"> |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Display the search by entry date input boxes |
|
| 4 | - * |
|
| 5 | - * @see class-search-widget.php |
|
| 6 | - */ |
|
| 3 | + * Display the search by entry date input boxes |
|
| 4 | + * |
|
| 5 | + * @see class-search-widget.php |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $search_field = $gravityview_view->search_field; |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <div class="gv-search-box gv-search-date"> |
| 16 | - <?php if( ! gv_empty( $label, false ) ) { ?> |
|
| 16 | + <?php if ( ! gv_empty( $label, false ) ) { ?> |
|
| 17 | 17 | <label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p> |
| 20 | - <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>"> |
|
| 21 | - <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>"> |
|
| 20 | + <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>"> |
|
| 21 | + <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>"> |
|
| 22 | 22 | </p> |
| 23 | 23 | </div> |
| 24 | 24 | \ No newline at end of file |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Renders all the metaboxes on Add New / Edit View post type. |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @license GPL2+ |
|
| 7 | - * @author Katz Web Services, Inc. |
|
| 8 | - * @link http://gravityview.co |
|
| 9 | - * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 10 | - * |
|
| 11 | - * @since 1.0.0 |
|
| 12 | - */ |
|
| 3 | + * Renders all the metaboxes on Add New / Edit View post type. |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @license GPL2+ |
|
| 7 | + * @author Katz Web Services, Inc. |
|
| 8 | + * @link http://gravityview.co |
|
| 9 | + * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 10 | + * |
|
| 11 | + * @since 1.0.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | /** If this file is called directly, abort. */ |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1037,15 +1037,15 @@ discard block |
||
| 1037 | 1037 | GFForms::register_scripts(); |
| 1038 | 1038 | |
| 1039 | 1039 | $scripts = array( |
| 1040 | - 'sack', |
|
| 1041 | - 'gform_gravityforms', |
|
| 1042 | - 'gform_forms', |
|
| 1043 | - 'gform_form_admin', |
|
| 1044 | - 'jquery-ui-autocomplete' |
|
| 1040 | + 'sack', |
|
| 1041 | + 'gform_gravityforms', |
|
| 1042 | + 'gform_forms', |
|
| 1043 | + 'gform_form_admin', |
|
| 1044 | + 'jquery-ui-autocomplete' |
|
| 1045 | 1045 | ); |
| 1046 | 1046 | |
| 1047 | 1047 | if ( wp_is_mobile() ) { |
| 1048 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1048 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | foreach ($scripts as $script) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 274 | 274 | |
| 275 | 275 | $output = ''; |
| 276 | 276 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function save_postdata( $post_id ) { |
| 431 | 431 | |
| 432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 432 | + if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
@@ -28,30 +28,30 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 45 | 45 | |
| 46 | 46 | // @todo check if this hook is needed.. |
| 47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 48 | 48 | |
| 49 | 49 | // Add Connected Form column |
| 50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 51 | 51 | |
| 52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 53 | 53 | |
| 54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 55 | 55 | |
| 56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 67 | 67 | global $pagenow; |
| 68 | 68 | |
| 69 | - if ( !is_admin() ) { |
|
| 69 | + if ( ! is_admin() ) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | function add_view_dropdown() { |
| 88 | 88 | $current_screen = get_current_screen(); |
| 89 | 89 | |
| 90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $forms = gravityview_get_forms(); |
| 95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
| 96 | 96 | // If there are no forms to select, show no forms. |
| 97 | - if( !empty( $forms ) ) { ?> |
|
| 97 | + if ( ! empty( $forms ) ) { ?> |
|
| 98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 100 | - <?php foreach( $forms as $form ) { ?> |
|
| 101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 100 | + <?php foreach ( $forms as $form ) { ?> |
|
| 101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 102 | 102 | <?php } ?> |
| 103 | 103 | </select> |
| 104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
| 136 | 136 | |
| 137 | - if( empty( $connected_views ) ) { |
|
| 137 | + if ( empty( $connected_views ) ) { |
|
| 138 | 138 | return $menu_items; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $sub_menu_items = array(); |
| 142 | 142 | foreach ( (array)$connected_views as $view ) { |
| 143 | 143 | |
| 144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 149 | 149 | |
| 150 | - $sub_menu_items[] = array( |
|
| 150 | + $sub_menu_items[ ] = array( |
|
| 151 | 151 | 'label' => esc_attr( $label ), |
| 152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // If there were no items added, then let's create the parent menu |
| 157 | - if( $sub_menu_items ) { |
|
| 157 | + if ( $sub_menu_items ) { |
|
| 158 | 158 | |
| 159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 160 | - $sub_menu_items[] = array( |
|
| 160 | + $sub_menu_items[ ] = array( |
|
| 161 | 161 | 'url' => '#', |
| 162 | 162 | 'label' => '', |
| 163 | 163 | 'menu_class' => 'hidden', |
| 164 | 164 | 'capabilities' => '', |
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - $menu_items['gravityview'] = array( |
|
| 167 | + $menu_items[ 'gravityview' ] = array( |
|
| 168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $add = array( 'captcha', 'page' ); |
| 195 | 195 | |
| 196 | 196 | // Don't allowing editing the following values: |
| 197 | - if( $context === 'edit' ) { |
|
| 198 | - $add[] = 'post_id'; |
|
| 197 | + if ( $context === 'edit' ) { |
|
| 198 | + $add[ ] = 'post_id'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
| 218 | 218 | foreach ( $default_args as $key => $arg ) { |
| 219 | 219 | |
| 220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 222 | 222 | |
| 223 | 223 | // By default, use `tooltip` if defined. |
| 224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 225 | 225 | |
| 226 | 226 | // Otherwise, use the description as a tooltip. |
| 227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 228 | - $tooltip = $arg['desc']; |
|
| 227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 228 | + $tooltip = $arg[ 'desc' ]; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // If there's no tooltip set, continue |
| 232 | - if( empty( $tooltip ) ) { |
|
| 232 | + if ( empty( $tooltip ) ) { |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Add the tooltip |
| 237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 238 | - 'title' => $arg['label'], |
|
| 237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 238 | + 'title' => $arg[ 'label' ], |
|
| 239 | 239 | 'value' => $tooltip, |
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 256 | 256 | |
| 257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 258 | 258 | |
| 259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 274 | 274 | |
| 275 | 275 | $output = ''; |
| 276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 294 | 294 | |
| 295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 296 | 296 | |
| 297 | 297 | break; |
| 298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
| 333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 334 | 334 | |
| 335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
| 336 | - if( empty( $form ) ) { |
|
| 336 | + if ( empty( $form ) ) { |
|
| 337 | 337 | return ''; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // The $form is passed as the form ID |
| 341 | - if( !is_array( $form ) ) { |
|
| 341 | + if ( ! is_array( $form ) ) { |
|
| 342 | 342 | $form = gravityview_get_form( $form ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $form_id = $form['id']; |
|
| 345 | + $form_id = $form[ 'id' ]; |
|
| 346 | 346 | $links = array(); |
| 347 | 347 | |
| 348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 352 | 352 | } else { |
| 353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $output = ''; |
| 372 | 372 | |
| 373 | - if( !empty( $include_form_link ) ) { |
|
| 373 | + if ( ! empty( $include_form_link ) ) { |
|
| 374 | 374 | $output .= $form_link; |
| 375 | 375 | } |
| 376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 384 | 384 | |
| 385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 386 | 386 | |
| 387 | 387 | return $output; |
| 388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | // Get the date column and save it for later to add back in. |
| 397 | 397 | // This adds it after the Data Source column. |
| 398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
| 399 | - $date = $columns['date']; |
|
| 400 | - unset( $columns['date'] ); |
|
| 399 | + $date = $columns[ 'date' ]; |
|
| 400 | + unset( $columns[ 'date' ] ); |
|
| 401 | 401 | |
| 402 | 402 | $data_source_required_caps = array( |
| 403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | 'gravityforms_preview_forms', |
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 416 | 416 | |
| 417 | 417 | // Add the date back in. |
| 418 | - $columns['date'] = $date; |
|
| 418 | + $columns[ 'date' ] = $date; |
|
| 419 | 419 | |
| 420 | 420 | return $columns; |
| 421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function save_postdata( $post_id ) { |
| 431 | 431 | |
| 432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // validate post_type |
| 437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | |
@@ -449,67 +449,67 @@ discard block |
||
| 449 | 449 | $statii = array(); |
| 450 | 450 | |
| 451 | 451 | // check if this is a start fresh View |
| 452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 453 | 453 | |
| 454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 455 | 455 | // save form id |
| 456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 457 | 457 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
| 462 | 462 | return; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Was this a start fresh? |
| 466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 468 | 468 | } else { |
| 469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Check if we have a template id |
| 473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 474 | 474 | |
| 475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 476 | 476 | |
| 477 | 477 | // now save template id |
| 478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | // save View Configuration metabox |
| 483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 484 | 484 | |
| 485 | 485 | // template settings |
| 486 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 487 | - $_POST['template_settings'] = array(); |
|
| 486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 487 | + $_POST[ 'template_settings' ] = array(); |
|
| 488 | 488 | } |
| 489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 490 | 490 | |
| 491 | 491 | $fields = array(); |
| 492 | 492 | |
| 493 | 493 | // Directory&single Visible Fields |
| 494 | - if( !empty( $preset_fields ) ) { |
|
| 494 | + if ( ! empty( $preset_fields ) ) { |
|
| 495 | 495 | |
| 496 | 496 | $fields = $preset_fields; |
| 497 | 497 | |
| 498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
| 498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
| 499 | 499 | $fields = _gravityview_process_posted_fields(); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 502 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 503 | 503 | |
| 504 | 504 | // Directory Visible Widgets |
| 505 | - if( empty( $_POST['widgets'] ) ) { |
|
| 506 | - $_POST['widgets'] = array(); |
|
| 505 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 506 | + $_POST[ 'widgets' ] = array(); |
|
| 507 | 507 | } |
| 508 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
| 508 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
| 509 | 509 | |
| 510 | 510 | } // end save view configuration |
| 511 | 511 | |
| 512 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 512 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | /** |
@@ -541,20 +541,20 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | $output = ''; |
| 543 | 543 | |
| 544 | - if( !empty( $fields ) ) { |
|
| 544 | + if ( ! empty( $fields ) ) { |
|
| 545 | 545 | |
| 546 | - foreach( $fields as $id => $details ) { |
|
| 546 | + foreach ( $fields as $id => $details ) { |
|
| 547 | 547 | |
| 548 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
| 548 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // Edit mode only allows editing the parent fields, not single inputs. |
| 553 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 553 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 554 | 554 | continue; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
| 557 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
| 558 | 558 | |
| 559 | 559 | } // End foreach |
| 560 | 560 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | echo $output; |
| 563 | 563 | |
| 564 | 564 | // For the EDIT view we only want to allow the form fields. |
| 565 | - if( $context === 'edit' ) { |
|
| 565 | + if ( $context === 'edit' ) { |
|
| 566 | 566 | return; |
| 567 | 567 | } |
| 568 | 568 | |
@@ -586,16 +586,16 @@ discard block |
||
| 586 | 586 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 587 | 587 | array( |
| 588 | 588 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 589 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 589 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 590 | 590 | 'field_id' => 'all-fields', |
| 591 | 591 | 'label_type' => 'field', |
| 592 | 592 | 'input_type' => NULL, |
| 593 | 593 | 'field_options' => NULL, |
| 594 | 594 | 'settings_html' => NULL, |
| 595 | 595 | ) |
| 596 | - )); |
|
| 596 | + ) ); |
|
| 597 | 597 | |
| 598 | - if( !empty( $additional_fields )) { |
|
| 598 | + if ( ! empty( $additional_fields ) ) { |
|
| 599 | 599 | foreach ( (array)$additional_fields as $item ) { |
| 600 | 600 | |
| 601 | 601 | // Prevent items from not having index set |
@@ -606,16 +606,16 @@ discard block |
||
| 606 | 606 | 'input_type' => NULL, |
| 607 | 607 | 'field_options' => NULL, |
| 608 | 608 | 'settings_html' => NULL, |
| 609 | - )); |
|
| 609 | + ) ); |
|
| 610 | 610 | |
| 611 | 611 | // Backward compat. |
| 612 | - if( !empty( $item['field_options'] ) ) { |
|
| 612 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 613 | 613 | // Use settings_html from now on. |
| 614 | - $item['settings_html'] = $item['field_options']; |
|
| 614 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | // Render a label for each of them |
| 618 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
| 618 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
| 619 | 619 | |
| 620 | 620 | } |
| 621 | 621 | } |
@@ -628,64 +628,64 @@ discard block |
||
| 628 | 628 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 629 | 629 | * @return array |
| 630 | 630 | */ |
| 631 | - function get_entry_default_fields($form, $zone) { |
|
| 631 | + function get_entry_default_fields( $form, $zone ) { |
|
| 632 | 632 | |
| 633 | 633 | $entry_default_fields = array(); |
| 634 | 634 | |
| 635 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 635 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 636 | 636 | |
| 637 | 637 | $entry_default_fields = array( |
| 638 | 638 | 'id' => array( |
| 639 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 639 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 640 | 640 | 'type' => 'id', |
| 641 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 641 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 642 | 642 | ), |
| 643 | 643 | 'date_created' => array( |
| 644 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 645 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 644 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 645 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 646 | 646 | 'type' => 'date_created', |
| 647 | 647 | ), |
| 648 | 648 | 'source_url' => array( |
| 649 | - 'label' => __('Source URL', 'gravityview'), |
|
| 649 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 650 | 650 | 'type' => 'source_url', |
| 651 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 651 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 652 | 652 | ), |
| 653 | 653 | 'ip' => array( |
| 654 | - 'label' => __('User IP', 'gravityview'), |
|
| 654 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 655 | 655 | 'type' => 'ip', |
| 656 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 656 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 657 | 657 | ), |
| 658 | 658 | 'created_by' => array( |
| 659 | - 'label' => __('User', 'gravityview'), |
|
| 659 | + 'label' => __( 'User', 'gravityview' ), |
|
| 660 | 660 | 'type' => 'created_by', |
| 661 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 661 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 662 | 662 | ), |
| 663 | 663 | |
| 664 | 664 | /** |
| 665 | 665 | * @since 1.2 |
| 666 | 666 | */ |
| 667 | 667 | 'custom' => array( |
| 668 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 668 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 669 | 669 | 'type' => 'custom', |
| 670 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 670 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 671 | 671 | ), |
| 672 | 672 | |
| 673 | 673 | /** |
| 674 | 674 | * @since 1.7.2 |
| 675 | 675 | */ |
| 676 | 676 | 'other_entries' => array( |
| 677 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 677 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 678 | 678 | 'type' => 'other_entries', |
| 679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 679 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 680 | 680 | ), |
| 681 | 681 | ); |
| 682 | 682 | |
| 683 | 683 | |
| 684 | - if( 'single' !== $zone) { |
|
| 684 | + if ( 'single' !== $zone ) { |
|
| 685 | 685 | |
| 686 | - $entry_default_fields['entry_link'] = array( |
|
| 687 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 688 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 686 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 687 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 688 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 689 | 689 | 'type' => 'entry_link', |
| 690 | 690 | ); |
| 691 | 691 | } |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | * @param string|array $form form_ID or form object |
| 700 | 700 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 701 | 701 | */ |
| 702 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 702 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | /** |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | */ |
| 711 | 711 | function get_available_fields( $form = '', $zone = NULL ) { |
| 712 | 712 | |
| 713 | - if( empty( $form ) ) { |
|
| 713 | + if ( empty( $form ) ) { |
|
| 714 | 714 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
| 715 | 715 | return array(); |
| 716 | 716 | } |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $fields = gravityview_get_form_fields( $form, true ); |
| 720 | 720 | |
| 721 | 721 | // get meta fields ( only if form was already created ) |
| 722 | - if( !is_array( $form ) ) { |
|
| 722 | + if ( ! is_array( $form ) ) { |
|
| 723 | 723 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 724 | 724 | } else { |
| 725 | 725 | $meta_fields = array(); |
@@ -743,11 +743,11 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | $widgets = $this->get_registered_widgets(); |
| 745 | 745 | |
| 746 | - if( !empty( $widgets ) ) { |
|
| 746 | + if ( ! empty( $widgets ) ) { |
|
| 747 | 747 | |
| 748 | - foreach( $widgets as $id => $details ) { |
|
| 748 | + foreach ( $widgets as $id => $details ) { |
|
| 749 | 749 | |
| 750 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 750 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 751 | 751 | |
| 752 | 752 | } |
| 753 | 753 | } |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 782 | 782 | global $post; |
| 783 | 783 | |
| 784 | - if( $type === 'widget' ) { |
|
| 784 | + if ( $type === 'widget' ) { |
|
| 785 | 785 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 786 | 786 | } else { |
| 787 | 787 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -790,15 +790,15 @@ discard block |
||
| 790 | 790 | $available_items = array(); |
| 791 | 791 | |
| 792 | 792 | // if saved values, get available fields to label everyone |
| 793 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 793 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 794 | 794 | |
| 795 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 796 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 795 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 796 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 797 | 797 | } else { |
| 798 | 798 | $form = gravityview_get_form_id( $post->ID ); |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - if( 'field' === $type ) { |
|
| 801 | + if ( 'field' === $type ) { |
|
| 802 | 802 | $available_items = $this->get_available_fields( $form, $zone ); |
| 803 | 803 | } else { |
| 804 | 804 | $available_items = $this->get_registered_widgets(); |
@@ -806,39 +806,39 @@ discard block |
||
| 806 | 806 | |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - foreach( $rows as $row ) : |
|
| 810 | - foreach( $row as $col => $areas ) : |
|
| 811 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 809 | + foreach ( $rows as $row ) : |
|
| 810 | + foreach ( $row as $col => $areas ) : |
|
| 811 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 812 | 812 | |
| 813 | 813 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 814 | 814 | |
| 815 | - <?php foreach( $areas as $area ) : ?> |
|
| 815 | + <?php foreach ( $areas as $area ) : ?> |
|
| 816 | 816 | |
| 817 | 817 | <div class="gv-droppable-area"> |
| 818 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 818 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 819 | 819 | |
| 820 | 820 | <?php // render saved fields |
| 821 | 821 | |
| 822 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 822 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 823 | 823 | |
| 824 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 824 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 825 | 825 | |
| 826 | 826 | $input_type = NULL; |
| 827 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 827 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 828 | 828 | |
| 829 | - if( !$original_item ) { |
|
| 829 | + if ( ! $original_item ) { |
|
| 830 | 830 | |
| 831 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
| 831 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
| 832 | 832 | |
| 833 | 833 | $original_item = $field; |
| 834 | 834 | } else { |
| 835 | 835 | |
| 836 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 836 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 837 | 837 | |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | // Field options dialog box |
| 841 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 841 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 842 | 842 | |
| 843 | 843 | $item = array( |
| 844 | 844 | 'input_type' => $input_type, |
@@ -847,16 +847,16 @@ discard block |
||
| 847 | 847 | ); |
| 848 | 848 | |
| 849 | 849 | // Merge the values with the current item to pass things like widget descriptions and original field names |
| 850 | - if( $original_item ) { |
|
| 850 | + if ( $original_item ) { |
|
| 851 | 851 | $item = wp_parse_args( $item, $original_item ); |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | - switch( $type ) { |
|
| 854 | + switch ( $type ) { |
|
| 855 | 855 | case 'widget': |
| 856 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 856 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 857 | 857 | break; |
| 858 | 858 | default: |
| 859 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
| 859 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | |
@@ -866,11 +866,11 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | } // End if zone is not empty ?> |
| 868 | 868 | |
| 869 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 869 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 870 | 870 | </div> |
| 871 | 871 | <div class="gv-droppable-area-action"> |
| 872 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 873 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 872 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 873 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 874 | 874 | </div> |
| 875 | 875 | </div> |
| 876 | 876 | |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 893 | 893 | |
| 894 | 894 | $widgets = array(); |
| 895 | - if( !empty( $post_id ) ) { |
|
| 895 | + if ( ! empty( $post_id ) ) { |
|
| 896 | 896 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
| 897 | 897 | |
| 898 | 898 | } |
@@ -923,19 +923,19 @@ discard block |
||
| 923 | 923 | */ |
| 924 | 924 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 925 | 925 | |
| 926 | - if( empty( $template_id ) ) { |
|
| 926 | + if ( empty( $template_id ) ) { |
|
| 927 | 927 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
| 928 | 928 | return; |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 932 | 932 | |
| 933 | - if( empty( $template_areas ) ) { |
|
| 933 | + if ( empty( $template_areas ) ) { |
|
| 934 | 934 | |
| 935 | 935 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
| 936 | 936 | $output = '<div>'; |
| 937 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 938 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 937 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 938 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 939 | 939 | $output .= '</div>'; |
| 940 | 940 | } else { |
| 941 | 941 | |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - if( $echo ) { |
|
| 953 | + if ( $echo ) { |
|
| 954 | 954 | echo $output; |
| 955 | 955 | } |
| 956 | 956 | |
@@ -970,25 +970,25 @@ discard block |
||
| 970 | 970 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 971 | 971 | |
| 972 | 972 | // Add the GV font (with the Astronaut) |
| 973 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 973 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 974 | 974 | |
| 975 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 975 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 976 | 976 | |
| 977 | 977 | // Don't process any scripts below here if it's not a GravityView page. |
| 978 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
| 978 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
| 979 | 979 | |
| 980 | 980 | // Only enqueue the following on single pages |
| 981 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
| 981 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
| 982 | 982 | |
| 983 | 983 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 984 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 984 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 985 | 985 | |
| 986 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 986 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 987 | 987 | |
| 988 | 988 | //enqueue scripts |
| 989 | 989 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
| 990 | 990 | |
| 991 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 991 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 992 | 992 | 'cookiepath' => COOKIEPATH, |
| 993 | 993 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 994 | 994 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1001,9 +1001,9 @@ discard block |
||
| 1001 | 1001 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1002 | 1002 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1003 | 1003 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1004 | - )); |
|
| 1004 | + ) ); |
|
| 1005 | 1005 | |
| 1006 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1006 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1007 | 1007 | |
| 1008 | 1008 | self::enqueue_gravity_forms_scripts(); |
| 1009 | 1009 | |
@@ -1022,10 +1022,10 @@ discard block |
||
| 1022 | 1022 | ); |
| 1023 | 1023 | |
| 1024 | 1024 | if ( wp_is_mobile() ) { |
| 1025 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1025 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | - foreach ($scripts as $script) { |
|
| 1028 | + foreach ( $scripts as $script ) { |
|
| 1029 | 1029 | wp_enqueue_script( $script ); |
| 1030 | 1030 | } |
| 1031 | 1031 | } |
@@ -1034,11 +1034,11 @@ discard block |
||
| 1034 | 1034 | |
| 1035 | 1035 | $filter = current_filter(); |
| 1036 | 1036 | |
| 1037 | - if( preg_match('/script/ism', $filter ) ) { |
|
| 1037 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
| 1038 | 1038 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
| 1039 | 1039 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
| 1040 | 1040 | $registered = array_merge( $registered, $allow_scripts ); |
| 1041 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
| 1041 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
| 1042 | 1042 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
| 1043 | 1043 | $registered = array_merge( $registered, $allow_styles ); |
| 1044 | 1044 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | * @param bool $url_encode Whether to URL-encode output |
| 136 | 136 | * @param bool $esc_html Whether to apply `esc_html()` to output |
| 137 | 137 | * |
| 138 | - * @return mixed |
|
| 138 | + * @return string |
|
| 139 | 139 | */ |
| 140 | 140 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 141 | 141 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
| 112 | 112 | |
| 113 | - if( $this->_custom_merge_tag ) { |
|
| 113 | + if ( $this->_custom_merge_tag ) { |
|
| 114 | 114 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
| 115 | 115 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
| 116 | 116 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
| 134 | 134 | */ |
| 135 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 135 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @see GFCommon::replace_variables_prepopulate() |
| 141 | 141 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
| 142 | 142 | */ |
| 143 | - if( false === $form ) { |
|
| 143 | + if ( false === $form ) { |
|
| 144 | 144 | return $text; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -173,19 +173,19 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 175 | 175 | |
| 176 | - foreach( $matches as $match ) { |
|
| 176 | + foreach ( $matches as $match ) { |
|
| 177 | 177 | |
| 178 | - $full_tag = $match[0]; |
|
| 178 | + $full_tag = $match[ 0 ]; |
|
| 179 | 179 | |
| 180 | 180 | // Strip the Merge Tags |
| 181 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
| 181 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
| 182 | 182 | |
| 183 | 183 | // Replace the value from the entry, if exists |
| 184 | - if( isset( $entry[ $tag ] ) ) { |
|
| 184 | + if ( isset( $entry[ $tag ] ) ) { |
|
| 185 | 185 | |
| 186 | 186 | $value = $entry[ $tag ]; |
| 187 | 187 | |
| 188 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
| 188 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
| 189 | 189 | $value = $this->get_content( $value ); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function _filter_sortable_fields( $not_sortable ) { |
| 260 | 260 | |
| 261 | - if( ! $this->is_sortable ) { |
|
| 262 | - $not_sortable[] = $this->name; |
|
| 261 | + if ( ! $this->is_sortable ) { |
|
| 262 | + $not_sortable[ ] = $this->name; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | return $not_sortable; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | 'date_display' => array( |
| 289 | 289 | 'type' => 'text', |
| 290 | 290 | 'label' => __( 'Override Date Format', 'gravityview' ), |
| 291 | - '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>' ), |
|
| 291 | + '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>' ), |
|
| 292 | 292 | /** |
| 293 | 293 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
| 294 | 294 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $options = $this->field_support_options(); |
| 315 | 315 | |
| 316 | - if( isset( $options[ $key ] ) ) { |
|
| 316 | + if ( isset( $options[ $key ] ) ) { |
|
| 317 | 317 | $field_options[ $key ] = $options[ $key ]; |
| 318 | 318 | } |
| 319 | 319 | |