本文整理汇总了PHP中Config::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::Get方法的具体用法?PHP Config::Get怎么用?PHP Config::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetFavouritesByArray
/**
* Получить список избранного по списку айдишников
*
* @param array $aTargetId Список ID владельцев
* @param string $sTargetType Тип владельца
* @param int $sUserId ID пользователя
* @return array
*/
public function GetFavouritesByArray($aTargetId, $sTargetType, $sUserId)
{
if (!$aTargetId) {
return array();
}
if (Config::Get('sys.cache.solid')) {
return $this->GetFavouritesByArraySolid($aTargetId, $sTargetType, $sUserId);
}
if (!is_array($aTargetId)) {
$aTargetId = array($aTargetId);
}
$aTargetId = array_unique($aTargetId);
$aFavourite = array();
$aIdNotNeedQuery = array();
/**
* Делаем мульти-запрос к кешу
*/
$aCacheKeys = func_build_cache_keys($aTargetId, "favourite_{$sTargetType}_", '_' . $sUserId);
if (false !== ($data = $this->Cache_Get($aCacheKeys))) {
/**
* проверяем что досталось из кеша
*/
foreach ($aCacheKeys as $sValue => $sKey) {
if (array_key_exists($sKey, $data)) {
if ($data[$sKey]) {
$aFavourite[$data[$sKey]->getTargetId()] = $data[$sKey];
} else {
$aIdNotNeedQuery[] = $sValue;
}
}
}
}
/**
* Смотрим чего не было в кеше и делаем запрос в БД
*/
$aIdNeedQuery = array_diff($aTargetId, array_keys($aFavourite));
$aIdNeedQuery = array_diff($aIdNeedQuery, $aIdNotNeedQuery);
$aIdNeedStore = $aIdNeedQuery;
if ($data = $this->oMapper->GetFavouritesByArray($aIdNeedQuery, $sTargetType, $sUserId)) {
foreach ($data as $oFavourite) {
/**
* Добавляем к результату и сохраняем в кеш
*/
$aFavourite[$oFavourite->getTargetId()] = $oFavourite;
$this->Cache_Set($oFavourite, "favourite_{$oFavourite->getTargetType()}_{$oFavourite->getTargetId()}_{$sUserId}", array(), 60 * 60 * 24 * 7);
$aIdNeedStore = array_diff($aIdNeedStore, array($oFavourite->getTargetId()));
}
}
/**
* Сохраняем в кеш запросы не вернувшие результата
*/
foreach ($aIdNeedStore as $sId) {
$this->Cache_Set(null, "favourite_{$sTargetType}_{$sId}_{$sUserId}", array(), 60 * 60 * 24 * 7);
}
/**
* Сортируем результат согласно входящему массиву
*/
$aFavourite = func_array_sort_by_keys($aFavourite, $aTargetId);
return $aFavourite;
}
示例2: Exec
/**
* Запуск обработки
*/
public function Exec()
{
/**
* Получаем список тегов
*/
$aTags = $this->oEngine->Topic_GetOpenTopicTags(Config::Get('block.tags.tags_count'));
/**
* Расчитываем логарифмическое облако тегов
*/
if ($aTags) {
$this->Tools_MakeCloud($aTags);
/**
* Устанавливаем шаблон вывода
*/
$this->Viewer_Assign("aTags", $aTags);
}
/**
* Теги пользователя
*/
if ($oUserCurrent = $this->User_getUserCurrent()) {
$aTags = $this->oEngine->Topic_GetOpenTopicTags(Config::Get('block.tags.personal_tags_count'), $oUserCurrent->getId());
/**
* Расчитываем логарифмическое облако тегов
*/
if ($aTags) {
$this->Tools_MakeCloud($aTags);
/**
* Устанавливаем шаблон вывода
*/
$this->Viewer_Assign("aTagsUser", $aTags);
}
}
}
示例3: isBad
public function isBad()
{
if ($this->getRating() <= Config::Get('module.comment.bad')) {
return true;
}
return false;
}
示例4: EventLogin
/**
* Обрабатываем процесс залогинивания
*
*/
protected function EventLogin()
{
/**
* Если нажали кнопку "Войти"
*/
if (isPost('submit_login') and is_string(getRequest('login')) and is_string(getRequest('password'))) {
/**
* Проверяем есть ли такой юзер по логину
*/
if (func_check(getRequest('login'), 'mail') and $oUser = $this->User_GetUserByMail(getRequest('login')) or $oUser = $this->User_GetUserByLogin(getRequest('login'))) {
/**
* Сверяем хеши паролей и проверяем активен ли юзер
*/
if ($oUser->getPassword() == func_encrypt(getRequest('password')) and $oUser->getActivate()) {
$bRemember = getRequest('remember', false) ? true : false;
/**
* Авторизуем
*/
$this->User_Authorization($oUser, $bRemember);
/**
* Перенаправляем на страницу с которой произошла авторизация
*/
if (isset($_SERVER['HTTP_REFERER'])) {
$sBackUrl = $_SERVER['HTTP_REFERER'];
if (strpos($sBackUrl, Router::GetPath('login')) === false) {
Router::Location($sBackUrl);
}
}
Router::Location(Config::Get('path.root.web') . '/');
}
}
$this->Viewer_Assign('bLoginError', true);
}
$this->Viewer_AddHtmlTitle($this->Lang_Get('login'));
}
示例5: set
public function set($key, $value)
{
$this->check();
if (memcache_set($this->connection, $key, $value, 0, Config::Get('cache_time')) === false) {
throw new CacheException("Couldn't store data in cache");
}
}
示例6: savepro
public function savepro()
{
if ($this->post->firstname == '' || $this->post->lastname == '') {
$this->set('message', 'The first or lastname cannot be blank!');
$this->render('core_error.tpl');
return;
}
$params = array('firstname' => $this->post->firstname, 'lastname' => $this->post->lastname, 'email' => $this->post->email, 'hub' => $this->post->hub, 'retired' => $this->post->retired, 'totalflights' => $this->post->totalflights, 'totalpay' => floatval($this->post->totalpay), 'transferhours' => $this->post->transferhours);
PilotData::updateProfile($this->post->pilotid, $params);
PilotData::SaveFields($this->post->pilotid, $_POST);
/* Don't calculate a pilot's rank if this is set */
if (Config::Get('RANKS_AUTOCALCULATE') == false) {
PilotData::changePilotRank($this->post->pilotid, $this->post->rank);
} else {
RanksData::calculateUpdatePilotRank($this->post->pilotid);
}
StatsData::UpdateTotalHours();
$this->set('message', 'Profile updated successfully');
$this->render('core_success.tpl');
$this->set('pilots', PilotData::getAllPilots());
$this->render('/pm/pilot_manager.php');
if ($this->post->resend_email == 'true') {
$this->post->id = $this->post->pilotid;
$this->resendemail(false);
}
$pilot = PilotData::getPilotData($this->post->pilotid);
LogData::addLog(Auth::$userinfo->pilotid, 'Updated profile for ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname);
return;
break;
}
示例7: before
public function before($controller, $metadata, &$data)
{
if (!$controller->request->input->exists('app_id')) {
throw new BadRequestException("Missing app id.");
}
$conf = Config::Get('apps');
$app = $conf->{$controller->request->input->app_id};
if (!$app->signed) {
return;
}
if (!$controller->request->input->exists('app_id', 'signature', 'time')) {
throw new BadRequestException("Missing signature.");
}
$signature = str_replace(' ', '+', $controller->request->input->signature);
$vals = array();
foreach ($controller->request->input as $key => $val) {
if (!in_array($key, array('signature', 'time'))) {
$vals[$key] = $val;
}
}
$sig = sign($vals, $app->key, $controller->request->input->time);
if ($sig['signature'] != $signature) {
throw new BadRequestException("Invalid signature.");
}
}
示例8: __construct
public function __construct($config = null)
{
$config = $config ? $config : Config::Get('mandao');
$this->account = $config['account'];
$this->passwd = $config['passwd'];
$this->perfix = $config['perfix'];
}
示例9: Exec
public function Exec()
{
$aBanners = $this->GetParam('aBanners');
$this->PluginBanneroid_ModuleBanner_AddBannerStats(array('banner_id' => $aBanners[0]->getId(), 'event' => 'SHOW'));
$this->Viewer_Assign("oBanner", $aBanners[0]);
$this->Viewer_Assign('sBannersPath', Config::Get("plugin.banneroid.images_dir"));
}
示例10: Log
/**
* Делает запись в лог
*
* @param string $sMsg Сообщение для записи в лог
*/
public function Log($sMsg)
{
if ($this->bLogEnable and Config::Get('sys.logs.cron')) {
$sMsg = $this->sProcessName . ': ' . $sMsg;
$this->Logger_Notice($sMsg, array(), 'cron');
}
}
示例11: GetMailer
public static function GetMailer($address = '')
{
$emailConfig = Config::Get('email');
$currentConfig = $emailConfig[$address] ? $emailConfig[$address] : $emailConfig['default'];
$address = $currentConfig['address'];
if (!$currentConfig) {
return false;
}
if (!self::$phpMailers[$address]) {
$mailer = new PHPMailer();
$mailer->isSMTP();
$mailer->Host = $currentConfig['stmp_host'];
$mailer->Username = $currentConfig['user'];
$mailer->Password = $currentConfig['pwd'];
$mailer->SMTPAuth = true;
$mailer->Port = $currentConfig['port'];
$mailer->CharSet = "utf-8";
$mailer->setFrom($currentConfig['address']);
$mailer->isHTML();
} else {
$mailer = self::$phpMailers[$address];
}
$mailer->clearAllRecipients();
self::$phpMailers[$address] = $mailer;
return $mailer;
}
示例12: InitAction
public function InitAction($aVars)
{
$oLang = $this->Lang_Dictionary();
$this->Viewer_Assign('oLang', $oLang);
$oUser = $this->GetUser();
if ($oUser && $oUser->IsAdministrator() && Config::Get('plugin.' . $this->sPlugin . '.' . 'icon_menu')) {
$sScript = Plugin::GetTemplateWebPath($this->sPlugin) . 'js/' . 'icon_menu.js';
$this->Viewer_AppendScript($sScript);
}
if (Router::GetAction() == 'admin' || Router::GetAction() == 'error') {
return;
}
if (!$oUser) {
if (Router::GetAction() == 'registration') {
$aIp = admGetAllUserIp();
foreach ($aIp as $sIp) {
if ($this->PluginAceadminpanel_Admin_IsBanIp($sIp)) {
$this->Message_AddErrorSingle($this->Lang_Get('adm_banned2_text'), $this->Lang_Get('adm_denied_title'));
return $this->UserBanned(null);
}
}
}
return;
}
if (defined('ADMIN_SITE_CLOSED') && ADMIN_SITE_CLOSED && !$oUser->IsAdministrator()) {
$this->SiteClosed();
}
if ($oUser->IsBannedByLogin() || $oUser->IsBannedByIp() && !$oUser->IsAdministrator()) {
return $this->UserBanned($oUser);
}
}
示例13: resetdistances
public function resetdistances()
{
echo '<h3>Updating and Calculating Distances</h3>';
# Update all of the schedules
echo '<p><strong>Updating schedules...</strong></p>';
//$allschedules = SchedulesData::GetSchedulesNoDistance();
$allschedules = SchedulesData::findSchedules(array());
if (!$allschedules) {
echo 'No schedules to update';
$allschedules = array();
}
# Check 'em
foreach ($allschedules as $sched) {
$distance = SchedulesData::distanceBetweenPoints($sched->deplat, $sched->deplng, $sched->arrlat, $sched->arrlng);
$distance = sprintf("%.6f", $distance);
echo "{$sched->code}{$sched->flightnum} - {$sched->depname} to {$sched->arrname} " . "is {$distance} " . Config::Get('UNIT') . '<br />';
SchedulesData::updateScheduleFields($sched->id, array('distance' => $distance));
}
# Update all of the PIREPS
echo '<p><strong>Updating PIREPs...</strong></p>';
$allpireps = PIREPData::findPIREPS(array());
if (!$allpireps) {
echo 'No PIREPs need updating!';
$allpireps = array();
}
foreach ($allpireps as $pirep) {
# Find the schedule, and the distance supplied by the schedule:
$distance = SchedulesData::distanceBetweenPoints($pirep->deplat, $pirep->deplng, $pirep->arrlat, $pirep->arrlng);
$distance = sprintf("%.2f", $distance);
echo "PIREP Number {$pirep->pirepid} ({$pirep->code}{$pirep->flightnum}) " . "{$pirep->depname} to {$pirep->arrname} is {$distance} " . Config::Get('UNIT') . '<br />';
PIREPData::editPIREPFields($pirep->pirepid, array('distance' => $distance));
}
echo '<p>Completed!</p><br />';
LogData::addLog(Auth::$userinfo->pilotid, 'Reset distances');
}
示例14: LoadModules
public function LoadModules()
{
Std::Out();
Std::Out('[Info] [Modules] Loading');
Std::Out('[Info] [Modules] Available languages: ' . implode(', ', $this->GetAvailableLanguages(false)));
$Modules = Config::Get('Modules');
if (is_array($Modules)) {
$Loaded = array();
$Keys = array_keys($Modules);
foreach ($Keys as $Key) {
foreach ($Modules[$Key] as $Module) {
if (is_string($Module)) {
$Module = array($Module, $Module);
}
if (is_array($Module) && !empty($Module[0]) && !empty($Module[1])) {
$Name = strtolower($Module[0]);
$Loaded[$Key][$Name] = $this->LoadModule($Key, $Name, $Module[1]);
} else {
Std::Out('[Warning] [Modules] Config must be Key::Name or Key::[Name, AliasOf]');
Std::Out("{$Key}::", false);
Std::Out(var_export($Module, true));
}
}
}
Std::Out('[Info] [Modules] Ready!');
// ($N loaded modules)
return $Loaded;
}
Std::Out('[Warning] [Modules] Config file is not an array');
return false;
}
示例15: Activate
/**
* Активация плагина.
*/
public function Activate()
{
$aSqlConf = array(array('field' => 'topic_fixed', 'table' => Config::Get('db.table.topic'), 'file' => dirname(__FILE__) . '/sql/topic.sql'));
$this->exportSqlIfNeed($aSqlConf);
$this->Cache_Clean();
return true;
}