@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | var $is_searchable = true; |
| 13 | 13 | |
| 14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 15 | 15 | |
| 16 | 16 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
| 17 | 17 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $entry = GFAPI::get_entry( $entry_id ); |
| 45 | 45 | $post_id = rgar( $entry, 'post_id' ); |
| 46 | 46 | |
| 47 | - if( empty( $post_id ) ) { |
|
| 47 | + if ( empty( $post_id ) ) { |
|
| 48 | 48 | return false; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $post_category_fields = GFAPI::get_fields_by_type( $form, 'post_category' ); |
| 54 | 54 | |
| 55 | - if( $post_category_fields ) { |
|
| 55 | + if ( $post_category_fields ) { |
|
| 56 | 56 | |
| 57 | 57 | $updated_categories = array(); |
| 58 | 58 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return mixed |
| 121 | 121 | */ |
| 122 | - function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
| 122 | + function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
| 123 | 123 | |
| 124 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
| 124 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
| 125 | 125 | |
| 126 | 126 | // $entry['post_id'] should always be set, but we check to make sure. |
| 127 | - if( $entry && isset( $entry['post_id'] ) && $post_id = $entry['post_id'] ) { |
|
| 127 | + if ( $entry && isset( $entry[ 'post_id' ] ) && $post_id = $entry[ 'post_id' ] ) { |
|
| 128 | 128 | |
| 129 | 129 | $post_categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) ); |
| 130 | 130 | |
| 131 | 131 | // Always use the live value |
| 132 | 132 | foreach ( $choices as &$choice ) { |
| 133 | - $choice['isSelected'] = in_array( $choice['value'], array_values( $post_categories ) ); |
|
| 133 | + $choice[ 'isSelected' ] = in_array( $choice[ 'value' ], array_values( $post_categories ) ); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 141 | 141 | |
| 142 | - if( 'edit' === $context ) { |
|
| 142 | + if ( 'edit' === $context ) { |
|
| 143 | 143 | return $field_options; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 147 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 146 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 147 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 148 | 148 | |
| 149 | 149 | return $field_options; |
| 150 | 150 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | var $is_searchable = true; |
| 16 | 16 | |
| 17 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 17 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 18 | 18 | |
| 19 | 19 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
| 20 | 20 | |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 29 | 29 | |
| 30 | - if( 'edit' === $context ) { |
|
| 30 | + if ( 'edit' === $context ) { |
|
| 31 | 31 | return $field_options; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 35 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 34 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 35 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 36 | 36 | |
| 37 | 37 | return $field_options; |
| 38 | 38 | } |
@@ -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 ); |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 536 | 536 | |
| 537 | 537 | // Generate an unique hash to use as the default value |
| 538 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 538 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 539 | 539 | |
| 540 | 540 | /** |
| 541 | 541 | * @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}` |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 547 | 547 | |
| 548 | 548 | // Make sure we have something - use the original ID as backup. |
| 549 | - if( empty( $slug ) ) { |
|
| 549 | + if ( empty( $slug ) ) { |
|
| 550 | 550 | $slug = $id; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs. |
| 576 | 576 | * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default) |
| 577 | 577 | */ |
| 578 | - $custom = apply_filters('gravityview_custom_entry_slug', false ); |
|
| 578 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
| 579 | 579 | |
| 580 | 580 | // If we're using custom slug... |
| 581 | 581 | if ( $custom ) { |
@@ -589,8 +589,8 @@ discard block |
||
| 589 | 589 | // If it does have a hash set, and the hash is expected, use it. |
| 590 | 590 | // This check allows users to change the hash structure using the |
| 591 | 591 | // gravityview_entry_hash filter and have the old hashes expire. |
| 592 | - if( empty( $value ) || $value !== $hash ) { |
|
| 593 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$id_or_string.'": ' . $hash ); |
|
| 592 | + if ( empty( $value ) || $value !== $hash ) { |
|
| 593 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $id_or_string . '": ' . $hash ); |
|
| 594 | 594 | gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
| 595 | 595 | } |
| 596 | 596 | |
@@ -616,15 +616,15 @@ discard block |
||
| 616 | 616 | * @param boolean $custom Should we process the custom entry slug? |
| 617 | 617 | */ |
| 618 | 618 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 619 | - if( $custom ) { |
|
| 619 | + if ( $custom ) { |
|
| 620 | 620 | // create the gravityview_unique_id and save it |
| 621 | 621 | |
| 622 | 622 | // Get the entry hash |
| 623 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 623 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 624 | 624 | |
| 625 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash ); |
|
| 625 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $entry[ 'id' ] . '": ' . $hash ); |
|
| 626 | 626 | |
| 627 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
| 627 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) ); |
|
| 628 | 628 | |
| 629 | 629 | } |
| 630 | 630 | } |
@@ -641,14 +641,14 @@ discard block |
||
| 641 | 641 | */ |
| 642 | 642 | public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) { |
| 643 | 643 | |
| 644 | - if( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
| 644 | + if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
|
| 645 | 645 | $entry = GVCommon::get_entry( $entry ); |
| 646 | - } else if( empty( $entry ) ) { |
|
| 646 | + } else if ( empty( $entry ) ) { |
|
| 647 | 647 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | // Second parameter used to be passed as $field; this makes sure it's not an array |
| 651 | - if( !is_numeric( $post_id ) ) { |
|
| 651 | + if ( ! is_numeric( $post_id ) ) { |
|
| 652 | 652 | $post_id = NULL; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | $directory_link = self::directory_link( $post_id, false ); |
| 657 | 657 | |
| 658 | 658 | // No post ID? Get outta here. |
| 659 | - if( empty( $directory_link ) ) { |
|
| 659 | + if ( empty( $directory_link ) ) { |
|
| 660 | 660 | return ''; |
| 661 | 661 | } |
| 662 | 662 | |
@@ -667,9 +667,9 @@ discard block |
||
| 667 | 667 | $query_arg_name = GravityView_Post_Types::get_entry_var_name(); |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
| 670 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 671 | 671 | |
| 672 | - if( get_option('permalink_structure') && !is_preview() ) { |
|
| 672 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 673 | 673 | |
| 674 | 674 | $args = array(); |
| 675 | 675 | |
@@ -679,9 +679,9 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | $link_parts = explode( '?', $directory_link ); |
| 681 | 681 | |
| 682 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
| 682 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 683 | 683 | |
| 684 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
| 684 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
| 685 | 685 | |
| 686 | 686 | } else { |
| 687 | 687 | |
@@ -691,18 +691,18 @@ discard block |
||
| 691 | 691 | /** |
| 692 | 692 | * @since 1.7.3 |
| 693 | 693 | */ |
| 694 | - if( $add_directory_args ) { |
|
| 694 | + if ( $add_directory_args ) { |
|
| 695 | 695 | |
| 696 | - if( !empty( $_GET['pagenum'] ) ) { |
|
| 697 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 696 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 697 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
| 701 | 701 | * @since 1.7 |
| 702 | 702 | */ |
| 703 | - if( $sort = rgget('sort') ) { |
|
| 704 | - $args['sort'] = $sort; |
|
| 705 | - $args['dir'] = rgget('dir'); |
|
| 703 | + if ( $sort = rgget( 'sort' ) ) { |
|
| 704 | + $args[ 'sort' ] = $sort; |
|
| 705 | + $args[ 'dir' ] = rgget( 'dir' ); |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | } |
@@ -712,8 +712,8 @@ discard block |
||
| 712 | 712 | * has the view id so that Advanced Filters can be applied correctly when rendering the single view |
| 713 | 713 | * @see GravityView_frontend::get_context_view_id() |
| 714 | 714 | */ |
| 715 | - if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 716 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 715 | + if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
|
| 716 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | return add_query_arg( $args, $directory_link ); |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 734 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 734 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |
@@ -753,15 +753,15 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | $default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container'; |
| 755 | 755 | |
| 756 | - if( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 756 | + if ( GravityView_View::getInstance()->isHideUntilSearched() ) { |
|
| 757 | 757 | $default_css_class .= ' hidden'; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 760 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 761 | 761 | $default_css_class .= ' gv-container-no-results'; |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 764 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 765 | 765 | |
| 766 | 766 | /** |
| 767 | 767 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | |
| 773 | 773 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 774 | 774 | |
| 775 | - if( $echo ) { |
|
| 775 | + if ( $echo ) { |
|
| 776 | 776 | echo $css_class; |
| 777 | 777 | } |
| 778 | 778 | |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | $value = GravityView_API::field_value( $entry, $field ); |
| 785 | 785 | |
| 786 | - if( $value === '' ) { |
|
| 786 | + if ( $value === '' ) { |
|
| 787 | 787 | /** |
| 788 | 788 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 789 | 789 | * @param string $value (empty string) |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | return GravityView_API::entry_link( $entry, $post_id ); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | -function gv_no_results($wpautop = true) { |
|
| 805 | +function gv_no_results( $wpautop = true ) { |
|
| 806 | 806 | return GravityView_API::no_results( $wpautop ); |
| 807 | 807 | } |
| 808 | 808 | |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | $href = apply_filters( 'gravityview_go_back_url', $href ); |
| 825 | 825 | |
| 826 | - if( empty( $href ) ) { return NULL; } |
|
| 826 | + if ( empty( $href ) ) { return NULL; } |
|
| 827 | 827 | |
| 828 | 828 | // calculate link label |
| 829 | 829 | $gravityview_view = GravityView_View::getInstance(); |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | $link = gravityview_get_link( $href, esc_html( $label ), array( |
| 841 | 841 | 'data-viewid' => $gravityview_view->getViewId() |
| 842 | - )); |
|
| 842 | + ) ); |
|
| 843 | 843 | |
| 844 | 844 | return $link; |
| 845 | 845 | } |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | */ |
| 859 | 859 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 860 | 860 | |
| 861 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 861 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 862 | 862 | |
| 863 | 863 | // For the complete field value as generated by Gravity Forms |
| 864 | 864 | return $display_value; |
@@ -888,16 +888,16 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | $terms = explode( ', ', $value ); |
| 890 | 890 | |
| 891 | - foreach ($terms as $term_name ) { |
|
| 891 | + foreach ( $terms as $term_name ) { |
|
| 892 | 892 | |
| 893 | 893 | // If we're processing a category, |
| 894 | - if( $taxonomy === 'category' ) { |
|
| 894 | + if ( $taxonomy === 'category' ) { |
|
| 895 | 895 | |
| 896 | 896 | // Use rgexplode to prevent errors if : doesn't exist |
| 897 | 897 | list( $term_name, $term_id ) = rgexplode( ':', $value, 2 ); |
| 898 | 898 | |
| 899 | 899 | // The explode was succesful; we have the category ID |
| 900 | - if( !empty( $term_id )) { |
|
| 900 | + if ( ! empty( $term_id ) ) { |
|
| 901 | 901 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 902 | 902 | } else { |
| 903 | 903 | // We have to fall back to the name |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | // There's still a tag/category here. |
| 913 | - if( $term ) { |
|
| 913 | + if ( $term ) { |
|
| 914 | 914 | |
| 915 | 915 | $term_link = get_term_link( $term, $taxonomy ); |
| 916 | 916 | |
@@ -919,11 +919,11 @@ discard block |
||
| 919 | 919 | continue; |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 922 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 923 | 923 | } |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - return implode(', ', $output ); |
|
| 926 | + return implode( ', ', $output ); |
|
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | /** |
@@ -937,8 +937,8 @@ discard block |
||
| 937 | 937 | |
| 938 | 938 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 939 | 939 | |
| 940 | - if( empty( $link ) ) { |
|
| 941 | - return strip_tags( $output); |
|
| 940 | + if ( empty( $link ) ) { |
|
| 941 | + return strip_tags( $output ); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | return $output; |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | $fe = GravityView_frontend::getInstance(); |
| 958 | 958 | |
| 959 | 959 | // Solve problem when loading content via admin-ajax.php |
| 960 | - if( ! $fe->getGvOutputData() ) { |
|
| 960 | + if ( ! $fe->getGvOutputData() ) { |
|
| 961 | 961 | |
| 962 | 962 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' ); |
| 963 | 963 | |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | // Make 100% sure that we're dealing with a properly called situation |
| 968 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 968 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 969 | 969 | |
| 970 | 970 | do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() ); |
| 971 | 971 | |
@@ -985,10 +985,10 @@ discard block |
||
| 985 | 985 | |
| 986 | 986 | $fe = GravityView_frontend::getInstance(); |
| 987 | 987 | |
| 988 | - if( ! $fe->getGvOutputData() ) { return array(); } |
|
| 988 | + if ( ! $fe->getGvOutputData() ) { return array(); } |
|
| 989 | 989 | |
| 990 | 990 | // If not set, grab the current view ID |
| 991 | - if( empty( $view_id ) ) { |
|
| 991 | + if ( empty( $view_id ) ) { |
|
| 992 | 992 | $view_id = $fe->get_context_view_id(); |
| 993 | 993 | } |
| 994 | 994 | |
@@ -1053,11 +1053,11 @@ discard block |
||
| 1053 | 1053 | */ |
| 1054 | 1054 | $is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false ); |
| 1055 | 1055 | |
| 1056 | - if( $is_edit_entry ) { |
|
| 1056 | + if ( $is_edit_entry ) { |
|
| 1057 | 1057 | $context = 'edit'; |
| 1058 | - } else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1058 | + } else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) { |
|
| 1059 | 1059 | $context = 'single'; |
| 1060 | - } else if( class_exists( 'GravityView_View' ) ) { |
|
| 1060 | + } else if ( class_exists( 'GravityView_View' ) ) { |
|
| 1061 | 1061 | $context = GravityView_View::getInstance()->getContext(); |
| 1062 | 1062 | } |
| 1063 | 1063 | |
@@ -1085,12 +1085,12 @@ discard block |
||
| 1085 | 1085 | function gravityview_get_files_array( $value, $gv_class = '' ) { |
| 1086 | 1086 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1087 | 1087 | |
| 1088 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1089 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1088 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1089 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1093 | - include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' ); |
|
| 1092 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1093 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' ); |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class ); |
@@ -1168,12 +1168,12 @@ discard block |
||
| 1168 | 1168 | $args = apply_filters( 'gravityview/field_output/args', $args, $passed_args ); |
| 1169 | 1169 | |
| 1170 | 1170 | // Required fields. |
| 1171 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1171 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1172 | 1172 | do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args ); |
| 1173 | 1173 | return ''; |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1176 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1177 | 1177 | |
| 1178 | 1178 | /** |
| 1179 | 1179 | * Create the content variables for replacing. |
@@ -1189,37 +1189,37 @@ discard block |
||
| 1189 | 1189 | 'field_id' => '', |
| 1190 | 1190 | ); |
| 1191 | 1191 | |
| 1192 | - $context['value'] = gv_value( $entry, $args['field'] ); |
|
| 1192 | + $context[ 'value' ] = gv_value( $entry, $args[ 'field' ] ); |
|
| 1193 | 1193 | |
| 1194 | 1194 | // If the value is empty and we're hiding empty, return empty. |
| 1195 | - if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1195 | + if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1196 | 1196 | return ''; |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | - if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1200 | - $context['value'] = wpautop( $context['value'] ); |
|
| 1199 | + if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1200 | + $context[ 'value' ] = wpautop( $context[ 'value' ] ); |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | // Get width setting, if exists |
| 1204 | - $context['width'] = GravityView_API::field_width( $args['field'] ); |
|
| 1204 | + $context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] ); |
|
| 1205 | 1205 | |
| 1206 | 1206 | // If replacing with CSS inline formatting, let's do it. |
| 1207 | - $context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' ); |
|
| 1207 | + $context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' ); |
|
| 1208 | 1208 | |
| 1209 | 1209 | // Grab the Class using `gv_class` |
| 1210 | - $context['class'] = gv_class( $args['field'], $args['form'], $entry ); |
|
| 1211 | - $context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry ); |
|
| 1210 | + $context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1211 | + $context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry ); |
|
| 1212 | 1212 | |
| 1213 | 1213 | // Get field label if needed |
| 1214 | - if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) { |
|
| 1215 | - $context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] ); |
|
| 1214 | + if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) { |
|
| 1215 | + $context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] ); |
|
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | 1218 | // Default Label value |
| 1219 | - $context['label_value'] = gv_label( $args['field'], $entry ); |
|
| 1219 | + $context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry ); |
|
| 1220 | 1220 | |
| 1221 | - if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){ |
|
| 1222 | - $context['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1221 | + if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) { |
|
| 1222 | + $context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | /** |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | * @param string $markup The HTML for the markup |
| 1229 | 1229 | * @param array $args All args for the field output |
| 1230 | 1230 | */ |
| 1231 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args ); |
|
| 1231 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args ); |
|
| 1232 | 1232 | |
| 1233 | 1233 | /** |
| 1234 | 1234 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | foreach ( $context as $tag => $value ) { |
| 1252 | 1252 | |
| 1253 | 1253 | // If the tag doesn't exist just skip it |
| 1254 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1254 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1255 | 1255 | continue; |
| 1256 | 1256 | } |
| 1257 | 1257 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | $hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data ); |
| 55 | 55 | |
| 56 | - return (bool) $hide_coupon_fields; |
|
| 56 | + return (bool)$hide_coupon_fields; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) { |
| 70 | 70 | |
| 71 | 71 | if ( $this->should_hide_coupon_fields( $entry ) ) { |
| 72 | - $blacklist[] = 'coupon'; |
|
| 72 | + $blacklist[ ] = 'coupon'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return $blacklist; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | // No coupons match the codes provided |
| 108 | 108 | $discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form ); |
| 109 | 109 | |
| 110 | - if( ! $discounts ) { |
|
| 110 | + if ( ! $discounts ) { |
|
| 111 | 111 | return $value; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @see GF_Field_Coupon::get_field_input |
| 117 | 117 | */ |
| 118 | 118 | $_POST = ! isset( $_POST ) ? array() : $_POST; |
| 119 | - $_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts ); |
|
| 119 | + $_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts ); |
|
| 120 | 120 | $_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes ); |
| 121 | 121 | |
| 122 | 122 | return $value; |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | continue; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
| 75 | - $views->append( View::by_id( $shortcode->atts['id'] ) ); |
|
| 74 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
| 75 | + $views->append( View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
| 106 | - $views->append( View::by_id( $shortcode->atts['id'] ) ); |
|
| 105 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
| 106 | + $views->append( View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | * @return string The version of PHP. |
| 212 | 212 | */ |
| 213 | 213 | private function get_php_version() { |
| 214 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 215 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 214 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 215 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | * @return string The version of WordPress. |
| 224 | 224 | */ |
| 225 | 225 | private function get_wordpress_version() { |
| 226 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 227 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 226 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 227 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | * @return string The version of Gravity Forms. |
| 237 | 237 | */ |
| 238 | 238 | private function get_gravityforms_version() { |
| 239 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) |
|
| 239 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) |
|
| 240 | 240 | throw new \ErrorException( 'Gravity Forms is inactive or not installed.' ); |
| 241 | 241 | |
| 242 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 243 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 242 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 243 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | private function __clone() { } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | 26 | public function append( $value ) { |
| 27 | - $this->storage []= $value; |
|
| 27 | + $this->storage [ ] = $value; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | public static function add() { |
| 57 | 57 | $shortcode = new static(); |
| 58 | 58 | if ( shortcode_exists( $shortcode->name ) ) { |
| 59 | - if ( empty( self::$shortcodes[$shortcode->name] ) ) { |
|
| 59 | + if ( empty( self::$shortcodes[ $shortcode->name ] ) ) { |
|
| 60 | 60 | throw new \ErrorException( sprintf( 'Shortcode [%s] has already been registered elsewhere.', $shortcode->name ) ); |
| 61 | 61 | } |
| 62 | 62 | } else { |
| 63 | 63 | add_shortcode( $shortcode->name, array( get_class( $shortcode ), 'callback' ) ); |
| 64 | - self::$shortcodes[$shortcode->name] = $shortcode; |
|
| 64 | + self::$shortcodes[ $shortcode->name ] = $shortcode; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return self::$shortcodes[$shortcode->name]; |
|
| 67 | + return self::$shortcodes[ $shortcode->name ]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public static function remove() { |
| 78 | 78 | $shortcode = new static(); |
| 79 | - unset( self::$shortcodes[$shortcode->name] ); |
|
| 79 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
| 80 | 80 | remove_shortcode( $shortcode->name ); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
| 109 | 109 | |
| 110 | 110 | foreach ( $matches as $shortcode ) { |
| 111 | - $shortcode_name = $shortcode[2]; |
|
| 111 | + $shortcode_name = $shortcode[ 2 ]; |
|
| 112 | 112 | |
| 113 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
| 114 | - $shortcode_content = $shortcode[5]; |
|
| 113 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
| 114 | + $shortcode_content = $shortcode[ 5 ]; |
|
| 115 | 115 | |
| 116 | 116 | /** This is a registered GravityView shortcode. */ |
| 117 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
| 118 | - $shortcode = clone( self::$shortcodes[$shortcode_name] ); |
|
| 117 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
| 118 | + $shortcode = clone( self::$shortcodes[ $shortcode_name ] ); |
|
| 119 | 119 | } else { |
| 120 | 120 | /** This is some generic shortcode. */ |
| 121 | 121 | $shortcode = new self; |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | private function __construct( $passed_post = NULL ) { |
| 19 | 19 | |
| 20 | - if( !empty( $passed_post ) ) { |
|
| 20 | + if ( ! empty( $passed_post ) ) { |
|
| 21 | 21 | |
| 22 | 22 | $id_or_id_array = $this->maybe_get_view_id( $passed_post ); |
| 23 | 23 | |
| 24 | - if( !empty( $id_or_id_array ) ) { |
|
| 24 | + if ( ! empty( $id_or_id_array ) ) { |
|
| 25 | 25 | $this->add_view( $id_or_id_array ); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -58,40 +58,40 @@ discard block |
||
| 58 | 58 | public function maybe_get_view_id( $passed_post ) { |
| 59 | 59 | $ids = array(); |
| 60 | 60 | |
| 61 | - if( ! empty( $passed_post ) ) { |
|
| 61 | + if ( ! empty( $passed_post ) ) { |
|
| 62 | 62 | |
| 63 | - if( is_numeric( $passed_post ) ) { |
|
| 63 | + if ( is_numeric( $passed_post ) ) { |
|
| 64 | 64 | $passed_post = get_post( $passed_post ); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Convert WP_Posts into WP_Posts[] array |
| 68 | - if( $passed_post instanceof WP_Post ) { |
|
| 68 | + if ( $passed_post instanceof WP_Post ) { |
|
| 69 | 69 | $passed_post = array( $passed_post ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( is_array( $passed_post ) ) { |
|
| 72 | + if ( is_array( $passed_post ) ) { |
|
| 73 | 73 | |
| 74 | - foreach ( $passed_post as &$post) { |
|
| 74 | + foreach ( $passed_post as &$post ) { |
|
| 75 | 75 | if ( function_exists( 'gravityview' ) && $post instanceof WP_Post ) { |
| 76 | 76 | $views = \GV\View_Collection::from_post( $post ); |
| 77 | 77 | foreach ( $views->all() as $view ) { |
| 78 | - $ids []= $view->ID; |
|
| 78 | + $ids [ ] = $view->ID; |
|
| 79 | 79 | } |
| 80 | 80 | } else { |
| 81 | 81 | /** Deprecated, see \GV\View_Collection::from_post */ |
| 82 | - if( ( get_post_type( $post ) === 'gravityview' ) ) { |
|
| 83 | - $ids[] = $post->ID; |
|
| 84 | - } else{ |
|
| 82 | + if ( ( get_post_type( $post ) === 'gravityview' ) ) { |
|
| 83 | + $ids[ ] = $post->ID; |
|
| 84 | + } else { |
|
| 85 | 85 | // Parse the Post Content |
| 86 | 86 | $id = $this->parse_post_content( $post->post_content ); |
| 87 | - if( $id ) { |
|
| 88 | - $ids = array_merge( $ids, (array) $id ); |
|
| 87 | + if ( $id ) { |
|
| 88 | + $ids = array_merge( $ids, (array)$id ); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Parse the Post Meta |
| 92 | 92 | $id = $this->parse_post_meta( $post->ID ); |
| 93 | - if( $id ) { |
|
| 94 | - $ids = array_merge( $ids, (array) $id ); |
|
| 93 | + if ( $id ) { |
|
| 94 | + $ids = array_merge( $ids, (array)$id ); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -105,31 +105,31 @@ discard block |
||
| 105 | 105 | if ( function_exists( 'gravityview' ) ) { |
| 106 | 106 | $shortcodes = \GV\Shortcode::parse( $passed_post ); |
| 107 | 107 | foreach ( $shortcodes as $shortcode ) { |
| 108 | - if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) |
|
| 109 | - $ids []= $shortcode->atts['id']; |
|
| 108 | + if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) ) |
|
| 109 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
| 110 | 110 | } |
| 111 | 111 | } else { |
| 112 | 112 | /** Deprecated, use \GV\Shortcode::parse. */ |
| 113 | 113 | $id = $this->parse_post_content( $passed_post ); |
| 114 | - if( $id ) { |
|
| 115 | - $ids = array_merge( $ids, (array) $id ); |
|
| 114 | + if ( $id ) { |
|
| 115 | + $ids = array_merge( $ids, (array)$id ); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | } else { |
| 120 | 120 | $id = $this->get_id_from_atts( $passed_post ); |
| 121 | - $ids[] = intval( $id ); |
|
| 121 | + $ids[ ] = intval( $id ); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if( empty($ids) ) { |
|
| 126 | + if ( empty( $ids ) ) { |
|
| 127 | 127 | return NULL; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // If it's just one ID, return that. |
| 131 | 131 | // Otherwise, return array of IDs |
| 132 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
| 132 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public static function getInstance( $passed_post = NULL ) { |
| 139 | 139 | |
| 140 | - if( empty( self::$instance ) ) { |
|
| 140 | + if ( empty( self::$instance ) ) { |
|
| 141 | 141 | self::$instance = new GravityView_View_Data( $passed_post ); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -150,19 +150,19 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | function get_view( $view_id, $atts = NULL ) { |
| 152 | 152 | |
| 153 | - if( ! is_numeric( $view_id) ) { |
|
| 154 | - do_action('gravityview_log_error', sprintf('GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id) ); |
|
| 153 | + if ( ! is_numeric( $view_id ) ) { |
|
| 154 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id ) ); |
|
| 155 | 155 | return false; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Backup: the view hasn't been fetched yet. Doing it now. |
| 159 | 159 | if ( ! isset( $this->views[ $view_id ] ) ) { |
| 160 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] View #%s not set yet.', $view_id) ); |
|
| 160 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] View #%s not set yet.', $view_id ) ); |
|
| 161 | 161 | return $this->add_view( $view_id, $atts ); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if ( empty( $this->views[ $view_id ] ) ) { |
| 165 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id) ); |
|
| 165 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id ) ); |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | function add_view( $view_id, $atts = NULL ) { |
| 194 | 194 | |
| 195 | 195 | // Handle array of IDs |
| 196 | - if( is_array( $view_id ) ) { |
|
| 197 | - foreach( $view_id as $id ) { |
|
| 196 | + if ( is_array( $view_id ) ) { |
|
| 197 | + foreach ( $view_id as $id ) { |
|
| 198 | 198 | |
| 199 | 199 | $this->add_view( $id, $atts ); |
| 200 | 200 | } |
@@ -203,21 +203,21 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // The view has been set already; returning stored view. |
| 206 | - if ( !empty( $this->views[ $view_id ] ) ) { |
|
| 207 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id) ); |
|
| 206 | + if ( ! empty( $this->views[ $view_id ] ) ) { |
|
| 207 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id ) ); |
|
| 208 | 208 | return $this->views[ $view_id ]; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if( ! $this->view_exists( $view_id ) ) { |
|
| 212 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id) ); |
|
| 211 | + if ( ! $this->view_exists( $view_id ) ) { |
|
| 212 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id ) ); |
|
| 213 | 213 | return false; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $form_id = gravityview_get_form_id( $view_id ); |
| 217 | 217 | |
| 218 | - if( empty( $form_id ) ) { |
|
| 218 | + if ( empty( $form_id ) ) { |
|
| 219 | 219 | |
| 220 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id) ); |
|
| 220 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id ) ); |
|
| 221 | 221 | |
| 222 | 222 | return false; |
| 223 | 223 | } |
@@ -225,21 +225,21 @@ discard block |
||
| 225 | 225 | // Get the settings for the View ID |
| 226 | 226 | $view_settings = gravityview_get_template_settings( $view_id ); |
| 227 | 227 | |
| 228 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id), $view_settings ); |
|
| 228 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id ), $view_settings ); |
|
| 229 | 229 | |
| 230 | 230 | // Merge the view settings with the defaults |
| 231 | 231 | $view_defaults = wp_parse_args( $view_settings, self::get_default_args() ); |
| 232 | 232 | |
| 233 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults ); |
|
| 233 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults ); |
|
| 234 | 234 | |
| 235 | - if( ! empty( $atts ) && is_array( $atts ) ) { |
|
| 235 | + if ( ! empty( $atts ) && is_array( $atts ) ) { |
|
| 236 | 236 | |
| 237 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging with the $view_defaults', $atts ); |
|
| 237 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging with the $view_defaults', $atts ); |
|
| 238 | 238 | |
| 239 | 239 | // Get the settings from the shortcode and merge them with defaults. |
| 240 | 240 | $atts = shortcode_atts( $view_defaults, $atts ); |
| 241 | 241 | |
| 242 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging with the $view_defaults', $atts ); |
|
| 242 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging with the $view_defaults', $atts ); |
|
| 243 | 243 | |
| 244 | 244 | } else { |
| 245 | 245 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - unset( $atts['id'], $view_defaults, $view_settings ); |
|
| 251 | + unset( $atts[ 'id' ], $view_defaults, $view_settings ); |
|
| 252 | 252 | |
| 253 | 253 | $data = array( |
| 254 | 254 | 'id' => $view_id, |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | 'form' => gravityview_get_form( $form_id ), |
| 262 | 262 | ); |
| 263 | 263 | |
| 264 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] View #%s being added.', $view_id), $data ); |
|
| 264 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] View #%s being added.', $view_id ), $data ); |
|
| 265 | 265 | |
| 266 | 266 | $this->views[ $view_id ] = $data; |
| 267 | 267 | |
@@ -296,15 +296,15 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | private function filter_fields( $dir_fields ) { |
| 298 | 298 | |
| 299 | - if( empty( $dir_fields ) || !is_array( $dir_fields ) ) { |
|
| 299 | + if ( empty( $dir_fields ) || ! is_array( $dir_fields ) ) { |
|
| 300 | 300 | return $dir_fields; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - foreach( $dir_fields as $area => $fields ) { |
|
| 303 | + foreach ( $dir_fields as $area => $fields ) { |
|
| 304 | 304 | |
| 305 | - foreach( (array)$fields as $uniqid => $properties ) { |
|
| 305 | + foreach ( (array)$fields as $uniqid => $properties ) { |
|
| 306 | 306 | |
| 307 | - if( $this->hide_field_check_conditions( $properties ) ) { |
|
| 307 | + if ( $this->hide_field_check_conditions( $properties ) ) { |
|
| 308 | 308 | unset( $dir_fields[ $area ][ $uniqid ] ); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | private function hide_field_check_conditions( $properties ) { |
| 327 | 327 | |
| 328 | 328 | // logged-in visibility |
| 329 | - if( ! empty( $properties['only_loggedin'] ) && ! GVCommon::has_cap( $properties['only_loggedin_cap'] ) ) { |
|
| 329 | + if ( ! empty( $properties[ 'only_loggedin' ] ) && ! GVCommon::has_cap( $properties[ 'only_loggedin_cap' ] ) ) { |
|
| 330 | 330 | return true; |
| 331 | 331 | } |
| 332 | 332 | |
@@ -343,14 +343,14 @@ discard block |
||
| 343 | 343 | // Get the settings from the shortcode and merge them with defaults. |
| 344 | 344 | $atts = wp_parse_args( $atts, self::get_default_args() ); |
| 345 | 345 | |
| 346 | - $view_id = ! empty( $atts['view_id'] ) ? (int)$atts['view_id'] : NULL; |
|
| 346 | + $view_id = ! empty( $atts[ 'view_id' ] ) ? (int)$atts[ 'view_id' ] : NULL; |
|
| 347 | 347 | |
| 348 | - if( empty( $view_id ) && !empty( $atts['id'] ) ) { |
|
| 349 | - $view_id = (int)$atts['id']; |
|
| 348 | + if ( empty( $view_id ) && ! empty( $atts[ 'id' ] ) ) { |
|
| 349 | + $view_id = (int)$atts[ 'id' ]; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if( empty( $view_id ) ) { |
|
| 353 | - do_action('gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts ); |
|
| 352 | + if ( empty( $view_id ) ) { |
|
| 353 | + do_action( 'gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts ); |
|
| 354 | 354 | return; |
| 355 | 355 | } |
| 356 | 356 | |
@@ -372,46 +372,46 @@ discard block |
||
| 372 | 372 | * @hack This is so that the shortcode is registered for the oEmbed preview in the Admin |
| 373 | 373 | * @since 1.6 |
| 374 | 374 | */ |
| 375 | - if( ! shortcode_exists('gravityview') && class_exists( 'GravityView_Shortcode' ) ) { |
|
| 375 | + if ( ! shortcode_exists( 'gravityview' ) && class_exists( 'GravityView_Shortcode' ) ) { |
|
| 376 | 376 | new GravityView_Shortcode; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $shortcodes = gravityview_has_shortcode_r( $content, 'gravityview' ); |
| 380 | 380 | |
| 381 | - if( empty( $shortcodes ) ) { |
|
| 381 | + if ( empty( $shortcodes ) ) { |
|
| 382 | 382 | return NULL; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - do_action('gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes ); |
|
| 385 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes ); |
|
| 386 | 386 | |
| 387 | 387 | $ids = array(); |
| 388 | 388 | |
| 389 | - foreach ($shortcodes as $key => $shortcode) { |
|
| 389 | + foreach ( $shortcodes as $key => $shortcode ) { |
|
| 390 | 390 | |
| 391 | - $shortcode[3] = htmlspecialchars_decode( $shortcode[3], ENT_QUOTES ); |
|
| 391 | + $shortcode[ 3 ] = htmlspecialchars_decode( $shortcode[ 3 ], ENT_QUOTES ); |
|
| 392 | 392 | |
| 393 | - $args = shortcode_parse_atts( $shortcode[3] ); |
|
| 393 | + $args = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
| 394 | 394 | |
| 395 | - if( empty( $args['id'] ) ) { |
|
| 396 | - do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode ); |
|
| 395 | + if ( empty( $args[ 'id' ] ) ) { |
|
| 396 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode ); |
|
| 397 | 397 | continue; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args['id']), $args ); |
|
| 400 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args[ 'id' ] ), $args ); |
|
| 401 | 401 | |
| 402 | 402 | // Store the View to the object for later fetching. |
| 403 | - $this->add_view( $args['id'], $args ); |
|
| 403 | + $this->add_view( $args[ 'id' ], $args ); |
|
| 404 | 404 | |
| 405 | - $ids[] = $args['id']; |
|
| 405 | + $ids[ ] = $args[ 'id' ]; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - if( empty($ids) ) { |
|
| 408 | + if ( empty( $ids ) ) { |
|
| 409 | 409 | return NULL; |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // If it's just one ID, return that. |
| 413 | 413 | // Otherwise, return array of IDs |
| 414 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
| 414 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
| 415 | 415 | |
| 416 | 416 | } |
| 417 | 417 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | $meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', array(), $post_id ); |
| 434 | 434 | |
| 435 | - if( empty( $meta_keys ) ) { |
|
| 435 | + if ( empty( $meta_keys ) ) { |
|
| 436 | 436 | return NULL; |
| 437 | 437 | } |
| 438 | 438 | |
@@ -440,16 +440,16 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | $meta_content = ''; |
| 442 | 442 | |
| 443 | - foreach( $meta_keys as $key ) { |
|
| 444 | - $meta = get_post_meta( $post_id, $key , true ); |
|
| 445 | - if( ! is_string( $meta ) ) { |
|
| 443 | + foreach ( $meta_keys as $key ) { |
|
| 444 | + $meta = get_post_meta( $post_id, $key, true ); |
|
| 445 | + if ( ! is_string( $meta ) ) { |
|
| 446 | 446 | continue; |
| 447 | 447 | } |
| 448 | 448 | $meta_content .= $meta . ' '; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - if( empty( $meta_content ) ) { |
|
| 452 | - do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys ); |
|
| 451 | + if ( empty( $meta_content ) ) { |
|
| 452 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys ); |
|
| 453 | 453 | return NULL; |
| 454 | 454 | } |
| 455 | 455 | |
@@ -476,16 +476,16 @@ discard block |
||
| 476 | 476 | $message = NULL; |
| 477 | 477 | |
| 478 | 478 | // Not invalid if not set! |
| 479 | - if( empty( $post_id ) || empty( $view_id ) ) { |
|
| 479 | + if ( empty( $post_id ) || empty( $view_id ) ) { |
|
| 480 | 480 | |
| 481 | - if( $empty_is_valid ) { |
|
| 481 | + if ( $empty_is_valid ) { |
|
| 482 | 482 | return true; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $message = esc_html__( 'The ID is required.', 'gravityview' ); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if( ! $message ) { |
|
| 488 | + if ( ! $message ) { |
|
| 489 | 489 | $status = get_post_status( $post_id ); |
| 490 | 490 | |
| 491 | 491 | // Nothing exists with that post ID. |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if( ! $message ) { |
|
| 500 | + if ( ! $message ) { |
|
| 501 | 501 | |
| 502 | 502 | // Nothing exists with that post ID. |
| 503 | 503 | if ( empty( $status ) || in_array( $status, array( 'revision', 'attachment' ) ) ) { |
@@ -506,8 +506,8 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if( ! $message ) { |
|
| 510 | - if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
|
| 509 | + if ( ! $message ) { |
|
| 510 | + if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
|
| 511 | 511 | $views = GV\View_Collection::from_post( $post ); |
| 512 | 512 | $view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() ); |
| 513 | 513 | } else { |
@@ -516,21 +516,21 @@ discard block |
||
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | // The post or page specified does not contain the shortcode. |
| 519 | - if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) { |
|
| 519 | + if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) { |
|
| 520 | 520 | $message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' ); |
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - if( ! $message ) { |
|
| 524 | + if ( ! $message ) { |
|
| 525 | 525 | |
| 526 | 526 | // It's a View |
| 527 | - if( 'gravityview' === get_post_type( $post_id ) ) { |
|
| 528 | - $message = esc_html__( 'The ID is already a View.', 'gravityview' );; |
|
| 527 | + if ( 'gravityview' === get_post_type( $post_id ) ) { |
|
| 528 | + $message = esc_html__( 'The ID is already a View.', 'gravityview' ); ; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - if( $message ) { |
|
| 533 | + if ( $message ) { |
|
| 534 | 534 | return new WP_Error( 'invalid_embed_id', $message ); |
| 535 | 535 | } |
| 536 | 536 | |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | $args = self::get_default_args( $with_details ); |
| 549 | 549 | |
| 550 | - if( !isset( $args[ $key ] ) ) { return NULL; } |
|
| 550 | + if ( ! isset( $args[ $key ] ) ) { return NULL; } |
|
| 551 | 551 | |
| 552 | 552 | return $args[ $key ]; |
| 553 | 553 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | */ |
| 577 | 577 | $default_settings = apply_filters( 'gravityview_default_args', array( |
| 578 | 578 | 'id' => array( |
| 579 | - 'label' => __('View ID', 'gravityview'), |
|
| 579 | + 'label' => __( 'View ID', 'gravityview' ), |
|
| 580 | 580 | 'type' => 'number', |
| 581 | 581 | 'group' => 'default', |
| 582 | 582 | 'value' => NULL, |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | 'show_in_shortcode' => false, |
| 585 | 585 | ), |
| 586 | 586 | 'page_size' => array( |
| 587 | - 'label' => __('Number of entries per page', 'gravityview'), |
|
| 587 | + 'label' => __( 'Number of entries per page', 'gravityview' ), |
|
| 588 | 588 | 'type' => 'number', |
| 589 | 589 | 'class' => 'small-text', |
| 590 | 590 | 'group' => 'default', |
@@ -608,8 +608,8 @@ discard block |
||
| 608 | 608 | ), |
| 609 | 609 | 'admin_show_all_statuses' => array( |
| 610 | 610 | 'label' => __( 'Show all entries to administrators', 'gravityview' ), |
| 611 | - 'desc' => __('Administrators will be able to see entries with any approval status.', 'gravityview'), |
|
| 612 | - 'tooltip' => __('Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview'), |
|
| 611 | + 'desc' => __( 'Administrators will be able to see entries with any approval status.', 'gravityview' ), |
|
| 612 | + 'tooltip' => __( 'Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview' ), |
|
| 613 | 613 | 'requires' => 'show_only_approved', |
| 614 | 614 | 'type' => 'checkbox', |
| 615 | 615 | 'group' => 'default', |
@@ -634,40 +634,40 @@ discard block |
||
| 634 | 634 | 'user_edit' => array( |
| 635 | 635 | 'label' => __( 'Allow User Edit', 'gravityview' ), |
| 636 | 636 | 'group' => 'default', |
| 637 | - 'desc' => __('Allow logged-in users to edit entries they created.', 'gravityview'), |
|
| 637 | + 'desc' => __( 'Allow logged-in users to edit entries they created.', 'gravityview' ), |
|
| 638 | 638 | 'value' => 0, |
| 639 | - 'tooltip' => __('Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview'), |
|
| 639 | + 'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ), |
|
| 640 | 640 | 'type' => 'checkbox', |
| 641 | 641 | 'show_in_shortcode' => true, |
| 642 | 642 | ), |
| 643 | 643 | 'user_delete' => array( |
| 644 | 644 | 'label' => __( 'Allow User Delete', 'gravityview' ), |
| 645 | 645 | 'group' => 'default', |
| 646 | - 'desc' => __('Allow logged-in users to delete entries they created.', 'gravityview'), |
|
| 646 | + 'desc' => __( 'Allow logged-in users to delete entries they created.', 'gravityview' ), |
|
| 647 | 647 | 'value' => 0, |
| 648 | - 'tooltip' => __('Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview'), |
|
| 648 | + 'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ), |
|
| 649 | 649 | 'type' => 'checkbox', |
| 650 | 650 | 'show_in_shortcode' => true, |
| 651 | 651 | ), |
| 652 | 652 | 'sort_field' => array( |
| 653 | - 'label' => __('Sort by field', 'gravityview'), |
|
| 653 | + 'label' => __( 'Sort by field', 'gravityview' ), |
|
| 654 | 654 | 'type' => 'select', |
| 655 | 655 | 'value' => '', |
| 656 | 656 | 'group' => 'sort', |
| 657 | 657 | 'options' => array( |
| 658 | - '' => __( 'Default', 'gravityview'), |
|
| 659 | - 'date_created' => __( 'Date Created', 'gravityview'), |
|
| 658 | + '' => __( 'Default', 'gravityview' ), |
|
| 659 | + 'date_created' => __( 'Date Created', 'gravityview' ), |
|
| 660 | 660 | ), |
| 661 | 661 | 'show_in_shortcode' => true, |
| 662 | 662 | ), |
| 663 | 663 | 'sort_direction' => array( |
| 664 | - 'label' => __('Sort direction', 'gravityview'), |
|
| 664 | + 'label' => __( 'Sort direction', 'gravityview' ), |
|
| 665 | 665 | 'type' => 'select', |
| 666 | 666 | 'value' => 'ASC', |
| 667 | 667 | 'group' => 'sort', |
| 668 | 668 | 'options' => array( |
| 669 | - 'ASC' => __('ASC', 'gravityview'), |
|
| 670 | - 'DESC' => __('DESC', 'gravityview'), |
|
| 669 | + 'ASC' => __( 'ASC', 'gravityview' ), |
|
| 670 | + 'DESC' => __( 'DESC', 'gravityview' ), |
|
| 671 | 671 | //'RAND' => __('Random', 'gravityview'), |
| 672 | 672 | ), |
| 673 | 673 | 'show_in_shortcode' => true, |
@@ -683,69 +683,69 @@ discard block |
||
| 683 | 683 | 'show_in_template' => array( 'default_table' ), |
| 684 | 684 | ), |
| 685 | 685 | 'start_date' => array( |
| 686 | - 'label' => __('Filter by Start Date', 'gravityview'), |
|
| 686 | + 'label' => __( 'Filter by Start Date', 'gravityview' ), |
|
| 687 | 687 | 'class' => 'gv-datepicker', |
| 688 | - 'desc' => __('Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ), |
|
| 688 | + 'desc' => __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ), |
|
| 689 | 689 | 'type' => 'text', |
| 690 | 690 | 'value' => '', |
| 691 | 691 | 'group' => 'filter', |
| 692 | 692 | 'show_in_shortcode' => true, |
| 693 | 693 | ), |
| 694 | 694 | 'end_date' => array( |
| 695 | - 'label' => __('Filter by End Date', 'gravityview'), |
|
| 695 | + 'label' => __( 'Filter by End Date', 'gravityview' ), |
|
| 696 | 696 | 'class' => 'gv-datepicker', |
| 697 | - 'desc' => __('Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ), |
|
| 697 | + 'desc' => __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ), |
|
| 698 | 698 | 'type' => 'text', |
| 699 | 699 | 'value' => '', |
| 700 | 700 | 'group' => 'filter', |
| 701 | 701 | 'show_in_shortcode' => true, |
| 702 | 702 | ), |
| 703 | 703 | 'class' => array( |
| 704 | - 'label' => __('CSS Class', 'gravityview'), |
|
| 705 | - 'desc' => __('CSS class to add to the wrapping HTML container.', 'gravityview'), |
|
| 704 | + 'label' => __( 'CSS Class', 'gravityview' ), |
|
| 705 | + 'desc' => __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ), |
|
| 706 | 706 | 'group' => 'default', |
| 707 | 707 | 'type' => 'text', |
| 708 | 708 | 'value' => '', |
| 709 | 709 | 'show_in_shortcode' => false, |
| 710 | 710 | ), |
| 711 | 711 | 'search_value' => array( |
| 712 | - 'label' => __('Search Value', 'gravityview'), |
|
| 713 | - 'desc' => __('Define a default search value for the View', 'gravityview'), |
|
| 712 | + 'label' => __( 'Search Value', 'gravityview' ), |
|
| 713 | + 'desc' => __( 'Define a default search value for the View', 'gravityview' ), |
|
| 714 | 714 | 'type' => 'text', |
| 715 | 715 | 'value' => '', |
| 716 | 716 | 'group' => 'filter', |
| 717 | 717 | 'show_in_shortcode' => false, |
| 718 | 718 | ), |
| 719 | 719 | 'search_field' => array( |
| 720 | - 'label' => __('Search Field', 'gravityview'), |
|
| 721 | - 'desc' => __('If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview'), |
|
| 720 | + 'label' => __( 'Search Field', 'gravityview' ), |
|
| 721 | + 'desc' => __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ), |
|
| 722 | 722 | 'type' => 'number', |
| 723 | 723 | 'value' => '', |
| 724 | 724 | 'group' => 'filter', |
| 725 | 725 | 'show_in_shortcode' => false, |
| 726 | 726 | ), |
| 727 | 727 | 'single_title' => array( |
| 728 | - 'label' => __('Single Entry Title', 'gravityview'), |
|
| 728 | + 'label' => __( 'Single Entry Title', 'gravityview' ), |
|
| 729 | 729 | 'type' => 'text', |
| 730 | - 'desc' => __('When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview'), |
|
| 730 | + 'desc' => __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ), |
|
| 731 | 731 | 'group' => 'default', |
| 732 | 732 | 'value' => '', |
| 733 | 733 | 'show_in_shortcode' => false, |
| 734 | 734 | 'full_width' => true, |
| 735 | 735 | ), |
| 736 | 736 | 'back_link_label' => array( |
| 737 | - 'label' => __('Back Link Label', 'gravityview'), |
|
| 737 | + 'label' => __( 'Back Link Label', 'gravityview' ), |
|
| 738 | 738 | 'group' => 'default', |
| 739 | - 'desc' => __('The text of the link that returns to the multiple entries view.', 'gravityview'), |
|
| 739 | + 'desc' => __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ), |
|
| 740 | 740 | 'type' => 'text', |
| 741 | 741 | 'value' => '', |
| 742 | 742 | 'show_in_shortcode' => false, |
| 743 | 743 | 'full_width' => true, |
| 744 | 744 | ), |
| 745 | 745 | 'embed_only' => array( |
| 746 | - 'label' => __('Prevent Direct Access', 'gravityview'), |
|
| 746 | + 'label' => __( 'Prevent Direct Access', 'gravityview' ), |
|
| 747 | 747 | 'group' => 'default', |
| 748 | - 'desc' => __('Only allow access to this View when embedded using the shortcode.', 'gravityview'), |
|
| 748 | + 'desc' => __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ), |
|
| 749 | 749 | 'type' => 'checkbox', |
| 750 | 750 | 'value' => '', |
| 751 | 751 | 'show_in_shortcode' => false, |
@@ -756,15 +756,15 @@ discard block |
||
| 756 | 756 | 'value' => '', |
| 757 | 757 | 'show_in_shortcode' => false, |
| 758 | 758 | ), |
| 759 | - )); |
|
| 759 | + ) ); |
|
| 760 | 760 | |
| 761 | 761 | // By default, we only want the key => value pairing, not the whole array. |
| 762 | - if( empty( $with_details ) ) { |
|
| 762 | + if ( empty( $with_details ) ) { |
|
| 763 | 763 | |
| 764 | 764 | $defaults = array(); |
| 765 | 765 | |
| 766 | - foreach( $default_settings as $key => $value ) { |
|
| 767 | - $defaults[ $key ] = $value['value']; |
|
| 766 | + foreach ( $default_settings as $key => $value ) { |
|
| 767 | + $defaults[ $key ] = $value[ 'value' ]; |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | return $defaults; |
@@ -773,12 +773,12 @@ discard block |
||
| 773 | 773 | // But sometimes, we want all the details. |
| 774 | 774 | else { |
| 775 | 775 | |
| 776 | - foreach ($default_settings as $key => $value) { |
|
| 776 | + foreach ( $default_settings as $key => $value ) { |
|
| 777 | 777 | |
| 778 | 778 | // If the $group argument is set for the method, |
| 779 | 779 | // ignore any settings that aren't in that group. |
| 780 | - if( !empty( $group ) && is_string( $group ) ) { |
|
| 781 | - if( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
| 780 | + if ( ! empty( $group ) && is_string( $group ) ) { |
|
| 781 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
| 782 | 782 | unset( $default_settings[ $key ] ); |
| 783 | 783 | } |
| 784 | 784 | } |