本文整理汇总了PHP中PluginManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::getInstance方法的具体用法?PHP PluginManager::getInstance怎么用?PHP PluginManager::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (isset($_SESSION['odinUserLogged'])) {
Logger::getLogger('odin')->debug('User zalogowany');
}
$this->db = PluginManager::getInstance()->getPlugin('creole')->getC();
}
示例2: __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);
}
}
示例3: trigger_automaticupdate_action
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);
}
示例4: _render
protected function _render()
{
$manager = PluginManager::getInstance();
$manager->renderStart($this->context);
$html = $this->view->render();
$manager->renderEnd($this->context);
return $html;
}
示例5: display
protected function display()
{
$this->smartyHelper->assign('activeGlobalMenuItem', 'Admin');
if (Tools::isConnectedUser()) {
if (!$this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$this->smartyHelper->assign('accessDenied', TRUE);
} else {
$action = filter_input(INPUT_POST, 'action');
if (empty($action)) {
$action = 'display';
}
$pm = PluginManager::getInstance();
// === ACTIONS =====================================================
if ('enablePlugin' == $action) {
$pluginName = Tools::getSecurePOSTStringValue('pluginName');
$pm->enablePlugin($pluginName);
} else {
if ('disablePlugin' == $action) {
$pluginName = Tools::getSecurePOSTStringValue('pluginName');
$pm->disablePlugin($pluginName);
} else {
if ('discoverNewPlugins' == $action) {
try {
Tools::createClassMap();
$pm->discoverNewPlugins();
//$this->smartyHelper->assign('infoMsg', T_('Found xx new plugins !'));
} catch (Exception $e) {
$this->smartyHelper->assign('errorMsg', T_('Could not create classmap: ') . $e->getMessage());
}
}
}
}
// === DISPLAY =====================================================
// set values to display plugin table
$plugins = $pm->getPlugins();
$formattedPlugins = array();
foreach ($plugins as $plugin) {
$className = $plugin['className'];
$formated_domains = array();
foreach ($plugin['domains'] as $domName) {
array_push($formated_domains, T_($domName));
}
//sort($formated_domains);
$formated_categories = array();
foreach ($plugin['categories'] as $catName) {
array_push($formated_categories, T_($catName));
}
//sort($formated_categories);
$formattedPlugins[$className] = array('name' => $plugin['displayedName'], 'status' => $plugin['status'], 'statusName' => pluginManager::getStatusName($plugin['status']), 'domains' => implode(',<br>', $formated_domains), 'categories' => implode(',<br>', $formated_categories), 'version' => $plugin['version'], 'description' => $plugin['description']);
}
$this->smartyHelper->assign('availablePlugins', $formattedPlugins);
}
}
}
示例6: getEnabledPlugins
/**
* gets enabled plugins for a given studygroup
*
* @param string id of a studygroup
*
* @return array enabled plugins
*/
function getEnabledPlugins($id)
{
$enabled = array();
$plugin_manager = PluginManager::getInstance();
$plugins = $plugin_manager->getPlugins('StandardPlugin');
// get all globally enabled plugins
foreach ($plugins as $plugin) {
$enabled[get_class($plugin)] = $plugin->isActivated($id);
}
return $enabled;
}
示例7: details_action
public function details_action()
{
Navigation::activateItem("/admin/locations/sem_classes");
$modules = array('CoreOverview' => array('id' => "CoreOverview", 'name' => _("Kern-Übersicht"), 'enabled' => true), 'CoreAdmin' => array('id' => "CoreAdmin", 'name' => _("Kern-Verwaltung"), 'enabled' => true), 'CoreForum' => array('id' => "CoreForum", 'name' => _("Kern-Forum"), 'enabled' => true), 'CoreStudygroupAdmin' => array('id' => "CoreStudygroupAdmin", 'name' => _("Studiengruppen-Verwaltung"), 'enabled' => true), 'CoreDocuments' => array('id' => "CoreDocuments", 'name' => _("Kern-Dateibereich"), 'enabled' => true), 'CoreSchedule' => array('id' => "CoreSchedule", 'name' => _("Kern-Termine"), 'enabled' => true), 'CoreParticipants' => array('id' => "CoreParticipants", 'name' => _("Kern-Teilnehmer"), 'enabled' => true), 'CoreStudygroupParticipants' => array('id' => "CoreStudygroupParticipants", 'name' => _("Kern-Studiengruppen-Teilnehmer"), 'enabled' => true), 'CoreLiterature' => array('id' => "CoreLiterature", 'name' => _("Kern-Literatur"), 'enabled' => true), 'CoreScm' => array('id' => "CoreScm", 'name' => _("Kern-Freie-Informationen"), 'enabled' => true), 'CoreWiki' => array('id' => "CoreWiki", 'name' => _("Kern-Wiki"), 'enabled' => true), 'CoreResources' => array('id' => "CoreResources", 'name' => _("Kern-Ressourcen"), 'enabled' => true), 'CoreCalendar' => array('id' => "CoreCalendar", 'name' => _("Kern-Kalender"), 'enabled' => true), 'CoreElearningInterface' => array('id' => "CoreElearningInterface", 'name' => _("Kern-Lernmodule"), 'enabled' => true));
$plugin_infos = PluginManager::getInstance()->getPluginInfos("StandardPlugin");
foreach ($plugin_infos as $plugin_info) {
$modules[$plugin_info['class']] = $plugin_info;
}
$this->modules = $modules;
$this->sem_class = $GLOBALS['SEM_CLASS'][Request::get("id")];
$this->overview_url = $this->url_for("admin/sem_classes/overview");
}
示例8: displayCheck
/**
* Check if the option needs to be displayed in settings. Recursively also
* set all parents to displayed
*/
private function displayCheck()
{
// check if it is a category
$catDisplay = $this->category != 0;
// check if it is a plugin and if it is activated
$pluginManager = PluginManager::getInstance();
$plugin = $pluginManager->getPluginInfoById($this->plugin);
$pluginDisplay = $this->plugin == 0 || $pluginManager->isPluginActivatedForUser($this->plugin, $this->user_id) && $plugin['enabled'];
// now check both
if ($catDisplay && $pluginDisplay) {
$this->setDisplayed();
}
}
示例9: setNavigation
/**
* Sets the navigation of this plugin.
*
* @deprecated
*/
function setNavigation(StudipPluginNavigation $navigation)
{
parent::setNavigation($navigation);
// prepend copy of navigation to its sub navigation
$item_names = array_keys($navigation->getSubNavigation());
$navigation_copy = clone $navigation;
$navigation_copy->clearSubmenu();
$navigation_copy->freezeActivation();
$navigation->insertSubNavigation('self', $navigation_copy, $item_names[0]);
$navigation->setTitle($this->getDisplayTitle());
// Check activation for user and display if appropriate.
if (Navigation::hasItem('/profile') && is_object($this->getRequestedUser()) && $GLOBALS['perm']->have_profile_perm('user', $this->getRequestedUser()->getUserid()) && PluginManager::getInstance()->isPluginActivatedForUser($this->getPluginId(), $this->getRequestedUser()->getUserid())) {
Navigation::addItem('/profile/' . $this->getPluginclassname(), $navigation);
}
}
示例10: to
static function to($url, $permanent = false)
{
$_POST = null;
//Generalize this
if (!preg_match("/^https?:/", $url)) {
$url = UrlHelper::localized($url);
}
if ($permanent) {
header("HTTP/1.1 301 Moved Permanently");
}
PluginManager::getInstance()->onRedirect($url);
Session::end(true);
header('Location: ' . $url);
exit;
}
示例11: getContentById
public static function getContentById($id)
{
$db = PluginManager::getInstance()->getPlugin('creole')->getC();
if ($id == -1) {
$rs = $db->executeQuery('SELECT `object_id` FROM tree WHERE `left`="1"');
while ($rs->next()) {
$id = $rs->getInt('object_id');
}
} else {
preg_match('/\\/(.*)/', $id, $matches);
$id = $matches[1];
}
$rs = $db->executeQuery('SELECT o.*, c.class_name FROM objects o, classes c WHERE o.id="' . $id . '" AND o.class = c.id');
return $rs;
}
示例12: __construct
/**
*
**/
private function __construct($consumer_key, $template)
{
$this->template = $template;
$this->router = new \Slim();
restore_error_handler();
// @see handleErrors()
$this->permissions = new Permissions($consumer_key);
// Get routes from plugins, default routes are also defined as fake plugins
$default_routes = glob(dirname(__FILE__) . '/../routes/*.php');
foreach ($default_routes as $route) {
$class_name = 'RestIP\\' . str_replace(' ', '', ucwords(str_replace('-', ' ', basename($route, '.php')))) . 'Route';
require_once $route;
$router = new $class_name();
$router->routes($this);
$this->descriptions = array_merge($this->descriptions, $router->describeRoutes());
}
// Unfortunately, PluginEngine::sendMessage() discards the reference
// to the router somewhere along the way so we need to iterate manually
foreach (\PluginManager::getInstance()->getPlugins('APIPlugin') as $plugin) {
$plugin->routes($this);
$this->descriptions = array_merge($this->descriptions, $plugin->describeRoutes());
}
}
示例13: hosts_action
public function hosts_action()
{
//init
LernmarktplatzHost::thisOne();
$this->hosts = LernmarktplatzHost::findAll();
foreach ($this->hosts as $host) {
if (strpos($host['public_key'], "\r") !== false) {
$host['public_key'] = str_replace("\r", "", $host['public_key']);
$host->store();
}
}
if (!function_exists("curl_init")) {
PageLayout::postMessage(MessageBox::error(_("Ihr PHP hat kein aktiviertes cURL-Modul.")));
}
$plugin = PluginManager::getInstance()->getPluginInfo(get_class($this->plugin));
$plugin_roles = RolePersistence::getAssignedPluginRoles($plugin['id']);
$nobody_allowed = false;
foreach ($plugin_roles as $role) {
if (strtolower($role->rolename) === "nobody") {
$nobody_allowed = true;
}
}
if (!$nobody_allowed) {
PageLayout::postMessage(MessageBox::error(_("Dieses Plugin ist nicht für nobody freigegeben. Damit kann sich dieser Marktplatz nicht mit anderen Stud.IP verbinden.")));
}
//zufällig einen Host nach Neuigkeiten fragen:
if (count($this->hosts) > 1) {
$index = rand(0, count($this->hosts) - 1);
while ($this->hosts[$index]->isMe()) {
$index++;
if ($index >= count($this->hosts)) {
$index = 0;
}
}
$this->askForHosts($this->hosts[$index]);
}
}
示例14: perform
public function perform(IHttpContext $context, $params = null)
{
$tree = new Tree();
$db = PluginManager::getInstance()->getPlugin('creole')->getC();
if ($params[0] == null) {
$rs = $db->executeQuery('SELECT t.object_id, o.* FROM tree t, objects o WHERE t.object_id = o.id AND depth = 2');
$ret = array();
while ($rs->next()) {
$ret[] = $rs->getRow();
}
return array('result' => $ret, 'type' => 'cat');
} else {
if ($tree->hasChilds($params[0])) {
$rs = $db->executeQuery('SELECT o.*
FROM objects o
LEFT JOIN tree t ON ( t.object_id = o.id )
WHERE t.parent_id =' . $params[0]);
$ret = array();
while ($rs->next()) {
$ret[] = $rs->getRow();
}
return array('result' => $ret, 'type' => 'titles');
} else {
$rs = $db->executeQuery('SELECT o.*, u.FirstName, u.LastName
FROM objects o
LEFT JOIN tree t ON ( t.object_id = o.id )
LEFT JOIN lum_user u ON (o.user_id = u.id)
WHERE t.object_id =' . $params[0]);
$ret = array();
while ($rs->next()) {
$ret = $rs->getRow();
}
return array('result' => $ret, 'type' => 'text');
}
}
}
示例15: execute
function execute($query, $params)
{
if (!$this->pdo) {
$this->connect();
}
if (AppConfig::DEBUG_MODE) {
$parsed_query = $this->parse($query, $params);
PluginManager::getInstance()->queryStart($parsed_query);
}
$stm = $this->pdo->prepare($query);
$success = $stm->execute($params);
if (!$success) {
$error_info = $stm->errorInfo();
trigger_error($error_info[2], E_USER_WARNING);
return false;
}
if (AppConfig::DEBUG_MODE) {
PluginManager::getInstance()->queryEnd($parsed_query);
}
return $stm;
}