@@ -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. |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | * @param int $post_id Single post ID. |
23 | 23 | * @param array $cmb custom metabox array from CMB2. |
24 | 24 | */ |
25 | - public function get_values( $post_id, $cmb, $connected ){ |
|
25 | + public function get_values( $post_id, $cmb, $connected ) { |
|
26 | 26 | $value = ''; |
27 | 27 | |
28 | 28 | // First check that our post ID & cmb array aren't empty |
29 | - if ( empty( $cmb ) || empty( $post_id ) || ! is_user_logged_in() ){ |
|
29 | + if ( empty( $cmb ) || empty( $post_id ) || ! is_user_logged_in() ) { |
|
30 | 30 | return; |
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 ); |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // Value must exist to attempt to insert |
161 | - if ( ! empty( $value ) && ! is_wp_error( $value ) ){ |
|
161 | + if ( ! empty( $value ) && ! is_wp_error( $value ) ) { |
|
162 | 162 | |
163 | 163 | $this->update_meta( $post_id, $value, $cmb ); |
164 | 164 | |
165 | 165 | // If we're dealing with a WP Error object, just return the message for debugging |
166 | - } elseif ( is_wp_error( $value ) ){ |
|
166 | + } elseif ( is_wp_error( $value ) ) { |
|
167 | 167 | |
168 | 168 | return $value->get_error_message(); |
169 | 169 | |
@@ -180,22 +180,22 @@ discard block |
||
180 | 180 | * @param array $cmb Metabox data |
181 | 181 | * @return string cmb value |
182 | 182 | */ |
183 | - private function text( $cmb ){ |
|
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; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param array $cmb Metabox data |
221 | 221 | * @return string cmb value |
222 | 222 | */ |
223 | - private function url( $cmb ){ |
|
223 | + private function url( $cmb ) { |
|
224 | 224 | |
225 | 225 | return TestContent::link(); |
226 | 226 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | * @param array $cmb Metabox data |
236 | 236 | * @return string cmb value |
237 | 237 | */ |
238 | - private function email( $cmb ){ |
|
238 | + private function email( $cmb ) { |
|
239 | 239 | |
240 | - return TestContent::email();; |
|
240 | + return TestContent::email(); ; |
|
241 | 241 | |
242 | 242 | } |
243 | 243 | |
@@ -248,17 +248,17 @@ discard block |
||
248 | 248 | * @param array $cmb Metabox data |
249 | 249 | * @return int cmb value |
250 | 250 | */ |
251 | - private function number( $cmb ){ |
|
251 | + private function number( $cmb ) { |
|
252 | 252 | |
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 ); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param array $cmb Metabox data |
275 | 275 | * @return string cmb value |
276 | 276 | */ |
277 | - private function time( $cmb ){ |
|
277 | + private function time( $cmb ) { |
|
278 | 278 | |
279 | 279 | return TestContent::time(); |
280 | 280 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param array $cmb Metabox data |
290 | 290 | * @return string cmb value |
291 | 291 | */ |
292 | - private function timezone( $cmb ){ |
|
292 | + private function timezone( $cmb ) { |
|
293 | 293 | |
294 | 294 | return TestContent::timezone(); |
295 | 295 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param array $cmb Metabox data |
305 | 305 | * @return string cmb value |
306 | 306 | */ |
307 | - private function date( $cmb ){ |
|
307 | + private function date( $cmb ) { |
|
308 | 308 | |
309 | 309 | return TestContent::date( 'm/d/Y' ); |
310 | 310 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param array $cmb Metabox data |
320 | 320 | * @return string cmb value |
321 | 321 | */ |
322 | - private function timestamp( $cmb ){ |
|
322 | + private function timestamp( $cmb ) { |
|
323 | 323 | |
324 | 324 | return TestContent::date( 'U' ); |
325 | 325 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $cmb Metabox data |
333 | 333 | * @return string cmb value |
334 | 334 | */ |
335 | - private function color( $cmb ){ |
|
335 | + private function color( $cmb ) { |
|
336 | 336 | |
337 | 337 | return '#' . str_pad( dechex( mt_rand( 0, 0xFFFFFF ) ), 6, '0', STR_PAD_LEFT ); |
338 | 338 | |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | * @param array $cmb Metabox data |
348 | 348 | * @return string cmb value |
349 | 349 | */ |
350 | - private function textarea( $cmb ){ |
|
350 | + private function textarea( $cmb ) { |
|
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; |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | * @param array $cmb Metabox data |
369 | 369 | * @return string cmb value |
370 | 370 | */ |
371 | - private function radio( $cmb ){ |
|
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; |
@@ -387,11 +387,11 @@ discard block |
||
387 | 387 | * @param array $cmb Metabox data |
388 | 388 | * @return string cmb value |
389 | 389 | */ |
390 | - private function checkbox( $cmb ){ |
|
390 | + private function checkbox( $cmb ) { |
|
391 | 391 | $value = ''; |
392 | 392 | |
393 | 393 | // 50/50 odds of being turned on |
394 | - if ( rand( 0, 1 ) == 1 ){ |
|
394 | + if ( rand( 0, 1 ) == 1 ) { |
|
395 | 395 | $value = 'on'; |
396 | 396 | } |
397 | 397 | |
@@ -408,16 +408,16 @@ discard block |
||
408 | 408 | * @param array $cmb Metabox data |
409 | 409 | * @return array cmb value |
410 | 410 | */ |
411 | - private function multicheck( $cmb ){ |
|
411 | + private function multicheck( $cmb ) { |
|
412 | 412 | |
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 | - if ( rand( 0, 1 ) ){ |
|
420 | - $new_option[] = $key; |
|
419 | + if ( rand( 0, 1 ) ) { |
|
420 | + $new_option[ ] = $key; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @param array $cmb Metabox data |
436 | 436 | * @return string cmb value |
437 | 437 | */ |
438 | - private function wysiwyg( $cmb ){ |
|
438 | + private function wysiwyg( $cmb ) { |
|
439 | 439 | |
440 | 440 | return TestContent::paragraphs(); |
441 | 441 | |
@@ -452,10 +452,10 @@ discard block |
||
452 | 452 | * @param bool $connected Whether we're connected to the Internets or not |
453 | 453 | * @return mixed string|object cmb value or WP_Error object |
454 | 454 | */ |
455 | - private function file( $cmb, $post_id, $connected ){ |
|
455 | + private function file( $cmb, $post_id, $connected ) { |
|
456 | 456 | $value = ''; |
457 | 457 | |
458 | - if ( true === $connected ){ |
|
458 | + if ( true === $connected ) { |
|
459 | 459 | $value = TestContent::image( $post_id ); |
460 | 460 | } |
461 | 461 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param array $cmb Metabox data |
473 | 473 | * @return string cmb value |
474 | 474 | */ |
475 | - private function oembed( $cmb ){ |
|
475 | + private function oembed( $cmb ) { |
|
476 | 476 | |
477 | 477 | return TestContent::oembed(); |
478 | 478 | |
@@ -490,25 +490,25 @@ discard block |
||
490 | 490 | * @param string $value Value to add into the database. |
491 | 491 | * @param array $cmb SMB data. |
492 | 492 | */ |
493 | - private function update_meta( $post_id, $value, $cmb ){ |
|
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 @@ 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. |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | * @param int $post_id Single post ID. |
23 | 23 | * @param array $cmb custom metabox array from CMB2. |
24 | 24 | */ |
25 | - public function get_values( $post_id, $cmb, $connected ){ |
|
25 | + public function get_values( $post_id, $cmb, $connected ) { |
|
26 | 26 | $value = ''; |
27 | 27 | |
28 | 28 | // First check that our post ID & cmb array aren't empty |
29 | - if ( empty( $cmb ) || empty( $post_id ) || ! is_user_logged_in() ){ |
|
29 | + if ( empty( $cmb ) || empty( $post_id ) || ! is_user_logged_in() ) { |
|
30 | 30 | return; |
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 ); |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // Value must exist to attempt to insert |
161 | - if ( ! empty( $value ) && ! is_wp_error( $value ) ){ |
|
161 | + if ( ! empty( $value ) && ! is_wp_error( $value ) ) { |
|
162 | 162 | |
163 | 163 | $this->update_meta( $post_id, $value, $cmb ); |
164 | 164 | |
165 | 165 | // If we're dealing with a WP Error object, just return the message for debugging |
166 | - } elseif ( is_wp_error( $value ) ){ |
|
166 | + } elseif ( is_wp_error( $value ) ) { |
|
167 | 167 | |
168 | 168 | return $value->get_error_message(); |
169 | 169 | |
@@ -180,22 +180,22 @@ discard block |
||
180 | 180 | * @param array $cmb Metabox data |
181 | 181 | * @return string cmb value |
182 | 182 | */ |
183 | - private function text( $cmb ){ |
|
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,7 +203,7 @@ discard block |
||
203 | 203 | $value = TestContent::title( rand( 10, 50 ) ); |
204 | 204 | } |
205 | 205 | |
206 | - if ( 'acf' === $cmb['source'] && !empty( $cmb['extras']->chars ) ){ |
|
206 | + if ( 'acf' === $cmb['source'] && !empty( $cmb['extras']->chars ) ) { |
|
207 | 207 | $value = substr( $value, 0, $cmb['extras']->chars ); |
208 | 208 | } |
209 | 209 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param array $cmb Metabox data |
221 | 221 | * @return string cmb value |
222 | 222 | */ |
223 | - private function url( $cmb ){ |
|
223 | + private function url( $cmb ) { |
|
224 | 224 | |
225 | 225 | return TestContent::link(); |
226 | 226 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param array $cmb Metabox data |
236 | 236 | * @return string cmb value |
237 | 237 | */ |
238 | - private function email( $cmb ){ |
|
238 | + private function email( $cmb ) { |
|
239 | 239 | |
240 | 240 | return TestContent::email();; |
241 | 241 | |
@@ -248,16 +248,16 @@ discard block |
||
248 | 248 | * @param array $cmb Metabox data |
249 | 249 | * @return int cmb value |
250 | 250 | */ |
251 | - private function number( $cmb ){ |
|
251 | + private function number( $cmb ) { |
|
252 | 252 | |
253 | 253 | $min = 1; |
254 | 254 | $max = 10000000; |
255 | 255 | |
256 | - if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->min ) ){ |
|
256 | + if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->min ) ) { |
|
257 | 257 | $min = $cmb['extras']->min; |
258 | 258 | } |
259 | 259 | |
260 | - if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->max ) ){ |
|
260 | + if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->max ) ) { |
|
261 | 261 | $max = $cmb['extras']->max; |
262 | 262 | } |
263 | 263 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @param array $cmb Metabox data |
275 | 275 | * @return string cmb value |
276 | 276 | */ |
277 | - private function time( $cmb ){ |
|
277 | + private function time( $cmb ) { |
|
278 | 278 | |
279 | 279 | return TestContent::time(); |
280 | 280 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param array $cmb Metabox data |
290 | 290 | * @return string cmb value |
291 | 291 | */ |
292 | - private function timezone( $cmb ){ |
|
292 | + private function timezone( $cmb ) { |
|
293 | 293 | |
294 | 294 | return TestContent::timezone(); |
295 | 295 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param array $cmb Metabox data |
305 | 305 | * @return string cmb value |
306 | 306 | */ |
307 | - private function date( $cmb ){ |
|
307 | + private function date( $cmb ) { |
|
308 | 308 | |
309 | 309 | return TestContent::date( 'm/d/Y' ); |
310 | 310 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param array $cmb Metabox data |
320 | 320 | * @return string cmb value |
321 | 321 | */ |
322 | - private function timestamp( $cmb ){ |
|
322 | + private function timestamp( $cmb ) { |
|
323 | 323 | |
324 | 324 | return TestContent::date( 'U' ); |
325 | 325 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $cmb Metabox data |
333 | 333 | * @return string cmb value |
334 | 334 | */ |
335 | - private function color( $cmb ){ |
|
335 | + private function color( $cmb ) { |
|
336 | 336 | |
337 | 337 | return '#' . str_pad( dechex( mt_rand( 0, 0xFFFFFF ) ), 6, '0', STR_PAD_LEFT ); |
338 | 338 | |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | * @param array $cmb Metabox data |
348 | 348 | * @return string cmb value |
349 | 349 | */ |
350 | - private function textarea( $cmb ){ |
|
350 | + private function textarea( $cmb ) { |
|
351 | 351 | |
352 | 352 | $value = TestContent::plain_text(); |
353 | 353 | |
354 | - if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->chars ) ){ |
|
354 | + if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->chars ) ) { |
|
355 | 355 | $value = substr( $value, 0, $cmb['extras']->chars ); |
356 | 356 | } |
357 | 357 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @param array $cmb Metabox data |
369 | 369 | * @return string cmb value |
370 | 370 | */ |
371 | - private function radio( $cmb ){ |
|
371 | + private function radio( $cmb ) { |
|
372 | 372 | |
373 | 373 | // Grab a random item out of the array and return the key |
374 | 374 | $new_val = array_slice( $cmb['options'], rand( 0, count( $cmb['options'] ) ), 1 ); |
@@ -387,11 +387,11 @@ discard block |
||
387 | 387 | * @param array $cmb Metabox data |
388 | 388 | * @return string cmb value |
389 | 389 | */ |
390 | - private function checkbox( $cmb ){ |
|
390 | + private function checkbox( $cmb ) { |
|
391 | 391 | $value = ''; |
392 | 392 | |
393 | 393 | // 50/50 odds of being turned on |
394 | - if ( rand( 0, 1 ) == 1 ){ |
|
394 | + if ( rand( 0, 1 ) == 1 ) { |
|
395 | 395 | $value = 'on'; |
396 | 396 | } |
397 | 397 | |
@@ -408,15 +408,15 @@ discard block |
||
408 | 408 | * @param array $cmb Metabox data |
409 | 409 | * @return array cmb value |
410 | 410 | */ |
411 | - private function multicheck( $cmb ){ |
|
411 | + private function multicheck( $cmb ) { |
|
412 | 412 | |
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 | - if ( rand( 0, 1 ) ){ |
|
419 | + if ( rand( 0, 1 ) ) { |
|
420 | 420 | $new_option[] = $key; |
421 | 421 | } |
422 | 422 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @param array $cmb Metabox data |
436 | 436 | * @return string cmb value |
437 | 437 | */ |
438 | - private function wysiwyg( $cmb ){ |
|
438 | + private function wysiwyg( $cmb ) { |
|
439 | 439 | |
440 | 440 | return TestContent::paragraphs(); |
441 | 441 | |
@@ -452,10 +452,10 @@ discard block |
||
452 | 452 | * @param bool $connected Whether we're connected to the Internets or not |
453 | 453 | * @return mixed string|object cmb value or WP_Error object |
454 | 454 | */ |
455 | - private function file( $cmb, $post_id, $connected ){ |
|
455 | + private function file( $cmb, $post_id, $connected ) { |
|
456 | 456 | $value = ''; |
457 | 457 | |
458 | - if ( true === $connected ){ |
|
458 | + if ( true === $connected ) { |
|
459 | 459 | $value = TestContent::image( $post_id ); |
460 | 460 | } |
461 | 461 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param array $cmb Metabox data |
473 | 473 | * @return string cmb value |
474 | 474 | */ |
475 | - private function oembed( $cmb ){ |
|
475 | + private function oembed( $cmb ) { |
|
476 | 476 | |
477 | 477 | return TestContent::oembed(); |
478 | 478 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * @param string $value Value to add into the database. |
491 | 491 | * @param array $cmb SMB data. |
492 | 492 | */ |
493 | - private function update_meta( $post_id, $value, $cmb ){ |
|
493 | + private function update_meta( $post_id, $value, $cmb ) { |
|
494 | 494 | |
495 | 495 | $type = $cmb['type']; |
496 | 496 | $id = $cmb['id']; |
@@ -499,7 +499,7 @@ discard block |
||
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'] ) ){ |
|
502 | + if ( 'file'!== $cmb['type'] || ( 'file' === $cmb['type'] && 'cmb_hm' === $cmb['source'] ) ) { |
|
503 | 503 | add_post_meta( $post_id, $cmb['id'], $value, true ); |
504 | 504 | } else { |
505 | 505 | add_post_meta( $post_id, $cmb['id'].'_id', $value, true ); |
@@ -507,7 +507,7 @@ discard block |
||
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'] ){ |
|
510 | + if ( isset( $cmb['source'] ) && 'acf' === $cmb['source'] ) { |
|
511 | 511 | add_post_meta( $post_id, '_' . $cmb['id'], $cmb['key'], true ); |
512 | 512 | } |
513 | 513 |
@@ -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. |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param int $num_words Number of words to return. |
27 | 27 | * @return string Random title string. |
28 | 28 | */ |
29 | - public static function title( $num_words = '' ){ |
|
29 | + public static function title( $num_words = '' ) { |
|
30 | 30 | |
31 | 31 | $title = ''; |
32 | 32 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | // If we didn't choose a count, make one |
70 | - if ( empty( $num_words ) ){ |
|
70 | + if ( empty( $num_words ) ) { |
|
71 | 71 | $num_words = rand( 2, 10 ); |
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 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string Paragraph(s) of text. |
91 | 91 | */ |
92 | - public static function paragraphs(){ |
|
92 | + public static function paragraphs() { |
|
93 | 93 | |
94 | 94 | $content = ''; |
95 | 95 | |
@@ -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 ); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return string Plain text paragraphs. |
378 | 378 | */ |
379 | - public static function plain_text(){ |
|
379 | + public static function plain_text() { |
|
380 | 380 | |
381 | 381 | $paragraphs = array( |
382 | 382 | 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt luctus eros, a tincidunt massa aliquet sit amet. Sed faucibus, eros non lacinia porttitor, risus odio efficitur sapien, id porta urna massa ac est. Cras efficitur lacinia magna eget tempus. Fusce ex felis, finibus consectetur mi at, finibus rhoncus augue. In ut tortor lacinia, rutrum mauris vel, maximus tortor. Praesent ac arcu nec eros pharetra tristique. Morbi congue leo sed ipsum fermentum vulputate. Ut nulla eros, porta varius pulvinar eget, bibendum quis dolor. Morbi sed diam eu dui semper ornare nec quis nisl.', |
@@ -407,20 +407,20 @@ discard block |
||
407 | 407 | * @param int $post_id Post ID. |
408 | 408 | * @return mixed Attachment ID or WP Error. |
409 | 409 | */ |
410 | - public static function image( $post_id ){ |
|
410 | + public static function image( $post_id ) { |
|
411 | 411 | $file_array = array(); |
412 | 412 | |
413 | 413 | // Get the image from the API |
414 | 414 | $url = self::get_image_link(); |
415 | 415 | |
416 | 416 | // If the returned string is empty or it's not a string, try again. |
417 | - if ( empty( $url ) || !is_string( $url ) ){ |
|
417 | + if ( empty( $url ) || ! is_string( $url ) ) { |
|
418 | 418 | |
419 | 419 | // Try again |
420 | 420 | $url = self::get_image_link(); |
421 | 421 | |
422 | 422 | // If it fails again, just give up |
423 | - if ( empty( $url ) || !is_string( $url ) ){ |
|
423 | + if ( empty( $url ) || ! is_string( $url ) ) { |
|
424 | 424 | return; |
425 | 425 | } |
426 | 426 | |
@@ -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 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return string Image URL. |
463 | 463 | */ |
464 | - private static function get_image_link(){ |
|
464 | + private static function get_image_link() { |
|
465 | 465 | |
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" ); |
@@ -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 | - if ( !empty( $matches ) ){ |
|
489 | - return $response['url']; |
|
488 | + if ( ! empty( $matches ) ) { |
|
489 | + return $response[ 'url' ]; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @param string $format PHP Date format. |
501 | 501 | * @return mixed Date in the format requested. |
502 | 502 | */ |
503 | - public static function date( $format ){ |
|
503 | + public static function date( $format ) { |
|
504 | 504 | |
505 | 505 | $num_days = rand( 1, 60 ); |
506 | 506 | $date = date( $format, strtotime( " +$num_days days" ) ); |
@@ -517,16 +517,16 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return string Time string |
519 | 519 | */ |
520 | - public static function time(){ |
|
520 | + public static function time() { |
|
521 | 521 | |
522 | 522 | $times = array( |
523 | 523 | '8:00 am', |
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 ) ] ); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @return string Timezone |
543 | 543 | */ |
544 | - public static function timezone(){ |
|
544 | + public static function timezone() { |
|
545 | 545 | |
546 | 546 | $timezones = array( |
547 | 547 | 'America/Denver', |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @return string Phone #. |
574 | 574 | */ |
575 | - public static function phone(){ |
|
575 | + public static function phone() { |
|
576 | 576 | |
577 | 577 | $phone_numbers = array( |
578 | 578 | '7203893101', |
@@ -600,11 +600,11 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @return string Email address. |
602 | 602 | */ |
603 | - public static function email( $superrandom = false ){ |
|
603 | + public static function email( $superrandom = false ) { |
|
604 | 604 | |
605 | 605 | // In certain situations we need to ensure that the email is never |
606 | 606 | // duplicated, like in creating new users. |
607 | - if ( $superrandom !== false ){ |
|
607 | + if ( $superrandom !== false ) { |
|
608 | 608 | $user = $domain = ''; |
609 | 609 | |
610 | 610 | $tlds = array( |
@@ -622,11 +622,11 @@ discard block |
||
622 | 622 | $user_length = mt_rand( 5, 20 ); |
623 | 623 | $domain_length = mt_rand( 7, 12 ); |
624 | 624 | |
625 | - for ( $i = 1; $i <= $user_length; $i++ ){ |
|
625 | + for ( $i = 1; $i <= $user_length; $i++ ) { |
|
626 | 626 | $user .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 ); |
627 | 627 | } |
628 | 628 | |
629 | - for ( $i = 1; $i <= $domain_length; $i++ ){ |
|
629 | + for ( $i = 1; $i <= $domain_length; $i++ ) { |
|
630 | 630 | $domain .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 ); |
631 | 631 | } |
632 | 632 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * |
667 | 667 | * @return string URL. |
668 | 668 | */ |
669 | - public static function link(){ |
|
669 | + public static function link() { |
|
670 | 670 | |
671 | 671 | $links = array( |
672 | 672 | 'http://google.com', |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * |
691 | 691 | * @return string URL. |
692 | 692 | */ |
693 | - public static function oembed(){ |
|
693 | + public static function oembed() { |
|
694 | 694 | |
695 | 695 | $links = array( |
696 | 696 | 'https://www.youtube.com/watch?v=A85-YQsm6pY', |
@@ -715,10 +715,10 @@ discard block |
||
715 | 715 | * @param string $type Video service to get link from |
716 | 716 | * @return string URL. |
717 | 717 | */ |
718 | - public static function video( $type ){ |
|
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' : |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @return array Randomly strung together name. |
772 | 772 | */ |
773 | - public static function name(){ |
|
773 | + public static function name() { |
|
774 | 774 | |
775 | 775 | $first_names = array( |
776 | 776 | 'Jacqui', |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return string Organization name. |
834 | 834 | */ |
835 | - public static function organization(){ |
|
835 | + public static function organization() { |
|
836 | 836 | |
837 | 837 | $orgs = array( |
838 | 838 | 'Red Cross', |
@@ -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. |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param int $num_words Number of words to return. |
27 | 27 | * @return string Random title string. |
28 | 28 | */ |
29 | - public static function title( $num_words = '' ){ |
|
29 | + public static function title( $num_words = '' ) { |
|
30 | 30 | |
31 | 31 | $title = ''; |
32 | 32 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | // If we didn't choose a count, make one |
70 | - if ( empty( $num_words ) ){ |
|
70 | + if ( empty( $num_words ) ) { |
|
71 | 71 | $num_words = rand( 2, 10 ); |
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 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string Paragraph(s) of text. |
91 | 91 | */ |
92 | - public static function paragraphs(){ |
|
92 | + public static function paragraphs() { |
|
93 | 93 | |
94 | 94 | $content = ''; |
95 | 95 | |
@@ -351,11 +351,11 @@ 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 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return string Plain text paragraphs. |
378 | 378 | */ |
379 | - public static function plain_text(){ |
|
379 | + public static function plain_text() { |
|
380 | 380 | |
381 | 381 | $paragraphs = array( |
382 | 382 | 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt luctus eros, a tincidunt massa aliquet sit amet. Sed faucibus, eros non lacinia porttitor, risus odio efficitur sapien, id porta urna massa ac est. Cras efficitur lacinia magna eget tempus. Fusce ex felis, finibus consectetur mi at, finibus rhoncus augue. In ut tortor lacinia, rutrum mauris vel, maximus tortor. Praesent ac arcu nec eros pharetra tristique. Morbi congue leo sed ipsum fermentum vulputate. Ut nulla eros, porta varius pulvinar eget, bibendum quis dolor. Morbi sed diam eu dui semper ornare nec quis nisl.', |
@@ -407,20 +407,20 @@ discard block |
||
407 | 407 | * @param int $post_id Post ID. |
408 | 408 | * @return mixed Attachment ID or WP Error. |
409 | 409 | */ |
410 | - public static function image( $post_id ){ |
|
410 | + public static function image( $post_id ) { |
|
411 | 411 | $file_array = array(); |
412 | 412 | |
413 | 413 | // Get the image from the API |
414 | 414 | $url = self::get_image_link(); |
415 | 415 | |
416 | 416 | // If the returned string is empty or it's not a string, try again. |
417 | - if ( empty( $url ) || !is_string( $url ) ){ |
|
417 | + if ( empty( $url ) || !is_string( $url ) ) { |
|
418 | 418 | |
419 | 419 | // Try again |
420 | 420 | $url = self::get_image_link(); |
421 | 421 | |
422 | 422 | // If it fails again, just give up |
423 | - if ( empty( $url ) || !is_string( $url ) ){ |
|
423 | + if ( empty( $url ) || !is_string( $url ) ) { |
|
424 | 424 | return; |
425 | 425 | } |
426 | 426 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return string Image URL. |
463 | 463 | */ |
464 | - private static function get_image_link(){ |
|
464 | + private static function get_image_link() { |
|
465 | 465 | |
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" ); |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | // Check to make sure that the return contains a valid image extensions |
486 | 486 | preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response['url'], $matches); |
487 | 487 | |
488 | - if ( !empty( $matches ) ){ |
|
488 | + if ( !empty( $matches ) ) { |
|
489 | 489 | return $response['url']; |
490 | 490 | } |
491 | 491 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @param string $format PHP Date format. |
501 | 501 | * @return mixed Date in the format requested. |
502 | 502 | */ |
503 | - public static function date( $format ){ |
|
503 | + public static function date( $format ) { |
|
504 | 504 | |
505 | 505 | $num_days = rand( 1, 60 ); |
506 | 506 | $date = date( $format, strtotime( " +$num_days days" ) ); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return string Time string |
519 | 519 | */ |
520 | - public static function time(){ |
|
520 | + public static function time() { |
|
521 | 521 | |
522 | 522 | $times = array( |
523 | 523 | '8:00 am', |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @return string Timezone |
543 | 543 | */ |
544 | - public static function timezone(){ |
|
544 | + public static function timezone() { |
|
545 | 545 | |
546 | 546 | $timezones = array( |
547 | 547 | 'America/Denver', |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @return string Phone #. |
574 | 574 | */ |
575 | - public static function phone(){ |
|
575 | + public static function phone() { |
|
576 | 576 | |
577 | 577 | $phone_numbers = array( |
578 | 578 | '7203893101', |
@@ -600,11 +600,11 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @return string Email address. |
602 | 602 | */ |
603 | - public static function email( $superrandom = false ){ |
|
603 | + public static function email( $superrandom = false ) { |
|
604 | 604 | |
605 | 605 | // In certain situations we need to ensure that the email is never |
606 | 606 | // duplicated, like in creating new users. |
607 | - if ( $superrandom !== false ){ |
|
607 | + if ( $superrandom !== false ) { |
|
608 | 608 | $user = $domain = ''; |
609 | 609 | |
610 | 610 | $tlds = array( |
@@ -622,11 +622,11 @@ discard block |
||
622 | 622 | $user_length = mt_rand( 5, 20 ); |
623 | 623 | $domain_length = mt_rand( 7, 12 ); |
624 | 624 | |
625 | - for ( $i = 1; $i <= $user_length; $i++ ){ |
|
625 | + for ( $i = 1; $i <= $user_length; $i++ ) { |
|
626 | 626 | $user .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 ); |
627 | 627 | } |
628 | 628 | |
629 | - for ( $i = 1; $i <= $domain_length; $i++ ){ |
|
629 | + for ( $i = 1; $i <= $domain_length; $i++ ) { |
|
630 | 630 | $domain .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 ); |
631 | 631 | } |
632 | 632 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * |
667 | 667 | * @return string URL. |
668 | 668 | */ |
669 | - public static function link(){ |
|
669 | + public static function link() { |
|
670 | 670 | |
671 | 671 | $links = array( |
672 | 672 | 'http://google.com', |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * |
691 | 691 | * @return string URL. |
692 | 692 | */ |
693 | - public static function oembed(){ |
|
693 | + public static function oembed() { |
|
694 | 694 | |
695 | 695 | $links = array( |
696 | 696 | 'https://www.youtube.com/watch?v=A85-YQsm6pY', |
@@ -715,10 +715,10 @@ discard block |
||
715 | 715 | * @param string $type Video service to get link from |
716 | 716 | * @return string URL. |
717 | 717 | */ |
718 | - public static function video( $type ){ |
|
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' : |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @return array Randomly strung together name. |
772 | 772 | */ |
773 | - public static function name(){ |
|
773 | + public static function name() { |
|
774 | 774 | |
775 | 775 | $first_names = array( |
776 | 776 | 'Jacqui', |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return string Organization name. |
834 | 834 | */ |
835 | - public static function organization(){ |
|
835 | + public static function organization() { |
|
836 | 836 | |
837 | 837 | $orgs = array( |
838 | 838 | 'Red Cross', |
@@ -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 |