Example #1
0
 /**
  * Loads any extensions that other mod authors may have introduced
  *
  * @global string $sourcedir
  */
 private static function loadExtensions($force = FALSE)
 {
     global $sourcedir;
     if ($force || (self::$extensions = CacheAPI::getCache('simplsef_extensions', 3600)) === NULL) {
         $ext_dir = $sourcedir . '/SimpleSEF-Ext';
         self::$extensions = array();
         if (is_readable($ext_dir)) {
             $dh = opendir($ext_dir);
             while ($filename = readdir($dh)) {
                 // Skip these
                 if (in_array($filename, array('.', '..')) || preg_match('~ssef_([a-zA-Z_-]+)\\.php~', $filename, $match) == 0) {
                     continue;
                 }
                 self::$extensions[$match[1]] = $filename;
             }
         }
         CacheAPI::putCache('simplesef_extensions', self::$extensions, 3600);
         //self::log('Cache hit failed, reloading extensions');
     }
 }