Passed
Push — develop ( bb9128...160605 )
by Paul
02:51
created
src/Controller.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function filterPluginLinks( array $links )
29 29
 	{
30
-		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ));
31
-		$links[] = $this->app->config->disable_config
32
-			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ))
33
-			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ));
30
+		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ) );
31
+		$links[ ] = $this->app->config->disable_config
32
+			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ) )
33
+			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ) );
34 34
 		return $links;
35 35
 	}
36 36
 
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 
60 60
 		wp_enqueue_style( 'pollux/main.css',
61 61
 			$this->app->url( 'assets/main.css' ),
62
-			apply_filters( 'pollux/enqueue/css/deps', [] ),
62
+			apply_filters( 'pollux/enqueue/css/deps', [ ] ),
63 63
 			$this->app->version
64 64
 		);
65 65
 		wp_enqueue_script( 'pollux/main.js',
66 66
 			$this->app->url( 'assets/main.js' ),
67
-			apply_filters( 'pollux/enqueue/js/deps', [] ),
67
+			apply_filters( 'pollux/enqueue/js/deps', [ ] ),
68 68
 			$this->app->version
69 69
 		);
70 70
 		wp_localize_script( 'pollux/main.js',
71 71
 			apply_filters( 'pollux/enqueue/js/localize/name', $this->app->id ),
72
-			['vars' => apply_filters( 'pollux/enqueue/js/localize/variables', [] )]
72
+			[ 'vars' => apply_filters( 'pollux/enqueue/js/localize/variables', [ ] ) ]
73 73
 		);
74 74
 	}
