-
+ 0E9668B51DC2967D2956459B4F098E9CB06B507F03A6B61B15BDAD80AD3E368F032EDCD4E80B819A03BC6B1E46350FED3FE845E6247F547689B878A67D146C57mp-wp/wp-admin/plugins.php(0 . 0)(1 . 397)
55038 <?php
55039 /**
55040 * Plugins administration panel.
55041 *
55042 * @package WordPress
55043 * @subpackage Administration
55044 */
55045
55046 /** WordPress Administration Bootstrap */
55047 require_once('admin.php');
55048
55049 $action = '';
55050 foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
55051 if( isset($_POST[$action_key]) ) {
55052 $action = $action_key;
55053 break;
55054 }
55055 }
55056
55057 if( isset($_REQUEST['action']) && !empty($_REQUEST['action']) )
55058 $action = $_REQUEST['action'];
55059
55060 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
55061
55062 if( !empty($action) ) {
55063 switch( $action ) {
55064 case 'activate':
55065 check_admin_referer('activate-plugin_' . $plugin);
55066 $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
55067 if ( is_wp_error( $result ) )
55068 wp_die($result);
55069 $recent = (array)get_option('recently_activated');
55070 if ( isset($recent[ $plugin ]) ) {
55071 unset($recent[ $plugin ]);
55072 update_option('recently_activated', $recent);
55073 }
55074 wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
55075 exit;
55076 break;
55077 case 'activate-selected':
55078 check_admin_referer('bulk-manage-plugins');
55079 activate_plugins($_POST['checked'], 'plugins.php?error=true');
55080
55081 $recent = (array)get_option('recently_activated');
55082 foreach( (array)$_POST['checked'] as $plugin => $time) {
55083 if ( isset($recent[ $plugin ]) )
55084 unset($recent[ $plugin ]);
55085 }
55086 if( $recent != get_option('recently_activated') ) //If array changed, update it.
55087 update_option('recently_activated', $recent);
55088
55089 wp_redirect('plugins.php?activate-multi=true');
55090 exit;
55091 break;
55092 case 'error_scrape':
55093 check_admin_referer('plugin-activation-error_' . $plugin);
55094 $valid = validate_plugin($plugin);
55095 if ( is_wp_error($valid) )
55096 wp_die($valid);
55097 error_reporting( E_ALL ^ E_NOTICE );
55098 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
55099 include(WP_PLUGIN_DIR . '/' . $plugin);
55100 do_action('activate_' . $plugin);
55101 exit;
55102 break;
55103 case 'deactivate':
55104 check_admin_referer('deactivate-plugin_' . $plugin);
55105 deactivate_plugins($plugin);
55106 update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
55107 wp_redirect('plugins.php?deactivate=true');
55108 exit;
55109 break;
55110 case 'deactivate-selected':
55111 check_admin_referer('bulk-manage-plugins');
55112 deactivate_plugins($_POST['checked']);
55113 $deactivated = array();
55114 foreach ( (array)$_POST['checked'] as $plugin )
55115 $deactivated[ $plugin ] = time();
55116 update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
55117 wp_redirect('plugins.php?deactivate-multi=true');
55118 exit;
55119 break;
55120 case 'delete-selected':
55121 if ( ! current_user_can('delete_plugins') )
55122 wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
55123
55124 check_admin_referer('bulk-manage-plugins');
55125
55126 $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
55127 include(ABSPATH . 'wp-admin/update.php');
55128
55129 $title = __('Delete Plugin');
55130 $parent_file = 'plugins.php';
55131
55132 if ( ! isset($_REQUEST['verify-delete']) ) {
55133 wp_enqueue_script('jquery');
55134 require_once('admin-header.php');
55135 ?>
55136 <div class="wrap">
55137 <h2><?php _e('Delete Plugin(s)'); ?></h2>
55138 <?php
55139 $files_to_delete = $plugin_info = array();
55140 foreach ( (array) $plugins as $plugin ) {
55141 if ( '.' == dirname($plugin) ) {
55142 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
55143 if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
55144 $plugin_info[ $plugin ] = $data;
55145 } else {
55146 //Locate all the files in that folder:
55147 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
55148 if( $files ) {
55149 $files_to_delete = array_merge($files_to_delete, $files);
55150 }
55151 //Get plugins list from that folder
55152 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
55153 $plugin_info = array_merge($plugin_info, $folder_plugins);
55154 }
55155 }
55156 ?>
55157 <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
55158 <ul>
55159 <?php
55160 foreach ( $plugin_info as $plugin )
55161 echo '<li>', sprintf(__('%s by %s'), $plugin['Name'], $plugin['Author']), '</li>';
55162 ?>
55163 </ul>
55164 <p><?php _e('Are you sure you wish to delete these files?') ?></p>
55165 <form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
55166 <input type="hidden" name="verify-delete" value="1" />
55167 <input type="hidden" name="delete-selected" value="1" />
55168 <?php
55169 foreach ( (array)$plugins as $plugin )
55170 echo '<input type="hidden" name="checked[]" value="' . attribute_escape($plugin) . '" />';
55171 ?>
55172 <?php wp_nonce_field('bulk-manage-plugins') ?>
55173 <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
55174 </form>
55175 <form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
55176 <input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
55177 </form>
55178
55179 <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
55180 <div id="files-list" style="display:none;">
55181 <ul>
55182 <?php
55183 foreach ( (array)$files_to_delete as $file )
55184 echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>';
55185 ?>
55186 </ul>
55187 </div>
55188 </div>
55189 <?php
55190 require_once('admin-footer.php');
55191 exit;
55192 } //Endif verify-delete
55193 $delete_result = delete_plugins($plugins);
55194
55195 wp_cache_delete('plugins', 'plugins');
55196 break;
55197 case 'clear-recent-list':
55198 update_option('recently_activated', array());
55199 break;
55200 }
55201 }
55202
55203 wp_enqueue_script('plugin-install');
55204 add_thickbox();
55205
55206 $title = __('Manage Plugins');
55207 require_once('admin-header.php');
55208
55209 $invalid = validate_active_plugins();
55210 if ( !empty($invalid) )
55211 foreach ( $invalid as $plugin_file => $error )
55212 echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), wp_specialchars($plugin_file), $error->get_error_message()) . '</p></div>';
55213 ?>
55214
55215 <?php if ( isset($_GET['error']) ) : ?>
55216 <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
55217 <?php
55218 if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
55219 <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&plugin=' . attribute_escape($plugin) . '&_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?>"></iframe>
55220 <?php
55221 }
55222 ?>
55223 </div>
55224 <?php elseif ( 'delete-selected' == $action ) :
55225 if ( is_wp_error($delete_result) ) : ?>
55226 <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
55227 <?php else : ?>
55228 <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
55229 <?php endif; ?>
55230 <?php elseif ( isset($_GET['activate']) ) : ?>
55231 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
55232 <?php elseif (isset($_GET['activate-multi'])) : ?>
55233 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
55234 <?php elseif ( isset($_GET['deactivate']) ) : ?>
55235 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
55236 <?php elseif (isset($_GET['deactivate-multi'])) : ?>
55237 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
55238 <?php endif; ?>
55239
55240 <div class="wrap">
55241 <?php screen_icon(); ?>
55242 <h2><?php echo wp_specialchars( $title ); ?></h2>
55243
55244 <p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
55245 <?php
55246
55247 $all_plugins = get_plugins();
55248 $active_plugins = array();
55249 $inactive_plugins = array();
55250 $recent_plugins = array();
55251 $recently_activated = (array) get_option('recently_activated');
55252
55253 //Clean out any plugins which were deactivated over a week ago.
55254 foreach ( $recently_activated as $key => $time )
55255 if ( $time + (7*24*60*60) < time() ) //1 week
55256 unset($recently_activated[ $key ]);
55257 if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
55258 update_option('recently_activated', $recently_activated);
55259
55260 foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
55261
55262 //Translate, Apply Markup, Sanitize HTML
55263 $plugin_data = _get_plugin_data_markup_translate($plugin_data, true, true);
55264
55265 //Filter into individual sections
55266 if ( is_plugin_active($plugin_file) ) {
55267 $active_plugins[ $plugin_file ] = $plugin_data;
55268 } else {
55269 if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
55270 $recent_plugins[ $plugin_file ] = $plugin_data;
55271 else
55272 $inactive_plugins[ $plugin_file ] = $plugin_data;
55273 }
55274 }
55275
55276 ?>
55277
55278 <?php
55279 /**
55280 * @ignore
55281 *
55282 * @param array $plugins
55283 * @param string $context
55284 */
55285 function print_plugins_table($plugins, $context = '') {
55286 ?>
55287 <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
55288 <thead>
55289 <tr>
55290 <th scope="col" class="check-column"><input type="checkbox" /></th>
55291 <th scope="col"><?php _e('Plugin'); ?></th>
55292 <th scope="col" class="num"><?php _e('Version'); ?></th>
55293 <th scope="col"><?php _e('Description'); ?></th>
55294 <th scope="col" class="action-links"><?php _e('Action'); ?></th>
55295 </tr>
55296 </thead>
55297
55298 <tfoot>
55299 <tr>
55300 <th scope="col" class="check-column"><input type="checkbox" /></th>
55301 <th scope="col"><?php _e('Plugin'); ?></th>
55302 <th scope="col" class="num"><?php _e('Version'); ?></th>
55303 <th scope="col"><?php _e('Description'); ?></th>
55304 <th scope="col" class="action-links"><?php _e('Action'); ?></th>
55305 </tr>
55306 </tfoot>
55307
55308 <tbody class="plugins">
55309 <?php
55310
55311 if ( empty($plugins) ) {
55312 echo '<tr>
55313 <td colspan="6">' . __('No plugins to show') . '</td>
55314 </tr>';
55315 }
55316 foreach ( (array)$plugins as $plugin_file => $plugin_data) {
55317 $action_links = array();
55318
55319 if ( 'active' == $context )
55320 $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
55321 else //Inactive or Recently deactivated
55322 $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
55323
55324 if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
55325 $action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
55326
55327 $action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, $plugin_data, $context );
55328 $action_links = apply_filters( "plugin_action_links_$plugin_file", $action_links, $plugin_file, $plugin_data, $context );
55329
55330 echo "
55331 <tr class='$context'>
55332 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
55333 <td class='name'>{$plugin_data['Title']}</td>
55334 <td class='vers'>{$plugin_data['Version']}</td>
55335 <td class='desc'><p>{$plugin_data['Description']}</p></td>
55336 <td class='togl action-links'>";
55337 if ( !empty($action_links) )
55338 echo implode(' | ', $action_links);
55339 echo '</td>
55340 </tr>';
55341 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
55342 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
55343 }
55344 ?>
55345 </tbody>
55346 </table>
55347 <?php
55348 } //End print_plugins_table()
55349
55350 /**
55351 * @ignore
55352 *
55353 * @param string $context
55354 */
55355 function print_plugin_actions($context) {
55356 ?>
55357 <div class="alignleft actions">
55358 <select name="action">
55359 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
55360 <?php if( 'active' != $context ) : ?>
55361 <option value="activate-selected"><?php _e('Activate'); ?></option>
55362 <?php endif; ?>
55363 <?php if ( 'active' == $context ) : ?>
55364 <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
55365 <?php endif; ?>
55366 <?php if( current_user_can('delete_plugins') && ( 'recent' == $context || 'inactive' == $context ) ) : ?>
55367 <option value="delete-selected"><?php _e('Delete'); ?></option>
55368 <?php endif; ?>
55369 </select>
55370 <input type="submit" name="doaction_active" value="<?php _e('Apply'); ?>" class="button-secondary action" />
55371 <?php if( 'recent' == $context ) : ?>
55372 <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
55373 <?php endif; ?>
55374 </div>
55375 <?php
55376 }
55377 ?>
55378
55379 <?php if ( ! empty($active_plugins) ) : ?>
55380 <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
55381 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
55382 <?php wp_nonce_field('bulk-manage-plugins') ?>
55383
55384 <div class="tablenav">
55385 <?php print_plugin_actions('active') ?>
55386 </div>
55387 <div class="clear"></div>
55388 <?php print_plugins_table($active_plugins, 'active') ?>
55389 </form>
55390
55391 <p><?php printf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
55392 <?php endif; ?>
55393
55394 <?php if ( ! empty($recent_plugins) ) : ?>
55395 <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
55396 <p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p>
55397 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
55398 <?php wp_nonce_field('bulk-manage-plugins') ?>
55399
55400 <div class="tablenav">
55401 <?php print_plugin_actions('recent') ?>
55402 </div>
55403 <div class="clear"></div>
55404 <?php print_plugins_table($recent_plugins, 'recent') ?>
55405 </form>
55406 <?php endif; ?>
55407
55408 <?php if ( ! empty($inactive_plugins) ) : ?>
55409 <h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
55410 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
55411 <?php wp_nonce_field('bulk-manage-plugins') ?>
55412
55413 <div class="tablenav">
55414 <?php print_plugin_actions('inactive') ?>
55415 </div>
55416 <div class="clear"></div>
55417 <?php print_plugins_table($inactive_plugins, 'inactive') ?>
55418 </form>
55419 <?php endif; ?>
55420
55421 <?php if ( empty($all_plugins) ) : ?>
55422 <p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
55423 <?php endif; ?>
55424
55425 <h2><?php _e('Get More Plugins'); ?></h2>
55426 <p><?php _e('You can find additional plugins for your site by using the new <a href="plugin-install.php">Plugin Browser/Installer</a> functionality, Or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.'); ?></p>
55427 <p><?php printf(__('To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory.'), WP_PLUGIN_DIR); ?></p>
55428 <p><?php _e('Once a plugin has been installed, you may activate it here.'); ?></p>
55429
55430 </div>
55431
55432 <?php
55433 include('admin-footer.php');
55434 ?>