Permalink
Browse files

Update README.md

* Added syntax highlighting as it bothered me while reading
  • Loading branch information...
No3x committed Aug 11, 2016
1 parent 15a8a79 commit 4e9b39570063569bb26262b2b4c441a38a17bf5b
Showing with 5 additions and 5 deletions.
  1. +5 −5 README.md
View
@@ -12,7 +12,7 @@ Async requests are useful for pushing slow one-off tasks such as sending emails
Extend the `WP_Async_Request` class:
-```
+```php
class WP_Example_Request extends WP_Async_Request {
/**
@@ -69,7 +69,7 @@ Queues work on a first in first out basis, which allows additional items to be p
Extend the `WP_Background_Process` class:
-```
+```php
class WP_Example_Process extends WP_Background_Process {
/**
@@ -130,7 +130,7 @@ Instantiate your process:
Push items to the queue:
-```
+```php
foreach ( $items as $item ) {
$this->example_process->push_to_queue( $item );
}
@@ -144,7 +144,7 @@ Save and dispatch the queue:
If your site is behind BasicAuth, both async requests and background processes will fail to complete. This is because WP Background Processing relies on the [WordPress HTTP API](http://codex.wordpress.org/HTTP_API), which requires you to attach your BasicAuth credentials to requests. The easiest way to do this is using the following filter:
-```
+```php
function wpbp_http_request_args( $r, $url ) {
$r['headers']['Authorization'] = 'Basic ' . base64_encode( USERNAME . ':' . PASSWORD );
@@ -155,4 +155,4 @@ add_filter( 'http_request_args', 'wpbp_http_request_args', 10, 2);
## License
-[GPLv2+](http://www.gnu.org/licenses/gpl-2.0.html)
+[GPLv2+](http://www.gnu.org/licenses/gpl-2.0.html)

0 comments on commit 4e9b395

Please sign in to comment.