@@ -27,11 +27,11 @@ |
||
27 | 27 | DEALINGS IN THE SOFTWARE. |
28 | 28 | */ |
29 | 29 | |
30 | -if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { |
|
30 | +if (file_exists(__DIR__ . '/vendor/autoload.php')) { |
|
31 | 31 | require __DIR__ . '/vendor/autoload.php'; |
32 | 32 | } |
33 | 33 | |
34 | -if ( isset( $_GET['wps_disable'] ) ) { |
|
34 | +if (isset($_GET['wps_disable'])) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 |
@@ -13,86 +13,86 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param array $values Optional arguments for container. |
15 | 15 | */ |
16 | - public function __construct( $values = array() ) { |
|
16 | + public function __construct($values = array()) { |
|
17 | 17 | |
18 | 18 | $defaults = array(); |
19 | 19 | |
20 | 20 | $defaults['tables'] = array( |
21 | - '$wp' => function () { |
|
21 | + '$wp' => function() { |
|
22 | 22 | global $wp; |
23 | 23 | |
24 | - if ( ! $wp instanceof \WP ) { |
|
24 | + if ( ! $wp instanceof \WP) { |
|
25 | 25 | return array(); |
26 | 26 | } |
27 | 27 | |
28 | - $output = get_object_vars( $wp ); |
|
29 | - unset( $output['private_query_vars'] ); |
|
30 | - unset( $output['public_query_vars'] ); |
|
28 | + $output = get_object_vars($wp); |
|
29 | + unset($output['private_query_vars']); |
|
30 | + unset($output['public_query_vars']); |
|
31 | 31 | |
32 | - return array_filter( $output ); |
|
32 | + return array_filter($output); |
|
33 | 33 | }, |
34 | - '$wp_query' => function () { |
|
34 | + '$wp_query' => function() { |
|
35 | 35 | global $wp_query; |
36 | 36 | |
37 | - if ( ! $wp_query instanceof \WP_Query ) { |
|
37 | + if ( ! $wp_query instanceof \WP_Query) { |
|
38 | 38 | return array(); |
39 | 39 | } |
40 | 40 | |
41 | - $output = get_object_vars( $wp_query ); |
|
42 | - $output['query_vars'] = array_filter( $output['query_vars'] ); |
|
43 | - unset( $output['posts'] ); |
|
44 | - unset( $output['post'] ); |
|
41 | + $output = get_object_vars($wp_query); |
|
42 | + $output['query_vars'] = array_filter($output['query_vars']); |
|
43 | + unset($output['posts']); |
|
44 | + unset($output['post']); |
|
45 | 45 | |
46 | - return array_filter( $output ); |
|
46 | + return array_filter($output); |
|
47 | 47 | }, |
48 | - '$post' => function () { |
|
48 | + '$post' => function() { |
|
49 | 49 | $post = get_post(); |
50 | 50 | |
51 | - if ( ! $post instanceof \WP_Post ) { |
|
51 | + if ( ! $post instanceof \WP_Post) { |
|
52 | 52 | return array(); |
53 | 53 | } |
54 | 54 | |
55 | - return get_object_vars( $post ); |
|
55 | + return get_object_vars($post); |
|
56 | 56 | }, |
57 | 57 | ); |
58 | 58 | |
59 | - $defaults['handler.pretty'] = function ( $plugin ) { |
|
59 | + $defaults['handler.pretty'] = function($plugin) { |
|
60 | 60 | $handler = new PrettyPageHandler(); |
61 | 61 | |
62 | - foreach ( $plugin['tables'] as $name => $callback ) { |
|
63 | - $handler->addDataTableCallback( $name, $callback ); |
|
62 | + foreach ($plugin['tables'] as $name => $callback) { |
|
63 | + $handler->addDataTableCallback($name, $callback); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // Requires Remote Call plugin. |
67 | - $handler->addEditor( 'phpstorm-remote-call', 'http://localhost:8091?message=%file:%line' ); |
|
67 | + $handler->addEditor('phpstorm-remote-call', 'http://localhost:8091?message=%file:%line'); |
|
68 | 68 | |
69 | 69 | return $handler; |
70 | 70 | }; |
71 | 71 | |
72 | - $defaults['handler.json'] = function () { |
|
72 | + $defaults['handler.json'] = function() { |
|
73 | 73 | $handler = new Admin_Ajax_Handler(); |
74 | - $handler->addTraceToOutput( true ); |
|
74 | + $handler->addTraceToOutput(true); |
|
75 | 75 | |
76 | 76 | return $handler; |
77 | 77 | }; |
78 | 78 | |
79 | - $defaults['handler.rest'] = function () { |
|
79 | + $defaults['handler.rest'] = function() { |
|
80 | 80 | $handler = new Rest_Api_Handler(); |
81 | - $handler->addTraceToOutput( true ); |
|
81 | + $handler->addTraceToOutput(true); |
|
82 | 82 | |
83 | 83 | return $handler; |
84 | 84 | }; |
85 | 85 | |
86 | - $defaults['run'] = function ( $plugin ) { |
|
86 | + $defaults['run'] = function($plugin) { |
|
87 | 87 | $run = new Run(); |
88 | - $run->pushHandler( $plugin['handler.pretty'] ); |
|
89 | - $run->pushHandler( $plugin['handler.json'] ); |
|
90 | - $run->pushHandler( $plugin['handler.rest'] ); |
|
88 | + $run->pushHandler($plugin['handler.pretty']); |
|
89 | + $run->pushHandler($plugin['handler.json']); |
|
90 | + $run->pushHandler($plugin['handler.rest']); |
|
91 | 91 | |
92 | 92 | return $run; |
93 | 93 | }; |
94 | 94 | |
95 | - parent::__construct( array_merge( $defaults, $values ) ); |
|
95 | + parent::__construct(array_merge($defaults, $values)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function is_debug() { |
102 | 102 | |
103 | - return defined( 'WP_DEBUG' ) && WP_DEBUG; |
|
103 | + return defined('WP_DEBUG') && WP_DEBUG; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function is_debug_display() { |
110 | 110 | |
111 | - return defined( 'WP_DEBUG_DISPLAY' ) && false !== WP_DEBUG_DISPLAY; |
|
111 | + return defined('WP_DEBUG_DISPLAY') && false !== WP_DEBUG_DISPLAY; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function run() { |
118 | 118 | |
119 | - if ( ! $this->is_debug() || ! $this->is_debug_display() ) { |
|
119 | + if ( ! $this->is_debug() || ! $this->is_debug_display()) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | private function isAjaxRequest() { |
18 | 18 | |
19 | - return defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
19 | + return defined('DOING_AJAX') && DOING_AJAX; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function handle() { |
26 | 26 | |
27 | - if ( ! $this->isAjaxRequest() ) { |
|
27 | + if ( ! $this->isAjaxRequest()) { |
|
28 | 28 | return Handler::DONE; |
29 | 29 | } |
30 | 30 | |
31 | 31 | $response = array( |
32 | 32 | 'success' => false, |
33 | - 'data' => Formatter::formatExceptionAsDataArray( $this->getInspector(), $this->addTraceToOutput() ), |
|
33 | + 'data' => Formatter::formatExceptionAsDataArray($this->getInspector(), $this->addTraceToOutput()), |
|
34 | 34 | ); |
35 | 35 | |
36 | - if ( Misc::canSendHeaders() ) { |
|
37 | - header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); |
|
36 | + if (Misc::canSendHeaders()) { |
|
37 | + header('Content-Type: application/json; charset=' . get_option('blog_charset')); |
|
38 | 38 | } |
39 | 39 | |
40 | - $json_options = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? JSON_PRETTY_PRINT : 0; |
|
40 | + $json_options = version_compare(PHP_VERSION, '5.4.0', '>=') ? JSON_PRETTY_PRINT : 0; |
|
41 | 41 | |
42 | - echo wp_json_encode( $response, $json_options ); |
|
42 | + echo wp_json_encode($response, $json_options); |
|
43 | 43 | |
44 | 44 | return Handler::QUIT; |
45 | 45 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | private function isRestRequest() { |
18 | 18 | |
19 | - return defined( 'REST_REQUEST' ) && REST_REQUEST; |
|
19 | + return defined('REST_REQUEST') && REST_REQUEST; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,25 +24,25 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function handle() { |
26 | 26 | |
27 | - if ( ! $this->isRestRequest() ) { |
|
27 | + if ( ! $this->isRestRequest()) { |
|
28 | 28 | return Handler::DONE; |
29 | 29 | } |
30 | 30 | |
31 | - $data = Formatter::formatExceptionAsDataArray( $this->getInspector(), $this->addTraceToOutput() ); |
|
31 | + $data = Formatter::formatExceptionAsDataArray($this->getInspector(), $this->addTraceToOutput()); |
|
32 | 32 | $response = array( |
33 | 33 | 'code' => $data['type'], |
34 | 34 | 'message' => $data['message'], |
35 | 35 | 'data' => $data, |
36 | 36 | ); |
37 | 37 | |
38 | - if ( Misc::canSendHeaders() ) { |
|
39 | - status_header( 500 ); |
|
40 | - header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); |
|
38 | + if (Misc::canSendHeaders()) { |
|
39 | + status_header(500); |
|
40 | + header('Content-Type: application/json; charset=' . get_option('blog_charset')); |
|
41 | 41 | } |
42 | 42 | |
43 | - $json_options = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? JSON_PRETTY_PRINT : 0; |
|
43 | + $json_options = version_compare(PHP_VERSION, '5.4.0', '>=') ? JSON_PRETTY_PRINT : 0; |
|
44 | 44 | |
45 | - echo wp_json_encode( $response, $json_options ); |
|
45 | + echo wp_json_encode($response, $json_options); |
|
46 | 46 | |
47 | 47 | return Handler::QUIT; |
48 | 48 | } |