Completed
Push — develop ( 774b4b...4d6c21 )
by Zack
19:02
created
includes/admin/class-gravityview-admin-no-conflict.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		if( ! is_admin() ) { return; }
21
+		if ( ! is_admin() ) { return; }
22 22
 		
23 23
 		$this->add_hooks();
24 24
 	}
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	private function add_hooks() {
34 34
 		//Hooks for no-conflict functionality
35
-		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000);
36
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9);
35
+		add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 );
36
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 );
37 37
 
38
-		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000);
39
-		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11);
40
-		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1);
41
-		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1);
38
+		add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 );
39
+		add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 );
40
+		add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 );
41
+		add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 );
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	function no_conflict_scripts() {
52 52
 		global $wp_scripts;
53 53
 
54
-		if( ! gravityview()->request->is_admin( '', null ) ) {
54
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
55 55
 			return;
56 56
 		}
57 57
 
58 58
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
59 59
 
60
-		if( empty( $no_conflict_mode ) ) {
60
+		if ( empty( $no_conflict_mode ) ) {
61 61
 			return;
62 62
 		}
63 63
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	function no_conflict_styles() {
117 117
 		global $wp_styles;
118 118
 
119
-		if( ! gravityview()->request->is_admin( '', null ) ) {
119
+		if ( ! gravityview()->request->is_admin( '', null ) ) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
126
-			foreach ($wp_styles->registered as $key => $style) {
127
-				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
125
+		if ( ! empty( $wp_styles->registered ) ) {
126
+			foreach ( $wp_styles->registered as $key => $style ) {
127
+				if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
129 129
 				}
130 130
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$no_conflict_mode = gravityview()->plugin->settings->get( 'no-conflict-mode' );
134 134
 
135 135
 		// If no conflict is off, jQuery will suffice.
136
-		if( empty( $no_conflict_mode ) ) {
136
+		if ( empty( $no_conflict_mode ) ) {
137 137
 			return;
138 138
 		}
139 139
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		/**
162 162
 		 * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here.
163 163
 		 */
164
-		do_action('gravityview_remove_conflicts_after');
164
+		do_action( 'gravityview_remove_conflicts_after' );
165 165
 	}
166 166
 
167 167
 	/**
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 
195 195
 		//reset queue
196 196
 		$queue = array();
197
-		foreach( $wp_objects->queue as $object ) {
198
-			if( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
-				$queue[] = $object;
197
+		foreach ( $wp_objects->queue as $object ) {
198
+			if ( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) {
199
+				$queue[ ] = $object;
200 200
 			}
201 201
 		}
202 202
 		$wp_objects->queue = $queue;
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach ( $wp_objects->registered as $handle => $script_registration ) {
209
+			if ( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @param array $registered [description]
222 222
 	 * @param array $scripts    [description]
223 223
 	 */
224
-	private function add_script_dependencies($registered, $scripts) {
224
+	private function add_script_dependencies( $registered, $scripts ) {
225 225
 
226 226
 		//gets all dependent scripts linked to the $scripts array passed
227 227
 		do {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 				$deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array();
231 231
 				foreach ( $deps as $dep ) {
232 232
 					if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) {
233
-						$dependents[] = $dep;
233
+						$dependents[ ] = $dep;
234 234
 					}
235 235
 				}
236 236
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		// Dequeue other jQuery styles even if no-conflict is off.
124 124
 		// Terrible-looking tabs help no one.
125
-		if( !empty( $wp_styles->registered ) )  {
125
+		if( !empty( $wp_styles->registered ) ) {
126 126
 			foreach ($wp_styles->registered as $key => $style) {
127 127
 				if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) {
128 128
 					wp_dequeue_style( $key );
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 
206 206
 		//unregistering scripts
207 207
 		$registered = array();
208
-		foreach( $wp_objects->registered as $handle => $script_registration ){
209
-			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){
208
+		foreach( $wp_objects->registered as $handle => $script_registration ) {
209
+			if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) {
210 210
 				$registered[ $handle ] = $script_registration;
211 211
 			}
212 212
 		}
Please login to merge, or discard this patch.