Changeset 904

Show
Ignore:
Timestamp:
09/22/07 22:15:42 (14 months ago)
Author:
epithet
Message:

Updated to use system/plugins for core plugins.

Location:
branches/systemplugins/system
Files:
1 added
1 modified
5 moved

Legend:

Unmodified
Added
Removed
  • branches/systemplugins/system/classes/plugins.php

    r876 r904  
    169169    { 
    170170        $plugins= array(); 
    171         $files= array(); 
    172         $plugindir= HABARI_PATH . '/user/plugins/'; 
    173         $dirs= glob( $plugindir . '*', GLOB_ONLYDIR | GLOB_MARK ); 
    174         if ( Site::CONFIG_LOCAL != Site::$config_type ) 
    175         { 
     171        $plugindirs= array( HABARI_PATH . '/system/plugins/', HABARI_PATH . '/user/plugins/' ); 
     172        if ( Site::CONFIG_LOCAL != Site::$config_type ) { 
    176173            // include site-specific plugins 
    177             $site_dirs= glob( Site::get_dir('config') . '/plugins/*', GLOB_ONLYDIR | GLOB_MARK ); 
    178             if ( is_array( $site_dirs ) && ! empty( $site_dirs ) ) { 
    179                 $dirs= array_merge( $dirs, $site_dirs ); 
    180             } 
     174            $plugindirs[]= Site::get_dir('config') . '/plugins/';  
     175        } 
     176        $dirs = array(); 
     177        foreach($plugindirs as $plugindir) { 
     178            $dirs+= glob( $plugindir . '*', GLOB_ONLYDIR | GLOB_MARK ); 
    181179        } 
    182180        foreach( $dirs as $dir ) { 
    183181            $dirfiles = glob( $dir . '*.plugin.php' ); 
    184             $files = array_merge($dirfiles, $files); 
    185         } 
    186         // return $files; 
    187         // massage the return value so that this works on Windows 
    188         $plugins= array_map( create_function( '$s', 'return str_replace(\'\\\\\', \'/\', $s);' ), $files ); 
     182            if(count($dirfiles) > 0) { 
     183                $dirfiles = array_combine( 
     184                    // Use the basename of the file as the index to use the named plugin from the last directory in $dirs 
     185                    array_map('basename', $dirfiles), 
     186                    // massage the filenames so that this works on Windows 
     187                    array_map( create_function( '$s', 'return str_replace(\'\\\\\', \'/\', $s);' ), $dirfiles ) 
     188                ); 
     189                $plugins = array_merge($plugins, $dirfiles); 
     190            } 
     191        } 
    189192        sort($plugins); 
    190193        return $plugins;