@@ -255,7 +255,6 @@ |
||
| 255 | 255 | * Get the default date format for a field based on the field ID and the time format setting |
| 256 | 256 | * |
| 257 | 257 | * @since 1.14 |
| 258 | - |
|
| 259 | 258 | * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14} |
| 260 | 259 | * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14} |
| 261 | 260 | * |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
| 61 | 61 | |
| 62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
| 100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
| 101 | 101 | |
| 102 | 102 | // If the search is being sorted |
| 103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
| 103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
| 104 | 104 | |
| 105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
| 105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
| 109 | 109 | * @see modify_sort_id() |
| 110 | 110 | */ |
| 111 | - if( ! empty( $pieces[1] ) ) { |
|
| 111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
| 112 | 112 | |
| 113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
| 114 | - $this->_time_format = $pieces[1]; |
|
| 115 | - $this->_date_format = $pieces[2]; |
|
| 114 | + $this->_time_format = $pieces[ 1 ]; |
|
| 115 | + $this->_date_format = $pieces[ 2 ]; |
|
| 116 | 116 | |
| 117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
| 118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
| 118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
| 122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
| 123 | 123 | */ |
| 124 | - $criteria['sorting']['is_numeric'] = true; |
|
| 124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
| 125 | 125 | |
| 126 | 126 | // Modify the Gravity Forms WP Query |
| 127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | * then we want to modify the query. |
| 148 | 148 | * @see GFFormsModel::sort_by_field_query() |
| 149 | 149 | */ |
| 150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 151 | 151 | |
| 152 | - if( $this->_time_format === '24' ) { |
|
| 152 | + if ( $this->_time_format === '24' ) { |
|
| 153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
| 154 | 154 | } else { |
| 155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | // Set variables |
| 196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
| 197 | 197 | |
| 198 | - if( 'edit' === $context ) { |
|
| 198 | + if ( 'edit' === $context ) { |
|
| 199 | 199 | return $field_options; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Set default date format based on field ID and Form ID |
| 204 | 204 | */ |
| 205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 206 | 206 | |
| 207 | - $this->add_field_support('date_display', $field_options ); |
|
| 207 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 208 | 208 | |
| 209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 210 | 210 | |
| 211 | 211 | return $field_options; |
| 212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | private function _get_time_format() { |
| 222 | 222 | global $post; |
| 223 | 223 | |
| 224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
| 224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
| 225 | 225 | |
| 226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
| 227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // GF defaults to 12, so should we. |
| 241 | 241 | $time_format = '12'; |
| 242 | 242 | |
| 243 | - if( $form_id ) { |
|
| 243 | + if ( $form_id ) { |
|
| 244 | 244 | $form = GFAPI::get_form( $form_id ); |
| 245 | 245 | |
| 246 | 246 | if ( $form ) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $default = 'h:i A'; |
| 288 | 288 | |
| 289 | 289 | // This doesn't take into account 24-hour |
| 290 | - switch( $field_input_id ) { |
|
| 290 | + switch ( $field_input_id ) { |
|
| 291 | 291 | // Hours |
| 292 | 292 | case 1: |
| 293 | 293 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -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 | |
@@ -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 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
| 111 | 111 | |
| 112 | - if( $this->_custom_merge_tag ) { |
|
| 112 | + if ( $this->_custom_merge_tag ) { |
|
| 113 | 113 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
| 114 | 114 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
| 115 | 115 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
| 133 | 133 | */ |
| 134 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 134 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @see GFCommon::replace_variables_prepopulate() |
| 140 | 140 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
| 141 | 141 | */ |
| 142 | - if( false === $form ) { |
|
| 142 | + if ( false === $form ) { |
|
| 143 | 143 | return $text; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -172,19 +172,19 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 174 | 174 | |
| 175 | - foreach( $matches as $match ) { |
|
| 175 | + foreach ( $matches as $match ) { |
|
| 176 | 176 | |
| 177 | - $full_tag = $match[0]; |
|
| 177 | + $full_tag = $match[ 0 ]; |
|
| 178 | 178 | |
| 179 | 179 | // Strip the Merge Tags |
| 180 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
| 180 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
| 181 | 181 | |
| 182 | 182 | // Replace the value from the entry, if exists |
| 183 | - if( isset( $entry[ $tag ] ) ) { |
|
| 183 | + if ( isset( $entry[ $tag ] ) ) { |
|
| 184 | 184 | |
| 185 | 185 | $value = $entry[ $tag ]; |
| 186 | 186 | |
| 187 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
| 187 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
| 188 | 188 | $value = $this->get_content( $value ); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function _filter_sortable_fields( $not_sortable ) { |
| 259 | 259 | |
| 260 | - if( ! $this->is_sortable ) { |
|
| 261 | - $not_sortable[] = $this->name; |
|
| 260 | + if ( ! $this->is_sortable ) { |
|
| 261 | + $not_sortable[ ] = $this->name; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $not_sortable; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | 'date_display' => array( |
| 288 | 288 | 'type' => 'text', |
| 289 | 289 | 'label' => __( 'Override Date Format', 'gravityview' ), |
| 290 | - '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>' ), |
|
| 290 | + '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 | 291 | /** |
| 292 | 292 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
| 293 | 293 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | $options = $this->field_support_options(); |
| 314 | 314 | |
| 315 | - if( isset( $options[ $key ] ) ) { |
|
| 315 | + if ( isset( $options[ $key ] ) ) { |
|
| 316 | 316 | $field_options[ $key ] = $options[ $key ]; |
| 317 | 317 | } |
| 318 | 318 | |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | $connected_form = rgpost( 'form_id' ); |
| 377 | 377 | |
| 378 | 378 | // Otherwise, get the Form ID from the Post page |
| 379 | - if( empty( $connected_form ) ) { |
|
| 379 | + if ( empty( $connected_form ) ) { |
|
| 380 | 380 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if( empty( $connected_form ) ) { |
|
| 383 | + if ( empty( $connected_form ) ) { |
|
| 384 | 384 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
| 385 | 385 | return false; |
| 386 | 386 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | $delete = $this->get_delete_setting(); |
| 36 | 36 | |
| 37 | - if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 37 | + if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 38 | 38 | $this->fire_everything(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 99 | 99 | |
| 100 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 101 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 100 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 101 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 102 | 102 | |
| 103 | 103 | $sql = $wpdb->prepare( " |
| 104 | 104 | DELETE FROM $notes_table |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | parent::add_hooks(); |
| 58 | 58 | |
| 59 | - if( gravityview_is_admin_page() ) { |
|
| 59 | + if ( gravityview_is_admin_page() ) { |
|
| 60 | 60 | |
| 61 | 61 | // Make Yoast metabox go down to the bottom please. |
| 62 | 62 | add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) ); |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | global $pagenow; |
| 84 | 84 | |
| 85 | 85 | // New View page |
| 86 | - if( $pagenow === 'post-new.php' ) { |
|
| 87 | - $options['hideeditbox-gravityview'] = true; |
|
| 86 | + if ( $pagenow === 'post-new.php' ) { |
|
| 87 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $options; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $gv_page = gravityview_is_admin_page( '', 'single' ); |
| 79 | 79 | |
| 80 | 80 | // New View or Edit View page |
| 81 | - if( $gv_page && $pagenow === 'post-new.php' ) { |
|
| 81 | + if ( $gv_page && $pagenow === 'post-new.php' ) { |
|
| 82 | 82 | remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' ); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | function init() { |
| 22 | 22 | |
| 23 | 23 | $icon = is_admin() ? '<i class="icon gv-icon-astronaut-head"></i> ' : NULL; |
| 24 | - $this->title( $icon . __('GravityView', 'gravityview') ); |
|
| 24 | + $this->title( $icon . __( 'GravityView', 'gravityview' ) ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | function get_warnings() { |
| 28 | 28 | |
| 29 | - if( is_null( $this->warnings ) ) { |
|
| 29 | + if ( is_null( $this->warnings ) ) { |
|
| 30 | 30 | $this->warnings = GravityView_Logging::get_errors(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | function get_notices() { |
| 37 | 37 | |
| 38 | - if( is_null( $this->notices ) ) { |
|
| 38 | + if ( is_null( $this->notices ) ) { |
|
| 39 | 39 | $this->notices = GravityView_Logging::get_notices(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -84,27 +84,27 @@ discard block |
||
| 84 | 84 | </style> |
| 85 | 85 | <div id='debug-bar-gravityview'>"; |
| 86 | 86 | |
| 87 | - $output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignright" alt="" width="100" height="132" />'; |
|
| 87 | + $output .= '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="alignright" alt="" width="100" height="132" />'; |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | $warnings = $this->get_warnings(); |
| 91 | 91 | $notices = $this->get_notices(); |
| 92 | 92 | |
| 93 | - if(count($warnings)) { |
|
| 94 | - $output .= '<h3><span>'.__('Warnings', 'gravityview').'</span></h3>'; |
|
| 93 | + if ( count( $warnings ) ) { |
|
| 94 | + $output .= '<h3><span>' . __( 'Warnings', 'gravityview' ) . '</span></h3>'; |
|
| 95 | 95 | $output .= '<ol>'; |
| 96 | - foreach ( $warnings as $key => $notice) { |
|
| 97 | - if(empty($notice['message'])) { continue; } |
|
| 98 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-warning-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
| 96 | + foreach ( $warnings as $key => $notice ) { |
|
| 97 | + if ( empty( $notice[ 'message' ] ) ) { continue; } |
|
| 98 | + $output .= '<li><a href="#' . sanitize_html_class( 'gv-warning-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>'; |
|
| 99 | 99 | } |
| 100 | 100 | $output .= '</ol><hr />'; |
| 101 | 101 | } |
| 102 | - if(count($notices)) { |
|
| 103 | - $output .= '<h3><span>'.__('Logs', 'gravityview').'</span></h3>'; |
|
| 102 | + if ( count( $notices ) ) { |
|
| 103 | + $output .= '<h3><span>' . __( 'Logs', 'gravityview' ) . '</span></h3>'; |
|
| 104 | 104 | $output .= '<ol>'; |
| 105 | - foreach ( $notices as $key => $notice) { |
|
| 106 | - if(empty($notice['message'])) { continue; } |
|
| 107 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-notice-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
| 105 | + foreach ( $notices as $key => $notice ) { |
|
| 106 | + if ( empty( $notice[ 'message' ] ) ) { continue; } |
|
| 107 | + $output .= '<li><a href="#' . sanitize_html_class( 'gv-notice-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>'; |
|
| 108 | 108 | } |
| 109 | 109 | $output .= '</ol><hr />'; |
| 110 | 110 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | if ( count( $warnings ) ) { |
| 113 | 113 | $output .= '<h3>Warnings</h3>'; |
| 114 | 114 | $output .= '<ol class="debug-bar-php-list">'; |
| 115 | - foreach ( $warnings as $key => $notice) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
| 115 | + foreach ( $warnings as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
| 116 | 116 | $output .= '</ol>'; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if ( count( $notices ) ) { |
| 120 | 120 | $output .= '<h3>Notices</h3>'; |
| 121 | 121 | $output .= '<ol class="debug-bar-php-list">'; |
| 122 | - foreach ( $notices as $key => $notice) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
| 122 | + foreach ( $notices as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
| 123 | 123 | $output .= '</ol>'; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | * @param string|array $item Unescaped |
| 134 | 134 | * @return string Escaped HTML |
| 135 | 135 | */ |
| 136 | - function esc_html_recursive($item) { |
|
| 137 | - if(is_object($item)) { |
|
| 138 | - foreach($item as $key => $value) { |
|
| 139 | - $item->{$key} = $this->esc_html_recursive($value); |
|
| 136 | + function esc_html_recursive( $item ) { |
|
| 137 | + if ( is_object( $item ) ) { |
|
| 138 | + foreach ( $item as $key => $value ) { |
|
| 139 | + $item->{$key} = $this->esc_html_recursive( $value ); |
|
| 140 | 140 | } |
| 141 | - } else if(is_array($item)) { |
|
| 142 | - foreach($item as $key => $value) { |
|
| 143 | - $item[$key] = $this->esc_html_recursive($value); |
|
| 141 | + } else if ( is_array( $item ) ) { |
|
| 142 | + foreach ( $item as $key => $value ) { |
|
| 143 | + $item[ $key ] = $this->esc_html_recursive( $value ); |
|
| 144 | 144 | } |
| 145 | 145 | } else { |
| 146 | - $item = esc_html($item); |
|
| 146 | + $item = esc_html( $item ); |
|
| 147 | 147 | } |
| 148 | 148 | return $item; |
| 149 | 149 | } |
@@ -159,26 +159,26 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $output = ''; |
| 161 | 161 | |
| 162 | - if(!empty($notice['message'])) { |
|
| 163 | - $output .= '<a id="'.sanitize_html_class( $anchor ).'"></a>'; |
|
| 162 | + if ( ! empty( $notice[ 'message' ] ) ) { |
|
| 163 | + $output .= '<a id="' . sanitize_html_class( $anchor ) . '"></a>'; |
|
| 164 | 164 | $output .= "<li class='debug-bar-php-notice'>"; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $output .= '<div class="clear"></div>'; |
| 168 | 168 | |
| 169 | 169 | // Title |
| 170 | - $output .= '<div class="gravityview-debug-bar-title">'.esc_attr( $notice['message'] ).'</div>'; |
|
| 170 | + $output .= '<div class="gravityview-debug-bar-title">' . esc_attr( $notice[ 'message' ] ) . '</div>'; |
|
| 171 | 171 | |
| 172 | 172 | // Debugging Output |
| 173 | - if( empty( $notice['data'] ) ) { |
|
| 174 | - if( !is_null( $notice['data'] ) ) { |
|
| 175 | - $output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>'; |
|
| 173 | + if ( empty( $notice[ 'data' ] ) ) { |
|
| 174 | + if ( ! is_null( $notice[ 'data' ] ) ) { |
|
| 175 | + $output .= '<em>' . _x( 'Empty', 'Debugging output data is empty.', 'gravityview' ) . '</em>'; |
|
| 176 | 176 | } |
| 177 | 177 | } else { |
| 178 | - $output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) ); |
|
| 178 | + $output .= sprintf( '<pre>%s</pre>', print_r( $this->esc_html_recursive( $notice[ 'data' ] ), true ) ); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if(!empty($notice['message'])) { |
|
| 181 | + if ( ! empty( $notice[ 'message' ] ) ) { |
|
| 182 | 182 | $output .= '</li>'; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -5,4 +5,4 @@ |
||
| 5 | 5 | * @deprecated 1.7.5 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 8 | +include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|