protected function post_process($filename) { echo "post processing {$filename}...\n"; // Use the caching version via Dependency Injection. This means that all // new SSLTracks created using a SSLTrackFactory will get a RuntimeCachingSSLTrack // that knows how to ask the cache about expensive lookups (such as getID3 stuff). Inject::map('SSLTrackFactory', new SSLTrackCache()); $ts = new InstantTickSource(); $hfm = new SSLHistoryFileReplayer($filename); $ism = new ImmediateScrobbleModel(); // deal with PLAYED tracks one by one $ts->addTickObserver($hfm); $hfm->addExitObserver($ts); $hfm->addDiffObserver($ism); // get the PluginWrapper that wraps all other plugins. $pw = $this->plugin_manager->getObservers(); // add all of the PluginWrappers to the various places. $ts->addTickObserver($pw[0]); $hfm->addDiffObserver($pw[0]); $ism->addScrobbleObserver($pw[0]); $this->plugin_manager->onStart(); // Tick tick tick. This only returns if a signal is caught $ts->startClock($this->sleep); $this->plugin_manager->onStop(); }
private function calculateForWikiService($project_id) { if (!$this->plugin_manager->isPluginAllowedForProject($this->fulltextsearch_plugin, $project_id)) { return Search_SearchWiki::NAME; } return $this->getFullTextTypeName(); }
function install() { $request =& HTTPRequest::instance(); $name = $request->get('name'); if ($name) { $this->plugin_manager->installPlugin($name); } }
function activatePlugin($name) { $plugin_factory = PluginFactory::instance(); $plugin = $plugin_factory->getPluginByName($name); if (! $plugin) { echo "Install plugin\n"; $plugin_manager = new PluginManager(); $plugin = $plugin_manager->installPlugin($name); } if (! $plugin_factory->isPluginAvailable($plugin)) { echo "Activate plugin\n"; $plugin_factory->availablePlugin($plugin); } }
/** * Return filters for a saved search. * * @param int $id Search hash * * @return mixed array of filters or false if the given search has no filters. */ protected function getSearchSettings($id) { $search = $this->table->get('Search')->select(['finna_search_id' => $id])->current(); if (empty($search)) { return false; } $sessId = $this->session->getId(); if ($search->session_id == $sessId) { $minSO = $search->getSearchObject(); $savedSearch = $minSO->deminify($this->results); $params = $savedSearch->getUrlQuery()->getParamArray(); $settings = []; if (isset($params['filter'])) { $settings['filters'] = $params['filter']; } $params = $savedSearch->getParams(); $daterange = $params->getSpatialDateRangeFilter(); if ($daterange) { $field = $params->getSpatialDateRangeField() . '_type'; $type = $daterange['type']; $settings['params'] = [$field => $type]; } return $settings; } return false; }
public static function instance() { if (!self::$instance) { self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache()); } return self::$instance; }
function __construct($context, &$values = array(), &$args = array(), &$errors = array()) { //Notice: There's no difference in sending an empty $values array //or sending no value at all. Should this be detected? $action = $context->getAction(); if (!isset(self::$id_count[$action])) { self::$id_count[$action] = 0; } $this->_id = strtolower(get_class($this) . '_' . $action . '_' . ++self::$id_count[$action]); $this->_raw_value = (array) $values; $this->_context = $context; $this->args = (array) $args; $this->load = new Loader($context); $this->db = new DatabaseProxy($this->load); $this->plugin = PluginManager::getInstance()->getPluginList(); $this->lang = $this->load->lang(); $this->session = new Session($context->getModule()); $this->valid = $this->load->validator('/phaxsi/validator'); $this->helper = new HelperLoader($this->load); if (empty($this->_raw_value)) { if ($flash = Session::getFlash($this->_id)) { $this->_raw_value = $flash['values']; $this->_errors = $flash['errors']; } } if ($errors) { $this->_errors = array_merge((array) $this->_errors, $errors); } $create_method_ptr = array(&$this, $this->_context->getAction()); if (is_callable($create_method_ptr)) { call_user_func($create_method_ptr); } else { trigger_error("Form '" . $this->_context->getPath() . "' does not exist.", E_USER_ERROR); } }
public function activatePlugins() { $this->activatePlugin('docman'); PluginManager::instance()->invalidateCache(); PluginManager::instance()->loadPlugins(); return $this; }
public function __construct() { parent::__construct(); $userRepository = new UserRepository(); $this->presenter = new ManageReservationsPresenter($this, new ScheduleAdminManageReservationsService(new ReservationViewRepository(), $userRepository, new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization())), new ScheduleAdminScheduleRepository($userRepository, ServiceLocator::GetServer()->GetUserSession()), new ResourceAdminResourceRepository($userRepository, ServiceLocator::GetServer()->GetUserSession()), new AttributeService(new AttributeRepository()), new UserPreferenceRepository()); $this->SetPageId('manage-reservations-schedule-admin'); }
public function __construct() { if (isset($_SESSION['odinUserLogged'])) { Logger::getLogger('odin')->debug('User zalogowany'); } $this->db = PluginManager::getInstance()->getPlugin('creole')->getC(); }
public static function instance() { if (!self::$instance) { self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache(), new ForgeUpgradeConfig(new System_Command())); } return self::$instance; }
public function __construct() { parent::__construct(); $this->presenter = new ManageReservationsPresenter($this, new GroupAdminManageReservationsService(new ReservationViewRepository(), new UserRepository(), new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization())), new ScheduleRepository(), new ResourceRepository(), new AttributeService(new AttributeRepository()), new UserPreferenceRepository()); $this->SetCanUpdateResourceStatus(false); $this->SetPageId('manage-reservations-group-admin'); }
/** * Singleton * @static */ public static function getInstance() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; }
/** * Constructor. * * @param actionInfo An ActionInfo object as provided by the constroller * @param request A valid HTTP request */ function AdminAction($actionInfo, $request) { $this->Action($actionInfo, $request); // get information about the session $session = HttpVars::getSession(); $this->_session = $session["SessionInfo"]; $this->_config =& Config::getConfig(); // get the information about the user and quit if we don't have it... $this->_getUserInfo(); if ($this->_userInfo == "") { header("HTTP/1.0 403 Forbidden"); print $this->mustAuthenticatePage(); die; } // do the same with the information about the blog $this->_getBlogInfo(); if ($this->_blogInfo == "") { if ($this->_actionInfo->getActionParamValue() != "blogSelect") { header("HTTP/1.0 403 Forbidden"); print $this->mustAuthenticatePage(); die; } } // prepare the plugin manager in case we'd like to throw events $this->_pm =& PluginManager::getPluginManager(); // fetch the site locale $this->_locale =& $this->getLocale(); $users =& new Users(); $this->_userBlogs = $users->getUsersBlogs($this->_userInfo->getId(), BLOG_STATUS_ACTIVE); }
/** * Execute the console command. * * @return void */ public function fire() { /** @var $plugin PluginBootstrap */ \PluginManager::sync(); if ($collection = \PluginManager::getPluginCollection() and count($collection) > 0) { /** @var Table $table */ $table = new Table($this->getOutput()); $table->setHeaders(['name', 'version', 'description', 'active', 'installed']); $rows = []; foreach ($collection as $plugin) { $rows[] = [$plugin->getName(), $plugin->getVersion(), $plugin->getDescription(), $plugin->isActive() ? 'yes' : 'no', $plugin->isInstalled() ? 'yes' : 'no']; } $table->setRows($rows); $table->render(); } else { $line = <<<EVO <info>no plugins avalaible</info> EVO; $this->line($line); } /*$this->line(<<<EOF The <info>%command.name%</info> command lists all commands: <info>php %command.full_name%</info> You can also display the commands for a specific namespace: EOF );*/ //$this->line('Alle Plugins.asdkjashdkash'); }
/** * Return true if given project has the right to use this plugin. * * @param string $group_id * * @return bool */ function isAllowed($group_id) { if (!isset($this->allowedForProject[$group_id])) { $this->allowed_for_project[$group_id] = PluginManager::instance()->isPluginAllowedForProject($this, $group_id); } return $this->allowed_for_project[$group_id]; }
/** * * @param $reservationAuthorization IReservationAuthorization */ public function __construct($reservationAuthorization = null) { $this->reservationAuthorization = $reservationAuthorization; if (is_null($this->reservationAuthorization)) { $this->reservationAuthorization = new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization()); } }
/** * If an exception is detected this is used to dispatch * to an internal controller and view * @param Exception $e the exception object. * * @return void */ public function dispatchException($e) { $req_error = get_class($e) == 'Empathy\\MVC\\RequestException' ? true : false; $this->controller = new Controller($this); $this->plugin_manager->preEvent(); $this->controller->viewException($this->debug_mode, $e, $req_error); }
/** * Return existing instance of PluginManager, or create it. * * @return PluginManager instance. */ public static function getInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
/** * Performs the action. */ function perform() { // fetch the articles for the given blog $articles = new Articles(); $blogSettings = $this->_blogInfo->getSettings(); $localeCode = $blogSettings->getValue("locale"); // fetch the default profile as chosen by the administrator $defaultProfile = $this->_config->getValue("default_rss_profile"); if ($defaultProfile == "" || $defaultProfile == null) { $defaultProfile = DEFAULT_PROFILE; } // fetch the profile // if the profile specified by the user is not valid, then we will // use the default profile as configured $profile = $this->_request->getValue("profile"); if ($profile == "") { $profile = $defaultProfile; } // fetch the category, or set it to '0' otherwise, which will mean // fetch all the most recent posts from any category $categoryId = $this->_request->getValue("categoryId"); if (!is_numeric($categoryId)) { $categoryId = 0; } // check if the template is available $this->_view = new RssView($this->_blogInfo, $profile, array("profile" => $profile, "categoryId" => $categoryId)); // do nothing if the view was already cached if ($this->_view->isCached()) { return true; } // create an instance of a locale object $locale = Locales::getLocale($localeCode); // fetch the posts, though we are going to fetch the same amount in both branches $amount = $blogSettings->getValue("recent_posts_max", 15); $t = new Timestamp(); if ($blogSettings->getValue('show_future_posts_in_calendar')) { $blogArticles = $articles->getBlogArticles($this->_blogInfo->getId(), -1, $amount, $categoryId, POST_STATUS_PUBLISHED, 0); } else { $today = $t->getTimestamp(); $blogArticles = $articles->getBlogArticles($this->_blogInfo->getId(), -1, $amount, $categoryId, POST_STATUS_PUBLISHED, 0, $today); } $pm =& PluginManager::getPluginManager(); $pm->setBlogInfo($this->_blogInfo); $pm->setUserInfo($this->_userInfo); $result = $pm->notifyEvent(EVENT_POSTS_LOADED, array('articles' => &$blogArticles)); $articles = array(); foreach ($blogArticles as $article) { $postText = $article->getIntroText(); $postExtendedText = $article->getExtendedText(); $pm->notifyEvent(EVENT_TEXT_FILTER, array("text" => &$postText)); $pm->notifyEvent(EVENT_TEXT_FILTER, array("text" => &$postExtendedText)); $article->setIntroText($postText); $article->setExtendedText($postExtendedText); array_push($articles, $article); } $this->_view->setValue("locale", $locale); $this->_view->setValue("posts", $articles); $this->setCommonData(); return true; }
/** * @param IReservationViewRepository $reservationViewRepository * @param IReservationAuthorization $authorization * @param IReservationHandler $reservationHandler * @param IUpdateReservationPersistenceService $persistenceService */ public function __construct(IReservationViewRepository $reservationViewRepository, $authorization = null, $reservationHandler = null, $persistenceService = null) { $this->reservationViewRepository = $reservationViewRepository; $this->reservationAuthorization = $authorization == null ? new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization()) : $authorization; $this->persistenceService = $persistenceService == null ? new UpdateReservationPersistenceService(new ReservationRepository()) : $persistenceService; $this->reservationHandler = $reservationHandler == null ? ReservationHandler::Create(ReservationAction::Update, $this->persistenceService, ServiceLocator::GetServer()->GetUserSession()) : $reservationHandler; }
public function trigger_automaticupdate_action($class) { $output = array(); if (Request::isPost()) { $plugin = PluginManager::getInstance()->getPluginInfo($class); $low_cost_secret = md5($GLOBALS['STUDIP_INSTALLATION_ID'] . $plugin['id']); if ($plugin['automatic_update_url'] && $low_cost_secret === \Request::option("s")) { if ($plugin['automatic_update_secret'] && !$this->verify_secret($plugin['automatic_update_secret'])) { $output['error'] = "Incorrect payload."; } else { //everything fine, we can download and install the plugin $update_url = $plugin['automatic_update_url']; require_once 'app/models/plugin_administration.php'; $plugin_admin = new PluginAdministration(); try { $plugin_admin->installPluginFromURL($update_url); } catch (Exception $e) { $output['exception'] = $e->getMessage(); } } } else { $output['error'] = "Wrong URL."; } if (!count($output)) { $output['message'] = "ok"; } } else { $output['error'] = "Only POST requests allowed."; } $this->render_json($output); }
/** * Carries out the specified action */ function perform() { // get the parameters, which have already been validated $this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName")); $this->_userPassword = $this->_request->getValue("userPassword"); $this->_op = Textfilter::filterAllHTML($this->_request->getValue("op")); // create a plugin manager $pm =& PluginManager::getPluginManager(); // try to authenticate the user $users = new Users(); if (!$users->authenticateUser($this->_userName, $this->_userPassword)) { $this->_view = new AdminDefaultView(); $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_username_or_password")); $this->setCommonData(); $pm->notifyEvent(EVENT_LOGIN_FAILURE, array("user" => $this->_userName)); return false; } // if the user is correct, get and put his or her information in the session $userInfo = $users->getUserInfo($this->_userName, $this->_userPassword); if (!$userInfo) { $this->_view = new AdminDefaultView(); $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_username_or_password")); $this->setCommonData(); $pm->notifyEvent(EVENT_LOGIN_FAILURE, array("user" => $this->_userName)); return false; } $pm->notifyEvent(EVENT_USER_LOADED, array("user" => &$userInfo, "from" => "Login")); //$sessionInfo = $_SESSION["SessionInfo"]; $session = HttpVars::getSession(); $sessionInfo = $session["SessionInfo"]; $sessionInfo->setValue("userInfo", $userInfo); $session["SessionInfo"] = $sessionInfo; HttpVars::setSession($session); // get the list of blogs to which the user belongs $userBlogs = $users->getUsersBlogs($userInfo->getId(), BLOG_STATUS_ACTIVE); // but if he or she does not belong to any yet, we quit if (empty($userBlogs)) { $this->_view = new AdminDefaultView(); $this->_view->setErrorMessage($this->_locale->tr("error_dont_belong_to_any_blog")); $this->setCommonData(); return false; } $pm->notifyEvent(EVENT_BLOGS_LOADED, array("blogs" => &$userBlogs, "from" => "Login")); // check if we are skipping the dashboard if ($this->_config->getValue("skip_dashboard")) { // get the first blog that came $this->_blogInfo = end($userBlogs); // set it in the session $session = HttpVars::getSession(); $session["SessionInfo"]->setValue("blogInfo", $this->_blogInfo); HttpVars::setSession($session); // and then continue... AdminController::setForwardAction("newPost"); } else { $this->_view = new AdminDashboardView($userInfo, $userBlogs); } // better to return true if everything's fine return true; }
public function __construct() { $authorization = new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization()); $service = new CalendarSubscriptionService(new UserRepository(), new ResourceRepository(), new ScheduleRepository()); $subscriptionValidator = new CalendarSubscriptionValidator($this, $service); $this->presenter = new CalendarSubscriptionPresenter($this, new ReservationViewRepository(), $subscriptionValidator, $service, new PrivacyFilter($authorization)); parent::__construct('', 1); }
private function useFulltextSearch() { $fulltext_plugin = $this->plugin_manager->getPluginByName('fulltextsearch'); if (!$fulltext_plugin) { return false; } return $this->plugin_manager->isPluginAvailable($fulltext_plugin); }
protected function _render() { $manager = PluginManager::getInstance(); $manager->renderStart($this->context); $html = $this->view->render(); $manager->renderEnd($this->context); return $html; }
/** * @param IWebAuthentication $authentication */ private function SetAuthentication($authentication) { if (is_null($authentication)) { $this->authentication = new WebAuthentication(PluginManager::Instance()->LoadAuthentication(), ServiceLocator::GetServer()); } else { $this->authentication = $authentication; } }
private function displayInstallReadme($name) { $readme_file = $this->plugin_manager->getInstallReadme($name); $readme_content = $this->plugin_manager->fetchFormattedReadme($readme_file); if ($readme_content) { echo $readme_content; } }
/** * @param IReservationApprovalPage $approvePage * @param UserSession $userSession * @return ReservationApprovalPresenter */ public function Approve(IReservationApprovalPage $approvePage, UserSession $userSession) { $persistenceFactory = new ReservationPersistenceFactory(); $approveAction = ReservationAction::Approve; $handler = ReservationHandler::Create($approveAction, $persistenceFactory->Create($approveAction), $userSession); $auth = new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization()); return new ReservationApprovalPresenter($approvePage, $persistenceFactory->Create($approveAction), $handler, $auth, $userSession); }
public function container() { $id = URI::instance()->segment(3, false); $p = ORM::factory('plugin_instance', $id); if ($p->loaded) { echo PluginManager::instance()->get_plugin($p)->render(); } }