Changeset 12731
- Timestamp:
- 01/15/2010 08:21:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin.php
r12728 r12731 83 83 do_action('admin_init'); 84 84 85 // Handle plugin admin pages. 86 if (isset($plugin_page)) { 85 if (isset($plugin_page) ) { 87 86 if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) { 88 87 $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); … … 98 97 } 99 98 } 100 101 if ( $page_hook ) { 102 do_action('load-' . $page_hook); 103 if (! isset($_GET['noheader'])) 104 require_once(ABSPATH . 'wp-admin/admin-header.php'); 105 106 do_action($page_hook); 107 } else { 108 if ( validate_file($plugin_page) ) { 109 wp_die(__('Invalid plugin page')); 110 } 111 112 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") ) ) 113 wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); 114 115 do_action('load-' . $plugin_page); 116 117 if (! isset($_GET['noheader'])) 118 require_once(ABSPATH . 'wp-admin/admin-header.php'); 119 120 if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) 121 include(WPMU_PLUGIN_DIR . "/$plugin_page"); 122 else 123 include(ABSPATH . PLUGINDIR . "/$plugin_page"); 124 } 125 126 include(ABSPATH . 'wp-admin/admin-footer.php'); 127 128 exit(); 129 } else if (isset($_GET['import'])) { 130 131 $importer = $_GET['import']; 132 133 if ( ! current_user_can('import') ) 134 wp_die(__('You are not allowed to import.')); 135 136 if ( validate_file($importer) ) { 137 wp_die(__('Invalid importer.')); 138 } 139 140 // Allow plugins to define importers as well 141 if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) 142 { 143 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) 144 { 145 wp_die(__('Cannot load importer.')); 146 } 147 include(ABSPATH . "wp-admin/import/$importer.php"); 148 } 149 150 $parent_file = 'tools.php'; 151 $submenu_file = 'import.php'; 152 $title = __('Import'); 153 154 if (! isset($_GET['noheader'])) 155 require_once(ABSPATH . 'wp-admin/admin-header.php'); 156 157 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 158 159 define('WP_IMPORTING', true); 160 if ( is_multisite() ) { 161 kses_init_filters(); // Always filter imported data with kses. 162 } 163 164 call_user_func($wp_importers[$importer][2]); 165 166 include(ABSPATH . 'wp-admin/admin-footer.php'); 167 168 // Make sure rules are flushed 169 global $wp_rewrite; 170 $wp_rewrite->flush_rules(false); 171 172 exit(); 173 } else { 174 do_action("load-$pagenow"); 175 } 176 177 if ( !empty($_REQUEST['action']) ) 178 do_action('admin_action_' . $_REQUEST['action']); 99 } 179 100 180 101 $hook_suffix = ''; … … 217 138 $current_screen = apply_filters('current_screen', $current_screen); 218 139 140 // Handle plugin admin pages. 141 if ( isset($plugin_page) ) { 142 if ( $page_hook ) { 143 do_action('load-' . $page_hook); 144 if (! isset($_GET['noheader'])) 145 require_once(ABSPATH . 'wp-admin/admin-header.php'); 146 147 do_action($page_hook); 148 } else { 149 if ( validate_file($plugin_page) ) { 150 wp_die(__('Invalid plugin page')); 151 } 152 153 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") ) ) 154 wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); 155 156 do_action('load-' . $plugin_page); 157 158 if (! isset($_GET['noheader'])) 159 require_once(ABSPATH . 'wp-admin/admin-header.php'); 160 161 if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) 162 include(WPMU_PLUGIN_DIR . "/$plugin_page"); 163 else 164 include(ABSPATH . PLUGINDIR . "/$plugin_page"); 165 } 166 167 include(ABSPATH . 'wp-admin/admin-footer.php'); 168 169 exit(); 170 } else if (isset($_GET['import'])) { 171 172 $importer = $_GET['import']; 173 174 if ( ! current_user_can('import') ) 175 wp_die(__('You are not allowed to import.')); 176 177 if ( validate_file($importer) ) { 178 wp_die(__('Invalid importer.')); 179 } 180 181 // Allow plugins to define importers as well 182 if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) 183 { 184 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) 185 { 186 wp_die(__('Cannot load importer.')); 187 } 188 include(ABSPATH . "wp-admin/import/$importer.php"); 189 } 190 191 $parent_file = 'tools.php'; 192 $submenu_file = 'import.php'; 193 $title = __('Import'); 194 195 if (! isset($_GET['noheader'])) 196 require_once(ABSPATH . 'wp-admin/admin-header.php'); 197 198 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 199 200 define('WP_IMPORTING', true); 201 if ( is_multisite() ) { 202 kses_init_filters(); // Always filter imported data with kses. 203 } 204 205 call_user_func($wp_importers[$importer][2]); 206 207 include(ABSPATH . 'wp-admin/admin-footer.php'); 208 209 // Make sure rules are flushed 210 global $wp_rewrite; 211 $wp_rewrite->flush_rules(false); 212 213 exit(); 214 } else { 215 do_action("load-$pagenow"); 216 } 217 218 if ( !empty($_REQUEST['action']) ) 219 do_action('admin_action_' . $_REQUEST['action']); 220 219 221 ?>
Note: See TracChangeset
for help on using the changeset viewer.