本文整理汇总了PHP中PluginManager类的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager类的具体用法?PHP PluginManager怎么用?PHP PluginManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PluginManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activatePlugin
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);
}
}
示例2: instance
public static function instance()
{
if (!self::$instance) {
self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache());
}
return self::$instance;
}
示例3: __construct
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);
}
}
示例4: activatePlugins
public function activatePlugins()
{
$this->activatePlugin('docman');
PluginManager::instance()->invalidateCache();
PluginManager::instance()->loadPlugins();
return $this;
}
示例5: __construct
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');
}
示例6: __construct
public function __construct()
{
if (isset($_SESSION['odinUserLogged'])) {
Logger::getLogger('odin')->debug('User zalogowany');
}
$this->db = PluginManager::getInstance()->getPlugin('creole')->getC();
}
示例7: instance
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;
}
示例8: __construct
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');
}
示例9: AdminAction
/**
* 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);
}
示例10: fire
/**
* 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');
}
示例11: isAllowed
/**
* 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];
}
示例12: __construct
/**
*
* @param $reservationAuthorization IReservationAuthorization
*/
public function __construct($reservationAuthorization = null)
{
$this->reservationAuthorization = $reservationAuthorization;
if (is_null($this->reservationAuthorization)) {
$this->reservationAuthorization = new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization());
}
}
示例13: getInstance
/**
* 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;
}
示例14: perform
/**
* 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;
}
示例15: post_process
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();
}