| [ Root ] [ Search ] [ Index ] |
PHP Cross Reference of WordPress 3.0.1Provided by Yoast |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * WordPress Administration Bootstrap 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** 10 * In WordPress Administration Panels 11 * 12 * @since unknown 13 */ 14 if ( !defined('WP_ADMIN') ) 15 define('WP_ADMIN', TRUE); 16 17 if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) 18 define('WP_LOAD_IMPORTERS', true); 19 20 require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); 21 22 if ( get_option('db_upgraded') ) { 23 $wp_rewrite->flush_rules(); 24 update_option( 'db_upgraded', false ); 25 26 /** 27 * Runs on the next page load after successful upgrade 28 * 29 * @since 2.8 30 */ 31 do_action('after_db_upgrade'); 32 } elseif ( get_option('db_version') != $wp_db_version ) { 33 if ( !is_multisite() ) { 34 wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); 35 exit; 36 } elseif ( apply_filters( 'do_mu_upgrade', true ) ) { 37 /** 38 * On really small MU installs run the upgrader every time, 39 * else run it less often to reduce load. 40 * 41 * @since 2.8.4b 42 */ 43 $c = get_blog_count(); 44 if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) { 45 require_once( ABSPATH . WPINC . '/http.php' ); 46 $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) ); 47 do_action( 'after_mu_upgrade', $response ); 48 unset($response); 49 } 50 unset($c); 51 } 52 } 53 54 require_once (ABSPATH . 'wp-admin/includes/admin.php'); 55 56 auth_redirect(); 57 58 nocache_headers(); 59 60 update_category_cache(); 61 62 // Schedule trash collection 63 if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) 64 wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); 65 66 set_screen_options(); 67 68 $date_format = get_option('date_format'); 69 $time_format = get_option('time_format'); 70 71 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback')); 72 73 wp_enqueue_script( 'common' ); 74 wp_enqueue_script( 'jquery-color' ); 75 76 $editing = false; 77 78 if ( isset($_GET['page']) ) { 79 $plugin_page = stripslashes($_GET['page']); 80 $plugin_page = plugin_basename($plugin_page); 81 } 82 83 if ( isset($_GET['post_type']) ) 84 $typenow = sanitize_key($_GET['post_type']); 85 else 86 $typenow = ''; 87 88 if ( isset($_GET['taxonomy']) ) 89 $taxnow = sanitize_key($_GET['taxonomy']); 90 else 91 $taxnow = ''; 92 93 require (ABSPATH . 'wp-admin/menu.php'); 94 95 if ( current_user_can( 'manage_options' ) ) 96 @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) ); 97 98 do_action('admin_init'); 99 100 if ( isset($plugin_page) ) { 101 if ( !empty($typenow) ) 102 $the_parent = $pagenow . '?post_type=' . $typenow; 103 else 104 $the_parent = $pagenow; 105 if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) { 106 $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); 107 // backwards compatibility for plugins using add_management_page 108 if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) { 109 // There could be plugin specific params on the URL, so we need the whole query string 110 if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) 111 $query_string = $_SERVER[ 'QUERY_STRING' ]; 112 else 113 $query_string = 'page=' . $plugin_page; 114 wp_redirect( 'tools.php?' . $query_string ); 115 exit; 116 } 117 } 118 unset($the_parent); 119 } 120 121 $hook_suffix = ''; 122 if ( isset($page_hook) ) 123 $hook_suffix = $page_hook; 124 else if ( isset($plugin_page) ) 125 $hook_suffix = $plugin_page; 126 else if ( isset($pagenow) ) 127 $hook_suffix = $pagenow; 128 129 set_current_screen(); 130 131 // Handle plugin admin pages. 132 if ( isset($plugin_page) ) { 133 if ( $page_hook ) { 134 do_action('load-' . $page_hook); 135 if (! isset($_GET['noheader'])) 136 require_once (ABSPATH . 'wp-admin/admin-header.php'); 137 138 do_action($page_hook); 139 } else { 140 if ( validate_file($plugin_page) ) 141 wp_die(__('Invalid plugin page')); 142 143 144 if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) 145 wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); 146 147 do_action('load-' . $plugin_page); 148 149 if ( !isset($_GET['noheader'])) 150 require_once (ABSPATH . 'wp-admin/admin-header.php'); 151 152 if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) 153 include(WPMU_PLUGIN_DIR . "/$plugin_page"); 154 else 155 include(WP_PLUGIN_DIR . "/$plugin_page"); 156 } 157 158 include (ABSPATH . 'wp-admin/admin-footer.php'); 159 160 exit(); 161 } else if (isset($_GET['import'])) { 162 163 $importer = $_GET['import']; 164 165 if ( ! current_user_can('import') ) 166 wp_die(__('You are not allowed to import.')); 167 168 if ( validate_file($importer) ) 169 wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); 170 171 // Allow plugins to define importers as well 172 if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) { 173 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) 174 wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); 175 include(ABSPATH . "wp-admin/import/$importer.php"); 176 } 177 178 $parent_file = 'tools.php'; 179 $submenu_file = 'import.php'; 180 $title = __('Import'); 181 182 if (! isset($_GET['noheader'])) 183 require_once (ABSPATH . 'wp-admin/admin-header.php'); 184 185 require_once (ABSPATH . 'wp-admin/includes/upgrade.php'); 186 187 define('WP_IMPORTING', true); 188 189 if ( is_multisite() ) 190 kses_init_filters(); // Always filter imported data with kses. 191 192 call_user_func($wp_importers[$importer][2]); 193 194 include (ABSPATH . 'wp-admin/admin-footer.php'); 195 196 // Make sure rules are flushed 197 global $wp_rewrite; 198 $wp_rewrite->flush_rules(false); 199 200 exit(); 201 } else { 202 do_action("load-$pagenow"); 203 // Backwards compatibility with old load-page-new.php, load-page.php, 204 // and load-categories.php actions. 205 if ( $typenow == 'page' ) { 206 if ( $pagenow == 'post-new.php' ) 207 do_action( 'load-page-new.php' ); 208 elseif ( $pagenow == 'post.php' ) 209 do_action( 'load-page.php' ); 210 } elseif ( $taxnow == 'category' && $pagenow == 'edit-tags.php' ) { 211 do_action( 'load-categories.php' ); 212 } 213 } 214 215 if ( !empty($_REQUEST['action']) ) 216 do_action('admin_action_' . $_REQUEST['action']); 217 218 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Oct 14 05:12:05 2010 | Cross-referenced by PHPXref 0.7 |