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