@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | do_action( 'gravityview_search_widget_fields_before', $this ); |
| 28 | 28 | |
| 29 | - foreach( array_merge( $this->search_fields, $this->permalink_fields ) as $search_field ) { |
|
| 29 | + foreach ( array_merge( $this->search_fields, $this->permalink_fields ) as $search_field ) { |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @action `gravityview_search_widget_field_before` Before each search input is rendered (other than the submit button) |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | do_action( 'gravityview_search_widget_field_before', $this, $search_field ); |
| 37 | 37 | |
| 38 | 38 | $gravityview_view->search_field = $search_field; |
| 39 | - $this->render( 'search-field', $search_field['input'], false ); |
|
| 39 | + $this->render( 'search-field', $search_field[ 'input' ], false ); |
|
| 40 | 40 | |
| 41 | 41 | // show/hide the search button if there are input type fields |
| 42 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
| 42 | + if ( ! $has_inputs && $search_field[ 'input' ] != 'link' ) { |
|
| 43 | 43 | $has_inputs = true; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | do_action( 'gravityview_search_widget_fields_after', $this ); |
| 59 | 59 | |
| 60 | - if( $has_inputs ) { |
|
| 60 | + if ( $has_inputs ) { |
|
| 61 | 61 | $this->render( 'search-field', 'submit', false ); |
| 62 | 62 | } |
| 63 | 63 | ?> |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains" |
| 14 | 14 | * @var array |
| 15 | 15 | */ |
| 16 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 16 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 17 | 17 | |
| 18 | 18 | var $is_searchable = true; |
| 19 | 19 | |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | // Set the $_field_id var |
| 46 | 46 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 47 | 47 | |
| 48 | - if( $this->is_choice_value_enabled() ) { |
|
| 49 | - $field_options['choice_display'] = array( |
|
| 48 | + if ( $this->is_choice_value_enabled() ) { |
|
| 49 | + $field_options[ 'choice_display' ] = array( |
|
| 50 | 50 | 'type' => 'radio', |
| 51 | 51 | 'value' => 'value', |
| 52 | 52 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 46 | 46 | |
| 47 | 47 | // It's not the parent field; it's an input |
| 48 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 48 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 49 | 49 | |
| 50 | - if( $this->is_choice_value_enabled() ) { |
|
| 50 | + if ( $this->is_choice_value_enabled() ) { |
|
| 51 | 51 | |
| 52 | 52 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
| 53 | 53 | $default = 'value'; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $field_options['choice_display'] = array( |
|
| 68 | + $field_options[ 'choice_display' ] = array( |
|
| 69 | 69 | 'type' => 'radio', |
| 70 | 70 | 'class' => 'vertical', |
| 71 | 71 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
| 64 | 64 | |
| 65 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 65 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -103,31 +103,31 @@ discard block |
||
| 103 | 103 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
| 104 | 104 | |
| 105 | 105 | // If the search is being sorted |
| 106 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
| 106 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
| 107 | 107 | |
| 108 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
| 108 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
| 112 | 112 | * @see modify_sort_id() |
| 113 | 113 | */ |
| 114 | - if( ! empty( $pieces[1] ) ) { |
|
| 114 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
| 115 | 115 | |
| 116 | 116 | // Pass these to the _modify_query_sort_by_time_hack() method |
| 117 | - $this->_time_format = $pieces[1]; |
|
| 118 | - $this->_date_format = $pieces[2]; |
|
| 117 | + $this->_time_format = $pieces[ 1 ]; |
|
| 118 | + $this->_date_format = $pieces[ 2 ]; |
|
| 119 | 119 | |
| 120 | 120 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
| 121 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
| 121 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
| 125 | 125 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
| 126 | 126 | */ |
| 127 | - $criteria['sorting']['is_numeric'] = true; |
|
| 127 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
| 128 | 128 | |
| 129 | 129 | // Modify the Gravity Forms WP Query |
| 130 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 130 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * then we want to modify the query. |
| 151 | 151 | * @see GFFormsModel::sort_by_field_query() |
| 152 | 152 | */ |
| 153 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 153 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 154 | 154 | |
| 155 | - if( $this->_time_format === '24' ) { |
|
| 155 | + if ( $this->_time_format === '24' ) { |
|
| 156 | 156 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
| 157 | 157 | } else { |
| 158 | 158 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -198,18 +198,18 @@ discard block |
||
| 198 | 198 | // Set variables |
| 199 | 199 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 200 | 200 | |
| 201 | - if( 'edit' === $context ) { |
|
| 201 | + if ( 'edit' === $context ) { |
|
| 202 | 202 | return $field_options; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | 206 | * Set default date format based on field ID and Form ID |
| 207 | 207 | */ |
| 208 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 208 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 209 | 209 | |
| 210 | - $this->add_field_support('date_display', $field_options ); |
|
| 210 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 211 | 211 | |
| 212 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 212 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 213 | 213 | |
| 214 | 214 | return $field_options; |
| 215 | 215 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | private function _get_time_format() { |
| 225 | 225 | global $post; |
| 226 | 226 | |
| 227 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
| 227 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
| 228 | 228 | |
| 229 | 229 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
| 230 | 230 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | // GF defaults to 12, so should we. |
| 244 | 244 | $time_format = '12'; |
| 245 | 245 | |
| 246 | - if( $form_id ) { |
|
| 246 | + if ( $form_id ) { |
|
| 247 | 247 | $form = GFAPI::get_form( $form_id ); |
| 248 | 248 | |
| 249 | 249 | if ( $form ) { |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $default = 'h:i A'; |
| 291 | 291 | |
| 292 | 292 | // This doesn't take into account 24-hour |
| 293 | - switch( $field_input_id ) { |
|
| 293 | + switch ( $field_input_id ) { |
|
| 294 | 294 | // Hours |
| 295 | 295 | case 1: |
| 296 | 296 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -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_Radio'; |
| 17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | // Set the $_field_id var |
| 41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 42 | 42 | |
| 43 | - if( $this->is_choice_value_enabled() ) { |
|
| 44 | - $field_options['choice_display'] = array( |
|
| 43 | + if ( $this->is_choice_value_enabled() ) { |
|
| 44 | + $field_options[ 'choice_display' ] = array( |
|
| 45 | 45 | 'type' => 'radio', |
| 46 | 46 | 'value' => 'value', |
| 47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | // Set the $_field_id var |
| 45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 46 | 46 | |
| 47 | - if( $this->is_choice_value_enabled() ) { |
|
| 48 | - $field_options['choice_display'] = array( |
|
| 47 | + if ( $this->is_choice_value_enabled() ) { |
|
| 48 | + $field_options[ 'choice_display' ] = array( |
|
| 49 | 49 | 'type' => 'radio', |
| 50 | 50 | 'value' => 'value', |
| 51 | 51 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -24,21 +24,21 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 26 | 26 | |
| 27 | - unset( $field_options['search_filter'] ); |
|
| 27 | + unset( $field_options[ 'search_filter' ] ); |
|
| 28 | 28 | |
| 29 | - if( 'edit' === $context ) { |
|
| 29 | + if ( 'edit' === $context ) { |
|
| 30 | 30 | return $field_options; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $add_options['link_to_file'] = array( |
|
| 33 | + $add_options[ 'link_to_file' ] = array( |
|
| 34 | 34 | 'type' => 'checkbox', |
| 35 | 35 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 36 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 36 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 37 | 37 | 'value' => false, |
| 38 | 38 | 'merge_tags' => false, |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - $add_options['image_width'] = array( |
|
| 41 | + $add_options[ 'image_width' ] = array( |
|
| 42 | 42 | 'type' => 'text', |
| 43 | 43 | 'label' => __( 'Custom Width:', 'gravityview' ), |
| 44 | 44 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | $base_id = null; |
| 128 | 128 | |
| 129 | 129 | $is_single = gravityview_get_context() === 'single'; |
| 130 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 130 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 131 | 131 | $field_compat = $gravityview_view->getCurrentField(); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $output_arr = array(); |
| 135 | 135 | |
| 136 | 136 | // Get an array of file paths for the field. |
| 137 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 137 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 138 | 138 | |
| 139 | 139 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 140 | 140 | if ( ! is_array( $file_paths ) ) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $rendered = null; |
| 154 | 154 | |
| 155 | 155 | // If the site is HTTPS, use HTTPS |
| 156 | - if ( function_exists('set_url_scheme') ) { |
|
| 156 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 157 | 157 | $file_path = set_url_scheme( $file_path ); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | $file_path_info = pathinfo( $file_path ); |
| 165 | 165 | |
| 166 | 166 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 167 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 168 | - $basename = $file_path_info['basename']; |
|
| 167 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 168 | + $basename = $file_path_info[ 'basename' ]; |
|
| 169 | 169 | |
| 170 | 170 | // Get the secure download URL |
| 171 | 171 | $is_secure = false; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 204 | 204 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 205 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 205 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 206 | 206 | ), $context ); |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 240 | 240 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 241 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 241 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 242 | 242 | ), $context ); |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -271,13 +271,13 @@ discard block |
||
| 271 | 271 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 272 | 272 | $image_atts = array( |
| 273 | 273 | 'src' => $file_path, |
| 274 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 275 | - 'alt' => $field_settings['label'], |
|
| 276 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 274 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 275 | + 'alt' => $field_settings[ 'label' ], |
|
| 276 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 277 | 277 | ); |
| 278 | 278 | |
| 279 | 279 | if ( $is_secure ) { |
| 280 | - $image_atts['validate_src'] = false; |
|
| 280 | + $image_atts[ 'validate_src' ] = false; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | $image = new GravityView_Image( $image_atts ); |
| 294 | 294 | |
| 295 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 295 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @filter `gravityview/fields/fileupload/allow_insecure_lightbox` Allow insecure links to be shown for the lighbox. |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | $override_security = apply_filters( 'gravityview/fields/fileupload/allow_insecure_lightbox', false, $file_path, $field_settings, $context ); |
| 305 | 305 | |
| 306 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) && ( ! $is_secure || $override_security ) ) { |
|
| 306 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) && ( ! $is_secure || $override_security ) ) { |
|
| 307 | 307 | $lightbox_link_atts = array( |
| 308 | 308 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 309 | 309 | 'class' => 'thickbox', |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context ); |
| 313 | 313 | |
| 314 | 314 | if ( $override_security ) { |
| 315 | - $image_atts['src'] = $insecure_file_path; |
|
| 315 | + $image_atts[ 'src' ] = $insecure_file_path; |
|
| 316 | 316 | $image = new GravityView_Image( $image_atts ); |
| 317 | 317 | $file_path = $insecure_file_path; |
| 318 | 318 | // :( a kitten died somewhere |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | // Show as link should render the image regardless. |
| 327 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 327 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 328 | 328 | $text = $rendered; |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 342 | 342 | |
| 343 | 343 | // Output textualized content where |
| 344 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 344 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 345 | 345 | /** |
| 346 | 346 | * Modify the link text (defaults to the file name) |
| 347 | 347 | * |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 356 | 356 | |
| 357 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 357 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 358 | 358 | /** |
| 359 | 359 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 360 | 360 | * @param array|string $link_atts Array or attributes string |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $content = empty( $rendered ) ? $text : $rendered; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - $output_arr[] = array( |
|
| 373 | + $output_arr[ ] = array( |
|
| 374 | 374 | 'file_path' => $file_path, |
| 375 | 375 | 'content' => $content |
| 376 | 376 | ); |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $form_id; |
| 46 | 46 | |
| 47 | - function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) { |
|
| 47 | + function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) { |
|
| 48 | 48 | |
| 49 | 49 | // Backward compat |
| 50 | - if ( ! empty( $item['type'] ) ) { |
|
| 51 | - $item['input_type'] = $item['type']; |
|
| 52 | - unset( $item['type'] ); |
|
| 50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 52 | + unset( $item[ 'type' ] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->id = $item_id; |
| 76 | 76 | $this->form_id = $form_id; |
| 77 | 77 | $this->settings = $settings; |
| 78 | - $this->label_type = $item['label_type']; |
|
| 78 | + $this->label_type = $item[ 'label_type' ]; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | foreach ( $field_info_items as $item ) { |
| 121 | 121 | |
| 122 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 122 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 126 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 127 | 127 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 128 | 128 | $output .= '<span class="' . $class . '">'; |
| 129 | - $output .= esc_html( $item['value'] ); |
|
| 129 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 130 | 130 | $output .= '</span>'; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -154,29 +154,29 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 156 | 156 | // TODO: Un-hack this |
| 157 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 157 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 158 | 158 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 159 | 159 | |
| 160 | 160 | // Should we show the icon that the field is being used as a link to single entry? |
| 161 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 161 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 162 | 162 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 163 | 163 | |
| 164 | 164 | // When a field label is empty, use the Field ID |
| 165 | 165 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 166 | 166 | |
| 167 | 167 | // If there's a custom label, and show label is checked, use that as the field heading |
| 168 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 169 | - $label = $this->settings['custom_label']; |
|
| 170 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 171 | - $label = $this->item['customLabel']; |
|
| 168 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 169 | + $label = $this->settings[ 'custom_label' ]; |
|
| 170 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 171 | + $label = $this->item[ 'customLabel' ]; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 175 | 175 | |
| 176 | 176 | $label = esc_attr( $label ); |
| 177 | 177 | |
| 178 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 179 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 178 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 179 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Name of field / widget |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | $output .= '</h5>'; |
| 194 | 194 | |
| 195 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 196 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 195 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 196 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 197 | 197 | |
| 198 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 198 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 199 | 199 | |
| 200 | 200 | return $output; |
| 201 | 201 | } |
@@ -47,16 +47,16 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | $atts = apply_filters( 'gravityview/shortcodes/gventry/atts', $atts ); |
| 49 | 49 | |
| 50 | - $view = \GV\View::by_id( $atts['view_id'] ); |
|
| 50 | + $view = \GV\View::by_id( $atts[ 'view_id' ] ); |
|
| 51 | 51 | |
| 52 | 52 | if ( ! $view ) { |
| 53 | - gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts['view_id'] ) ); |
|
| 53 | + gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
| 54 | 54 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', null, null, $atts ); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $entry_id = ! empty( $atts['entry_id'] ) ? $atts['entry_id'] : $atts['id']; |
|
| 57 | + $entry_id = ! empty( $atts[ 'entry_id' ] ) ? $atts[ 'entry_id' ] : $atts[ 'id' ]; |
|
| 58 | 58 | |
| 59 | - switch( $entry_id ): |
|
| 59 | + switch ( $entry_id ): |
|
| 60 | 60 | case 'last': |
| 61 | 61 | if ( class_exists( '\GF_Query' ) ) { |
| 62 | 62 | /** |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
| 66 | 66 | */ |
| 67 | 67 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
| 68 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
| 68 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
| 69 | 69 | /** |
| 70 | 70 | * Reverse existing sorts. |
| 71 | 71 | */ |
| 72 | - $sort = &$parameters['sorting']; |
|
| 73 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
| 72 | + $sort = &$parameters[ 'sorting' ]; |
|
| 73 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
| 74 | 74 | } else { |
| 75 | 75 | /** |
| 76 | 76 | * Otherwise, sort by date_created. |
| 77 | 77 | */ |
| 78 | - $parameters['sorting'] = array( |
|
| 78 | + $parameters[ 'sorting' ] = array( |
|
| 79 | 79 | 'key' => 'id', |
| 80 | 80 | 'direction' => 'ASC', |
| 81 | 81 | 'is_numeric' => true |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | /** If a sort already exists, reverse it. */ |
| 92 | 92 | if ( $sort = end( $entries->sorts ) ) { |
| 93 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
| 93 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
| 94 | 94 | } else { |
| 95 | 95 | /** Otherwise, sort by date_created */ |
| 96 | 96 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | break; |
| 109 | 109 | default: |
| 110 | 110 | if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) { |
| 111 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
| 111 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
| 112 | 112 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, null, $atts ); |
| 113 | 113 | } |
| 114 | 114 | endswitch; |
| 115 | 115 | |
| 116 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
| 116 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
| 117 | 117 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
| 118 | 118 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
| 119 | 119 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | return apply_filters( 'gravityview/shortcodes/gventry/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( ! $view->form ) { |
|
| 126 | + if ( ! $view->form ) { |
|
| 127 | 127 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -146,43 +146,43 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** Unapproved entries. */ |
| 149 | - if ( $entry['status'] != 'active' ) { |
|
| 149 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 150 | 150 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 151 | 151 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 154 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 155 | 155 | |
| 156 | 156 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 157 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 157 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 158 | 158 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 159 | 159 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if ( $atts['edit'] ) { |
|
| 163 | + if ( $atts[ 'edit' ] ) { |
|
| 164 | 164 | /** |
| 165 | 165 | * Based on code in our unit-tests. |
| 166 | 166 | * Mocks old context, etc. |
| 167 | 167 | */ |
| 168 | 168 | $loader = \GravityView_Edit_Entry::getInstance(); |
| 169 | - $render = $loader->instances['render']; |
|
| 169 | + $render = $loader->instances[ 'render' ]; |
|
| 170 | 170 | |
| 171 | 171 | add_filter( 'gravityview/is_single_entry', '__return_true' ); |
| 172 | 172 | |
| 173 | - $form = \GFAPI::get_form( $entry['form_id'] ); |
|
| 173 | + $form = \GFAPI::get_form( $entry[ 'form_id' ] ); |
|
| 174 | 174 | |
| 175 | 175 | $data = \GravityView_View_Data::getInstance( $view ); |
| 176 | 176 | $template = \GravityView_View::getInstance( array( |
| 177 | 177 | 'form' => $form, |
| 178 | - 'form_id' => $form['id'], |
|
| 178 | + 'form_id' => $form[ 'id' ], |
|
| 179 | 179 | 'view_id' => $view->ID, |
| 180 | 180 | 'entries' => array( $entry ), |
| 181 | 181 | 'atts' => \GVCommon::get_template_settings( $view->ID ), |
| 182 | 182 | ) ); |
| 183 | 183 | |
| 184 | - $_GET['edit'] = wp_create_nonce( |
|
| 185 | - \GravityView_Edit_Entry::get_nonce_key( $view->ID, $form['id'], $entry['id'] ) |
|
| 184 | + $_GET[ 'edit' ] = wp_create_nonce( |
|
| 185 | + \GravityView_Edit_Entry::get_nonce_key( $view->ID, $form[ 'id' ], $entry[ 'id' ] ) |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | add_filter( 'gravityview/edit_entry/success', $callback = function( $message ) use ( $view, $entry, $atts ) { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | return apply_filters( 'gravityview/shortcodes/gventry/edit/success', $message, $view, $entry, $atts ); |
| 200 | 200 | } ); |
| 201 | 201 | |
| 202 | - ob_start() && $render->init( $data, \GV\Entry::by_id( $entry['id'] ), $view ); |
|
| 202 | + ob_start() && $render->init( $data, \GV\Entry::by_id( $entry[ 'id' ] ), $view ); |
|
| 203 | 203 | $output = ob_get_clean(); // Render :) |
| 204 | 204 | |
| 205 | 205 | remove_filter( 'gravityview/is_single_entry', '__return_true' ); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $renderer = new \GV\Entry_Renderer(); |
| 212 | 212 | |
| 213 | 213 | $request = new \GV\Mock_Request(); |
| 214 | - $request->returns['is_entry'] = $entry; |
|
| 214 | + $request->returns[ 'is_entry' ] = $entry; |
|
| 215 | 215 | |
| 216 | 216 | $output = $renderer->render( $entry, $view, $request ); |
| 217 | 217 | |