Completed
Push — master ( b15b16...6e2b0e )
by Scott Kingsley
02:40 queued 17s
created
wordpress-fields-api.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * The absolute server path to the fields API directory.
24 24
  */
25
-define( 'WP_FIELDS_API_DIR', plugin_dir_path( __FILE__ ) );
25
+define('WP_FIELDS_API_DIR', plugin_dir_path(__FILE__));
26 26
 
27 27
 /**
28 28
  * On `plugins_loaded`, create an instance of the Fields API manager class.
@@ -30,33 +30,33 @@  discard block
 block discarded – undo
30 30
 function _wp_fields_api_include() {
31 31
 
32 32
 	// Bail if we're already in WP core (depending on the name used)
33
-	if ( class_exists( 'WP_Fields_API' ) || class_exists( 'Fields_API' ) ) {
33
+	if (class_exists('WP_Fields_API') || class_exists('Fields_API')) {
34 34
 		return;
35 35
 	}
36 36
 
37
-	if ( ! defined( 'WP_FIELDS_API_EXAMPLES' ) ) {
38
-		define( 'WP_FIELDS_API_EXAMPLES', false );
37
+	if ( ! defined('WP_FIELDS_API_EXAMPLES')) {
38
+		define('WP_FIELDS_API_EXAMPLES', false);
39 39
 	}
40 40
 
41
-	require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/fields-api/class-wp-fields-api.php' );
41
+	require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/fields-api/class-wp-fields-api.php');
42 42
 
43 43
 	// Init Fields API class
44 44
 	$GLOBALS['wp_fields'] = WP_Fields_API::get_instance();
45 45
 
46 46
 }
47 47
 
48
-add_action( 'plugins_loaded', '_wp_fields_api_include', 8 );
48
+add_action('plugins_loaded', '_wp_fields_api_include', 8);
49 49
 
50 50
 /**
51 51
  * Implement Fields API Customizer instead of WP Core Customizer.
52 52
  */
