@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class MetaboxTypes{ |
|
11 | +class MetaboxTypes { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Decide which cmb library to try and loop to get our metaboxes. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | // Loop through the rules to check for post type matches |
110 | 110 | foreach ( $fieldset->rules as $rule ) { |
111 | - if ( $rule['param'] === 'post_type' && $rule['value'] === $slug ) { |
|
111 | + if ( $rule[ 'param' ] === 'post_type' && $rule[ 'value' ] === $slug ) { |
|
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | } |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | |
146 | 146 | $data = get_metadata( 'post', get_the_id() ); |
147 | 147 | |
148 | - foreach ( $data['rule'] as $rule ) { |
|
149 | - $rules[] = unserialize( $rule ); |
|
148 | + foreach ( $data[ 'rule' ] as $rule ) { |
|
149 | + $rules[ ] = unserialize( $rule ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | foreach ( $data as $key => $value ) { |
153 | 153 | if ( substr( $key, 0, 6 ) == 'field_' ) : |
154 | - $field_detail = unserialize( $value[0] ); |
|
155 | - $fields[] = array( |
|
156 | - 'key' => $field_detail['key'], |
|
157 | - 'type' => $field_detail['type'], |
|
158 | - 'name' => $field_detail['label'], |
|
159 | - 'id' => $field_detail['name'], |
|
154 | + $field_detail = unserialize( $value[ 0 ] ); |
|
155 | + $fields[ ] = array( |
|
156 | + 'key' => $field_detail[ 'key' ], |
|
157 | + 'type' => $field_detail[ 'type' ], |
|
158 | + 'name' => $field_detail[ 'label' ], |
|
159 | + 'id' => $field_detail[ 'name' ], |
|
160 | 160 | 'extras' => (object) array( |
161 | - 'chars' => ( isset( $field_detail['maxlength'] ) ? $field_detail['maxlength'] : '' ), |
|
162 | - 'max' => ( isset( $field_detail['max'] ) ? $field_detail['max'] : '' ), |
|
163 | - 'min' => ( isset( $field_detail['min'] ) ? $field_detail['min'] : '' ), |
|
161 | + 'chars' => ( isset( $field_detail[ 'maxlength' ] ) ? $field_detail[ 'maxlength' ] : '' ), |
|
162 | + 'max' => ( isset( $field_detail[ 'max' ] ) ? $field_detail[ 'max' ] : '' ), |
|
163 | + 'min' => ( isset( $field_detail[ 'min' ] ) ? $field_detail[ 'min' ] : '' ), |
|
164 | 164 | ), |
165 | - 'options' => ( isset( $field_detail['choices'] ) ? $field_detail['choices'] : '' ), |
|
165 | + 'options' => ( isset( $field_detail[ 'choices' ] ) ? $field_detail[ 'choices' ] : '' ), |
|
166 | 166 | 'source' =>'acf', |
167 | 167 | ); |
168 | 168 | |
169 | 169 | endif; |
170 | 170 | } |
171 | 171 | |
172 | - $info[] = (object) array( |
|
172 | + $info[ ] = (object) array( |
|
173 | 173 | 'rules' => $rules, |
174 | 174 | 'fields' => $fields |
175 | 175 | ); |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | foreach ( $all_metaboxes as $metabox_array ) { |
208 | 208 | |
209 | 209 | // If the custom post type ID matches this set of fields, set & stop |
210 | - if ( in_array( $slug, $metabox_array['object_types'] ) ) { |
|
210 | + if ( in_array( $slug, $metabox_array[ 'object_types' ] ) ) { |
|
211 | 211 | |
212 | 212 | // If this is the first group of fields, simply set the value |
213 | 213 | // Else, merge this group with the previous one |
214 | 214 | if ( empty( $fields ) ) { |
215 | - $fields = $metabox_array['fields']; |
|
215 | + $fields = $metabox_array[ 'fields' ]; |
|
216 | 216 | } else { |
217 | - $fields = array_merge( $fields, $metabox_array['fields'] ); |
|
217 | + $fields = array_merge( $fields, $metabox_array[ 'fields' ] ); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | $match = false; |
228 | 228 | |
229 | 229 | // Establish correct cmb types |
230 | - if ( is_string( $cmb->meta_box['object_types'] ) ) { |
|
231 | - if ( $cmb->meta_box['object_types'] == $slug ) { |
|
230 | + if ( is_string( $cmb->meta_box[ 'object_types' ] ) ) { |
|
231 | + if ( $cmb->meta_box[ 'object_types' ] == $slug ) { |
|
232 | 232 | $match = true; |
233 | 233 | } |
234 | 234 | } else { |
235 | - if ( in_array( $slug, $cmb->meta_box['object_types'] ) ) { |
|
235 | + if ( in_array( $slug, $cmb->meta_box[ 'object_types' ] ) ) { |
|
236 | 236 | $match = true; |
237 | 237 | } |
238 | 238 | } |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | if ( empty( $fields ) ) { |
245 | - $fields = $cmb->meta_box['fields']; |
|
245 | + $fields = $cmb->meta_box[ 'fields' ]; |
|
246 | 246 | } else { |
247 | - $fields = array_merge( $fields, $cmb->meta_box['fields'] ); |
|
247 | + $fields = array_merge( $fields, $cmb->meta_box[ 'fields' ] ); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | } |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | foreach ( $all_metaboxes as $metabox_array ) { |
282 | 282 | |
283 | 283 | // If the custom post type ID matches this set of fields, set & stop |
284 | - if ( in_array( $slug, $metabox_array['pages'] ) ) { |
|
284 | + if ( in_array( $slug, $metabox_array[ 'pages' ] ) ) { |
|
285 | 285 | |
286 | 286 | // If this is the first group of fields, simply set the value |
287 | 287 | // Else, merge this group with the previous one |
288 | 288 | if ( empty( $fields ) ) { |
289 | - $fields = $metabox_array['fields']; |
|
289 | + $fields = $metabox_array[ 'fields' ]; |
|
290 | 290 | } else { |
291 | - $fields = array_merge( $fields, $metabox_array['fields'] ); |
|
291 | + $fields = array_merge( $fields, $metabox_array[ 'fields' ] ); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | foreach ( $fields as $key => $value ) { |
316 | - $fields[ $key ]['source'] = $source; |
|
316 | + $fields[ $key ][ 'source' ] = $source; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | return $fields; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use DummyPress as test; |
4 | 4 | |
5 | 5 | // If uninstall is not called from WordPress, exit |
6 | -if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
6 | +if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
7 | 7 | exit(); |
8 | 8 | } |
9 | 9 |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | * @subpackage Test Content |
12 | 12 | * @author Old Town Media |
13 | 13 | */ |
14 | -class Users extends Abs\View{ |
|
14 | +class Users extends Abs\View { |
|
15 | 15 | |
16 | 16 | public function __construct() { |
17 | 17 | |
18 | 18 | $this->title = __( 'Users', 'dummybot' ); |
19 | 19 | $this->type = 'user'; |
20 | - $this->priority = 4; |
|
20 | + $this->priority = 4; |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | $html .= "<h3>"; |
42 | 42 | |
43 | - $html .= "<span class='label'>" . esc_html( $role['name'] ) . "</span>"; |
|
44 | - $html .= $this->build_button( 'create', $role['slug'], esc_html__( 'Create Users', 'dummybot' ) ); |
|
45 | - $html .= $this->build_button( 'delete', $role['slug'], esc_html__( 'Delete Users', 'dummybot' ) ); |
|
43 | + $html .= "<span class='label'>" . esc_html( $role[ 'name' ] ) . "</span>"; |
|
44 | + $html .= $this->build_button( 'create', $role[ 'slug' ], esc_html__( 'Create Users', 'dummybot' ) ); |
|
45 | + $html .= $this->build_button( 'delete', $role[ 'slug' ], esc_html__( 'Delete Users', 'dummybot' ) ); |
|
46 | 46 | |
47 | 47 | $html .= "</h3>"; |
48 | 48 |
@@ -10,13 +10,13 @@ |
||
10 | 10 | * @subpackage Test Content |
11 | 11 | * @author Old Town Media |
12 | 12 | */ |
13 | -class Posts extends Abs\View{ |
|
13 | +class Posts extends Abs\View { |
|
14 | 14 | |
15 | 15 | public function __construct() { |
16 | 16 | |
17 | 17 | $this->title = __( 'Posts', 'dummybot' ); |
18 | 18 | $this->type = 'post'; |
19 | - $this->priority = 1; |
|
19 | + $this->priority = 1; |
|
20 | 20 | |
21 | 21 | } |
22 | 22 |
@@ -10,13 +10,13 @@ |
||
10 | 10 | * @subpackage Test Content |
11 | 11 | * @author Old Town Media |
12 | 12 | */ |
13 | -class Various extends Abs\View{ |
|
13 | +class Various extends Abs\View { |
|
14 | 14 | |
15 | 15 | public function __construct() { |
16 | 16 | |
17 | 17 | $this->title = __( 'Various', 'dummybot' ); |
18 | 18 | $this->type = 'all'; |
19 | - $this->priority = 10; |
|
19 | + $this->priority = 10; |
|
20 | 20 | |
21 | 21 | } |
22 | 22 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | * @subpackage Test Content |
11 | 11 | * @author Old Town Media |
12 | 12 | */ |
13 | -class Terms extends Abs\View{ |
|
13 | +class Terms extends Abs\View { |
|
14 | 14 | |
15 | 15 | public function __construct() { |
16 | 16 | |
17 | 17 | $this->title = __( 'Terms', 'dummybot' ); |
18 | 18 | $this->type = 'term'; |
19 | - $this->priority = 2; |
|
19 | + $this->priority = 2; |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | foreach ( $taxonomies as $tax ) : |
37 | 37 | |
38 | 38 | $skipped_taxonomies = array( |
39 | - 'post_format', // We shouldn't be making random post format classes |
|
40 | - 'product_shipping_class', // These aren't used visually and are therefore skipped |
|
41 | - 'nav_menu', // Menus are handled seperately of taxonomies |
|
39 | + 'post_format', // We shouldn't be making random post format classes |
|
40 | + 'product_shipping_class', // These aren't used visually and are therefore skipped |
|
41 | + 'nav_menu', // Menus are handled seperately of taxonomies |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 | // Skip banned taxonomies |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | function dummypress_autoloader( $class ) { |
25 | 25 | $namespace = explode( '\\', $class ); |
26 | 26 | |
27 | - if ( __NAMESPACE__ !== $namespace[0] ) { |
|
27 | + if ( __NAMESPACE__ !== $namespace[ 0 ] ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'Views' |
37 | 37 | ); |
38 | 38 | |
39 | - if ( in_array( $namespace[1], $nss ) ) { |
|
39 | + if ( in_array( $namespace[ 1 ], $nss ) ) { |
|
40 | 40 | $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '/\1', $class ) ); |
41 | 41 | $class = str_replace( '\\', '', $class ); |
42 | 42 | $file = dirname( __FILE__ ) . '/' . $class . '.php'; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @subpackage Evans |
14 | 14 | * @author Old Town Media |
15 | 15 | */ |
16 | -class User extends Abs\Type{ |
|
16 | +class User extends Abs\Type { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * type |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | // Create test posts |
58 | - for( $i = 0; $i < $num; $i++ ) { |
|
58 | + for ( $i = 0; $i < $num; $i++ ) { |
|
59 | 59 | |
60 | 60 | $return = $this->create_test_object( $slug ); |
61 | 61 | |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | // First, insert our post |
91 | 91 | $userdata = array( |
92 | 92 | 'user_pass' => wp_generate_password( 12, true, true ), |
93 | - 'user_login' => strtolower( $name['first'] . $name['last'] ) . rand( 10, 100 ), |
|
93 | + 'user_login' => strtolower( $name[ 'first' ] . $name[ 'last' ] ) . rand( 10, 100 ), |
|
94 | 94 | 'user_email' => apply_filters( "tc_{$slug}_user_email", TestContent::email( true ) ), |
95 | - 'display_name' => strtolower( $name['first'] . $name['last'] ), |
|
96 | - 'first_name' => $name['first'], |
|
97 | - 'last_name' => $name['last'], |
|
95 | + 'display_name' => strtolower( $name[ 'first' ] . $name[ 'last' ] ), |
|
96 | + 'first_name' => $name[ 'first' ], |
|
97 | + 'last_name' => $name[ 'last' ], |
|
98 | 98 | 'description' => TestContent::title(), |
99 | 99 | 'user_registered' => date( 'Y-m-d H:i:s' ), |
100 | 100 | 'role' => $slug, |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | |
150 | 150 | foreach ( $roles as $role ) { |
151 | 151 | |
152 | - if ( in_array( $role['name'], $skipped_roles ) ) { |
|
152 | + if ( in_array( $role[ 'name' ], $skipped_roles ) ) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | |
156 | - $clean_roles[] = array( |
|
157 | - 'name' => $role['name'], |
|
158 | - 'slug' => $flipped[ $role['name'] ] |
|
156 | + $clean_roles[ ] = array( |
|
157 | + 'name' => $role[ 'name' ], |
|
158 | + 'slug' => $flipped[ $role[ 'name' ] ] |
|
159 | 159 | ); |
160 | 160 | |
161 | 161 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function delete_all() { |
174 | 174 | |
175 | - $delete = new Delete; |
|
175 | + $delete = new Delete; |
|
176 | 176 | |
177 | 177 | // Make sure that the current user is logged in & has full permissions. |
178 | 178 | if ( ! $delete->user_can_delete() ) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | // Loop through all user roles and remove any data |
191 | 191 | foreach ( $this->get_roles() as $role ) : |
192 | 192 | |
193 | - $this->delete( $role['slug'] ); |
|
193 | + $this->delete( $role[ 'slug' ] ); |
|
194 | 194 | |
195 | 195 | endforeach; |
196 | 196 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ); |
243 | 243 | |
244 | 244 | $objects = new \WP_User_Query( $query ); |
245 | - $users = $objects->get_results(); |
|
245 | + $users = $objects->get_results(); |
|
246 | 246 | |
247 | 247 | if ( ! empty( $users ) ) { |
248 | 248 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | continue; |
261 | 261 | } |
262 | 262 | |
263 | - $events[] = array( |
|
263 | + $events[ ] = array( |
|
264 | 264 | 'action' => 'deleted', |
265 | 265 | 'oid' => $user->ID, |
266 | 266 | 'type' => $slug, |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | } |
274 | 274 | |
275 | - $events[] = array( |
|
275 | + $events[ ] = array( |
|
276 | 276 | 'action' => 'general', |
277 | 277 | 'message' => __( 'Deleted', 'dummybot' ) . ' ' . $slug |
278 | 278 | ); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @subpackage Evans |
14 | 14 | * @author Old Town Media |
15 | 15 | */ |
16 | -class Post extends Abs\Type{ |
|
16 | +class Post extends Abs\Type { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * metabox_types |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | // Create test posts |
92 | - for( $i = 0; $i < $num; $i++ ) { |
|
92 | + for ( $i = 0; $i < $num; $i++ ) { |
|
93 | 93 | |
94 | 94 | $return = $this->create_test_object( $slug, $supports, $metaboxes ); |
95 | 95 | |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | ); |
132 | 132 | |
133 | 133 | // Add title if supported |
134 | - if ( $supports['title'] === true ) { |
|
135 | - $post['post_title'] = $title; |
|
134 | + if ( $supports[ 'title' ] === true ) { |
|
135 | + $post[ 'post_title' ] = $title; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // Add main content if supported |
139 | - if ( $supports['editor'] === true ) { |
|
140 | - $post['post_content'] = apply_filters( "tc_{$slug}_post_content", TestContent::paragraphs() ); |
|
139 | + if ( $supports[ 'editor' ] === true ) { |
|
140 | + $post[ 'post_content' ] = apply_filters( "tc_{$slug}_post_content", TestContent::paragraphs() ); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // Add excerpt content if supported |
144 | - if ( $supports['excerpt'] === true ) { |
|
145 | - $post['post_excerpt'] = apply_filters( "tc_{$slug}_post_excerpt", TestContent::plain_text() ); |
|
144 | + if ( $supports[ 'excerpt' ] === true ) { |
|
145 | + $post[ 'post_excerpt' ] = apply_filters( "tc_{$slug}_post_excerpt", TestContent::plain_text() ); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Insert then post object |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | add_post_meta( $post_id, 'dummypress_test_data', '__test__', true ); |
153 | 153 | |
154 | 154 | // Add thumbnail if supported |
155 | - if ( $this->connected == true && ( $supports['thumbnail'] === true || in_array( $slug, array( 'post', 'page' ) ) ) ) { |
|
155 | + if ( $this->connected == true && ( $supports[ 'thumbnail' ] === true || in_array( $slug, array( 'post', 'page' ) ) ) ) { |
|
156 | 156 | update_post_meta( $post_id, '_thumbnail_id', TestContent::image( $post_id ) ); |
157 | 157 | } |
158 | 158 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'object' => 'post', |
181 | 181 | 'oid' => $post_id, |
182 | 182 | 'type' => get_post_type( $post_id ), |
183 | - 'link_edit' => admin_url( '/post.php?post='.$post_id.'&action=edit' ), |
|
183 | + 'link_edit' => admin_url( '/post.php?post=' . $post_id . '&action=edit' ), |
|
184 | 184 | 'link_view' => get_permalink( $post_id ), |
185 | 185 | ); |
186 | 186 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | ); |
253 | 253 | |
254 | 254 | // Set the term data to update |
255 | - $post_data['tax_input'][ $tax ] = array( $terms[$index]->term_id ); |
|
255 | + $post_data[ 'tax_input' ][ $tax ] = array( $terms[ $index ]->term_id ); |
|
256 | 256 | |
257 | 257 | // Update the post with the taxonomy info |
258 | 258 | $return = wp_update_post( $post_data ); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function delete_all() { |
277 | 277 | |
278 | - $delete = new Delete; |
|
278 | + $delete = new Delete; |
|
279 | 279 | |
280 | 280 | // Make sure that the current user is logged in & has full permissions. |
281 | 281 | if ( ! $delete->user_can_delete() ) { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function delete( $slug ) { |
308 | 308 | |
309 | - $delete = new Delete; |
|
309 | + $delete = new Delete; |
|
310 | 310 | |
311 | 311 | // Make sure that the current user is logged in & has full permissions. |
312 | 312 | if ( ! $delete->user_can_delete() ) { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | |
356 | - $events[] = array( |
|
356 | + $events[ ] = array( |
|
357 | 357 | 'action' => 'deleted', |
358 | 358 | 'oid' => get_the_id(), |
359 | 359 | 'type' => get_post_type( get_the_id() ), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | $obj = get_post_type_object( $slug ); |
369 | 369 | |
370 | - $events[] = array( |
|
370 | + $events[ ] = array( |
|
371 | 371 | 'action' => 'general', |
372 | 372 | 'message' => __( 'Deleted', 'dummybot' ) . ' ' . $obj->labels->all_items |
373 | 373 | ); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | private function delete_associated_media( $pid ) { |
396 | 396 | |
397 | - $delete = new Delete; |
|
397 | + $delete = new Delete; |
|
398 | 398 | |
399 | 399 | // Make sure that the current user is logged in & has full permissions. |
400 | 400 | if ( ! $delete->user_can_delete() ) { |