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


PHP Manager::loadAllPluginsAndGetTheirInfo方法代码示例

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


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

示例1: getPluginsHavingUpdate

 /**
  * @param bool $themesOnly
  * @return array
  */
 public function getPluginsHavingUpdate()
 {
     $this->pluginManager->loadAllPluginsAndGetTheirInfo();
     $loadedPlugins = $this->pluginManager->getLoadedPlugins();
     try {
         $pluginsHavingUpdate = $this->marketplaceClient->getInfoOfPluginsHavingUpdate($loadedPlugins);
     } catch (\Exception $e) {
         $pluginsHavingUpdate = array();
     }
     foreach ($pluginsHavingUpdate as $key => $updatePlugin) {
         foreach ($loadedPlugins as $loadedPlugin) {
             if (!empty($updatePlugin['name']) && $loadedPlugin->getPluginName() == $updatePlugin['name']) {
                 $updatePlugin['currentVersion'] = $loadedPlugin->getVersion();
                 $updatePlugin['isActivated'] = $this->pluginManager->isPluginActivated($updatePlugin['name']);
                 $pluginsHavingUpdate[$key] = $this->addMissingRequirements($updatePlugin);
                 break;
             }
         }
     }
     // remove plugins that have updates but for some reason are not loaded
     foreach ($pluginsHavingUpdate as $key => $updatePlugin) {
         if (empty($updatePlugin['currentVersion'])) {
             unset($pluginsHavingUpdate[$key]);
         }
     }
     return $pluginsHavingUpdate;
 }
开发者ID:piwik,项目名称:piwik,代码行数:31,代码来源:Plugins.php

示例2: safemode

 public function safemode($lastError = array())
 {
     ob_clean();
     $this->tryToRepairPiwik();
     if (empty($lastError)) {
         $lastError = array('message' => Common::getRequestVar('error_message', null, 'string'), 'file' => Common::getRequestVar('error_file', null, 'string'), 'line' => Common::getRequestVar('error_line', null, 'integer'));
     }
     $outputFormat = Common::getRequestVar('format', 'html', 'string');
     $outputFormat = strtolower($outputFormat);
     if (!empty($outputFormat) && 'html' !== $outputFormat) {
         $errorMessage = $lastError['message'];
         if (Piwik::isUserIsAnonymous()) {
             $errorMessage = 'A fatal error occurred.';
         }
         $response = new \Piwik\API\ResponseBuilder($outputFormat);
         $message = $response->getResponseException(new Exception($errorMessage));
         return $message;
     }
     if (Common::isPhpCliMode()) {
         // TODO: I can't find how this will ever get called / safeMode is never set for Console
         throw new Exception("Error: " . var_export($lastError, true));
     }
     $view = new View('@CorePluginsAdmin/safemode');
     $view->lastError = $lastError;
     $view->isSuperUser = Piwik::hasUserSuperUserAccess();
     $view->isAnonymousUser = Piwik::isUserIsAnonymous();
     $view->plugins = $this->pluginManager->loadAllPluginsAndGetTheirInfo();
     $view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE);
     $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE);
     $view->emailSuperUser = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
     $view->piwikVersion = Version::VERSION;
     $view->showVersion = !Common::getRequestVar('tests_hide_piwik_version', 0);
     $view->pluginCausesIssue = '';
     if (!empty($lastError['file'])) {
         preg_match('/piwik\\/plugins\\/(.*)\\//', $lastError['file'], $matches);
         if (!empty($matches[1])) {
             $view->pluginCausesIssue = $matches[1];
         }
     }
     return $view->render();
 }
开发者ID:piwik,项目名称:piwik,代码行数:41,代码来源:Controller.php


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