53 53
 function _wp_fields_api_customize_include() {
54 54
 
55
-	if ( ! ( ( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] ) || ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) ) ) ) {
55
+	if ( ! ((isset($_REQUEST['wp_customize']) && 'on' == $_REQUEST['wp_customize']) || (is_admin() && 'customize.php' == basename($_SERVER['PHP_SELF'])))) {
56 56
 		return;
57 57
 	}
58 58
 
59
-	require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/class-wp-customize-manager.php' );
59
+	require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/class-wp-customize-manager.php');
60 60
 
61 61
 	// Init Customize class
62 62
 	$GLOBALS['wp_customize'] = new WP_Customize_Manager;
@@ -71,63 +71,63 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function _wp_fields_api_implementations() {
73 73
 
74
-	$implementation_dir = WP_FIELDS_API_DIR . 'implementation/wp-includes/fields-api/forms/';
74
+	$implementation_dir = WP_FIELDS_API_DIR.'implementation/wp-includes/fields-api/forms/';
75 75
 
76 76
 	// Meta boxes
77
-	add_action( 'add_meta_boxes', array( 'WP_Fields_API_Meta_Box_Section', 'add_meta_boxes' ), 10, 2 );
77
+	add_action('add_meta_boxes', array('WP_Fields_API_Meta_Box_Section', 'add_meta_boxes'), 10, 2);
78 78
 
79 79
 	// Post
80
-	require_once( $implementation_dir . 'class-wp-fields-api-form-post.php' );
80
+	require_once($implementation_dir.'class-wp-fields-api-form-post.php');
81 81
 
82
-	WP_Fields_API_Form_Post::register( 'post', 'post-edit' );
82
+	WP_Fields_API_Form_Post::register('post', 'post-edit');
83 83
 
84 84
 	// Term
85
-	require_once( $implementation_dir . 'class-wp-fields-api-form-term.php' );
86
-	require_once( $implementation_dir . 'class-wp-fields-api-form-term-add.php' );
85
+	require_once($implementation_dir.'class-wp-fields-api-form-term.php');
86
+	require_once($implementation_dir.'class-wp-fields-api-form-term-add.php');
87 87
 
88
-	WP_Fields_API_Form_Term::register( 'term', 'term-edit' );
89
-	WP_Fields_API_Form_Term_Add::register( 'term', 'term-add' );
88
+	WP_Fields_API_Form_Term::register('term', 'term-edit');
89
+	WP_Fields_API_Form_Term_Add::register('term', 'term-add');
90 90
 
91 91
 	// User
92
-	require_once( $implementation_dir . 'class-wp-fields-api-form-user-edit.php' );
92
+	require_once($implementation_dir.'class-wp-fields-api-form-user-edit.php');
93 93
 
94
-	WP_Fields_API_Form_User_Edit::register( 'user', 'user-edit' );
94
+	WP_Fields_API_Form_User_Edit::register('user', 'user-edit');
95 95
 
96 96
 	// Comment
97
-	require_once( $implementation_dir . 'class-wp-fields-api-form-comment.php' );
97
+	require_once($implementation_dir.'class-wp-fields-api-form-comment.php');
98 98
 
99
-	WP_Fields_API_Form_Comment::register( 'comment', 'comment-edit' );
99
+	WP_Fields_API_Form_Comment::register('comment', 'comment-edit');
100 100
 
101 101
 	// Settings
102
-	require_once( $implementation_dir . 'settings/class-wp-fields-api-form-settings.php' );
103
-	require_once( $implementation_dir . 'settings/class-wp-fields-api-form-settings-general.php' );
102
+	require_once($implementation_dir.'settings/class-wp-fields-api-form-settings.php');
103
+	require_once($implementation_dir.'settings/class-wp-fields-api-form-settings-general.php');
104 104
 
105
-	WP_Fields_API_Form_Settings_General::register( 'settings', 'general' );
105
+	WP_Fields_API_Form_Settings_General::register('settings', 'general');
106 106
 
107 107
 	// Settings API compatibility
108
-	require_once( $implementation_dir . 'settings/class-wp-fields-api-settings-api.php' );
108
+	require_once($implementation_dir.'settings/class-wp-fields-api-settings-api.php');
109 109
 
110 110
 	// Run Settings API compatibility (has it's own hooks)
111 111
 	new WP_Fields_API_Settings_API;
112 112
 
113 113
 }
114
-add_action( 'fields_register', '_wp_fields_api_implementations', 5 );
114
+add_action('fields_register', '_wp_fields_api_implementations', 5);
115 115
 
116 116
 // Post
117
-add_action( 'load-post.php', '_wp_fields_api_load_include', 999 );
117
+add_action('load-post.php', '_wp_fields_api_load_include', 999);
118 118
 
119 119
 // Term
120
-add_action( 'load-edit-tags.php', '_wp_fields_api_load_include', 999 );
120
+add_action('load-edit-tags.php', '_wp_fields_api_load_include', 999);
121 121
 
122 122
 // User
123
-add_action( 'load-user-edit.php', '_wp_fields_api_load_include', 999 );
124
-add_action( 'load-profile.php', '_wp_fields_api_load_include', 999 );
123
+add_action('load-user-edit.php', '_wp_fields_api_load_include', 999);
124
+add_action('load-profile.php', '_wp_fields_api_load_include', 999);
125 125
 
126 126
 // Comment
127
-add_action( 'load-comment.php', '_wp_fields_api_load_include', 999 );
127
+add_action('load-comment.php', '_wp_fields_api_load_include', 999);
128 128
 
129 129
 // Settings
130
-add_action( 'load-options-general.php', '_wp_fields_api_load_include', 999 );
130
+add_action('load-options-general.php', '_wp_fields_api_load_include', 999);
131 131
 
132 132
 function _wp_fields_api_load_include() {
133 133
 
@@ -135,19 +135,19 @@  discard block
 block discarded – undo
135 135
 
136 136
 	static $overridden;
137 137
 
138
-	if ( empty( $overridden ) ) {
138
+	if (empty($overridden)) {
139 139
 		$overridden = array();
140 140
 	}
141 141
 
142
-	$load_path = WP_FIELDS_API_DIR . 'implementation/wp-admin/';
142
+	$load_path = WP_FIELDS_API_DIR.'implementation/wp-admin/';
143 143
 
144
-	if ( file_exists( $load_path . $pagenow ) && ! in_array( $pagenow, $overridden ) ) {
144
+	if (file_exists($load_path.$pagenow) && ! in_array($pagenow, $overridden)) {
145 145
 		$overridden[] = $pagenow;
146 146
 
147 147
 		_wp_fields_api_override_compatibility();
148 148
 
149 149
 		// Load our override
150
-		require_once( $load_path . $pagenow );
150
+		require_once($load_path.$pagenow);
151 151
 
152 152
 		// Bail on original core file, don't run the rest
153 153
 		exit;
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 	 * The following hooks are fired to ensure backward compatibility.
167 167
 	 * In all other cases, 'load-' . $pagenow should be used instead.
168 168
 	 */
169
-	if ( $typenow == 'page' ) {
170
-		if ( $pagenow == 'post-new.php' )
171
-			do_action( 'load-page-new.php' );
172
-		elseif ( $pagenow == 'post.php' )
173
-			do_action( 'load-page.php' );
174
-	}  elseif ( $pagenow == 'edit-tags.php' ) {
175
-		if ( $taxnow == 'category' )
176
-			do_action( 'load-categories.php' );
177
-		elseif ( $taxnow == 'link_category' )
178
-			do_action( 'load-edit-link-categories.php' );
169
+	if ($typenow == 'page') {
170
+		if ($pagenow == 'post-new.php')
171
+			do_action('load-page-new.php');
172
+		elseif ($pagenow == 'post.php')
173
+			do_action('load-page.php');
174
+	}  elseif ($pagenow == 'edit-tags.php') {
175
+		if ($taxnow == 'category')
176
+			do_action('load-categories.php');
177
+		elseif ($taxnow == 'link_category')
178
+			do_action('load-edit-link-categories.php');
179 179
 	}
180 180
 
181
-	if ( ! empty( $_REQUEST['action'] ) ) {
181
+	if ( ! empty($_REQUEST['action'])) {
182 182
 		/**
183 183
 		 * Fires when an 'action' request variable is sent.
184 184
 		 *
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 *
188 188
 		 * @since 2.6.0
189 189
 		 */
190
-		do_action( 'admin_action_' . $_REQUEST['action'] );
190
+		do_action('admin_action_'.$_REQUEST['action']);
191 191
 	}
192 192
 
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -167,15 +167,17 @@
 block discarded – undo
167 167
 	 * In all other cases, 'load-' . $pagenow should be used instead.
168 168
 	 */
169 169
 	if ( $typenow == 'page' ) {
170
-		if ( $pagenow == 'post-new.php' )
171
-			do_action( 'load-page-new.php' );
172
-		elseif ( $pagenow == 'post.php' )
173
-			do_action( 'load-page.php' );
174
-	}  elseif ( $pagenow == 'edit-tags.php' ) {
175
-		if ( $taxnow == 'category' )
176
-			do_action( 'load-categories.php' );
177
-		elseif ( $taxnow == 'link_category' )
178
-			do_action( 'load-edit-link-categories.php' );
170
+		if ( $pagenow == 'post-new.php' ) {
171
+					do_action( 'load-page-new.php' );
172
+		} elseif ( $pagenow == 'post.php' ) {
173
+					do_action( 'load-page.php' );
174
+		}
175
+	} elseif ( $pagenow == 'edit-tags.php' ) {
176
+		if ( $taxnow == 'category' ) {
177
+					do_action( 'load-categories.php' );
178
+		} elseif ( $taxnow == 'link_category' ) {
179
+					do_action( 'load-edit-link-categories.php' );
180
+		}
179 181
 	}
180 182
 
181 183
 	if ( ! empty( $_REQUEST['action'] ) ) {
Please login to merge, or discard this patch.