@@ -64,7 +64,7 @@ |
||
64 | 64 | * Set an setting. |
65 | 65 | * |
66 | 66 | * @param mixed $key The key in this setting to retrieve. |
67 | - * @param mixed $default A default in case the key is not set. |
|
67 | + * @param false|null $default A default in case the key is not set. |
|
68 | 68 | * |
69 | 69 | * @api |
70 | 70 | * @since 2.0 |
@@ -174,7 +174,6 @@ |
||
174 | 174 | * @param \GV\View $view The View. |
175 | 175 | * @param \GV\Entry_Collection $entries The calculated entries. |
176 | 176 | * @param array $atts The shortcode attributes (with defaults). |
177 | - * @param array $view_atts A quirky compatibility parameter where we get the unaltered view atts. |
|
178 | 177 | * |
179 | 178 | * @return string The output. |
180 | 179 | */ |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'page_size' => 20, |
39 | 39 | ) ); |
40 | 40 | |
41 | - $view = \GV\View::by_id( $atts['id'] ? : $atts['view_id'] ); |
|
41 | + $view = \GV\View::by_id( $atts[ 'id' ] ?: $atts[ 'view_id' ] ); |
|
42 | 42 | |
43 | 43 | if ( ! $view ) { |
44 | 44 | gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $view->ID ) ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return get_the_password_form( $view->ID ); |
73 | 73 | } |
74 | 74 | |
75 | - if ( ! $view->form ) { |
|
75 | + if ( ! $view->form ) { |
|
76 | 76 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
77 | 77 | |
78 | 78 | /** |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * View details. |
98 | 98 | */ |
99 | - if ( $atts['detail'] ) { |
|
99 | + if ( $atts[ 'detail' ] ) { |
|
100 | 100 | return $this->detail( $view, $entries, $atts ); |
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Editing a single entry. |
104 | 104 | */ |
105 | 105 | } else if ( ! $is_reembedded && ( $entry = $request->is_edit_entry() ) ) { |
106 | - if ( $entry['status'] != 'active' ) { |
|
106 | + if ( $entry[ 'status' ] != 'active' ) { |
|
107 | 107 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
108 | 108 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
109 | 109 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | if ( $view->settings->get( 'show_only_approved' ) ) { |
117 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
117 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
118 | 118 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
119 | 119 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * Viewing a single entry. |
128 | 128 | */ |
129 | 129 | } else if ( ! $is_reembedded && ( $entry = $request->is_entry() ) ) { |
130 | - if ( $entry['status'] != 'active' ) { |
|
130 | + if ( $entry[ 'status' ] != 'active' ) { |
|
131 | 131 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
132 | 132 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
133 | 133 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | if ( $view->settings->get( 'show_only_approved' ) ) { |
141 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
141 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
142 | 142 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
143 | 143 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
144 | 144 | } |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | |
156 | 156 | // Mock the request with the actual View, not the global one |
157 | 157 | $mock_request = new \GV\Mock_Request(); |
158 | - $mock_request->returns['is_view'] = $view; |
|
159 | - $mock_request->returns['is_entry'] = $request->is_entry(); |
|
160 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry(); |
|
161 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
158 | + $mock_request->returns[ 'is_view' ] = $view; |
|
159 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry(); |
|
160 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry(); |
|
161 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
162 | 162 | |
163 | 163 | $request = $mock_request; |
164 | 164 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | private function detail( $view, $entries, $atts ) { |
182 | 182 | $output = ''; |
183 | 183 | |
184 | - switch ( $key = $atts['detail'] ): |
|
184 | + switch ( $key = $atts[ 'detail' ] ): |
|
185 | 185 | case 'total_entries': |
186 | 186 | $output = number_format_i18n( $entries->total() ); |
187 | 187 | break; |
@@ -24,7 +24,6 @@ |
||
24 | 24 | /** |
25 | 25 | * Get a \GV\Field by Field ID for this data source. |
26 | 26 | * |
27 | - * @param int $field_id The internal field ID (custom content, etc.) |
|
28 | 27 | * |
29 | 28 | * @return \GV\Field|null The requested field or null if not found. |
30 | 29 | */ |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @param \GV\Field $field The field to be ouput. |
24 | 24 | * |
25 | - * @return string|false The field output or false if "hide_empty" is set. |
|
25 | + * @return null|string The field output or false if "hide_empty" is set. |
|
26 | 26 | */ |
27 | 27 | public function the_field( \GV\Field $field ) { |
28 | 28 | $renderer = new Field_Renderer(); |
@@ -63,7 +63,6 @@ |
||
63 | 63 | * Initializer. |
64 | 64 | * |
65 | 65 | * @param \GV\View $view The View connected to this template. |
66 | - * @param \GV\Entry_Collection $entries A collection of entries for this view. |
|
67 | 66 | * @param \GV\Request $request The request context. |
68 | 67 | */ |
69 | 68 | public function __construct( Entry $entry, View $view, Request $request ) { |
@@ -113,18 +113,18 @@ |
||
113 | 113 | global $post; |
114 | 114 | |
115 | 115 | if ( ! $this->request->is_view() && $post ) { |
116 | - $specifics []= sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
117 | - $specifics []= sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
118 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
119 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
116 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
117 | + $specifics [ ] = sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
118 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
119 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
120 | 120 | } |
121 | 121 | |
122 | - $specifics []= sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
123 | - $specifics []= sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
124 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
125 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
122 | + $specifics [ ] = sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
123 | + $specifics [ ] = sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
124 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
125 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
126 | 126 | |
127 | - $specifics []= sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
127 | + $specifics [ ] = sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
128 | 128 | |
129 | 129 | return array_merge( $specifics, $templates ); |
130 | 130 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | * @param \GV\Field $field The Field. |
52 | 52 | * @param \GV\Request $request The request. |
53 | 53 | * |
54 | - * @return void |
|
54 | + * @return string|null |
|
55 | 55 | */ |
56 | 56 | public function __construct( \GV\View $view, \GV\Entry $entry = null, \GV\Field $field = null, \GV\Request $request = null ) { |
57 | 57 | add_filter( $this->filter_prefix . '_get_template_part', array( $this, 'add_id_specific_templates' ), 10, 3 ); |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | $additional = array(); |
99 | 99 | |
100 | 100 | // form-19-table-body.php |
101 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
101 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
102 | 102 | |
103 | 103 | // view-3-table-body.php |
104 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
104 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
105 | 105 | |
106 | 106 | global $post; |
107 | 107 | if ( $post ) { |
108 | 108 | // page-19-table-body.php |
109 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
109 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Combine with existing table-body.php and table.php |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ob_start(); |
131 | 131 | |
132 | 132 | $request = new Mock_Request(); |
133 | - $request->returns['is_view'] = $this->view; |
|
133 | + $request->returns[ 'is_view' ] = $this->view; |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * You got one shot. One opportunity. To render all the widgets you have ever wanted. |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) { |
145 | 145 | /** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */ |
146 | 146 | if ( is_array( $wp_filter[ $hook ] ) ) { |
147 | - if ( ! empty( $wp_filter[ $hook ][10] ) ) { |
|
148 | - foreach ( $wp_filter[ $hook ][10] as $function_key => $callback ) { |
|
147 | + if ( ! empty( $wp_filter[ $hook ][ 10 ] ) ) { |
|
148 | + foreach ( $wp_filter[ $hook ][ 10 ] as $function_key => $callback ) { |
|
149 | 149 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
150 | - unset( $wp_filter[ $hook ][10][ $function_key ] ); |
|
150 | + unset( $wp_filter[ $hook ][ 10 ][ $function_key ] ); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | 154 | } else { |
155 | - foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) { |
|
155 | + foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
156 | 156 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
157 | - unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] ); |
|
157 | + unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] ); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | if ( $this->entry ) { |
167 | 167 | |
168 | - $request->returns['is_entry'] = $this->entry; |
|
168 | + $request->returns[ 'is_entry' ] = $this->entry; |
|
169 | 169 | |
170 | 170 | global $post; |
171 | 171 | |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | 'fields' => $this->view->fields->by_visible(), |
210 | 210 | 'in_the_loop' => true, |
211 | 211 | ), empty( $parameters ) ? array() : array( |
212 | - 'paging' => $parameters['paging'], |
|
213 | - 'sorting' => $parameters['sorting'], |
|
212 | + 'paging' => $parameters[ 'paging' ], |
|
213 | + 'sorting' => $parameters[ 'sorting' ], |
|
214 | 214 | ), $post ? array() : array( |
215 | 215 | 'post' => $post, |
216 | 216 | ) ) ); |
@@ -151,7 +151,7 @@ |
||
151 | 151 | * Output a field cell. |
152 | 152 | * |
153 | 153 | * @param \GV\Field $field The field to be ouput. |
154 | - * @param \GV\Field $entry The entry this field is for. |
|
154 | + * @param Entry $entry The entry this field is for. |
|
155 | 155 | * |
156 | 156 | * @return void |
157 | 157 | */ |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | */ |
116 | 116 | do_action( 'gravityview/template/table/cells/before', $context ); |
117 | 117 | |
118 | - /** |
|
119 | - * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
120 | - * @since 1.0.7 |
|
118 | + /** |
|
119 | + * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
120 | + * @since 1.0.7 |
|
121 | 121 | * @param GravityView_View $this Current GravityView_View object |
122 | 122 | * @deprecated Use `gravityview/template/table/cells/before` |
123 | - */ |
|
124 | - do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
123 | + */ |
|
124 | + do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
|
125 | 125 | |
126 | - foreach ( $fields->all() as $field ) { |
|
126 | + foreach ( $fields->all() as $field ) { |
|
127 | 127 | $this->the_field( $field, $entry ); |
128 | 128 | } |
129 | 129 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | */ |
135 | 135 | do_action( 'gravityview/template/table/cells/after', $context ); |
136 | 136 | |
137 | - /** |
|
138 | - * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
139 | - * @since 1.0.7 |
|
137 | + /** |
|
138 | + * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells. |
|
139 | + * @since 1.0.7 |
|
140 | 140 | * @param GravityView_View $this Current GravityView_View object |
141 | 141 | * @deprecated Use `gravityview/template/table/cells/after` |
142 | - */ |
|
143 | - do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
142 | + */ |
|
143 | + do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() ); |
|
144 | 144 | |
145 | 145 | ?> |
146 | 146 | </tr> |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | do_action( 'gravityview/template/table/body/before', $context ); |
202 | 202 | |
203 | 203 | /** |
204 | - * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
205 | - * @deprecated Use `gravityview/template/table/body/before` |
|
206 | - * @since 1.0.7 |
|
207 | - * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
208 | - */ |
|
204 | + * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
205 | + * @deprecated Use `gravityview/template/table/body/before` |
|
206 | + * @since 1.0.7 |
|
207 | + * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
208 | + */ |
|
209 | 209 | do_action( 'gravityview_table_body_before', \GravityView_View::getInstance() /** ugh! */ ); |
210 | 210 | } |
211 | 211 | |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | do_action( 'gravityview/template/table/body/after', $context ); |
228 | 228 | |
229 | 229 | /** |
230 | - * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
231 | - * @deprecated Use `gravityview/template/table/body/after` |
|
232 | - * @since 1.0.7 |
|
233 | - * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
234 | - */ |
|
230 | + * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
231 | + * @deprecated Use `gravityview/template/table/body/after` |
|
232 | + * @since 1.0.7 |
|
233 | + * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
234 | + */ |
|
235 | 235 | do_action( 'gravityview_table_body_after', \GravityView_View::getInstance() /** ugh! */ ); |
236 | 236 | } |
237 | 237 |
@@ -595,6 +595,7 @@ |
||
595 | 595 | * Retrieve the entries for the current view and request. |
596 | 596 | * |
597 | 597 | * @param \GV\Request The request. Usued for now. |
598 | + * @param Request|null $request |
|
598 | 599 | * |
599 | 600 | * @return \GV\Entry_Collection The entries. |
600 | 601 | */ |
@@ -62,7 +62,6 @@ |
||
62 | 62 | * |
63 | 63 | * Internal static cache for gets, and whatnot. |
64 | 64 | * This is not persistent, resets across requests. |
65 | - |
|
66 | 65 | * @internal |
67 | 66 | */ |
68 | 67 | private static $cache = array(); |
@@ -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 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * Editing a single entry. |
283 | 283 | */ |
284 | 284 | if ( $entry = $request->is_edit_entry() ) { |
285 | - if ( $entry['status'] != 'active' ) { |
|
285 | + if ( $entry[ 'status' ] != 'active' ) { |
|
286 | 286 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
287 | 287 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
288 | 288 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | if ( $view->settings->get( 'show_only_approved' ) ) { |
296 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
296 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
297 | 297 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
298 | 298 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
299 | 299 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * Viewing a single entry. |
307 | 307 | */ |
308 | 308 | } else if ( $entry = $request->is_entry() ) { |
309 | - if ( $entry['status'] != 'active' ) { |
|
309 | + if ( $entry[ 'status' ] != 'active' ) { |
|
310 | 310 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
311 | 311 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
312 | 312 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | if ( $view->settings->get( 'show_only_approved' ) ) { |
320 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
320 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
321 | 321 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
322 | 322 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
323 | 323 | } |
@@ -365,11 +365,11 @@ discard block |
||
365 | 365 | if ( ! $view->form ) { |
366 | 366 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
367 | 367 | 'view_id' => $view->ID, |
368 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
368 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
369 | 369 | ) ); |
370 | 370 | } else if ( gravityview()->plugin->supports( Plugin::FEATURE_JOINS ) ) { |
371 | 371 | /** And the connected joins. */ |
372 | - foreach( (array)get_post_meta( $view->ID, '_gravityview_form_joins', true ) as $_join ) { |
|
372 | + foreach ( (array)get_post_meta( $view->ID, '_gravityview_form_joins', true ) as $_join ) { |
|
373 | 373 | if ( ! is_array( $_join ) || count( $_join ) != 4 ) { |
374 | 374 | continue; |
375 | 375 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column ); |
382 | 382 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column ); |
383 | 383 | |
384 | - $view->joins []= new Join( $join, $join_column, $join_on, $join_on_column ); |
|
384 | + $view->joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
@@ -609,21 +609,20 @@ discard block |
||
609 | 609 | if ( $request instanceof REST\Request ) { |
610 | 610 | $atts = $this->settings->as_atts(); |
611 | 611 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
612 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
612 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
613 | 613 | ) ); |
614 | - $parameters['paging'] = $paging_parameters['paging']; |
|
614 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
615 | 615 | } |
616 | 616 | |
617 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
618 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 ); |
|
617 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
619 | 618 | |
620 | 619 | if ( gravityview()->plugin->supports( Plugin::FEATURE_JOINS ) ) { |
621 | 620 | /** |
622 | 621 | * New \GF_Query stuff :) |
623 | 622 | */ |
624 | - $query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] ); |
|
623 | + $query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] ); |
|
625 | 624 | |
626 | - $query->limit( $parameters['paging']['page_size'] ) |
|
625 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
627 | 626 | ->page( $page ); |
628 | 627 | |
629 | 628 | /** |
@@ -664,15 +663,15 @@ discard block |
||
664 | 663 | } ); |
665 | 664 | } else { |
666 | 665 | $entries = $this->form->entries |
667 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
666 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
668 | 667 | ->offset( $this->settings->get( 'offset' ) ) |
669 | - ->limit( $parameters['paging']['page_size'] ) |
|
668 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
670 | 669 | ->page( $page ); |
671 | 670 | |
672 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
671 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
673 | 672 | $field = new \GV\Field(); |
674 | - $field->ID = $parameters['sorting']['key']; |
|
675 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
673 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
674 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
676 | 675 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
677 | 676 | } |
678 | 677 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @param array $widget_args The Widget shortcode args. |
318 | 318 | * @param string $content The content. |
319 | - * @param string|\GV\Template_Context $context The context, if available. |
|
319 | + * @param string $context The context, if available. |
|
320 | 320 | * |
321 | 321 | * @return void |
322 | 322 | */ |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @internal |
376 | 376 | * @since 2.0 |
377 | 377 | * |
378 | - * @return \GV\Widget|null The widget implementation from configuration or none. |
|
378 | + * @return Widget The widget implementation from configuration or none. |
|
379 | 379 | */ |
380 | 380 | public static function from_configuration( $configuration ) { |
381 | 381 | $registered_widgets = self::registered(); |
@@ -163,14 +163,14 @@ |
||
163 | 163 | return $settings; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
166 | + /** |
|
167 | 167 | * Get the Widget ID. |
168 | 168 | * |
169 | - * @return string The Widget ID. |
|
170 | - */ |
|
171 | - public function get_widget_id() { |
|
172 | - return $this->widget_id; |
|
173 | - } |
|
169 | + * @return string The Widget ID. |
|
170 | + */ |
|
171 | + public function get_widget_id() { |
|
172 | + return $this->widget_id; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Get the widget settings |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
152 | 152 | |
153 | 153 | if ( $enable_custom_class ) { |
154 | - $settings['custom_class'] = array( |
|
154 | + $settings[ 'custom_class' ] = array( |
|
155 | 155 | 'type' => 'text', |
156 | 156 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
157 | 157 | 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function get_default_widget_areas() { |
205 | 205 | $default_areas = array( |
206 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
207 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ) , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
206 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
207 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | $widgets[ $this->get_widget_id() ] = array( |
237 | - 'label' => $this->widget_label , |
|
237 | + 'label' => $this->widget_label, |
|
238 | 238 | 'description' => $this->widget_description, |
239 | 239 | 'subtitle' => $this->widget_subtitle, |
240 | 240 | 'class' => get_called_class(), |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
257 | 257 | if ( $this->get_widget_id() === $widget ) { |
258 | - if( $settings = $this->get_settings() ) { |
|
258 | + if ( $settings = $this->get_settings() ) { |
|
259 | 259 | $options = array_merge( $options, $settings ); |
260 | 260 | } |
261 | 261 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | return; |
307 | 307 | } |
308 | 308 | |
309 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
309 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |