WordPress.org

Plugin Directory

Changeset 161367


Ignore:
Timestamp:
10/07/09 20:49:57 (5 years ago)
Author:
ikailo
Message:
 
Location:
wp-hive/tags/0.5
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-hive/tags/0.5/db.php

    r161092 r161367  
    2424 */ 
    2525 
     26if ( ! defined( 'WP_PLUGIN_DIR' ) ) 
     27    define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); 
     28 
    2629require_once( ABSPATH . WPINC . '/wp-db.php' ); 
    27 require_once( WP_CONTENT_DIR . '/plugins/wp-hive/do-prefix.php'); 
     30require_once( WP_PLUGIN_DIR . '/wp-hive/do-prefix.php'); 
    2831?> 
  • wp-hive/tags/0.5/includes/install.php

    r161092 r161367  
    9797} 
    9898 
    99  
    10099?> 
  • wp-hive/tags/0.5/wp-hive.php

    r161092 r161367  
    33 Plugin Name: WP Hive 
    44 Plugin URI: http://wp-hive.com/overview/ 
    5  Description: Hive manager for multiple blogs with a single WP installation. **NOTE** To deactivate this plugin, you must delete the file 'wp-content/db.php' first! 
     5 Description: Run multiple blogs using a single installation of WordPress. 
    66 Version: 0.5 
    77 Author: ikailo 
     
    2929 */ 
    3030 
    31 do_action('wphive_loading_plugin'); 
    32  
    3331/* 
    34  * Permalinks 
     32 * Activate 
    3533 */ 
    36  
    37 function wphive_check_permalinks() { 
    38     global $wp_rewrite, $wphive; 
    39     if (!$wp_rewrite->using_permalinks() && $wphive->site_has_subdirs($wphive->current_site)) { 
    40         echo "<div id='wphive-warning' class='updated fade'><p><strong>WP Hive Warning:</strong><br/>A 
    41 subdirectory site is installed using WP Hive, but you are not using pretty permalinks.<br/>Fix the problem now by 
    42 <a href='/wp-admin/options-permalink.php'>configuring this site to use pretty permalinks</a>. 
    43 </p></div>"; 
     34if (!function_exists('wphive_activate')) { 
     35    function wphive_activate() { 
     36        return copy( dirname(__FILE__) . '/db.php', WP_CONTENT_DIR . '/db.php' ); 
    4437    } 
    45 } 
    46 if ( isset($_REQUEST['wphive_save_site'])) { 
    47     add_action('wphive_site_added', 'wphive_check_permalinks'); 
    48 } 
    49 elseif ( isset($_REQUEST['wphive_remove_site']) ) { 
    50     add_action('wphive_site_removed', 'wphive_check_permalinks'); 
    51 } 
    52 elseif ( version_compare(get_bloginfo('version'), '2.8', '>=') &&  isset($_REQUEST['permalink_structure']) ) { 
    53     add_action('permalink_structure_changed', 'wphive_check_permalinks'); 
    54 } 
    55 else { 
    56     add_action('admin_notices', 'wphive_check_permalinks'); 
     38    register_activation_hook(__FILE__,'wphive_activate'); 
    5739} 
    5840 
    5941/* 
    60  * Admin 
     42 * Deactivate 
    6143 */ 
     44if (!function_exists('wphive_deactivate')) { 
     45    function wphive_deactivate() { 
     46        if (file_exists( WP_CONTENT_DIR . '/db.php')) { 
     47            wphive_delete_cookie('wphive_pathname'); 
     48            return unlink( WP_CONTENT_DIR . '/db.php' ); 
     49        } 
     50    } 
     51    register_deactivation_hook(__FILE__,'wphive_deactivate'); 
     52} 
    6253 
    63 function wphive_admin_hook() { 
    64     if ( current_user_can('manage_options') ) { 
    65         add_menu_page('WP Hive', 'WP Hive', 8, WPHIVE_PATH.'/admin/settings.php', null, get_option('siteurl').'/wp-content/plugins/wp-hive/images/wphive.png'); 
    66         add_submenu_page(WPHIVE_PATH.'/admin/settings.php', 'WP Hive > Settings', 'Settings', 8, WPHIVE_PATH.'/admin/settings.php'); 
    67         add_submenu_page(WPHIVE_PATH.'/admin/settings.php', 'WP Hive > Edit', 'Edit', 8, WPHIVE_PATH.'/admin/edit.php'); 
    68         add_submenu_page(WPHIVE_PATH.'/admin/settings.php', 'WP Hive > Add New', 'Add New', 8, WPHIVE_PATH.'/admin/add.php'); 
    69         define('WPHIVE_ADMIN_REL', 'admin.php?page=wp-hive/admin'); 
    70     } 
     54// Load the plugin 
     55 
     56if ( defined('WPHIVE_PATH') ) { 
     57// Engage Plugin 
     58    require_once(WPHIVE_PATH.'/includes/plugin.php'); 
    7159} 
    72 add_action('admin_menu', 'wphive_admin_hook'); 
     60else { 
     61// db.php his not in place. Must deactivate this plugin. 
     62    $current = get_option('active_plugins'); 
     63    $plugin_name = 'wp-hive/wp-hive.php'; 
     64    array_splice($current, array_search( $plugin, $current), 1 ); 
     65    update_option('active_plugins', $current); 
     66} 
    7367 
    74 /*  
    75  * Sorting out wp-admin confusion  
    76  * when logging into subdirectories. 
    77  */ 
    78  
    79 function wphive_login_notices() { 
    80     if ( isset($_COOKIE['wphive_pathname']) ) { 
    81          
    82         function wphive_login_name($message) { 
    83             return '<p class="message">' . sprintf('Logging into %s', get_bloginfo('title', 'display' )). '</p>'; 
    84         } 
    85         add_filter('login_message', 'wphive_login_name' ); 
    86  
    87         function wphive_admin_name() { 
    88             echo "<div id='wphive-warning' class='updated fade'><p>".sprintf('Administrating %s', get_bloginfo('title', 'display' )).".</p></div>"; 
    89         } 
    90         add_action('admin_notices', 'wphive_admin_name'); 
    91  
    92     } 
    93 } 
    94 wphive_login_notices(); 
    95  
    96 /* 
    97  * Fix Meta URLs 
    98  */ 
    99  
    100 function wphive_meta_url($meta_url) { 
    101     global $wphive; 
    102     $pathname = $wphive->current_site->path; 
    103     if ('/' != $pathname) { 
    104         $link = str_replace(get_option('siteurl'), get_option('home'), $meta_url); 
    105         return str_replace($pathname.$pathname, $pathname, $link); 
    106     } 
    107     return $meta_url; 
    108 } 
    109 add_filter('login_url', 'wphive_meta_url'); 
    110 add_filter('logout_url', 'wphive_meta_url'); 
    111 add_filter('register', 'wphive_meta_url'); 
    112 add_filter('wp_admin', 'wphive_meta_url'); 
    113  
    114 /* 
    115  *  Log Out 
    116  */ 
    117  
    118 function wphive_logout() { 
    119     wphive_delete_cookie('wphive_pathname'); 
    120     wp_redirect(get_bloginfo('home')); 
    121     exit(0); 
    122 } 
    123 add_action('wp_logout', 'wphive_logout'); 
    124  
    125 /* 
    126  * Add-ons 
    127  */ 
    128  
    129 include ('add-ons/root-files-rewriter.php'); 
    130  
    131 do_action('wphive_plugin_loaded'); 
    13268?> 
Note: See TracChangeset for help on using the changeset viewer.