@@ -15,34 +15,34 @@ |
||
| 15 | 15 | $field_info_items = array(); |
| 16 | 16 | |
| 17 | 17 | // Fields with IDs, not like Source URL or Entry ID |
| 18 | - if( is_numeric( $this->id ) ) { |
|
| 18 | + if ( is_numeric( $this->id ) ) { |
|
| 19 | 19 | |
| 20 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
| 20 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
| 21 | 21 | |
| 22 | - $field_info_items[] = array( |
|
| 23 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
| 22 | + $field_info_items[ ] = array( |
|
| 23 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | - $field_info_items[] = array( |
|
| 27 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
| 26 | + $field_info_items[ ] = array( |
|
| 27 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
| 28 | 28 | ); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if( !empty( $this->item['desc'] ) ) { |
|
| 32 | - $field_info_items[] = array( |
|
| 33 | - 'value' => $this->item['desc'] |
|
| 31 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 32 | + $field_info_items[ ] = array( |
|
| 33 | + 'value' => $this->item[ 'desc' ] |
|
| 34 | 34 | ); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 38 | - $field_info_items[] = array( |
|
| 39 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 37 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 38 | + $field_info_items[ ] = array( |
|
| 39 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 40 | 40 | 'class' => 'gv-sublabel' |
| 41 | 41 | ); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $field_info_items[] = array( |
|
| 45 | - 'value' => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ), |
|
| 44 | + $field_info_items[ ] = array( |
|
| 45 | + 'value' => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ), |
|
| 46 | 46 | 'hide_in_picker' => true, |
| 47 | 47 | ); |
| 48 | 48 | |
@@ -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 | // Prevent items from not having index set |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->id = $item_id; |
| 72 | 72 | $this->form_id = $form_id; |
| 73 | 73 | $this->settings = $settings; |
| 74 | - $this->label_type = $item['label_type']; |
|
| 74 | + $this->label_type = $item[ 'label_type' ]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | foreach ( $field_info_items as $item ) { |
| 117 | 117 | |
| 118 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 118 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 122 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 123 | 123 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 124 | 124 | $output .= '<span class="' . $class . '">'; |
| 125 | - $output .= esc_html( $item['value'] ); |
|
| 125 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 126 | 126 | $output .= '</span>'; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -150,29 +150,29 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 152 | 152 | // TODO: Un-hack this |
| 153 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 153 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 154 | 154 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 155 | 155 | |
| 156 | 156 | // Should we show the icon that the field is being used as a link to single entry? |
| 157 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 157 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 158 | 158 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 159 | 159 | |
| 160 | 160 | // When a field label is empty, use the Field ID |
| 161 | 161 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 162 | 162 | |
| 163 | 163 | // If there's a custom label, and show label is checked, use that as the field heading |
| 164 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 165 | - $label = $this->settings['custom_label']; |
|
| 166 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 167 | - $label = $this->item['customLabel']; |
|
| 164 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 165 | + $label = $this->settings[ 'custom_label' ]; |
|
| 166 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 167 | + $label = $this->item[ 'customLabel' ]; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 171 | 171 | |
| 172 | 172 | $label = esc_attr( $label ); |
| 173 | 173 | |
| 174 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 175 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 174 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 175 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // Name of field / widget |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $output .= '</h5>'; |
| 190 | 190 | |
| 191 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 192 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 191 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 192 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 193 | 193 | |
| 194 | - $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>'; |
|
| 194 | + $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>'; |
|
| 195 | 195 | |
| 196 | 196 | return $output; |
| 197 | 197 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function the_field( \GV\Field $field ) { |
| 28 | 28 | $renderer = new Field_Renderer(); |
| 29 | - $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source(); |
|
| 29 | + $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source(); |
|
| 30 | 30 | |
| 31 | 31 | return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request ); |
| 32 | 32 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | foreach ( $fields->all() as $field ) { |
| 64 | 64 | $context = Template_Context::from_template( $this, compact( 'field' ) ); |
| 65 | 65 | |
| 66 | - $form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form; |
|
| 66 | + $form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form; |
|
| 67 | 67 | $entry = $this->entry->from_field( $field ); |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -58,16 +58,16 @@ |
||
| 58 | 58 | if ( $view->joins ) { |
| 59 | 59 | $form_ids = array(); |
| 60 | 60 | foreach ( $view->joins as $join ) { |
| 61 | - $form_ids[] = $join->join->ID; |
|
| 62 | - $form_ids[] = $join->join_on->ID; |
|
| 61 | + $form_ids[ ] = $join->join->ID; |
|
| 62 | + $form_ids[ ] = $join->join_on->ID; |
|
| 63 | 63 | } |
| 64 | 64 | foreach ( $entry->entries as $e ) { |
| 65 | - if ( ! in_array( $e['form_id'], $form_ids ) ) { |
|
| 65 | + if ( ! in_array( $e[ 'form_id' ], $form_ids ) ) { |
|
| 66 | 66 | gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $e->ID, 'view_id' => $view->ID ) ); |
| 67 | 67 | return null; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - } else if ( $view->form && $view->form->ID != $entry['form_id'] ) { |
|
| 70 | + } else if ( $view->form && $view->form->ID != $entry[ 'form_id' ] ) { |
|
| 71 | 71 | gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $entry->ID, 'view_id' => $view->ID ) ); |
| 72 | 72 | return null; |
| 73 | 73 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ( ! $entry instanceof Entry ) { |
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | - $_entry->entries[ $entry['form_id'] ] = &$entry; |
|
| 47 | + $_entry->entries[ $entry[ 'form_id' ] ] = &$entry; |
|
| 48 | 48 | } |
| 49 | 49 | return $_entry; |
| 50 | 50 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | foreach ( $this->entries as $entry ) { |
| 67 | 67 | $entry = $entry->as_entry(); |
| 68 | - $_entry['_multi'][ $entry['form_id'] ] = $entry; |
|
| 68 | + $_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function get_permalink( \GV\View $view = null, \GV\Request $request = null, $track_directory = true ) { |
| 88 | 88 | $slugs = array(); |
| 89 | 89 | add_filter( 'gravityview/entry/slug', $callback = function( $slug ) use ( &$slugs ) { |
| 90 | - $slugs[] = $slug; |
|
| 90 | + $slugs[ ] = $slug; |
|
| 91 | 91 | return implode( ',', $slugs ); |
| 92 | 92 | }, 10, 1 ); |
| 93 | 93 | |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | 28 | public function the_field( \GV\Field $field, $extras = null ) { |
| 29 | - $form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form; |
|
| 29 | + $form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form; |
|
| 30 | 30 | $entry = $this->entry->from_field( $field ); |
| 31 | 31 | |
| 32 | 32 | $renderer = new Field_Renderer(); |
| 33 | - $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source(); |
|
| 33 | + $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source(); |
|
| 34 | 34 | |
| 35 | 35 | $value = $renderer->render( $field, $this->view, $source, $entry, $this->request ); |
| 36 | 36 | |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | $hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context ); |
| 59 | 59 | |
| 60 | 60 | if ( is_numeric( $field->ID ) ) { |
| 61 | - $extras['field'] = $field->as_configuration(); |
|
| 61 | + $extras[ 'field' ] = $field->as_configuration(); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $extras['entry'] = $this->entry->as_entry(); |
|
| 65 | - $extras['hide_empty'] = $hide_empty; |
|
| 66 | - $extras['label'] = $label; |
|
| 67 | - $extras['value'] = $value; |
|
| 64 | + $extras[ 'entry' ] = $this->entry->as_entry(); |
|
| 65 | + $extras[ 'hide_empty' ] = $hide_empty; |
|
| 66 | + $extras[ 'label' ] = $label; |
|
| 67 | + $extras[ 'value' ] = $value; |
|
| 68 | 68 | |
| 69 | 69 | return \gravityview_field_output( $extras, $context ); |
| 70 | 70 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function is_add_oembed_preview() { |
| 47 | 47 | /** The preview request is a parse-embed AJAX call without a type set. */ |
| 48 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
| 48 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return boolean |
| 64 | 64 | */ |
| 65 | 65 | public static function is_rest() { |
| 66 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
| 66 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( ! in_array( $e['form_id'], $valid_forms ) ) { |
|
| 122 | + if ( ! in_array( $e[ 'form_id' ], $valid_forms ) ) { |
|
| 123 | 123 | return false; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - unset( $needs_forms[ $e['form_id'] ] ); |
|
| 126 | + unset( $needs_forms[ $e[ 'form_id' ] ] ); |
|
| 127 | 127 | |
| 128 | 128 | array_push( $multientry, $e ); |
| 129 | 129 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $entry = Multi_Entry::from_entries( array_filter( $multientry ) ); |
| 143 | - } else { |
|
| 143 | + } else { |
|
| 144 | 144 | /** |
| 145 | 145 | * A regular one. |
| 146 | 146 | */ |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | $get = $_GET; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - unset( $get['mode'] ); |
|
| 198 | + unset( $get[ 'mode' ] ); |
|
| 199 | 199 | |
| 200 | 200 | $get = array_filter( $get, 'gravityview_is_not_empty_string' ); |
| 201 | 201 | |
| 202 | - if( $has_field_key = $this->_has_field_key( $get ) ) { |
|
| 202 | + if ( $has_field_key = $this->_has_field_key( $get ) ) { |
|
| 203 | 203 | return true; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ); |
|
| 206 | + return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $meta = array(); |
| 228 | 228 | foreach ( $fields as $field ) { |
| 229 | - if( empty( $field->_gf_field_class_name ) ) { |
|
| 230 | - $meta[] = preg_quote( $field->name ); |
|
| 229 | + if ( empty( $field->_gf_field_class_name ) ) { |
|
| 230 | + $meta[ ] = preg_quote( $field->name ); |
|
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | foreach ( $get as $key => $value ) { |
| 235 | - if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) { |
|
| 235 | + if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) { |
|
| 236 | 236 | $has_field_key = true; |
| 237 | 237 | break; |
| 238 | 238 | } |
@@ -140,7 +140,7 @@ |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $entry = Multi_Entry::from_entries( array_filter( $multientry ) ); |
| 143 | - } else { |
|
| 143 | + } else { |
|
| 144 | 144 | /** |
| 145 | 145 | * A regular one. |
| 146 | 146 | */ |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $supports = array( 'title', 'revisions' ); |
| 109 | 109 | |
| 110 | 110 | if ( $is_hierarchical ) { |
| 111 | - $supports[] = 'page-attributes'; |
|
| 111 | + $supports[ ] = 'page-attributes'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | $rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' ); |
| 211 | 211 | |
| 212 | 212 | add_filter( 'query_vars', function( $query_vars ) { |
| 213 | - $query_vars[] = 'csv'; |
|
| 213 | + $query_vars[ ] = 'csv'; |
|
| 214 | 214 | return $query_vars; |
| 215 | 215 | } ); |
| 216 | 216 | |
| 217 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) { |
|
| 217 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) { |
|
| 218 | 218 | call_user_func_array( 'add_rewrite_rule', $rule ); |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -283,13 +283,13 @@ discard block |
||
| 283 | 283 | return $content; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 286 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | 289 | * Editing a single entry. |
| 290 | 290 | */ |
| 291 | 291 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
| 292 | - if ( $entry['status'] != 'active' ) { |
|
| 292 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 293 | 293 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 294 | 294 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 303 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 303 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 304 | 304 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 305 | 305 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 306 | 306 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * Viewing a single entry. |
| 314 | 314 | */ |
| 315 | 315 | } else if ( $entry = $request->is_entry( $view->form ? $view->form->ID : 0 ) ) { |
| 316 | - if ( $entry['status'] != 'active' ) { |
|
| 316 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 317 | 317 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 318 | 318 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 319 | 319 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $show_only_approved = $view->settings->get( 'show_only_approved' ); |
| 327 | 327 | |
| 328 | 328 | foreach ( $entryset as $e ) { |
| 329 | - if ( $e['status'] != 'active' ) { |
|
| 329 | + if ( $e[ 'status' ] != 'active' ) { |
|
| 330 | 330 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
| 331 | 331 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 332 | 332 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
| 340 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 340 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 341 | 341 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
| 342 | 342 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 343 | 343 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
| 513 | 513 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
| 514 | 514 | |
| 515 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
| 515 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | return $joins; |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | list( $join, $join_column, $join_on, $join_on_column ) = $meta; |
| 561 | 561 | |
| 562 | - $forms[] = GF_Form::by_id( $join_on ); |
|
| 562 | + $forms[ ] = GF_Form::by_id( $join_on ); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | return $forms; |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | if ( ! $view->form ) { |
| 601 | 601 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
| 602 | 602 | 'view_id' => $view->ID, |
| 603 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
| 603 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
| 604 | 604 | ) ); |
| 605 | 605 | } |
| 606 | 606 | |
@@ -833,34 +833,33 @@ discard block |
||
| 833 | 833 | * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead |
| 834 | 834 | */ |
| 835 | 835 | $parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID ); |
| 836 | - $parameters['context_view_id'] = $this->ID; |
|
| 836 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
| 837 | 837 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
| 838 | 838 | |
| 839 | 839 | if ( $request instanceof REST\Request ) { |
| 840 | 840 | $atts = $this->settings->as_atts(); |
| 841 | 841 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
| 842 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
| 842 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
| 843 | 843 | ) ); |
| 844 | - $parameters['paging'] = $paging_parameters['paging']; |
|
| 844 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
| 848 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 ); |
|
| 847 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
| 849 | 848 | |
| 850 | 849 | /** |
| 851 | 850 | * Cleanup duplicate field_filter parameters to simplify the query. |
| 852 | 851 | */ |
| 853 | 852 | $unique_field_filters = array(); |
| 854 | - foreach ( $parameters['search_criteria']['field_filters'] as $key => $filter ) { |
|
| 853 | + foreach ( $parameters[ 'search_criteria' ][ 'field_filters' ] as $key => $filter ) { |
|
| 855 | 854 | if ( 'mode' === $key ) { |
| 856 | - $unique_field_filters['mode'] = $filter; |
|
| 855 | + $unique_field_filters[ 'mode' ] = $filter; |
|
| 857 | 856 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
| 858 | - $unique_field_filters[] = $filter; |
|
| 857 | + $unique_field_filters[ ] = $filter; |
|
| 859 | 858 | } |
| 860 | 859 | } |
| 861 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
| 860 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
| 862 | 861 | |
| 863 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
| 862 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 864 | 863 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
| 865 | 864 | } |
| 866 | 865 | |
@@ -868,10 +867,10 @@ discard block |
||
| 868 | 867 | /** |
| 869 | 868 | * New \GF_Query stuff :) |
| 870 | 869 | */ |
| 871 | - $query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] ); |
|
| 870 | + $query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] ); |
|
| 872 | 871 | |
| 873 | - $query->limit( $parameters['paging']['page_size'] ) |
|
| 874 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
| 872 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
| 873 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
| 875 | 874 | |
| 876 | 875 | /** |
| 877 | 876 | * Any joins? |
@@ -913,15 +912,15 @@ discard block |
||
| 913 | 912 | } ); |
| 914 | 913 | } else { |
| 915 | 914 | $entries = $this->form->entries |
| 916 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
| 915 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
| 917 | 916 | ->offset( $this->settings->get( 'offset' ) ) |
| 918 | - ->limit( $parameters['paging']['page_size'] ) |
|
| 917 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
| 919 | 918 | ->page( $page ); |
| 920 | 919 | |
| 921 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
| 920 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
| 922 | 921 | $field = new \GV\Field(); |
| 923 | - $field->ID = $parameters['sorting']['key']; |
|
| 924 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
| 922 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
| 923 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
| 925 | 924 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
| 926 | 925 | } |
| 927 | 926 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function __destruct() { |
| 95 | - remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );; |
|
| 95 | + remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -175,55 +175,55 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | if ( $is_view && $post ) { |
| 177 | 177 | if ( $field_type ) { |
| 178 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
| 179 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
| 180 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
| 181 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
| 182 | - $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
| 183 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
| 184 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
| 185 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
| 178 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
| 179 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
| 180 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
| 181 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
| 182 | + $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
| 183 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
| 184 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
| 185 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
| 189 | - $specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
| 190 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 191 | - $specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 188 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
| 189 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
| 190 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 191 | + $specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** Field-specific */ |
| 195 | 195 | if ( $field_id && $form_id ) { |
| 196 | 196 | |
| 197 | 197 | if ( $field_id ) { |
| 198 | - $specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
| 199 | - $specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
| 198 | + $specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
| 199 | + $specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if ( $field_type ) { |
| 203 | - $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
| 204 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
| 205 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
| 206 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
| 207 | - |
|
| 208 | - $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
| 209 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
| 210 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
| 211 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
| 212 | - |
|
| 213 | - $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
| 214 | - $inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
| 215 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
| 216 | - $inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
| 203 | + $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
| 204 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
| 205 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
| 206 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
| 207 | + |
|
| 208 | + $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
| 209 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
| 210 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
| 211 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
| 212 | + |
|
| 213 | + $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
| 214 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
| 215 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
| 216 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if ( $form_id ) { |
| 221 | 221 | /** Generic field templates */ |
| 222 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
| 223 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
| 222 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
| 223 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
| 224 | 224 | |
| 225 | - $specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
| 226 | - $specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
| 225 | + $specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
| 226 | + $specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | * Ignore some types that conflict. |
| 232 | 232 | */ |
| 233 | 233 | if ( ! in_array( $field_type, array( 'notes' ) ) ) { |
| 234 | - $specifics []= sprintf( '%s.php', $field_type ); |
|
| 235 | - $specifics []= sprintf( 'fields/%s.php', $field_type ); |
|
| 234 | + $specifics [ ] = sprintf( '%s.php', $field_type ); |
|
| 235 | + $specifics [ ] = sprintf( 'fields/%s.php', $field_type ); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 239 | - $specifics []= sprintf( '%sfield.php', $slug_dir ); |
|
| 238 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 239 | + $specifics [ ] = sprintf( '%sfield.php', $slug_dir ); |
|
| 240 | 240 | |
| 241 | 241 | return array_merge( $specifics, $templates ); |
| 242 | 242 | }; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | /** Prevent any PHP warnings that may be generated. */ |
| 268 | 268 | ob_start(); |
| 269 | 269 | |
| 270 | - $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry['currency'], false, 'html' ); |
|
| 270 | + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $entry[ 'currency' ], false, 'html' ); |
|
| 271 | 271 | |
| 272 | 272 | if ( $errors = ob_get_clean() ) { |
| 273 | 273 | gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) ); |