75 75
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$widgets = apply_filters( 'pollux/dashoard/widgets', [
84 84
 			'dashboard_primary',
85 85
 			'dashboard_quick_press',
86
-		]);
86
+		] );
87 87
 		foreach( $widgets as $widget ) {
88 88
 			remove_meta_box( $widget, 'dashboard', 'normal' );
89 89
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function registerArchiveAssets( WP_Screen $screen )
107 107
 	{
108
-		if(( new Helper )->endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) {
108
+		if( ( new Helper )->endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) {
109 109
 			wp_enqueue_script( 'common' );
110 110
 			wp_enqueue_script( 'editor-expand' );
111 111
 			wp_enqueue_script( 'post' );
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 		if( $screen->id == 'settings_page_pollux' && $screen->pagenow == 'options-general.php' ) {
126 126
 			wp_enqueue_style( 'pollux/codemirror.css',
127 127
 				$this->app->url( 'assets/codemirror.css' ),
128
-				[],
128
+				[ ],
129 129
 				$this->app->version
130 130
 			);
131 131
 			wp_enqueue_script( 'pollux/codemirror.js',
132 132
 				$this->app->url( 'assets/codemirror.js' ),
133
-				['pollux/main.js'],
133
+				[ 'pollux/main.js' ],
134 134
 				$this->app->version
135 135
 			);
136 136
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			&& $this->app->gatekeeper->hasPendingDependencies() ) {
147 147
 			wp_enqueue_script( 'updates' );
148 148
 			add_filter( 'pollux/enqueue/js/localize/variables', function( $vars ) {
149
-				$vars['l10n'] = [
149
+				$vars[ 'l10n' ] = [
150 150
 					'pluginActivatingLabel' => __( 'Activating %s...', 'pollux' ),
151 151
 					'pluginActivatedLabel' => __( '%s activated!', 'pollux' ),
152 152
 				];
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	protected function registerSettingsAssets( WP_Screen $screen )
162 162
 	{
163
-		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() )) {
163
+		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() ) ) {
164 164
 			wp_enqueue_script( 'common' );
165 165
 			wp_enqueue_script( 'postbox' );
166 166
 			wp_enqueue_script( 'wp-lists' );
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function filterWordPressFooter( $text )
42 42
 	{
43
-		if( $this->app->config->remove_wordpress_footer )return;
43
+		if( $this->app->config->remove_wordpress_footer ) {
44
+			return;
45
+		}
44 46
 		return $text;
45 47
 	}
46 48
 
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	 */
80 82
 	public function removeDashboardWidgets()
81 83
 	{
82
-		if( !$this->app->config->remove_dashboard_widgets )return;
84
+		if( !$this->app->config->remove_dashboard_widgets ) {
85
+			return;
86
+		}
83 87
 		$widgets = apply_filters( 'pollux/dashoard/widgets', [
84 88
 			'dashboard_primary',
85 89
 			'dashboard_quick_press',
@@ -95,7 +99,9 @@  discard block
 block discarded – undo
95 99
 	 */
96 100
 	public function removeWordPressMenu()
97 101
 	{
98
-		if( !$this->app->config->remove_wordpress_menu )return;
102
+		if( !$this->app->config->remove_wordpress_menu ) {
103
+			return;
104
+		}
99 105
 		global $wp_admin_bar;
100 106
 		$wp_admin_bar->remove_menu( 'wp-logo' );
101 107
 	}
@@ -145,7 +151,8 @@  discard block
 block discarded – undo
145 151
 			&& $screen->pagenow == 'options-general.php'
146 152
 			&& $this->app->gatekeeper->hasPendingDependencies() ) {
147 153
 			wp_enqueue_script( 'updates' );
148
-			add_filter( 'pollux/enqueue/js/localize/variables', function( $vars ) {
154
+			add_filter( 'pollux/enqueue/js/localize/variables', function( $vars )
155
+			{
149 156
 				$vars['l10n'] = [
150 157
 					'pluginActivatingLabel' => __( 'Activating %s...', 'pollux' ),
151 158
 					'pluginActivatedLabel' => __( '%s activated!', 'pollux' ),
Please login to merge, or discard this patch.
src/PostType/DisablePosts.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	{
26 26
 		if( !$this->app->config->disable_posts )return;
27 27
 
28
-		add_action( 'init',               [$this, 'disable'] );
29
-		add_action( 'wp_dashboard_setup', [$this, 'modifyDashboardWidgets'] );
30
-		add_action( 'admin_bar_menu',     [$this, 'removeFromAdminBar'], 999 );
31
-		add_action( 'admin_menu',         [$this, 'removeFromAdminMenu'] );
32
-		add_action( 'admin_init',         [$this, 'unregisterDashboardWidgets'] );
33
-		add_action( 'widgets_init',       [$this, 'unregisterWidgets'], 1 );
34
-		add_filter( 'posts_results',      [$this, 'filterPostQuery'] );
35
-		add_filter( 'pre_get_posts',      [$this, 'filterSearchQuery'] );
28
+		add_action( 'init', [ $this, 'disable' ] );
29
+		add_action( 'wp_dashboard_setup', [ $this, 'modifyDashboardWidgets' ] );
30
+		add_action( 'admin_bar_menu', [ $this, 'removeFromAdminBar' ], 999 );
31
+		add_action( 'admin_menu', [ $this, 'removeFromAdminMenu' ] );
32
+		add_action( 'admin_init', [ $this, 'unregisterDashboardWidgets' ] );
33
+		add_action( 'widgets_init', [ $this, 'unregisterWidgets' ], 1 );
34
+		add_filter( 'posts_results', [ $this, 'filterPostQuery' ] );
35
+		add_filter( 'pre_get_posts', [ $this, 'filterSearchQuery' ] );
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function disable()
43 43
 	{
44
-		if( !in_array(( new Helper )->getCurrentScreen()->pagenow, [
44
+		if( !in_array( ( new Helper )->getCurrentScreen()->pagenow, [
45 45
 			'edit.php', 'edit-tags.php', 'post-new.php',
46
-		]))return;
46
+		] ) )return;
47 47
 
48 48
 		if( !filter_input_array( INPUT_GET, [
49 49
 			'post_type' => FILTER_DEFAULT,
50 50
 			'taxonomy' => FILTER_DEFAULT,
51
-		])) {
51
+		] ) ) {
52 52
 			wp_safe_redirect( get_admin_url(), 301 );
53 53
 			exit;
54 54
 		}
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * @return array
67 67
 	 * @filter posts_results
68 68
 	 */
69
-	public function filterPostQuery( $posts = [] )
69
+	public function filterPostQuery( $posts = [ ] )
70 70
 	{
71 71
 		global $wp_query;
72 72
 		return $this->isAdmin() || strpos( $wp_query->request, "wp_posts.post_type = 'post'" ) === false
73 73
 			? $posts
74
-			: [];
74
+			: [ ];
75 75
 	}
76 76
 
77 77
 	/**
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 		if( $this->isAdmin() || !$query->is_main_query() || !is_search() ) {
84 84
 			return $query;
85 85
 		}
86
-		$post_types = get_post_types( ['exclude_from_search' => false ] );
87
-		unset( $post_types['post'] );
86
+		$post_types = get_post_types( [ 'exclude_from_search' => false ] );
87
+		unset( $post_types[ 'post' ] );
88 88
 		$query->set( 'post_type', array_values( $post_types ) );
89 89
 		return $query;
90 90
 	}
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function modifyDashboardWidgets()
97 97
 	{
98
-		if( !is_blog_admin() || !current_user_can( 'edit_posts' ))return;
98
+		if( !is_blog_admin() || !current_user_can( 'edit_posts' ) )return;
99 99
 
100 100
 		global $wp_meta_boxes;
101
-		$widgets = &$wp_meta_boxes['dashboard']['normal']['core'];
102
-		if( !isset( $widgets['dashboard_right_now']['callback'] ))return;
103
-		$widgets['dashboard_right_now']['callback'] = function() {
101
+		$widgets = &$wp_meta_boxes[ 'dashboard' ][ 'normal' ][ 'core' ];
102
+		if( !isset( $widgets[ 'dashboard_right_now' ][ 'callback' ] ) )return;
103
+		$widgets[ 'dashboard_right_now' ][ 'callback' ] = function() {
104 104
 			ob_start();
105 105
 			wp_dashboard_right_now();
106 106
 			echo preg_replace( '/<li class="post-count">(.*?)<\/li>/', '', ob_get_clean() );
Please login to merge, or discard this patch.