/** * Load extenders. This is neat stuff. Basically, each extension folder (under ONE_LIB_PATH or ONE_CUSTOM_PATH) * can contain an extension.php file. These files can define a local One_Extension subclass and inject it into the * One_Config::get('extensions') list. Extensions are loaded on initialize and other events. Well, they could be * and will be in the future. Now it's only for initialization. */ public static function loadExtensions() { // call plugin extenders. These define a class for a plugin that is added to the extenders list $extenders = One_Locator::locateAllUsing('extension.php', self::get('locator.root')); if (count($extenders)) { foreach ($extenders as $extenderPath) { require_once $extenderPath; } } }
/** * Get all available containers and widgets * * @return array */ public static function getAvailable() { if (is_null(self::$availableCW)) { $containers = array(); $places = One_Locator::locateAllUsing('*.php', '%ROOT%/form/container/'); $ignore = array('abstract', 'index', 'factory'); foreach ($places as $container) { $container = preg_replace('/_tbd.php$/', '.php', $container); //TODO: replace tmp fix if (preg_match('|([^/]*).php$|', $container, $match)) { if (in_array($match[1], $ignore) || strpos($match[1], '.') !== false) { unset($containers[$container]); } else { $containers[$container] = strtolower($match[1]); } } else { unset($containers[$container]); } } sort($containers); $widgets = array(); $places = One_Locator::locateAllUsing('*.php', '%ROOT%/form/widget/{joomla,multi,scalar,select,search}/'); foreach ($places as $widget) { $widget = preg_replace('/_tbd.php$/', '.php', $widget); //TODO: replace tmp fix if (preg_match('|([^/]*)/([^/]*).php$|', $widget, $match)) { if (!in_array($match[2], $ignore)) { $widgets[] = $match[1] . '-' . strtolower($match[2]); } } } $widgets[] = 'defaultactions'; $widgets[] = 'button'; $widgets[] = 'file'; $widgets[] = 'submit'; $widgets[] = 'label'; $widgets[] = 'button'; $widgets[] = 'nscript'; $widgets[] = 'inline'; //TODO: adding a widget here should not be necessary !! sort($widgets); self::$availableCW = array('containers' => $containers, 'widgets' => $widgets); } return self::$availableCW; }
/** * Return an array with available filter names * * @meta * @return array */ public static function getFilterNames($schemeName = NULL) { $pattern = One_Config::get('locator.root') . 'filter/' . ($schemeName !== null ? '{scheme/,}' : ''); $places = One_Locator::locateAllUsing('*.xml', $pattern); $filters = array(); foreach ($places as $place) { preg_match("|([a-zA-Z0-9_\\-]*)\\.xml\$|", $place, $matches); $filters[] = $matches[1]; } sort($filters); return $filters; }