@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return GravityView_Field | bool |
| 43 | 43 | */ |
| 44 | 44 | public static function create( $properties ) { |
| 45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
| 46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
| 45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
| 46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
| 47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
| 48 | 48 | return new GravityView_Field( $properties ); |
| 49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return bool True: yes, it exists; False: nope |
| 63 | 63 | */ |
| 64 | 64 | public static function exists( $field_name ) { |
| 65 | - return isset( self::$_fields["{$field_name}"] ); |
|
| 65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
| 98 | 98 | |
| 99 | - foreach( self::$_fields as $field ) { |
|
| 100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
| 99 | + foreach ( self::$_fields as $field ) { |
|
| 100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
| 101 | 101 | return $field; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function get_all( $group = '' ) { |
| 118 | 118 | |
| 119 | - if( '' !== $group ) { |
|
| 119 | + if ( '' !== $group ) { |
|
| 120 | 120 | $return_fields = self::$_fields; |
| 121 | 121 | foreach ( $return_fields as $key => $field ) { |
| 122 | - if( $group !== $field->group ) { |
|
| 122 | + if ( $group !== $field->group ) { |
|
| 123 | 123 | unset( $return_fields[ $key ] ); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | /** |
| 78 | 78 | * Alias for get_instance() |
| 79 | 79 | * |
| 80 | - * @param $field_name |
|
| 80 | + * @param string $field_name |
|
| 81 | 81 | * |
| 82 | 82 | * @return GravityView_Field|false |
| 83 | 83 | */ |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <div class="gv-search-box gv-search-date"> |
| 14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 16 | 16 | <?php } ?> |
| 17 | 17 | <p> |
| 18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 19 | 19 | </p> |
| 20 | 20 | </div> |
| 21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | |
| 11 | 11 | ?> |
| 12 | 12 | <div class="gv-search-box gv-search-field-text"> |
| 13 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 15 | 15 | <?php } ?> |
| 16 | 16 | <p> |
| 17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
| 17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
| 18 | 18 | </p> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 25 | 25 | |
| 26 | - if( 'edit' === $context ) { |
|
| 26 | + if ( 'edit' === $context ) { |
|
| 27 | 27 | return $field_options; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $this->add_field_support('date_display', $field_options ); |
|
| 30 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
| 52 | 52 | |
| 53 | 53 | $date_field_output = ''; |
| 54 | - switch( $field_input_id ) { |
|
| 54 | + switch ( $field_input_id ) { |
|
| 55 | 55 | case 1: |
| 56 | 56 | $date_field_output = rgar( $parsed_date, 'day' ); |
| 57 | 57 | break; |
@@ -40,7 +40,6 @@ |
||
| 40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
| 41 | 41 | * |
| 42 | 42 | * @since 1.16.4 |
| 43 | - |
|
| 44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
| 45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
| 46 | 45 | * |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 20 | 20 | |
| 21 | - if( 'edit' === $context ) { |
|
| 21 | + if ( 'edit' === $context ) { |
|
| 22 | 22 | return $field_options; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'quiz_show_explanation' => array( |
| 27 | 27 | 'type' => 'checkbox', |
| 28 | 28 | 'label' => __( 'Show Answer Explanation?', 'gravityview' ), |
| 29 | - 'desc' => __('If the field has an answer explanation, show it?', 'gravityview'), |
|
| 29 | + 'desc' => __( 'If the field has an answer explanation, show it?', 'gravityview' ), |
|
| 30 | 30 | 'value' => false, |
| 31 | 31 | 'merge_tags' => false, |
| 32 | 32 | ), |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * @param mixed $field_id Field ID or Field array |
| 290 | 290 | * @return string field type |
| 291 | 291 | */ |
| 292 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
| 293 | - return GVCommon::get_field_type( $form, $field_id ); |
|
| 292 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
| 293 | + return GVCommon::get_field_type( $form, $field_id ); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | * @return string HTML of the output. Empty string if $view_id is empty. |
| 304 | 304 | */ |
| 305 | 305 | function get_gravityview( $view_id = '', $atts = array() ) { |
| 306 | - if( !empty( $view_id ) ) { |
|
| 307 | - $atts['id'] = $view_id; |
|
| 306 | + if ( ! empty( $view_id ) ) { |
|
| 307 | + $atts[ 'id' ] = $view_id; |
|
| 308 | 308 | $args = wp_parse_args( $atts, GravityView_View_Data::get_default_args() ); |
| 309 | 309 | $GravityView_frontend = GravityView_frontend::getInstance(); |
| 310 | 310 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -347,19 +347,19 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
| 349 | 349 | |
| 350 | - if( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 350 | + if ( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 351 | 351 | |
| 352 | 352 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
| 353 | - foreach( $form_fields as $form_field ) { |
|
| 353 | + foreach ( $form_fields as $form_field ) { |
|
| 354 | 354 | $field_id = $form_field->id; |
| 355 | - foreach( $view_fields as $zone ) { |
|
| 355 | + foreach ( $view_fields as $zone ) { |
|
| 356 | 356 | |
| 357 | 357 | // ACF compatibility; ACF-added fields aren't arrays |
| 358 | 358 | if ( ! is_array( $zone ) ) { continue; } |
| 359 | 359 | |
| 360 | - foreach( $zone as $field ) { |
|
| 360 | + foreach ( $zone as $field ) { |
|
| 361 | 361 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
| 362 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
| 362 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
| 363 | 363 | return true; |
| 364 | 364 | } |
| 365 | 365 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @see GVCommon::get_form_fields() |
| 58 | 58 | * @access public |
| 59 | - * @param string|array $form_id (default: '') or $form object |
|
| 59 | + * @param string|array $form (default: '') or $form object |
|
| 60 | 60 | * @return array |
| 61 | 61 | */ |
| 62 | 62 | function gravityview_get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -94,6 +94,7 @@ discard block |
||
| 94 | 94 | * @param int|array $form_ids The ID of the form or an array IDs of the Forms. Zero for all forms. |
| 95 | 95 | * @param mixed $passed_criteria (default: null) |
| 96 | 96 | * @param mixed &$total (default: null) |
| 97 | + * @param integer $total |
|
| 97 | 98 | * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays |
| 98 | 99 | */ |
| 99 | 100 | function gravityview_get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) { |
@@ -106,7 +107,6 @@ discard block |
||
| 106 | 107 | * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()` |
| 107 | 108 | * |
| 108 | 109 | * @access public |
| 109 | - * @param mixed $entry_id |
|
| 110 | 110 | * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false. |
| 111 | 111 | * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true {@since 1.14} |
| 112 | 112 | * @return array|boolean |
@@ -193,7 +193,6 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @see GravityView_Template::template_id |
| 195 | 195 | * |
| 196 | - * @param int $view_id The ID of the View to get the layout of |
|
| 197 | 196 | * |
| 198 | 197 | * @return string GravityView_Template::template_id value. Empty string if not. |
| 199 | 198 | */ |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | * @return void |
| 42 | 42 | */ |
| 43 | 43 | private function fix_posted_fields() { |
| 44 | - if( is_admin() && isset( $_POST['action'] ) && isset( $_POST['post_type'] ) ) { |
|
| 45 | - if( 'editpost' === $_POST['action'] && 'gravityview' === $_POST['post_type'] ) { |
|
| 46 | - $_POST['fields'] = _gravityview_process_posted_fields(); |
|
| 44 | + if ( is_admin() && isset( $_POST[ 'action' ] ) && isset( $_POST[ 'post_type' ] ) ) { |
|
| 45 | + if ( 'editpost' === $_POST[ 'action' ] && 'gravityview' === $_POST[ 'post_type' ] ) { |
|
| 46 | + $_POST[ 'fields' ] = _gravityview_process_posted_fields(); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -40,11 +40,11 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $field_options['link_phone'] = array( |
| 43 | - 'type' => 'checkbox', |
|
| 44 | - 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
| 45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 46 | - 'value' => true, |
|
| 47 | - ); |
|
| 43 | + 'type' => 'checkbox', |
|
| 44 | + 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
| 45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 46 | + 'value' => true, |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | 49 | return $field_options; |
| 50 | 50 | } |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 37 | 37 | |
| 38 | - if( 'edit' === $context ) { |
|
| 38 | + if ( 'edit' === $context ) { |
|
| 39 | 39 | return $field_options; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $field_options['link_phone'] = array( |
|
| 42 | + $field_options[ 'link_phone' ] = array( |
|
| 43 | 43 | 'type' => 'checkbox', |
| 44 | 44 | 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
| 45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview' ), |
|
| 46 | 46 | 'value' => true, |
| 47 | 47 | ); |
| 48 | 48 | |
@@ -220,6 +220,9 @@ |
||
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | + /** |
|
| 224 | + * @param string $key |
|
| 225 | + */ |
|
| 223 | 226 | public function getCurrentFieldSetting( $key ) { |
| 224 | 227 | $settings = $this->getCurrentField('field_settings'); |
| 225 | 228 | |
@@ -329,34 +329,34 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * Get the fields for a specific context |
|
| 333 | - * |
|
| 334 | - * @since 1.19.2 |
|
| 335 | - * |
|
| 332 | + * Get the fields for a specific context |
|
| 333 | + * |
|
| 334 | + * @since 1.19.2 |
|
| 335 | + * |
|
| 336 | 336 | * @param string $context [Optional] "directory", "single", or "edit" |
| 337 | 337 | * |
| 338 | 338 | * @return array Array of GravityView field layout configurations |
| 339 | 339 | */ |
| 340 | 340 | public function getContextFields( $context = '' ) { |
| 341 | 341 | |
| 342 | - if( '' === $context ) { |
|
| 343 | - $context = $this->getContext(); |
|
| 344 | - } |
|
| 342 | + if( '' === $context ) { |
|
| 343 | + $context = $this->getContext(); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | 346 | $fields = $this->getFields(); |
| 347 | 347 | |
| 348 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | + foreach ( (array) $fields as $key => $context_fields ) { |
|
| 349 | 349 | |
| 350 | - // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 351 | - $matches = explode( '_', $key ); |
|
| 350 | + // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 351 | + $matches = explode( '_', $key ); |
|
| 352 | 352 | |
| 353 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 354 | - return $context_fields; |
|
| 355 | - } |
|
| 356 | - } |
|
| 353 | + if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 354 | + return $context_fields; |
|
| 355 | + } |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | 358 | return array(); |
| 359 | - } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | 362 | * @param array $fields |
@@ -449,10 +449,10 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | public function getPaging() { |
| 451 | 451 | |
| 452 | - $default_params = array( |
|
| 453 | - 'offset' => 0, |
|
| 454 | - 'page_size' => 20, |
|
| 455 | - ); |
|
| 452 | + $default_params = array( |
|
| 453 | + 'offset' => 0, |
|
| 454 | + 'page_size' => 20, |
|
| 455 | + ); |
|
| 456 | 456 | |
| 457 | 457 | return wp_parse_args( $this->paging, $default_params ); |
| 458 | 458 | } |
@@ -509,10 +509,10 @@ discard block |
||
| 509 | 509 | public function getSorting() { |
| 510 | 510 | |
| 511 | 511 | $defaults_params = array( |
| 512 | - 'sort_field' => 'date_created', |
|
| 513 | - 'sort_direction' => 'ASC', |
|
| 514 | - 'is_numeric' => false, |
|
| 515 | - ); |
|
| 512 | + 'sort_field' => 'date_created', |
|
| 513 | + 'sort_direction' => 'ASC', |
|
| 514 | + 'is_numeric' => false, |
|
| 515 | + ); |
|
| 516 | 516 | |
| 517 | 517 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 518 | 518 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | die; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
| 19 | +if ( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
| 20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 'atts' => NULL, |
| 158 | 158 | ) ); |
| 159 | 159 | |
| 160 | - foreach ($atts as $key => $value) { |
|
| 161 | - if( is_null( $value ) ) { |
|
| 160 | + foreach ( $atts as $key => $value ) { |
|
| 161 | + if ( is_null( $value ) ) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | $this->{$key} = $value; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | static function getInstance( $passed_post = NULL ) { |
| 191 | 191 | |
| 192 | - if( empty( self::$instance ) ) { |
|
| 192 | + if ( empty( self::$instance ) ) { |
|
| 193 | 193 | self::$instance = new self( $passed_post ); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function getCurrentField( $key = NULL ) { |
| 204 | 204 | |
| 205 | - if( !empty( $key ) ) { |
|
| 206 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
| 205 | + if ( ! empty( $key ) ) { |
|
| 206 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
| 207 | 207 | return $this->_current_field[ $key ]; |
| 208 | 208 | } |
| 209 | 209 | return NULL; |
@@ -214,16 +214,16 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public function setCurrentFieldSetting( $key, $value ) { |
| 216 | 216 | |
| 217 | - if( !empty( $this->_current_field ) ) { |
|
| 218 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
| 217 | + if ( ! empty( $this->_current_field ) ) { |
|
| 218 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function getCurrentFieldSetting( $key ) { |
| 224 | - $settings = $this->getCurrentField('field_settings'); |
|
| 224 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
| 225 | 225 | |
| 226 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
| 226 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
| 227 | 227 | return $settings[ $key ]; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function getAtts( $key = NULL ) { |
| 256 | 256 | |
| 257 | - if( !empty( $key ) ) { |
|
| 258 | - if( isset( $this->atts[ $key ] ) ) { |
|
| 257 | + if ( ! empty( $key ) ) { |
|
| 258 | + if ( isset( $this->atts[ $key ] ) ) { |
|
| 259 | 259 | return $this->atts[ $key ]; |
| 260 | 260 | } |
| 261 | 261 | return NULL; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
| 323 | 323 | |
| 324 | - if( $fields && !empty( $key ) ) { |
|
| 324 | + if ( $fields && ! empty( $key ) ) { |
|
| 325 | 325 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
| 326 | 326 | } |
| 327 | 327 | |
@@ -339,18 +339,18 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public function getContextFields( $context = '' ) { |
| 341 | 341 | |
| 342 | - if( '' === $context ) { |
|
| 342 | + if ( '' === $context ) { |
|
| 343 | 343 | $context = $this->getContext(); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $fields = $this->getFields(); |
| 347 | 347 | |
| 348 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
| 349 | 349 | |
| 350 | 350 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
| 351 | 351 | $matches = explode( '_', $key ); |
| 352 | 352 | |
| 353 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
| 354 | 354 | return $context_fields; |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | public function getField( $key ) { |
| 373 | 373 | |
| 374 | - if( !empty( $key ) ) { |
|
| 375 | - if( isset( $this->fields[ $key ] ) ) { |
|
| 374 | + if ( ! empty( $key ) ) { |
|
| 375 | + if ( isset( $this->fields[ $key ] ) ) { |
|
| 376 | 376 | return $this->fields[ $key ]; |
| 377 | 377 | } |
| 378 | 378 | } |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | public function getPaginationCounts() { |
| 479 | 479 | |
| 480 | 480 | $paging = $this->getPaging(); |
| 481 | - $offset = $paging['offset']; |
|
| 482 | - $page_size = $paging['page_size']; |
|
| 481 | + $offset = $paging[ 'offset' ]; |
|
| 482 | + $page_size = $paging[ 'page_size' ]; |
|
| 483 | 483 | $total = $this->getTotalEntries(); |
| 484 | 484 | |
| 485 | 485 | if ( empty( $total ) ) { |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | */ |
| 501 | 501 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
| 502 | 502 | |
| 503 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
| 503 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | /** |
@@ -591,16 +591,16 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | public function getCurrentEntry() { |
| 593 | 593 | |
| 594 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
| 594 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
| 595 | 595 | $entries = $this->getEntries(); |
| 596 | - $entry = $entries[0]; |
|
| 596 | + $entry = $entries[ 0 ]; |
|
| 597 | 597 | } else { |
| 598 | 598 | $entry = $this->_current_entry; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** @since 1.16 Fixes DataTables empty entry issue */ |
| 602 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
| 603 | - $entry = $this->_current_field['entry']; |
|
| 602 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
| 603 | + $entry = $this->_current_field[ 'entry' ]; |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | return $entry; |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | */ |
| 638 | 638 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
| 639 | 639 | |
| 640 | - if( empty( $zone ) ) { |
|
| 641 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
|
| 640 | + if ( empty( $zone ) ) { |
|
| 641 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); |
|
| 642 | 642 | return NULL; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -647,37 +647,37 @@ discard block |
||
| 647 | 647 | 'context' => $this->getContext(), |
| 648 | 648 | 'entry' => $this->getCurrentEntry(), |
| 649 | 649 | 'form' => $this->getForm(), |
| 650 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 650 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 651 | 651 | ); |
| 652 | 652 | |
| 653 | 653 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 654 | 654 | |
| 655 | 655 | $output = ''; |
| 656 | 656 | |
| 657 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 657 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 658 | 658 | |
| 659 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 659 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 660 | 660 | |
| 661 | 661 | // Backward compatibility |
| 662 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
| 662 | + if ( 'table' === $this->getTemplatePartSlug() ) { |
|
| 663 | 663 | /** |
| 664 | 664 | * @filter `gravityview_table_cells` Modify the fields displayed in a table |
| 665 | 665 | * @param array $fields |
| 666 | 666 | * @param GravityView_View $this |
| 667 | 667 | */ |
| 668 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 668 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if( empty( $fields ) ) { |
|
| 671 | + if ( empty( $fields ) ) { |
|
| 672 | 672 | |
| 673 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] Empty View configuration for this context.', $fields ); |
|
| 673 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] Empty View configuration for this context.', $fields ); |
|
| 674 | 674 | |
| 675 | 675 | return NULL; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | $field_output = ''; |
| 679 | 679 | foreach ( $fields as $field ) { |
| 680 | - $final_atts['field'] = $field; |
|
| 680 | + $final_atts[ 'field' ] = $field; |
|
| 681 | 681 | |
| 682 | 682 | $field_output .= gravityview_field_output( $final_atts ); |
| 683 | 683 | } |
@@ -688,21 +688,21 @@ discard block |
||
| 688 | 688 | * @since 1.7.6 |
| 689 | 689 | * @param boolean $hide_empty_zone Default: false |
| 690 | 690 | */ |
| 691 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 691 | + if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 692 | 692 | return NULL; |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 696 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 695 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 696 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | $output .= $field_output; |
| 700 | 700 | |
| 701 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 701 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 702 | 702 | $output .= '</div>'; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if( $echo ) { |
|
| 705 | + if ( $echo ) { |
|
| 706 | 706 | echo $output; |
| 707 | 707 | } |
| 708 | 708 | |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | */ |
| 721 | 721 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 722 | 722 | |
| 723 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 723 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 724 | 724 | |
| 725 | 725 | $located = $this->located_templates[ $template_names ]; |
| 726 | 726 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | // Set $load to always false so we handle it here. |
| 730 | 730 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 731 | 731 | |
| 732 | - if( is_string( $template_names ) ) { |
|
| 732 | + if ( is_string( $template_names ) ) { |
|
| 733 | 733 | $this->located_templates[ $template_names ] = $located; |
| 734 | 734 | } |
| 735 | 735 | } |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | * @return mixed|null The stored data. |
| 748 | 748 | */ |
| 749 | 749 | public function __get( $name ) { |
| 750 | - if( isset( $this->{$name} ) ) { |
|
| 750 | + if ( isset( $this->{$name} ) ) { |
|
| 751 | 751 | return $this->{$name}; |
| 752 | 752 | } else { |
| 753 | 753 | return NULL; |
@@ -776,15 +776,15 @@ discard block |
||
| 776 | 776 | $additional = array(); |
| 777 | 777 | |
| 778 | 778 | // form-19-table-body.php |
| 779 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 779 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 780 | 780 | |
| 781 | 781 | // view-3-table-body.php |
| 782 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 782 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 783 | 783 | |
| 784 | - if( $this->getPostId() ) { |
|
| 784 | + if ( $this->getPostId() ) { |
|
| 785 | 785 | |
| 786 | 786 | // page-19-table-body.php |
| 787 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 787 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // Combine with existing table-body.php and table.php |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | |
| 807 | 807 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
| 808 | 808 | |
| 809 | - if( !empty( $template_file) ) { |
|
| 809 | + if ( ! empty( $template_file ) ) { |
|
| 810 | 810 | |
| 811 | 811 | if ( $require_once ) { |
| 812 | 812 | require_once( $template_file ); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | public function render_widget_hooks( $view_id ) { |
| 825 | 825 | |
| 826 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 826 | + if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 827 | 827 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
| 828 | 828 | return; |
| 829 | 829 | } |
@@ -831,9 +831,9 @@ discard block |
||
| 831 | 831 | $view_data = gravityview_get_current_view_data( $view_id ); |
| 832 | 832 | |
| 833 | 833 | // get View widget configuration |
| 834 | - $widgets = (array)$view_data['widgets']; |
|
| 834 | + $widgets = (array)$view_data[ 'widgets' ]; |
|
| 835 | 835 | |
| 836 | - switch( current_filter() ) { |
|
| 836 | + switch ( current_filter() ) { |
|
| 837 | 837 | default: |
| 838 | 838 | case 'gravityview_before': |
| 839 | 839 | $zone = 'header'; |
@@ -847,9 +847,9 @@ discard block |
||
| 847 | 847 | * Filter widgets not in the current zone |
| 848 | 848 | * @since 1.16 |
| 849 | 849 | */ |
| 850 | - foreach( $widgets as $key => $widget ) { |
|
| 850 | + foreach ( $widgets as $key => $widget ) { |
|
| 851 | 851 | // The widget isn't in the current zone |
| 852 | - if( false === strpos( $key, $zone ) ) { |
|
| 852 | + if ( false === strpos( $key, $zone ) ) { |
|
| 853 | 853 | unset( $widgets[ $key ] ); |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -864,8 +864,8 @@ discard block |
||
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | // Prevent being called twice |
| 867 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
| 868 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
| 867 | + if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { |
|
| 868 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); |
|
| 869 | 869 | return; |
| 870 | 870 | } |
| 871 | 871 | |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | |
| 877 | 877 | $default_css_class = 'gv-grid gv-widgets-' . $zone; |
| 878 | 878 | |
| 879 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 879 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 880 | 880 | $default_css_class .= ' gv-widgets-no-results'; |
| 881 | 881 | } |
| 882 | 882 | |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | * @param string $zone Current widget zone, either `header` or `footer` |
| 888 | 888 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 889 | 889 | */ |
| 890 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 890 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 891 | 891 | |
| 892 | 892 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 893 | 893 | |
@@ -895,17 +895,17 @@ discard block |
||
| 895 | 895 | ?> |
| 896 | 896 | <div class="<?php echo $css_class; ?>"> |
| 897 | 897 | <?php |
| 898 | - foreach( $rows as $row ) { |
|
| 899 | - foreach( $row as $col => $areas ) { |
|
| 900 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
|
| 898 | + foreach ( $rows as $row ) { |
|
| 899 | + foreach ( $row as $col => $areas ) { |
|
| 900 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; |
|
| 901 | 901 | ?> |
| 902 | 902 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 903 | 903 | <?php |
| 904 | - if( !empty( $areas ) ) { |
|
| 905 | - foreach( $areas as $area ) { |
|
| 906 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 907 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
| 908 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
| 904 | + if ( ! empty( $areas ) ) { |
|
| 905 | + foreach ( $areas as $area ) { |
|
| 906 | + if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 907 | + foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { |
|
| 908 | + do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); |
|
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | } |
@@ -921,8 +921,8 @@ discard block |
||
| 921 | 921 | * Prevent widgets from being called twice. |
| 922 | 922 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin |
| 923 | 923 | */ |
| 924 | - if( did_action( 'wp_head' ) ) { |
|
| 925 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
| 924 | + if ( did_action( 'wp_head' ) ) { |
|
| 925 | + do_action( $zone . '_' . $view_id . '_widgets' ); |
|
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | |