protected function getPluginCommand($plugin, $command, $params = array()) { if (!FileUtils::file_exists_incpath('M/plugins/' . $plugin . '/commands/' . $command . '.php')) { if (!FileUtils::file_exists_incpath('M/plugins/' . $plugin)) { throw new Exception($plugin . ' plugin does not exist'); } else { throw new Exception($plugin . ' does not have ' . $command . ' command'); } } require_once 'M/plugins/' . $plugin . '/commands/' . $command . '.php'; $className = $plugin . '_Command_' . $command; // Setting up options including Databases DSN Mreg::get('setup')->setUpEnv(); // Executing $com = new $className(); return $com; }
public static function resolve_class($class, $role, $init_function = null) { if (class_exists($class)) { return true; } $file = strtolower(str_replace('_', '/', $class)) . '.php'; foreach (self::getPaths($role) as $path) { $full_path = $path . '/' . $file_name; if (FileUtils::file_exists_incpath($full_path)) { require_once self::resolve_file($file, $role); if ($init_function instanceof Closure) { $init_function(); } return true; } } throw new UnresolvedFileException("Could not load class {$class} in " . print_r(self::getPaths($role), true)); }
public function getTemplatePath() { $folders = array_reverse($this->_config['tplfolders']); Log::error('Searching file ' . $this->_tplfile . ' in ' . print_r($folders, true)); foreach ($folders as $folder) { if (FileUtils::file_exists_incpath($folder . $this->_tplfile . '.php')) { Log::error('Found file in ' . $folder); return $folder . $this->_tplfile . '.php'; } } return false; }