當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SettingsPiwik::isAutoUpdateEnabled方法代碼示例

本文整理匯總了PHP中Piwik\SettingsPiwik::isAutoUpdateEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP SettingsPiwik::isAutoUpdateEnabled方法的具體用法?PHP SettingsPiwik::isAutoUpdateEnabled怎麽用?PHP SettingsPiwik::isAutoUpdateEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\SettingsPiwik的用法示例。


在下文中一共展示了SettingsPiwik::isAutoUpdateEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: check

 /**
  * Check for a newer version
  *
  * @param bool $force Force check
  * @param int $interval Interval used for update checks
  */
 public static function check($force = false, $interval = null)
 {
     if (!SettingsPiwik::isAutoUpdateEnabled()) {
         return;
     }
     if ($interval === null) {
         $interval = self::CHECK_INTERVAL;
     }
     $lastTimeChecked = Option::get(self::LAST_TIME_CHECKED);
     if ($force || $lastTimeChecked === false || time() - $interval > $lastTimeChecked) {
         // set the time checked first, so that parallel Piwik requests don't all trigger the http requests
         Option::set(self::LAST_TIME_CHECKED, time(), $autoLoad = 1);
         $latestVersion = self::getLatestAvailableVersionNumber();
         $latestVersion = trim((string) $latestVersion);
         if (!preg_match('~^[0-9][0-9a-zA-Z_.-]*$~D', $latestVersion)) {
             $latestVersion = '';
         }
         Option::set(self::LATEST_VERSION, $latestVersion);
     }
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:26,代碼來源:UpdateCheck.php

示例2: overview

 public function overview()
 {
     $view = $this->configureViewAndCheckPermission('@Marketplace/overview');
     $show = Common::getRequestVar('show', 'plugins', 'string');
     $query = Common::getRequestVar('query', '', 'string', $_POST);
     $sort = new Sort();
     $sort = $sort->getSort();
     $mode = new Mode();
     $mode = $mode->getMode();
     // we're fetching all available plugins to decide which tabs need to be shown in the UI and to know the number
     // of total available plugins
     $allPlugins = $this->plugins->getAllPlugins();
     $allThemes = $this->plugins->getAllThemes();
     $paidPlugins = $this->plugins->getAllPaidPlugins();
     $showThemes = $show === 'themes';
     $showPlugins = !$showThemes;
     $showPaid = $show === 'premium';
     $showAll = !$showPaid;
     if ($showPlugins && $showPaid) {
         $type = PurchaseType::TYPE_PAID;
         $view->numAvailablePlugins = count($paidPlugins);
     } elseif ($showPlugins && $showAll) {
         $type = PurchaseType::TYPE_ALL;
         $view->numAvailablePlugins = count($allPlugins);
     } else {
         $type = PurchaseType::TYPE_ALL;
         $view->numAvailablePlugins = count($allThemes);
     }
     $pluginsToShow = $this->plugins->searchPlugins($query, $sort, $showThemes, $type);
     $paidPluginsToInstallAtOnce = array();
     if (SettingsPiwik::isAutoUpdatePossible()) {
         foreach ($paidPlugins as $paidPlugin) {
             if ($this->canPluginBeInstalled($paidPlugin) || $this->pluginManager->isPluginInstalled($paidPlugin['name']) && !$this->pluginManager->isPluginActivated($paidPlugin['name'])) {
                 $paidPluginsToInstallAtOnce[] = $paidPlugin['name'];
             }
         }
     }
     $view->paidPluginsToInstallAtOnce = $paidPluginsToInstallAtOnce;
     $view->pluginsToShow = $pluginsToShow;
     $view->isValidConsumer = $this->consumer->isValidConsumer();
     $view->paidPlugins = $paidPlugins;
     $view->freePlugins = $allPlugins;
     $view->themes = $allThemes;
     $view->showThemes = $showThemes;
     $view->showPlugins = $showPlugins;
     $view->showFree = $showAll;
     $view->showPaid = $showPaid;
     $view->pluginType = $show;
     $view->pluginTypeOptions = array('plugins' => Piwik::translate('General_Plugins'), 'premium' => Piwik::translate('Marketplace_PaidPlugins'), 'themes' => Piwik::translate('CorePluginsAdmin_Themes'));
     $view->pluginSortOptions = array(Sort::METHOD_LAST_UPDATED => Piwik::translate('Marketplace_SortByLastUpdated'), Sort::METHOD_POPULAR => Piwik::translate('Marketplace_SortByPopular'), Sort::METHOD_NEWEST => Piwik::translate('Marketplace_SortByNewest'), Sort::METHOD_ALPHA => Piwik::translate('Marketplace_SortByAlpha'));
     $view->mode = $mode;
     $view->query = $query;
     $view->sort = $sort;
     $view->hasLicenseKey = $this->licenseKey->has();
     $view->hasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
     $view->installNonce = Nonce::getNonce(static::INSTALL_NONCE);
     $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE);
     $view->deactivateNonce = Nonce::getNonce(PluginsController::DEACTIVATE_NONCE);
     $view->activateNonce = Nonce::getNonce(PluginsController::ACTIVATE_NONCE);
     $view->isSuperUser = Piwik::hasUserSuperUserAccess();
     $view->isPluginsAdminEnabled = CorePluginsAdmin::isPluginsAdminEnabled();
     $view->isAutoUpdatePossible = SettingsPiwik::isAutoUpdatePossible();
     $view->isAutoUpdateEnabled = SettingsPiwik::isAutoUpdateEnabled();
     return $view->render();
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:65,代碼來源:Controller.php


注:本文中的Piwik\SettingsPiwik::isAutoUpdateEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。