Changeset 1010
- Timestamp:
- 03/25/2004 08:10:26 AM (21 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/plugins.php
r1008 r1010 4 4 require_once('admin-header.php'); 5 5 6 if ($user_level == 0) //Checks to see if user has logged in 7 die ("Cheatin' uh ?"); 6 if ($user_level < 9) // Must be at least level 9 7 die ("Sorry, you must be at least a level 8 user to modify plugins."); 8 9 // Clean up options 10 // if any files are in the option that don't exist, axe 'em 11 12 $check_plugins = explode("\n", (get_settings('active_plugins'))); 13 foreach ($check_plugins as $check_plugin) { 14 if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) { 15 $current = get_settings('active_plugins') . "\n"; 16 $current = str_replace($check_plugin . "\n", '', $current); 17 $current = preg_replace("|\n+|", "\n", $current); 18 update_option('active_plugins', trim($current)); 19 } 20 } 21 22 23 if ('activate' == $_GET['action']) { 24 $current = "\n" . get_settings('active_plugins') . "\n"; 25 $current = preg_replace("|(\n)+\s*|", "\n", $current); 26 $current = trim($current) . "\n " . trim($_GET['plugin']); 27 $current = trim($current); 28 $current = preg_replace('|\n\s*|', '\n', $current); // I don't know where this is coming from 29 update_option('active_plugins', $current); 30 header('Location: plugins.php'); 31 } 32 33 if ('deactivate' == $_GET['action']) { 34 $current = "\n" . get_settings('active_plugins') . "\n"; 35 $current = str_replace("\n" . $_GET['plugin'], '', $current); 36 $current = preg_replace("|(\n)+\s*|", "\n", $current); 37 update_option('active_plugins', trim($current)); 38 header('Location: plugins.php'); 39 } 8 40 9 41 ?> … … 19 51 20 52 if ('' != trim(get_settings('active_plugins'))) { 21 $current_plugins = unserialize(get_settings('active_plugins'));53 $current_plugins = explode("\n", (get_settings('active_plugins'))); 22 54 } 23 24 /*25 Plugin Name: matt's cool plugin26 Plugin URI: http://photomatt.net/plugins/cool-plugin27 Description: blah blah blah anything until a newline28 Author: photo matt29 Author URI: http://photomatt.net30 */31 55 32 56 if (!$plugins_dir || !$plugin_files) { … … 67 91 68 92 $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; 93 94 if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) { 95 $action = "<a href='plugins.php?action=deactivate&plugin=$plugin_file' title='Deactivate this plugin' class='delete'>Deactivate</a>"; 96 } else { 97 $action = "<a href='plugins.php?action=activate&plugin=$plugin_file' title='Activate this plugin' class='edit'>Activate</a>"; 98 } 69 99 echo " 70 100 <tr $style> … … 72 102 <td>$author</td> 73 103 <td>$description</td> 74 <td> <a href='' class='edit'>activate</a></td>104 <td>$action</td> 75 105 </tr>"; 76 106 } -
trunk/wp-settings.php
r957 r1010 69 69 } 70 70 71 71 if (!strstr($_SERVER['REQUEST_URI'], 'wp-admin/plugins.php') && get_settings('active_plugins')) { 72 $current_plugins = explode("\n", (get_settings('active_plugins'))); 73 foreach ($current_plugins as $plugin) { 74 if (file_exists(ABSPATH . 'wp-content/plugins/' . $plugin)) 75 include(ABSPATH . 'wp-content/plugins/' . $plugin); 76 } 77 } 72 78 73 79 ?>
Note: See TracChangeset
for help on using the changeset viewer.