本文整理汇总了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);
}
}
示例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();
}