@@ -4,8 +4,8 @@ |
||
| 4 | 4 | * Compatibility with Give WP plugin |
| 5 | 5 | */ |
| 6 | 6 | add_filter( 'give_load_admin_scripts', function( $is_admin_page, $hook ) { |
| 7 | - $needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' )); |
|
| 8 | - return substr( $hook, - strlen( $needle )) !== $needle |
|
| 7 | + $needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' ) ); |
|
| 8 | + return substr( $hook, - strlen( $needle ) ) !== $needle |
|
| 9 | 9 | ? $is_admin_page |
| 10 | 10 | : true; |
| 11 | 11 | }, 10, 2 ); |
@@ -3,7 +3,8 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Compatibility with Give WP plugin |
| 5 | 5 | */ |
| 6 | -add_filter( 'give_load_admin_scripts', function( $is_admin_page, $hook ) { |
|
| 6 | +add_filter( 'give_load_admin_scripts', function( $is_admin_page, $hook ) |
|
| 7 | +{ |
|
| 7 | 8 | $needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' )); |
| 8 | 9 | return substr( $hook, - strlen( $needle )) !== $needle |
| 9 | 10 | ? $is_admin_page |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | public $gatekeeper; |
| 19 | 19 | public $id; |
| 20 | 20 | public $name; |
| 21 | - public $notices = []; |
|
| 21 | + public $notices = [ ]; |
|
| 22 | 22 | public $version; |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function __construct() |
| 33 | 33 | { |
| 34 | - $this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' ); |
|
| 35 | - $this->gatekeeper = new GateKeeper( plugin_basename( $this->file )); |
|
| 34 | + $this->file = realpath( dirname( dirname( __FILE__ ) ) . '/pollux.php' ); |
|
| 35 | + $this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) ); |
|
| 36 | 36 | |
| 37 | 37 | $data = get_file_data( $this->file, array( |
| 38 | 38 | 'id' => 'Text Domain', |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | add_action( 'plugins_loaded', function() { |
| 59 | 59 | $this->bootstrap(); |
| 60 | 60 | }); |
| 61 | - add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' )); |
|
| 62 | - add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' )); |
|
| 63 | - add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' )); |
|
| 64 | - add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' )); |
|
| 65 | - add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' )); |
|
| 61 | + add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) ); |
|
| 62 | + add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) ); |
|
| 63 | + add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) ); |
|
| 64 | + add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ) ); |
|
| 65 | + add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) ); |
|
| 66 | 66 | |
| 67 | 67 | // Disallow indexing of the site on non-production environments |
| 68 | 68 | if( !$this->environment( 'production' ) && !is_admin() ) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function environment( $checkFor = '' ) |
| 78 | 78 | { |
| 79 | 79 | $environment = defined( 'WP_ENV' ) ? WP_ENV : 'production'; |
| 80 | - if( !empty( $checkFor )) { |
|
| 80 | + if( !empty( $checkFor ) ) { |
|
| 81 | 81 | return $environment == $checkFor; |
| 82 | 82 | } |
| 83 | 83 | return $environment; |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ), |
| 97 | 97 | trailingslashit( WP_CONTENT_DIR ), |
| 98 | 98 | trailingslashit( ABSPATH ), |
| 99 | - trailingslashit( dirname( ABSPATH )), |
|
| 100 | - trailingslashit( dirname( dirname( ABSPATH ))), |
|
| 101 | - ]); |
|
| 99 | + trailingslashit( dirname( ABSPATH ) ), |
|
| 100 | + trailingslashit( dirname( dirname( ABSPATH ) ) ), |
|
| 101 | + ] ); |
|
| 102 | 102 | foreach( (array) $locations as $location ) { |
| 103 | - if( !file_exists( $location . $filename ))continue; |
|
| 103 | + if( !file_exists( $location . $filename ) )continue; |
|
| 104 | 104 | return $location . $filename; |
| 105 | 105 | } |
| 106 | 106 | return null; |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * @param string $view |
| 134 | 134 | * @return void|null |
| 135 | 135 | */ |
| 136 | - public function render( $view, array $data = [] ) |
|
| 136 | + public function render( $view, array $data = [ ] ) |
|
| 137 | 137 | { |
| 138 | 138 | $file = apply_filters( 'pollux/views/file', |
| 139 | - $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))), |
|
| 139 | + $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ), |
|
| 140 | 140 | $view, |
| 141 | 141 | $data |
| 142 | 142 | ); |
| 143 | - if( !file_exists( $file ))return; |
|
| 143 | + if( !file_exists( $file ) )return; |
|
| 144 | 144 | extract( $data ); |
| 145 | 145 | include $file; |
| 146 | 146 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function url( $path = '' ) |
| 153 | 153 | { |
| 154 | - return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' )); |
|
| 154 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | protected function loadHooks() |
| 186 | 186 | { |
| 187 | - if( $file = $this->getFile( 'pollux-hooks.php' )) { |
|
| 187 | + if( $file = $this->getFile( 'pollux-hooks.php' ) ) { |
|
| 188 | 188 | include_once $file; |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -206,6 +206,6 @@ discard block |
||
| 206 | 206 | 'ArchiveMeta' => 'GeminiLabs\Pollux\Facades\ArchiveMeta', |
| 207 | 207 | 'PostMeta' => 'GeminiLabs\Pollux\Facades\PostMeta', |
| 208 | 208 | 'SiteMeta' => 'GeminiLabs\Pollux\Facades\SiteMeta', |
| 209 | - )))->register(); |
|
| 209 | + ) ) )->register(); |
|
| 210 | 210 | } |
| 211 | 211 | } |
@@ -55,7 +55,8 @@ discard block |
||
| 55 | 55 | $basename = plugin_basename( $this->file ); |
| 56 | 56 | $controller = $this->make( 'Controller' ); |
| 57 | 57 | |
| 58 | - add_action( 'plugins_loaded', function() { |
|
| 58 | + add_action( 'plugins_loaded', function() |
|
| 59 | + { |
|
| 59 | 60 | $this->bootstrap(); |
| 60 | 61 | }); |
| 61 | 62 | add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' )); |
@@ -100,7 +101,9 @@ discard block |
||
| 100 | 101 | trailingslashit( dirname( dirname( ABSPATH ))), |
| 101 | 102 | ]); |
| 102 | 103 | foreach( (array) $locations as $location ) { |
| 103 | - if( !file_exists( $location . $filename ))continue; |
|
| 104 | + if( !file_exists( $location . $filename )) { |
|
| 105 | + continue; |
|
| 106 | + } |
|
| 104 | 107 | return $location . $filename; |
| 105 | 108 | } |
| 106 | 109 | return null; |
@@ -140,7 +143,9 @@ discard block |
||
| 140 | 143 | $view, |
| 141 | 144 | $data |
| 142 | 145 | ); |
| 143 | - if( !file_exists( $file ))return; |
|
| 146 | + if( !file_exists( $file )) { |
|
| 147 | + return; |
|
| 148 | + } |
|
| 144 | 149 | extract( $data ); |
| 145 | 150 | include $file; |
| 146 | 151 | } |