/** * @param string $controller * @param string $action * @param string $template * * @return string Empty string if path is not found. */ public function findView($controller, $action, $template = 'php') { $viewPath = $this->controller->getViewPath(); if (!is_array($viewPath)) { $viewPath = [$viewPath]; } $viewPath = Filter::run('cl-view-path', [$viewPath, $this->controller, $controller, $action]); $viewPath = Filter::run("cl-view-path-{$controller}", [$viewPath, $this->controller, $controller, $action]); if ($viewPath) { if ($path = $this->viewPaths($viewPath, strtolower($controller) . DIRECTORY_SEPARATOR . strtolower($action) . '.' . $template)) { return $path; } if ($path = $this->viewPaths($viewPath, $controller . DIRECTORY_SEPARATOR . $action . '.' . $template)) { return $path; } if ($path = $this->viewPaths($viewPath, $controller . '-' . $action . '.' . $template)) { return $path; } } $apps = AoiSoraSettings::getApplications(); $lc_controller = strtolower($controller); $lc_action = strtolower($action); foreach ($apps as $app) { $path = $app['path']; if (file_exists($path . VIEWS . $controller . '/' . $action . '.php')) { return $path . VIEWS . $controller . '/' . $action . '.php'; } if (file_exists($path . VIEWS . $lc_controller . '/' . $lc_action . '.php')) { return $path . VIEWS . $lc_controller . '/' . $lc_action . '.php'; } } return ''; }
public function init() { if (Security::isAdmin()) { Filter::register('set_plugin_has_updates', array($this, 'siteTransientUpdatePlugins')); Hook::register('set_plugin_has_updates', array($this, 'transientUpdatePlugins')); if (isset($_GET['plugin']) && $_GET['plugin'] == $this->application->getName()) { Hook::register('install_plugins_pre_plugin-information', array($this, 'versionInformation')); } $this->application->onInitUpdate(); $oldVersion = AoiSoraSettings::getApplicationVersion($this->application->getName()); if ($this->application->installed() && version_compare($oldVersion, $this->version, '<')) { AoiSoraSettings::addApplication($this->application->getName(), $this->application->getInstallDirectory(), $this->version); $this->application->update(); } if ($this->update_site && isset($_REQUEST['action']) && 'upgrade-plugin' == $_REQUEST['action'] && isset($_REQUEST['plugin']) && urldecode($_REQUEST['plugin']) == $this->application->getInstallName()) { Filter::register('http_request_args', array($this, 'addUpdateUrl'), 10); } } }