@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | 23 | $this->console = new Console; |
| 24 | - $this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' ); |
|
| 24 | + $this->file = realpath( dirname( __DIR__ ) . '/' . static::ID . '.php' ); |
|
| 25 | 25 | $this->profiler = new Profiler; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | 8192 => 'Deprecated', //E_DEPRECATED |
| 42 | 42 | ); |
| 43 | 43 | $errname = array_key_exists( $errno, $errorCodes ) |
| 44 | - ? $errorCodes[$errno] |
|
| 44 | + ? $errorCodes[ $errno ] |
|
| 45 | 45 | : 'Unknown'; |
| 46 | - $hash = md5( $errno.$errstr.$errfile.$errline ); |
|
| 47 | - if( array_key_exists( $hash, $this->errors )) { |
|
| 48 | - $this->errors[$hash]['count']++; |
|
| 46 | + $hash = md5( $errno . $errstr . $errfile . $errline ); |
|
| 47 | + if( array_key_exists( $hash, $this->errors ) ) { |
|
| 48 | + $this->errors[ $hash ][ 'count' ]++; |
|
| 49 | 49 | } |
| 50 | 50 | else { |
| 51 | - $this->errors[$hash] = array( |
|
| 51 | + $this->errors[ $hash ] = array( |
|
| 52 | 52 | "errno" => $errno, |
| 53 | 53 | "message" => $errstr, |
| 54 | 54 | "file" => $errfile, |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | public function init() |
| 66 | 66 | { |
| 67 | 67 | $controller = new Controller( $this ); |
| 68 | - add_filter( 'all', array( $controller, 'initConsole' )); |
|
| 69 | - add_filter( 'all', array( $controller, 'initProfiler' )); |
|
| 70 | - add_action( 'plugins_loaded', array( $controller, 'registerLanguages' )); |
|
| 68 | + add_filter( 'all', array( $controller, 'initConsole' ) ); |
|
| 69 | + add_filter( 'all', array( $controller, 'initProfiler' ) ); |
|
| 70 | + add_action( 'plugins_loaded', array( $controller, 'registerLanguages' ) ); |
|
| 71 | 71 | add_action( 'init', function() use( $controller ) { |
| 72 | - if( !apply_filters( 'blackbar/enabled', true ))return; |
|
| 73 | - add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
|
| 74 | - add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
|
| 75 | - add_action( 'admin_footer', array( $controller, 'renderBar' )); |
|
| 76 | - add_action( 'wp_footer', array( $controller, 'renderBar' )); |
|
| 77 | - add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' )); |
|
| 72 | + if( !apply_filters( 'blackbar/enabled', true ) )return; |
|
| 73 | + add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' ) ); |
|
| 74 | + add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' ) ); |
|
| 75 | + add_action( 'admin_footer', array( $controller, 'renderBar' ) ); |
|
| 76 | + add_action( 'wp_footer', array( $controller, 'renderBar' ) ); |
|
| 77 | + add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' ) ); |
|
| 78 | 78 | }); |
| 79 | 79 | apply_filters( 'debug', 'Profiler Started' ); |
| 80 | 80 | apply_filters( 'debug', 'blackbar/profiler/noise' ); |
| 81 | - set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT ); |
|
| 81 | + set_error_handler( array( $this, 'errorHandler' ), E_ALL | E_STRICT ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function path( $file = '' ) |
| 89 | 89 | { |
| 90 | - return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ); |
|
| 90 | + return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function render( $view, array $data = array() ) |
| 98 | 98 | { |
| 99 | - $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); |
|
| 100 | - if( !file_exists( $file ))return; |
|
| 99 | + $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ); |
|
| 100 | + if( !file_exists( $file ) )return; |
|
| 101 | 101 | extract( $data ); |
| 102 | 102 | include $file; |
| 103 | 103 | } |
@@ -108,6 +108,6 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function url( $path = '' ) |
| 110 | 110 | { |
| 111 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
| 111 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
| 112 | 112 | } |
| 113 | 113 | } |
@@ -68,8 +68,11 @@ discard block |
||
| 68 | 68 | add_filter( 'all', array( $controller, 'initConsole' )); |
| 69 | 69 | add_filter( 'all', array( $controller, 'initProfiler' )); |
| 70 | 70 | add_action( 'plugins_loaded', array( $controller, 'registerLanguages' )); |
| 71 | - add_action( 'init', function() use( $controller ) { |
|
| 72 | - if( !apply_filters( 'blackbar/enabled', true ))return; |
|
| 71 | + add_action( 'init', function() use( $controller ) |
|
| 72 | + { |
|
| 73 | + if( !apply_filters( 'blackbar/enabled', true )) { |
|
| 74 | + return; |
|
| 75 | + } |
|
| 73 | 76 | add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
| 74 | 77 | add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' )); |
| 75 | 78 | add_action( 'admin_footer', array( $controller, 'renderBar' )); |
@@ -97,7 +100,9 @@ discard block |
||
| 97 | 100 | public function render( $view, array $data = array() ) |
| 98 | 101 | { |
| 99 | 102 | $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))); |
| 100 | - if( !file_exists( $file ))return; |
|
| 103 | + if( !file_exists( $file )) { |
|
| 104 | + return; |
|
| 105 | + } |
|
| 101 | 106 | extract( $data ); |
| 102 | 107 | include $file; |
| 103 | 108 | } |