@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @subpackage Test Content |
10 | 10 | * @author Old Town Media |
11 | 11 | */ |
12 | -abstract class Type{ |
|
12 | +abstract class Type { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * type |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function set_type( $types ) { |
50 | 50 | |
51 | - $types[] = $this->type; |
|
51 | + $types[ ] = $this->type; |
|
52 | 52 | return $types; |
53 | 53 | |
54 | 54 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @subpackage Test Content |
10 | 10 | * @author Old Town Media |
11 | 11 | */ |
12 | -abstract class Type{ |
|
12 | +abstract class Type { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * type |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @subpackage Evans |
11 | 11 | * @author Old Town Media |
12 | 12 | */ |
13 | -class Reporting{ |
|
13 | +class Reporting { |
|
14 | 14 | |
15 | 15 | public function create_report( $data ) { |
16 | 16 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @subpackage Evans |
11 | 11 | * @author Old Town Media |
12 | 12 | */ |
13 | -class Reporting{ |
|
13 | +class Reporting { |
|
14 | 14 | |
15 | 15 | public function create_report( $data ) { |
16 | 16 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @subpackage Evans |
10 | 10 | * @author Old Town Media |
11 | 11 | */ |
12 | -class Delete{ |
|
12 | +class Delete { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Delete all test content created ever. |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - $type = 'DummyPress\Types\\' . ucwords( $data['type'] ); |
|
68 | - $slug = $data['slug']; |
|
67 | + $type = 'DummyPress\Types\\' . ucwords( $data[ 'type' ] ); |
|
68 | + $slug = $data[ 'slug' ]; |
|
69 | 69 | |
70 | 70 | $object = new $type(); |
71 | 71 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @subpackage Evans |
10 | 10 | * @author Old Town Media |
11 | 11 | */ |
12 | -class Delete{ |
|
12 | +class Delete { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Delete all test content created ever. |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class MetaboxValues{ |
|
11 | +class MetaboxValues { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Assigns the proper testing data to a custom metabox. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | // Fetch the appropriate type of data and return |
34 | - switch( $cmb['type'] ) { |
|
34 | + switch ( $cmb[ 'type' ] ) { |
|
35 | 35 | |
36 | 36 | case 'text': |
37 | 37 | case 'text_small': |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | case 'checkbox': |
122 | 122 | |
123 | - if ( isset( $cmb['source'] ) && 'acf' === $cmb['source'] ) { |
|
123 | + if ( isset( $cmb[ 'source' ] ) && 'acf' === $cmb[ 'source' ] ) { |
|
124 | 124 | $value = $this->multicheck( $cmb ); |
125 | 125 | } else { |
126 | 126 | $value = $this->checkbox( $cmb ); |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | private function text( $cmb ) { |
184 | 184 | |
185 | 185 | // If phone is in the id, fetch a phone # |
186 | - if ( stripos( $cmb['id'], 'phone' ) ) { |
|
186 | + if ( stripos( $cmb[ 'id' ], 'phone' ) ) { |
|
187 | 187 | $value = TestContent::phone(); |
188 | 188 | |
189 | 189 | // If email is in the id, fetch an email address |
190 | - } elseif ( stripos( $cmb['id'], 'email' ) ) { |
|
190 | + } elseif ( stripos( $cmb[ 'id' ], 'email' ) ) { |
|
191 | 191 | $value = TestContent::email(); |
192 | 192 | |
193 | 193 | // If time is in the id, fetch a time string |
194 | - } elseif ( stripos( $cmb['id'], 'time' ) ) { |
|
194 | + } elseif ( stripos( $cmb[ 'id' ], 'time' ) ) { |
|
195 | 195 | $value = TestContent::time(); |
196 | 196 | |
197 | 197 | // If company|organization is in the ID, fetch a company name |
198 | - } elseif ( stripos( $cmb['id'], 'company' ) || stripos( $cmb['id'], 'organization' ) ) { |
|
198 | + } elseif ( stripos( $cmb[ 'id' ], 'company' ) || stripos( $cmb[ 'id' ], 'organization' ) ) { |
|
199 | 199 | $value = TestContent::organization(); |
200 | 200 | |
201 | 201 | // Otherwise, just a random text string |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $value = TestContent::title( rand( 10, 50 ) ); |
204 | 204 | } |
205 | 205 | |
206 | - if ( 'acf' === $cmb['source'] && ! empty( $cmb['extras']->chars ) ) { |
|
207 | - $value = substr( $value, 0, $cmb['extras']->chars ); |
|
206 | + if ( 'acf' === $cmb[ 'source' ] && ! empty( $cmb[ 'extras' ]->chars ) ) { |
|
207 | + $value = substr( $value, 0, $cmb[ 'extras' ]->chars ); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | return $value; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function email( $cmb ) { |
239 | 239 | |
240 | - return TestContent::email();; |
|
240 | + return TestContent::email(); ; |
|
241 | 241 | |
242 | 242 | } |
243 | 243 | |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | $min = 1; |
254 | 254 | $max = 10000000; |
255 | 255 | |
256 | - if ( 'acf' == $cmb['source'] && ! empty( $cmb['extras']->min ) ) { |
|
257 | - $min = $cmb['extras']->min; |
|
256 | + if ( 'acf' == $cmb[ 'source' ] && ! empty( $cmb[ 'extras' ]->min ) ) { |
|
257 | + $min = $cmb[ 'extras' ]->min; |
|
258 | 258 | } |
259 | 259 | |
260 | - if ( 'acf' == $cmb['source'] && ! empty( $cmb['extras']->max ) ) { |
|
261 | - $max = $cmb['extras']->max; |
|
260 | + if ( 'acf' == $cmb[ 'source' ] && ! empty( $cmb[ 'extras' ]->max ) ) { |
|
261 | + $max = $cmb[ 'extras' ]->max; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | return rand( $min, $max ); |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | |
352 | 352 | $value = TestContent::plain_text(); |
353 | 353 | |
354 | - if ( 'acf' == $cmb['source'] && ! empty( $cmb['extras']->chars ) ) { |
|
355 | - $value = substr( $value, 0, $cmb['extras']->chars ); |
|
354 | + if ( 'acf' == $cmb[ 'source' ] && ! empty( $cmb[ 'extras' ]->chars ) ) { |
|
355 | + $value = substr( $value, 0, $cmb[ 'extras' ]->chars ); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return $value; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | private function radio( $cmb ) { |
372 | 372 | |
373 | 373 | // Grab a random item out of the array and return the key |
374 | - $new_val = array_slice( $cmb['options'], rand( 0, count( $cmb['options'] ) ), 1 ); |
|
374 | + $new_val = array_slice( $cmb[ 'options' ], rand( 0, count( $cmb[ 'options' ] ) ), 1 ); |
|
375 | 375 | $value = key( $new_val ); |
376 | 376 | |
377 | 377 | return $value; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | $new_option = array(); |
414 | 414 | |
415 | 415 | // Loop through each of our options |
416 | - foreach ( $cmb['options'] as $key => $value ) { |
|
416 | + foreach ( $cmb[ 'options' ] as $key => $value ) { |
|
417 | 417 | |
418 | 418 | // 50/50 chance of being included |
419 | 419 | if ( rand( 0, 1 ) ) { |
420 | - $new_option[] = $key; |
|
420 | + $new_option[ ] = $key; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | } |
@@ -492,23 +492,23 @@ discard block |
||
492 | 492 | */ |
493 | 493 | private function update_meta( $post_id, $value, $cmb ) { |
494 | 494 | |
495 | - $type = $cmb['type']; |
|
496 | - $id = $cmb['id']; |
|
497 | - $value = apply_filters( "tc_{$type}_metabox", $value ); // Filter by metabox type |
|
495 | + $type = $cmb[ 'type' ]; |
|
496 | + $id = $cmb[ 'id' ]; |
|
497 | + $value = apply_filters( "tc_{$type}_metabox", $value ); // Filter by metabox type |
|
498 | 498 | $value = apply_filters( "tc_{$id}_metabox", $value ); // Filter by metabox ID |
499 | 499 | |
500 | 500 | // Files must be treated separately - they use the attachment ID |
501 | 501 | // & url of media for separate cmb values. (only in cmb1 & cmb2 though) |
502 | - if ( 'file'!== $cmb['type'] || ( 'file' === $cmb['type'] && 'cmb_hm' === $cmb['source'] ) ) { |
|
503 | - add_post_meta( $post_id, $cmb['id'], $value, true ); |
|
502 | + if ( 'file' !== $cmb[ 'type' ] || ( 'file' === $cmb[ 'type' ] && 'cmb_hm' === $cmb[ 'source' ] ) ) { |
|
503 | + add_post_meta( $post_id, $cmb[ 'id' ], $value, true ); |
|
504 | 504 | } else { |
505 | - add_post_meta( $post_id, $cmb['id'].'_id', $value, true ); |
|
506 | - add_post_meta( $post_id, $cmb['id'], wp_get_attachment_url( $value ), true ); |
|
505 | + add_post_meta( $post_id, $cmb[ 'id' ] . '_id', $value, true ); |
|
506 | + add_post_meta( $post_id, $cmb[ 'id' ], wp_get_attachment_url( $value ), true ); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | // Add extra, redundant meta. Because, why not have two rows for the price of one? |
510 | - if ( isset( $cmb['source'] ) && 'acf' === $cmb['source'] ) { |
|
511 | - add_post_meta( $post_id, '_' . $cmb['id'], $cmb['key'], true ); |
|
510 | + if ( isset( $cmb[ 'source' ] ) && 'acf' === $cmb[ 'source' ] ) { |
|
511 | + add_post_meta( $post_id, '_' . $cmb[ 'id' ], $cmb[ 'key' ], true ); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class MetaboxValues{ |
|
11 | +class MetaboxValues { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Assigns the proper testing data to a custom metabox. |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class Ajax{ |
|
11 | +class Ajax { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * reporting |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->reporting = new Reporting; |
45 | 45 | $this->action = 'handle_test_data'; |
46 | 46 | |
47 | - add_action( "wp_ajax_{$this->action}" , array( $this, 'handle_ajax' ) ); |
|
47 | + add_action( "wp_ajax_{$this->action}", array( $this, 'handle_ajax' ) ); |
|
48 | 48 | add_filter( 'option_active_plugins', array( $this, 'ajax_exclude_plugins' ) ); |
49 | 49 | |
50 | 50 | } |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function ajax_exclude_plugins( $plugins ) { |
79 | 79 | |
80 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['action'] ) || false === strpos( $_POST['action'], $this->action ) ) { |
|
80 | + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST[ 'action' ] ) || false === strpos( $_POST[ 'action' ], $this->action ) ) { |
|
81 | 81 | return $plugins; |
82 | 82 | } |
83 | 83 | |
84 | - foreach( $plugins as $key => $plugin ) { |
|
84 | + foreach ( $plugins as $key => $plugin ) { |
|
85 | 85 | |
86 | 86 | if ( false !== strpos( $plugin, $this->plugin->definitions->slug ) ) { |
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - unset( $plugins[$key] ); |
|
90 | + unset( $plugins[ $key ] ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $plugins; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function handle_ajax() { |
104 | 104 | |
105 | - $action = $_REQUEST['todo']; |
|
106 | - $nonce = $_REQUEST['nonce']; |
|
105 | + $action = $_REQUEST[ 'todo' ]; |
|
106 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
107 | 107 | |
108 | 108 | // Verify that we have a proper logged in user and it's the right person |
109 | 109 | if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'handle-test-data' ) ) { |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | */ |
132 | 132 | private function creation_routing( $data ) { |
133 | 133 | |
134 | - $type = 'DummyPress\Types\\' . ucwords( $data['type'] ); |
|
134 | + $type = 'DummyPress\Types\\' . ucwords( $data[ 'type' ] ); |
|
135 | 135 | $object = new $type(); |
136 | - $return = $object->create_objects( $data['slug'], $data['connection'], true, 1 ); |
|
136 | + $return = $object->create_objects( $data[ 'slug' ], $data[ 'connection' ], true, 1 ); |
|
137 | 137 | |
138 | 138 | $clean = $this->reporting->create_report( $return ); |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $delete_content = new Delete; |
152 | 152 | |
153 | - if ( $data['type'] == 'all' ) { |
|
153 | + if ( $data[ 'type' ] == 'all' ) { |
|
154 | 154 | |
155 | 155 | $return = $delete_content->delete_all_test_data(); |
156 | 156 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class Ajax{ |
|
11 | +class Ajax { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * reporting |
@@ -130,8 +130,8 @@ |
||
130 | 130 | } else { |
131 | 131 | // We didn't get a reponse so print the notice out |
132 | 132 | echo '<div class="notice notice-error">'; |
133 | - echo '<p>' . esc_html__( 'WordPress could not connect to Splashbase and therefore images will not pull into metaboxes/thumbnails. Turn Airplane Mode off or reconnect to the Internet to get images when creating test data.', 'dummybot' ) . '</p>'; |
|
134 | - echo '</div>'; |
|
133 | + echo '<p>' . esc_html__( 'WordPress could not connect to Splashbase and therefore images will not pull into metaboxes/thumbnails. Turn Airplane Mode off or reconnect to the Internet to get images when creating test data.', 'dummybot' ) . '</p>'; |
|
134 | + echo '</div>'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class AdminPage{ |
|
11 | +class AdminPage { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * plugin |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | public function hooks() { |
49 | 49 | |
50 | 50 | $connection = new ConnectionTest; |
51 | - $this->definitions = $this->plugin->get_definitions(); |
|
52 | - $this->connected = $connection->test(); |
|
51 | + $this->definitions = $this->plugin->get_definitions(); |
|
52 | + $this->connected = $connection->test(); |
|
53 | 53 | |
54 | - add_action( 'admin_menu' , array( $this, 'add_menu_item' ) ); |
|
55 | - add_filter( 'plugin_action_links_' . $this->definitions->basename , array( $this, 'add_settings_link' ) ); |
|
54 | + add_action( 'admin_menu', array( $this, 'add_menu_item' ) ); |
|
55 | + add_filter( 'plugin_action_links_' . $this->definitions->basename, array( $this, 'add_settings_link' ) ); |
|
56 | 56 | add_action( 'admin_notices', array( $this, 'internet_connected_admin_notice' ) ); |
57 | 57 | |
58 | 58 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function load_scripts() { |
144 | 144 | |
145 | - wp_enqueue_script( 'test-content-js', plugins_url( 'assets/admin.js' , dirname( __FILE__ ) ) ); |
|
146 | - wp_enqueue_style( 'test-content-css', plugins_url( 'assets/admin.css' , dirname( __FILE__ ) ) ); |
|
145 | + wp_enqueue_script( 'test-content-js', plugins_url( 'assets/admin.js', dirname( __FILE__ ) ) ); |
|
146 | + wp_enqueue_style( 'test-content-css', plugins_url( 'assets/admin.css', dirname( __FILE__ ) ) ); |
|
147 | 147 | |
148 | 148 | $data = array( |
149 | 149 | 'nonce' => wp_create_nonce( 'handle-test-data' ), |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function admin_page() { |
166 | 166 | echo '<div class="wrap" id="options_editor">' . "\n"; |
167 | 167 | |
168 | - echo '<h2>' . esc_html__( 'Create Test Data' , 'dummybot' ) . '</h2>' . "\n"; |
|
168 | + echo '<h2>' . esc_html__( 'Create Test Data', 'dummybot' ) . '</h2>' . "\n"; |
|
169 | 169 | |
170 | 170 | echo "<div class='nav-tab-wrapper'>"; |
171 | 171 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @subpackage Evans |
9 | 9 | * @author Old Town Media |
10 | 10 | */ |
11 | -class AdminPage{ |
|
11 | +class AdminPage { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * plugin |
@@ -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 |
@@ -11,7 +11,7 @@ |
||
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 |
@@ -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,7 +10,7 @@ |
||
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 |
@@ -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,7 +10,7 @@ |
||
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 |