当前位置: 首页>>代码示例>>PHP>>正文


PHP Gdn::pluginManager方法代码示例

本文整理汇总了PHP中Gdn::pluginManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn::pluginManager方法的具体用法?PHP Gdn::pluginManager怎么用?PHP Gdn::pluginManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdn的用法示例。


在下文中一共展示了Gdn::pluginManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getConnections

 /**
  * Find available social plugins.
  *
  * @return array|mixed
  * @throws Exception
  */
 protected function getConnections()
 {
     $this->fireEvent('GetConnections');
     $connections = [];
     $addons = Gdn::addonManager()->lookupAllByType(\Vanilla\Addon::TYPE_ADDON);
     foreach ($addons as $addonName => $addon) {
         $addonInfo = $addon->getInfo();
         // Limit to designated social addons.
         if (!array_key_exists('socialConnect', $addonInfo)) {
             continue;
         }
         // See if addon is enabled.
         $isEnabled = Gdn::addonManager()->isEnabled($addonName, \Vanilla\Addon::TYPE_ADDON);
         setValue('enabled', $addonInfo, $isEnabled);
         // See if we can detect whether connection is configured.
         $isConfigured = null;
         if ($isEnabled) {
             $pluginInstance = Gdn::pluginManager()->getPluginInstance($addonName, Gdn_PluginManager::ACCESS_PLUGINNAME);
             if (method_exists($pluginInstance, 'isConfigured')) {
                 $isConfigured = $pluginInstance->isConfigured();
             }
         }
         setValue('configured', $addonInfo, $isConfigured);
         // Add the connection.
         $connections[$addonName] = $addonInfo;
     }
     return $connections;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:34,代码来源:class.socialcontroller.php

示例2: gdn_dispatcher_beforeDispatch_handler

 /**
  * Override the default dashboard page with the new stats one.
  */
 public function gdn_dispatcher_beforeDispatch_handler($Sender)
 {
     $Enabled = c('Garden.Analytics.Enabled', true);
     if ($Enabled && !Gdn::pluginManager()->hasNewMethod('SettingsController', 'Index')) {
         Gdn::pluginManager()->registerNewMethod('VanillaStatsPlugin', 'StatsDashboard', 'SettingsController', 'Index');
     }
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:10,代码来源:class.vanillastats.plugin.php

示例3: isRemovable

 /**
  * Is the application/plugin/theme removable?
  *
  * @param string $Type self::TYPE_APPLICATION or self::TYPE_PLUGIN or self::TYPE_THEME
  * @param string $Name
  * @return boolean
  */
 public static function isRemovable($Type, $Name)
 {
     switch ($Type) {
         case self::TYPE_APPLICATION:
             $ApplicationManager = Gdn::Factory('ApplicationManager');
             if ($IsRemovable = !array_key_exists($Name, $ApplicationManager->EnabledApplications())) {
                 $ApplicationInfo = arrayValue($Name, $ApplicationManager->AvailableApplications(), array());
                 $ApplicationFolder = arrayValue('Folder', $ApplicationInfo, '');
                 $IsRemovable = IsWritable(PATH_APPLICATIONS . DS . $ApplicationFolder);
             }
             break;
         case self::TYPE_PLUGIN:
             if ($IsRemovable = !array_key_exists($Name, Gdn::pluginManager()->EnabledPlugins())) {
                 $PluginInfo = arrayValue($Name, Gdn::pluginManager()->AvailablePlugins(), false);
                 $PluginFolder = arrayValue('Folder', $PluginInfo, false);
                 $IsRemovable = IsWritable(PATH_PLUGINS . DS . $PluginFolder);
             }
             break;
         case self::TYPE_THEME:
             // TODO
             $IsRemovable = false;
             break;
     }
     return $IsRemovable;
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:32,代码来源:class.settingsmodule.php

示例4: refresh

 /**
  * Reload the locale system.
  */
 public function refresh()
 {
     $LocalName = $this->current();
     $ApplicationWhiteList = Gdn::applicationManager()->enabledApplicationFolders();
     $PluginWhiteList = Gdn::pluginManager()->enabledPluginFolders();
     $ForceRemapping = true;
     $this->set($LocalName, $ApplicationWhiteList, $PluginWhiteList, $ForceRemapping);
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:11,代码来源:class.locale.php

示例5: gdn_dispatcher_afterAnalyzeRequest_handler

 /**
  * Remove plugins that are not mobile friendly!
  */
 public function gdn_dispatcher_afterAnalyzeRequest_handler($Sender)
 {
     // Remove plugins so they don't mess up layout or functionality.
     $inPublicDashboard = $Sender->application() == 'dashboard' && in_array($Sender->controller(), array('Activity', 'Profile', 'Search'));
     if (in_array($Sender->application(), array('vanilla', 'conversations')) || $inPublicDashboard) {
         Gdn::pluginManager()->removeMobileUnfriendlyPlugins();
     }
     saveToConfig('Garden.Format.EmbedSize', '240x135', false);
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:12,代码来源:class.mobilethemehooks.php

示例6: availableThemes

 /**
  * Looks through the themes directory for valid themes.
  *
  * The themes are returned as an associative array of "Theme Name" => "Theme Info Array".
  *
  * @param bool $force Deprecated.
  * @return array Returns the available themes in an array.
  */
 public function availableThemes($force = false)
 {
     $addons = $this->addonManager->lookupAllByType(Addon::TYPE_THEME);
     $result = [];
     /* @var Addon $addon */
     foreach ($addons as $addon) {
         $result[$addon->getRawKey()] = Gdn::pluginManager()->calcOldInfoArray($addon);
     }
     return $result;
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:18,代码来源:class.thememanager.php

示例7: initStatic

 /**
  * Fires an event for initializing static members in the calling class.
  *
  * @return bool Whether the event was fired.
  * @throws Exception
  */
 public static function initStatic()
 {
     if (!self::$initStaticFired) {
         self::$initStaticFired = true;
         Gdn::pluginManager()->fireAs(get_called_class());
         Gdn::pluginManager()->fireEvent('InitStatic');
         return true;
     }
     return false;
 }
开发者ID:R-J,项目名称:vanilla,代码行数:16,代码来源:class.staticinitializer.php

示例8: base_render_before

 /**
  * Remove mobile rendering from our custom non-forum pages.
  *
  * @param $sender
  */
 public function base_render_before($sender)
 {
     $userFacing = $sender->MasterView == 'default' || $sender->MasterView == '';
     $onForumPage = !in_array(strtolower($sender->Application), array('vanilla', 'conversations', 'dashboard'));
     if ($userFacing && isMobile() && $onForumPage) {
         // Use the main theme instead of mobile
         $sender->Theme = c('Garden.Theme');
         Gdn::pluginManager()->unregisterPlugin('MobileThemeHooks');
     }
 }
开发者ID:vanilla,项目名称:community,代码行数:15,代码来源:class.hooks.php

示例9: gdn_dispatcher_afterAnalyzeRequest_handler

 public function gdn_dispatcher_afterAnalyzeRequest_handler($sender)
 {
     $inPublicDashboard = in_array($sender->controller(), array('Activity', 'Profile', 'Search'));
     if (in_array($sender->application(), array('vanilla', 'conversations')) || $inPublicDashboard) {
         Gdn::pluginManager()->removeMobileUnfriendlyPlugins();
     }
     saveToConfig('Garden.Format.EmbedSize', '240x135', false);
     saveToConfig('Vanilla.AdminCheckboxes.Use', false, false);
     //the table discussions layout takes up too much space on small screens
     saveToConfig('Vanilla.Discussions.Layout', 'modern', false);
 }
开发者ID:Nordic-T,项目名称:vanilla-themes,代码行数:11,代码来源:class.minusbaselinethemehooks.php

示例10: categoryWatch

 /**
  *
  *
  * @since 2.0.18
  * @access public
  * @return array Category IDs.
  */
 public static function categoryWatch($AllDiscussions = true)
 {
     $Categories = self::categories();
     $AllCount = count($Categories);
     $Watch = array();
     foreach ($Categories as $CategoryID => $Category) {
         if ($AllDiscussions && val('HideAllDiscussions', $Category)) {
             continue;
         }
         if ($Category['PermsDiscussionsView'] && $Category['Following']) {
             $Watch[] = $CategoryID;
         }
     }
     Gdn::pluginManager()->EventArguments['CategoryIDs'] =& $Watch;
     Gdn::pluginManager()->fireEvent('CategoryWatch');
     if ($AllCount == count($Watch)) {
         return true;
     }
     return $Watch;
 }
开发者ID:austins,项目名称:vanilla,代码行数:27,代码来源:class.categorymodel.php

示例11: validate

 /**
  * Validate captcha.
  *
  * @param mixed $value
  * @return boolean validity of captcha submission
  */
 public static function validate($value = null)
 {
     if (is_null($value)) {
         // Get captcha text
         $captchaText = null;
         Gdn::pluginManager()->EventArguments['captchatext'] =& $captchaText;
         Gdn::pluginManager()->fireAs('captcha')->fireEvent('get', ['captcha' => $value]);
         $value = $captchaText;
     }
     if (is_null($value)) {
         return false;
     }
     // Validate captcha text
     // Assume invalid submission
     $valid = false;
     Gdn::pluginManager()->EventArguments['captchavalid'] =& $valid;
     Gdn::pluginManager()->fireAs('captcha')->fireEvent('validate', ['captcha' => $value]);
     $isValid = $valid ? true : false;
     unset(Gdn::pluginManager()->EventArguments['captchavalid']);
     return $isValid;
 }
开发者ID:R-J,项目名称:vanilla,代码行数:27,代码来源:class.captcha.php

示例12: getImageSize

 /**
  * If passed path leads to an image, return size
  *
  * @param string $Path Path to file.
  * @return array [0] => Height, [1] => Width.
  */
 public static function getImageSize($Path)
 {
     // Static FireEvent for intercepting non-local files.
     $Sender = new stdClass();
     $Sender->Returns = array();
     $Sender->EventArguments = array();
     $Sender->EventArguments['Path'] =& $Path;
     $Sender->EventArguments['Parsed'] = Gdn_Upload::parse($Path);
     Gdn::pluginManager()->callEventHandlers($Sender, 'Gdn_Upload', 'CopyLocal');
     if (!in_array(strtolower(pathinfo($Path, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png'))) {
         return array(0, 0);
     }
     $ImageSize = @getimagesize($Path);
     if (is_array($ImageSize)) {
         if (!in_array($ImageSize[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
             return array(0, 0);
         }
         return array($ImageSize[0], $ImageSize[1]);
     }
     return array(0, 0);
 }
开发者ID:vanilla,项目名称:addons,代码行数:27,代码来源:class.mediamodel.php

示例13: attach

 /**
  * Attach mappings for vanilla extension folders.
  *
  * @param string $ExtensionType The type of extension to map.
  * This should be one of: CONTEXT_THEME, CONTEXT_PLUGIN, CONTEXT_APPLICATION.
  */
 public static function attach($ExtensionType)
 {
     switch ($ExtensionType) {
         case self::CONTEXT_APPLICATION:
             if (Gdn::applicationManager() instanceof Gdn_ApplicationManager) {
                 $EnabledApplications = Gdn::applicationManager()->enabledApplicationFolders();
                 foreach ($EnabledApplications as $EnabledApplication) {
                     self::attachApplication($EnabledApplication);
                 }
             }
             break;
         case self::CONTEXT_PLUGIN:
             if (Gdn::pluginManager() instanceof Gdn_PluginManager) {
                 foreach (Gdn::pluginManager()->searchPaths() as $SearchPath => $SearchPathName) {
                     if ($SearchPathName === true || $SearchPathName == 1) {
                         $SearchPathName = md5($SearchPath);
                     }
                     // If we have already loaded the plugin manager, use its internal folder list
                     if (Gdn::pluginManager()->started()) {
                         $Folders = Gdn::pluginManager()->enabledPluginFolders($SearchPath);
                         foreach ($Folders as $PluginFolder) {
                             $FullPluginPath = combinePaths(array($SearchPath, $PluginFolder));
                             self::registerMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN, $FullPluginPath, array('SearchSubfolders' => true, 'Extension' => $SearchPathName, 'Structure' => Gdn_Autoloader_Map::STRUCTURE_SPLIT, 'SplitTopic' => strtolower($PluginFolder), 'PreWarm' => true));
                         }
                         $PluginMap = self::getMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN);
                         if ($PluginMap && !$PluginMap->mapIsOnDisk()) {
                             Gdn::pluginManager()->forceAutoloaderIndex();
                         }
                     }
                 }
             }
             break;
         case self::CONTEXT_THEME:
             break;
     }
 }
开发者ID:R-J,项目名称:vanilla,代码行数:42,代码来源:class.autoloader.php

示例14: plugins

 /**
  * Manage list of plugins.
  *
  * @since 2.0.0
  * @access public
  * @param string $Filter 'enabled', 'disabled', or 'all' (default)
  * @param string $PluginName Unique ID of plugin to be modified.
  * @param string $TransientKey Security token.
  */
 public function plugins($Filter = '', $PluginName = '', $TransientKey = '')
 {
     $this->permission('Garden.Settings.Manage');
     // Page setup
     $this->addJsFile('addons.js');
     $this->title(t('Plugins'));
     $this->addSideMenu('dashboard/settings/plugins');
     // Validate and set properties
     $Session = Gdn::session();
     if ($PluginName && !$Session->validateTransientKey($TransientKey)) {
         $PluginName = '';
     }
     if (!in_array($Filter, array('enabled', 'disabled'))) {
         $Filter = 'all';
     }
     $this->Filter = $Filter;
     // Retrieve all available plugins from the plugins directory
     $this->EnabledPlugins = Gdn::pluginManager()->enabledPlugins();
     self::sortAddons($this->EnabledPlugins);
     $this->AvailablePlugins = Gdn::pluginManager()->availablePlugins();
     self::sortAddons($this->AvailablePlugins);
     if ($PluginName != '') {
         try {
             $this->EventArguments['PluginName'] = $PluginName;
             if (array_key_exists($PluginName, $this->EnabledPlugins) === true) {
                 Gdn::pluginManager()->disablePlugin($PluginName);
                 Gdn_LibraryMap::clearCache();
                 $this->fireEvent('AfterDisablePlugin');
             } else {
                 $Validation = new Gdn_Validation();
                 if (!Gdn::pluginManager()->enablePlugin($PluginName, $Validation)) {
                     $this->Form->setValidationResults($Validation->results());
                 } else {
                     Gdn_LibraryMap::ClearCache();
                 }
                 $this->EventArguments['Validation'] = $Validation;
                 $this->fireEvent('AfterEnablePlugin');
             }
         } catch (Exception $e) {
             $this->Form->addError($e);
         }
         if ($this->Form->errorCount() == 0) {
             redirect('/settings/plugins/' . $this->Filter);
         }
     }
     $this->render();
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:56,代码来源:class.settingscontroller.php

示例15: toggle

 /**
  * Handle toggling this version of embedding on and off. Take care of disabling the other version of embed (the old plugin).
  *
  * @param string $Toggle
  * @param string $TransientKey
  * @return boolean
  * @throws Gdn_UserException
  */
 private function toggle($Toggle = '', $TransientKey = '')
 {
     if (in_array($Toggle, array('enable', 'disable')) && Gdn::session()->validateTransientKey($TransientKey)) {
         if ($Toggle == 'enable' && array_key_exists('embedvanilla', Gdn::pluginManager()->enabledPlugins())) {
             throw new Gdn_UserException('You must disable the "Embed Vanilla" plugin before continuing.');
         }
         // Do the toggle
         saveToConfig('Garden.Embed.Allow', $Toggle == 'enable' ? true : false);
         return true;
     }
     return false;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:20,代码来源:class.embedcontroller.php


注:本文中的Gdn::pluginManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。