@@ -427,29 +427,29 @@ discard block |
||
427 | 427 | } |
428 | 428 | |
429 | 429 | // Download the file |
430 | - $tmp = \download_url( $url ); |
|
430 | + $tmp = \download_url( $url ); |
|
431 | 431 | |
432 | - preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches ); |
|
432 | + preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches ); |
|
433 | 433 | |
434 | - $file_array['name'] = basename( $matches[0] ); |
|
435 | - $file_array['tmp_name'] = $tmp; |
|
434 | + $file_array['name'] = basename( $matches[0] ); |
|
435 | + $file_array['tmp_name'] = $tmp; |
|
436 | 436 | |
437 | - // Check for download errors |
|
438 | - if ( is_wp_error( $tmp ) ) { |
|
439 | - unlink( $file_array[ 'tmp_name' ] ); |
|
440 | - error_log( $tmp->get_error_message() ); |
|
441 | - } |
|
437 | + // Check for download errors |
|
438 | + if ( is_wp_error( $tmp ) ) { |
|
439 | + unlink( $file_array[ 'tmp_name' ] ); |
|
440 | + error_log( $tmp->get_error_message() ); |
|
441 | + } |
|
442 | 442 | |
443 | 443 | // Pull the image into the media library |
444 | - $image_id = media_handle_sideload( $file_array, $post_id ); |
|
444 | + $image_id = media_handle_sideload( $file_array, $post_id ); |
|
445 | 445 | |
446 | - // Check for handle sideload errors. |
|
447 | - if ( is_wp_error( $image_id ) ) { |
|
448 | - unlink( $file_array['tmp_name'] ); |
|
449 | - error_log( $image_id->get_error_message() ); |
|
450 | - } |
|
446 | + // Check for handle sideload errors. |
|
447 | + if ( is_wp_error( $image_id ) ) { |
|
448 | + unlink( $file_array['tmp_name'] ); |
|
449 | + error_log( $image_id->get_error_message() ); |
|
450 | + } |
|
451 | 451 | |
452 | - return apply_filters( "tc_image_data", $image_id ); |
|
452 | + return apply_filters( "tc_image_data", $image_id ); |
|
453 | 453 | |
454 | 454 | } |
455 | 455 | |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | |
473 | 473 | // If our cURL failed |
474 | 474 | if ( $curl_response === false ) { |
475 | - $info = curl_getinfo( $curl ); |
|
476 | - curl_close( $curl ); |
|
477 | - die( 'error occured during curl exec. Additional info: ' . var_export( $info ) ); |
|
475 | + $info = curl_getinfo( $curl ); |
|
476 | + curl_close( $curl ); |
|
477 | + die( 'error occured during curl exec. Additional info: ' . var_export( $info ) ); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | curl_close( $curl ); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | $char = "0123456789abcdefghijklmnopqrstuvwxyz"; |
621 | 621 | |
622 | 622 | $user_length = mt_rand( 5, 20 ); |
623 | - $domain_length = mt_rand( 7, 12 ); |
|
623 | + $domain_length = mt_rand( 7, 12 ); |
|
624 | 624 | |
625 | 625 | for ( $i = 1; $i <= $user_length; $i++ ){ |
626 | 626 | $user .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 ); |
@@ -466,7 +466,7 @@ |
||
466 | 466 | // cURL an image API for a completely random photo |
467 | 467 | $curl = curl_init( "http://www.splashbase.co/api/v1/images/random?images_only=true" ); |
468 | 468 | |
469 | - curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE ); |
|
469 | + curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); |
|
470 | 470 | |
471 | 471 | $curl_response = curl_exec( $curl ); |
472 | 472 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @subpackage Evans |
15 | 15 | * @author Old Town Media |
16 | 16 | */ |
17 | -class TestContent{ |
|
17 | +class TestContent { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Title function. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // Pull random words |
75 | - for( $i = 1; $i <= $num_words; $i++ ) { |
|
75 | + for ( $i = 1; $i <= $num_words; $i++ ) { |
|
76 | 76 | $title .= $random_words[ rand( 0, 31 ) ] . " "; |
77 | 77 | } |
78 | 78 | |
@@ -351,17 +351,17 @@ discard block |
||
351 | 351 | ); |
352 | 352 | |
353 | 353 | $used_keys = array(); |
354 | - for( $i = 1; $i < 7; $i++ ) { |
|
354 | + for ( $i = 1; $i < 7; $i++ ) { |
|
355 | 355 | |
356 | 356 | // Pull a new random key and make sure we're not repeating any elements |
357 | 357 | $key = rand( 0, 12 ); |
358 | - while( in_array( $key, $used_keys ) ) { |
|
358 | + while ( in_array( $key, $used_keys ) ) { |
|
359 | 359 | $key = rand( 0, 12 ); |
360 | 360 | } |
361 | 361 | |
362 | - $content .= $random_content_types[$key]; |
|
362 | + $content .= $random_content_types[ $key ]; |
|
363 | 363 | |
364 | - $used_keys[] = $key; |
|
364 | + $used_keys[ ] = $key; |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | return apply_filters( "tc_paragraphs_data", $content ); |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | |
432 | 432 | preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches ); |
433 | 433 | |
434 | - $file_array['name'] = basename( $matches[0] ); |
|
435 | - $file_array['tmp_name'] = $tmp; |
|
434 | + $file_array[ 'name' ] = basename( $matches[ 0 ] ); |
|
435 | + $file_array[ 'tmp_name' ] = $tmp; |
|
436 | 436 | |
437 | 437 | // Check for download errors |
438 | 438 | if ( is_wp_error( $tmp ) ) { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | // Check for handle sideload errors. |
447 | 447 | if ( is_wp_error( $image_id ) ) { |
448 | - unlink( $file_array['tmp_name'] ); |
|
448 | + unlink( $file_array[ 'tmp_name' ] ); |
|
449 | 449 | error_log( $image_id->get_error_message() ); |
450 | 450 | } |
451 | 451 | |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | $response = json_decode( $curl_response, true ); |
484 | 484 | |
485 | 485 | // Check to make sure that the return contains a valid image extensions |
486 | - preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response['url'], $matches); |
|
486 | + preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response[ 'url' ], $matches ); |
|
487 | 487 | |
488 | 488 | if ( ! empty( $matches ) ) { |
489 | - return $response['url']; |
|
489 | + return $response[ 'url' ]; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | } |
@@ -524,9 +524,9 @@ discard block |
||
524 | 524 | '5:00PM', |
525 | 525 | '13:00', |
526 | 526 | '2015', |
527 | - date( 'G:i', strtotime( " +".rand( 4, 24 )." hours" ) ), |
|
528 | - date( 'g:i', strtotime( " +".rand( 4, 24 )." hours" ) ), |
|
529 | - date( 'G:i A', strtotime( " +".rand( 4, 24 )." hours" ) ) |
|
527 | + date( 'G:i', strtotime( " +" . rand( 4, 24 ) . " hours" ) ), |
|
528 | + date( 'g:i', strtotime( " +" . rand( 4, 24 ) . " hours" ) ), |
|
529 | + date( 'G:i A', strtotime( " +" . rand( 4, 24 ) . " hours" ) ) |
|
530 | 530 | ); |
531 | 531 | |
532 | 532 | return apply_filters( "tc_time_data", $times[ rand( 0, 6 ) ] ); |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | public static function video( $type ) { |
719 | 719 | |
720 | 720 | // Switch through our video types. Expecting to add more in the future |
721 | - switch( $type ) { |
|
721 | + switch ( $type ) { |
|
722 | 722 | |
723 | 723 | // YouTube videos |
724 | 724 | case 'youtube' : |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * @subpackage Evans |
15 | 15 | * @author Old Town Media |
16 | 16 | */ |
17 | -class TestContent{ |
|
17 | +class TestContent { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Title function. |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * @see load_plugin_textdomain |
95 | 95 | */ |
96 | 96 | public function load_textdomain() { |
97 | - load_plugin_textdomain( 'dummybot', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' ); |
|
97 | + load_plugin_textdomain( 'dummybot', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class Plugin{ |
|
11 | +class Plugin { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Plugin definitions. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class Plugin{ |
|
11 | +class Plugin { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Plugin definitions. |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * @see load_plugin_textdomain |
95 | 95 | */ |
96 | 96 | public function load_textdomain() { |
97 | - load_plugin_textdomain( 'dummybot', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' ); |
|
97 | + load_plugin_textdomain( 'dummybot', false, basename( dirname( $this->definitions->file ) ) . '/languages/' ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -166,20 +166,20 @@ |
||
166 | 166 | |
167 | 167 | // Query for our terms |
168 | 168 | $args = array( |
169 | - 'hide_empty' => false, |
|
170 | - 'meta_query' => array( |
|
169 | + 'hide_empty' => false, |
|
170 | + 'meta_query' => array( |
|
171 | 171 | 'relation' => 'OR', |
172 | - array( |
|
173 | - 'key' => 'dummypress_test_data', |
|
174 | - 'value' => '__test__', |
|
175 | - 'compare' => '=' |
|
172 | + array( |
|
173 | + 'key' => 'dummypress_test_data', |
|
174 | + 'value' => '__test__', |
|
175 | + 'compare' => '=' |
|
176 | 176 | ), |
177 | 177 | array( |
178 | 178 | 'key' => 'evans_test_content', |
179 | 179 | 'value' => '__test__', |
180 | 180 | 'compare' => '=' |
181 | 181 | ), |
182 | - ) |
|
182 | + ) |
|
183 | 183 | ); |
184 | 184 | |
185 | 185 | $terms = get_terms( $slug, $args ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @subpackage Evans |
13 | 13 | * @author Old Town Media |
14 | 14 | */ |
15 | -class Term extends Abs\Type{ |
|
15 | +class Term extends Abs\Type { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * type |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Create test terms |
56 | - for( $i = 0; $i < $num; $i++ ) { |
|
56 | + for ( $i = 0; $i < $num; $i++ ) { |
|
57 | 57 | |
58 | 58 | $return = $this->create_test_object( $slug ); |
59 | 59 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ); |
94 | 94 | |
95 | 95 | // Then, set a test content flag on the new post for later deletion |
96 | - add_term_meta( $return['term_id'], 'dummypress_test_data', '__test__', true ); |
|
96 | + add_term_meta( $return[ 'term_id' ], 'dummypress_test_data', '__test__', true ); |
|
97 | 97 | |
98 | 98 | // Check if we have errors and return them or created message |
99 | 99 | if ( is_wp_error( $return ) ) { |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | return array( |
104 | 104 | 'action' => 'created', |
105 | 105 | 'object' => 'term', |
106 | - 'oid' => $return['term_id'], |
|
106 | + 'oid' => $return[ 'term_id' ], |
|
107 | 107 | 'type' => $slug, |
108 | - 'link_edit' => admin_url( '/edit-tags.php?action=edit&taxonomy='.$slug.'&tag_ID='.$return['term_id'] ), |
|
109 | - 'link_view' => get_term_link( $return['term_id'] ) |
|
108 | + 'link_edit' => admin_url( '/edit-tags.php?action=edit&taxonomy=' . $slug . '&tag_ID=' . $return[ 'term_id' ] ), |
|
109 | + 'link_view' => get_term_link( $return[ 'term_id' ] ) |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function delete_all() { |
123 | 123 | |
124 | - $delete = new Delete; |
|
124 | + $delete = new Delete; |
|
125 | 125 | |
126 | 126 | // Make sure that the current user is logged in & has full permissions. |
127 | 127 | if ( ! $delete->user_can_delete() ) { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function delete( $slug ) { |
154 | 154 | |
155 | - $delete = new Delete; |
|
155 | + $delete = new Delete; |
|
156 | 156 | |
157 | 157 | // Make sure that the current user is logged in & has full permissions. |
158 | 158 | if ( ! $delete->user_can_delete() ) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | continue; |
196 | 196 | } |
197 | 197 | |
198 | - $events[] = array( |
|
198 | + $events[ ] = array( |
|
199 | 199 | 'action' => 'deleted', |
200 | 200 | 'oid' => $term->term_id, |
201 | 201 | 'type' => $slug, |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $taxonomy = get_taxonomy( $slug ); |
211 | 211 | |
212 | - $events[] = array( |
|
212 | + $events[ ] = array( |
|
213 | 213 | 'action' => 'general', |
214 | 214 | 'message' => __( 'Deleted', 'dummybot' ) . ' ' . $taxonomy->labels->name |
215 | 215 | ); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @subpackage Evans |
13 | 13 | * @author Old Town Media |
14 | 14 | */ |
15 | -class Term extends Abs\Type{ |
|
15 | +class Term extends Abs\Type { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * type |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | global $wp_roles; |
138 | 138 | $clean_roles = array(); |
139 | 139 | |
140 | - $role_names = $wp_roles->get_names(); |
|
140 | + $role_names = $wp_roles->get_names(); |
|
141 | 141 | $flipped = array_flip( $role_names ); |
142 | 142 | |
143 | 143 | // Loop through all available roles |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $post_types = get_post_types( array( 'public' => true ), 'objects' ); |
184 | 184 | foreach ( $post_types as $post_type ) : |
185 | 185 | |
186 | - $this->delete( $post_type->name ); |
|
186 | + $this->delete( $post_type->name ); |
|
187 | 187 | |
188 | 188 | endforeach; |
189 | 189 | |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | 'number' => 500, |
229 | 229 | 'meta_query' => array( |
230 | 230 | 'relation' => 'OR', |
231 | - array( |
|
232 | - 'key' => 'dummypress_test_data', |
|
233 | - 'value' => '__test__', |
|
234 | - 'compare' => '=' |
|
231 | + array( |
|
232 | + 'key' => 'dummypress_test_data', |
|
233 | + 'value' => '__test__', |
|
234 | + 'compare' => '=' |
|
235 | 235 | ), |
236 | 236 | array( |
237 | 237 | 'key' => 'evans_test_content', |
@@ -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 @@ |
||
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 |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $post_types = get_post_types( array( 'public' => true ), 'objects' ); |
287 | 287 | foreach ( $post_types as $post_type ) : |
288 | 288 | |
289 | - return $this->delete( $post_type->name ); |
|
289 | + return $this->delete( $post_type->name ); |
|
290 | 290 | |
291 | 291 | endforeach; |
292 | 292 | |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | 'posts_per_page' => 500, |
325 | 325 | 'meta_query' => array( |
326 | 326 | 'relation' => 'OR', |
327 | - array( |
|
328 | - 'key' => 'dummypress_test_data', |
|
329 | - 'value' => '__test__', |
|
330 | - 'compare' => '=' |
|
327 | + array( |
|
328 | + 'key' => 'dummypress_test_data', |
|
329 | + 'value' => '__test__', |
|
330 | + 'compare' => '=' |
|
331 | 331 | ), |
332 | 332 | array( |
333 | 333 | 'key' => 'evans_test_content', |
@@ -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() ) { |
@@ -13,7 +13,7 @@ |
||
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 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
31 | - $class = str_replace( __NAMESPACE__ . '\\', '', $class ); |
|
31 | + $class = str_replace( __NAMESPACE__ . '\\', '', $class ); |
|
32 | 32 | |
33 | 33 | $nss = array( |
34 | 34 | 'Abstracts', |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | ); |
38 | 38 | |
39 | 39 | if ( in_array( $namespace[1], $nss ) ){ |
40 | - $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '/\1', $class ) ); |
|
41 | - $class = str_replace( '\\', '', $class ); |
|
42 | - $file = dirname( __FILE__ ) . '/' . $class . '.php'; |
|
43 | - } else { |
|
44 | - $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '-\\1', $class ) ); |
|
45 | - $file = dirname( __FILE__ ) . '/includes/class-' . $class . '.php'; |
|
46 | - } |
|
40 | + $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '/\1', $class ) ); |
|
41 | + $class = str_replace( '\\', '', $class ); |
|
42 | + $file = dirname( __FILE__ ) . '/' . $class . '.php'; |
|
43 | + } else { |
|
44 | + $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '-\\1', $class ) ); |
|
45 | + $file = dirname( __FILE__ ) . '/includes/class-' . $class . '.php'; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | if ( is_readable( $file ) ) { |
49 | 49 | require_once( $file ); |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | // Register hook providers and views. |
83 | 83 | plugin()->register_hooks( new AdminPage() ) |
84 | 84 | ->register_hooks( new Ajax() ) |
85 | - ->register_view( new Views\Posts() ) |
|
86 | - ->register_view( new Views\Terms() ) |
|
85 | + ->register_view( new Views\Posts() ) |
|
86 | + ->register_view( new Views\Terms() ) |
|
87 | 87 | ->register_view( new Views\Users() ) |
88 | 88 | ->register_view( new Views\Various() ) |
89 | 89 | ->register_type( new Types\Post() ) |
@@ -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'; |
@@ -4,12 +4,12 @@ |
||
4 | 4 | |
5 | 5 | // If uninstall is not called from WordPress, exit |
6 | 6 | if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
7 | - exit(); |
|
7 | + exit(); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | // Check if the current user has priveledges to run this method |
11 | 11 | if ( ! current_user_can( 'activate_plugins' ) ){ |
12 | - return; |
|
12 | + return; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | require dirname( __FILE__ ) . '/includes/class-delete.php'; |
@@ -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 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @see check_admin_page, check_airplane_mode, check_internet, check_splashbase |
26 | 26 | * |
27 | - * @return boolean Status of connection to Internet/Splashbase. |
|
27 | + * @return null|boolean Status of connection to Internet/Splashbase. |
|
28 | 28 | */ |
29 | 29 | public function test(){ |
30 | 30 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @subpackage Evans |
18 | 18 | * @author Old Town Media |
19 | 19 | */ |
20 | -class ConnectionTest{ |
|
20 | +class ConnectionTest { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Run all of our connection tests. |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | |
92 | - $last_uri_bit = explode( '=', $_SERVER['REQUEST_URI'] ); |
|
92 | + $last_uri_bit = explode( '=', $_SERVER[ 'REQUEST_URI' ] ); |
|
93 | 93 | if ( 'create-test-data' != end( $last_uri_bit ) ) { |
94 | 94 | return false; |
95 | 95 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // Attempt to open a socket connection to Google |
139 | 139 | $connected = @fsockopen( "www.google.com", 80 ); |
140 | 140 | |
141 | - if ( !$connected ) { |
|
141 | + if ( ! $connected ) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $test_url = esc_url( $url ); |
166 | 166 | $response = wp_remote_get( $test_url ); |
167 | 167 | |
168 | - if ( !is_array( $response ) ) { |
|
168 | + if ( ! is_array( $response ) ) { |
|
169 | 169 | return false; |
170 | 170 | } |
171 | 171 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @subpackage Evans |
18 | 18 | * @author Old Town Media |
19 | 19 | */ |
20 | -class ConnectionTest{ |
|
20 | +class ConnectionTest { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Run all of our connection tests. |
@@ -306,6 +306,9 @@ |
||
306 | 306 | |
307 | 307 | } |
308 | 308 | |
309 | + /** |
|
310 | + * @param string $source |
|
311 | + */ |
|
309 | 312 | private function add_source( $fields, $source ){ |
310 | 313 | |
311 | 314 | if ( empty( $fields ) || empty( $source ) ){ |
@@ -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; |
@@ -8,7 +8,7 @@ |
||
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. |