Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (34 sloc) 751 Bytes
<?php
trait WP_Example_Logger {
/**
* Really long running process
*
* @return int
*/
public function really_long_running_task() {
return sleep( 5 );
}
/**
* Log
*
* @param string $message
*/
public function log( $message ) {
error_log( $message );
}
/**
* Get lorem
*
* @param string $name
*
* @return string
*/
protected function get_message( $name ) {
$response = wp_remote_get( esc_url_raw( 'http://loripsum.net/api/1/short/plaintext' ) );
$body = trim( wp_remote_retrieve_body( $response ) );
if ( empty( $body ) ) {
$body = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quippe: habes enim a rhetoribus; Eaedem res maneant alio modo.';
}
return $name . ': ' . $body;
}
}