本文整理汇总了PHP中Config::getSafe方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getSafe方法的具体用法?PHP Config::getSafe怎么用?PHP Config::getSafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::getSafe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get(RESTApiRequest $request, $user_id)
{
$recorder = new \StreamRecorder();
$free = ceil($recorder->checkTotalUserRecordsLength($user_id) / 60);
$total = \Config::getSafe('total_records_length', 600);
return array('total' => $total, 'free' => $free);
}
示例2: getProvider
/**
* @return WeatherProvider
* @throws Exception
*/
private function getProvider()
{
$class = ucfirst(Config::getSafe('weather_provider', 'weatherco'));
if (!class_exists($class)) {
throw new Exception('Resource "' . $class . '" does not exist');
}
return new $class();
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->appid = Config::getSafe('openweathermap_appid', '');
if ($this->appid) {
$this->context_params['http']['header'] = 'x-api-key: ' . $this->appid;
}
}
示例4: getProvider
private static function getProvider()
{
$class = ucfirst(Config::getSafe('vclub_info_provider', 'kinopoisk'));
if (!class_exists($class)) {
throw new Exception('Resource "' . $class . '" does not exist');
}
return $class;
}
示例5: getUserInfo
public function getUserInfo(User $user)
{
if (!Config::exist('oss_url')) {
return false;
}
if (Config::get('oss_url') == '') {
return false;
}
$data = file_get_contents(Config::get('oss_url') . (strpos(Config::get('oss_url'), '?') > 0 ? '&' : '?') . 'mac=' . $user->getMac() . '&serial_number=' . $user->getSerialNumber() . '&type=' . $user->getStbType() . '&locale=' . $user->getLocale() . '&login=' . $user->getLogin() . '&portal=' . (empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST']) . '&verified=' . intval($user->isVerified()) . '&ip=' . $user->getIp());
return $this->parseResult($data, Config::getSafe('strict_oss_url_check', true));
}
示例6: getServices
public static function getServices()
{
$modules = Config::getSafe('disabled_modules', array());
sort($modules);
$idx = array_search('ivi', $modules);
if ($idx !== false) {
array_splice($modules, $idx, 1);
}
return array_map(function ($module) {
return array('id' => $module, 'name' => $module);
}, $modules);
}
示例7: get_save_folder
function get_save_folder($id)
{
$dir_name = ceil($id / 100);
$dir_path = realpath(PROJECT_PATH . '/../' . Config::getSafe('screenshots_path', 'screenshots/')) . '/' . $dir_name;
//echo '$dir_path: '.$dir_path;
if (!is_dir($dir_path)) {
umask(0);
if (!mkdir($dir_path, 0777)) {
return -1;
} else {
return $dir_path;
}
} else {
return $dir_path;
}
}
示例8: filterDocument
public function filterDocument($document)
{
if (empty($document)) {
throw new RESTNotFound("Document not found");
}
$document = array_intersect_key($document, $this->fields_map);
$document['account'] = $document['ls'];
unset($document['ls']);
$document['logo'] = \Config::exist('portal_logo_url') ? \Config::get('portal_logo_url') : null;
if (is_readable(realpath(PROJECT_PATH . '/../new/launcher/img/1080/bg.jpg'))) {
$document['background'] = \Config::getSafe('portal_url', '/stalker_portal/') . 'new/launcher/img/1080/bg.jpg';
} else {
$document['background'] = null;
}
return $document;
}
示例9: send
public function send()
{
if (!empty($this->request) && strpos($this->request->getAccept(), 'text/channel-monitoring-id-url') !== false) {
if (is_array($this->body['results'])) {
$channels = array_filter($this->body['results'], function ($channel) {
return $channel['enable_monitoring'];
});
//$channels = $this->body['results'];
if (preg_match("/items=(\\d+)-(\\d*)/", $this->request->getAccept(), $match)) {
$start = $match[1];
$end = empty($match[2]) ? count($channels) : $match[2];
$channels = array_slice($channels, $start - 1, $end - $start + 1);
//var_dump($start, $end, $channels);
} elseif (preg_match("/part=(\\d+)\\/(\\d+)/", $this->request->getAccept(), $match)) {
$length = count($channels);
$start = round((intval($match[1]) - 1) * ($length / intval($match[2])));
$end = round(intval($match[1]) * ($length / intval($match[2])));
$channels = array_slice($channels, $start, $end - $start);
//var_dump($length, $start, $end);
}
$body = array_reduce($channels, function ($prev, $curr) {
return $prev . $curr['id'] . ' ' . $curr['url'] . (isset($curr['type']) ? ' ' . $curr['type'] : '') . ' ' . str_replace(' ', '_', $curr["ch_name"]) . ' ' . ((int) $curr["status"] == 1 ? "up" : "down") . "\n";
}, '');
header("Content-Type: text/plain");
echo $body;
}
return;
}
header("Content-Type: " . $this->content_type);
$this->setOutput();
$response = json_encode($this->body);
echo $response;
ob_end_flush();
if (!Config::getSafe('enable_api_log', true)) {
return;
}
$logger = new Logger();
$logger->setPrefix("api_");
// format: ip - login - [date] method "query" - "data" response_bytes;
$logger->access(sprintf("%s - %s - [%s] %s \"%s\" - \"%s\" %d\n", empty($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_REAL_IP'], @$_SERVER['PHP_AUTH_USER'], date("r"), $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'], empty($this->request) ? 'no resource' : http_build_query($this->request->getData()), strlen($response)));
if (!empty($this->body['error'])) {
// format: ip - login - [date] method "query" - "data": error message;
$logger->error(sprintf("%s - %s - [%s] %s \"%s\" - \"%s\": %s\n", empty($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_REAL_IP'], @$_SERVER['PHP_AUTH_USER'], date("r"), $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'], empty($this->request) ? 'no resource' : http_build_query($this->request->getData()), $this->body['error']));
}
}
示例10: __construct
public function __construct($init_info = array())
{
if (empty($init_info)) {
return;
}
if (!empty($init_info['id'])) {
$this->storage = $this->getById($init_info['id']);
} else {
if (!empty($init_info['name'])) {
$this->storage = $this->getByName($init_info['name']);
}
}
if (empty($this->storage)) {
throw new ErrorException("Storage can not be initialized with values: " . var_export($init_info, true));
}
$this->max_failures = Config::getSafe("max_storage_failures", 3);
$this->stat_period = Config::getSafe("storage_stat_period", 300);
return $this->storage;
}
示例11: getEvents
public function getEvents()
{
$just_started = isset($_REQUEST['init']) ? (int) $_REQUEST['init'] : 0;
if (isset($_REQUEST['init']) && Config::getSafe('log_mac_clones', false) && $just_started == 0 && Stb::getInstance()->getParam('just_started') == 0) {
$clone_ip = Middleware::getClonesIPAddress($this->stb->mac);
if ($clone_ip) {
Stb::logDoubleMAC($clone_ip);
}
}
if ($this->stb->getParam('ip') != $this->stb->ip) {
$user = User::getInstance($this->stb->id);
$user->getInfoFromOSS();
}
$this->db->update('users', array('keep_alive' => 'NOW()', 'ip' => $this->stb->ip, 'now_playing_type' => intval($_REQUEST['cur_play_type']), 'just_started' => $just_started, 'last_watchdog' => 'NOW()'), array('mac' => $this->stb->mac));
$events = Event::getAllNotEndedEvents($this->stb->id);
$messages = count($events);
$res['data'] = array();
$res['data']['msgs'] = $messages;
if ($messages > 0) {
if ($events[0]['sended'] == 0) {
Event::setSended($events[0]['id']);
if ($events[0]['need_confirm'] == 0) {
Event::setEnded($events[0]['id']);
}
}
if ($events[0]['id'] != @$_GET['data']['event_active_id']) {
$res['data']['id'] = $events[0]['id'];
$res['data']['event'] = $events[0]['event'];
$res['data']['need_confirm'] = $events[0]['need_confirm'];
$res['data']['msg'] = $events[0]['msg'];
$res['data']['reboot_after_ok'] = $events[0]['reboot_after_ok'];
$res['data']['auto_hide_timeout'] = $events[0]['auto_hide_timeout'];
$res['data']['param1'] = $events[0]['param1'];
if (Config::getSafe('display_send_time_in_message', false)) {
$res['data']['send_time'] = $events[0]['addtime'];
}
}
}
$res['data']['additional_services_on'] = Config::getSafe('enable_tariff_plans', false) ? '1' : $this->stb->additional_services_on;
return $res;
}
示例12: getServices
public static function getServices()
{
$apps = new AppsManager();
$external_apps = $apps->getList(true);
$installed_apps = array_values(array_filter($external_apps, function ($app) {
return $app['installed'] == 1 && $app['status'] == 1 && !empty($app['alias']);
}));
$external_apps_list = array_map(function ($app) {
return array('id' => 'external_' . $app['alias'], 'name' => $app['alias'], 'external' => 1);
}, $installed_apps);
$modules = Config::getSafe('disabled_modules', array());
sort($modules);
$idx = array_search('ivi', $modules);
if ($idx !== false) {
array_splice($modules, $idx, 1);
}
$modules = array_map(function ($module) {
return array('id' => $module, 'name' => $module);
}, $modules);
$modules = array_merge($modules, $external_apps_list);
return $modules;
}
示例13: _
echo _('restart on OK');
?>
</span>
<span style="display:none" id="text_channel"><input type="text" name="channel" id="channel" size="5" maxlength="3"> <?php
echo _('channels');
?>
</span>
</td>
</tr>
<tr>
<td align="right">
TTL:
</td>
<td>
<input type="text" name="ttl" id="ttl" value="<?php
echo Config::getSafe('watchdog_timeout', 120) * 2;
?>
">, <?php
echo _('s');
?>
</td>
</tr>
<tr id="msg_row" style="display:none">
<td align="right" valign="top">
MSG:
</td>
<td>
<textarea name="msg" id="msg" rows="10" cols="50"></textarea><br/>
<?php
if (substr($locale, 0, 2) == 'ru') {
?>
示例14:
</form>
<?php
if (Admin::isPageActionAllowed()) {
?>
<table cellpadding="0" cellspacing="3" width="641">
<tr>
<td class="other">
<table align="center" width="80%">
<?php
if (Config::getSafe('enable_tariff_plans', false)) {
?>
<?php
if (Config::getSafe('enable_tv_subscription_for_tariff_plans', false)) {
?>
<tr align="center">
<td><a href="subscribe.php?id=<?php
echo $id;
?>
"><?php
echo _('TV subscription');
?>
</a> (<?php
echo kop2grn(get_cost_sub_channels());
?>
)</td>
</tr>
<?php
}
示例15: date
<?php
/*
*/
include "./common.php";
$from_date = date("Y-m-d H:i:s", time() - 7 * 24 * 60 * 60);
$from_id = Mysql::getInstance()->select('max(id) as max_id')->from('master_log')->where(array('added<' => $from_date))->get()->first('max_id');
if ($from_id) {
Mysql::getInstance()->delete('master_log', array('id<' => $from_id));
if (Config::getSafe('use_optimize_table', true)) {
Mysql::getInstance()->query('ALTER TABLE `master_log` DROP INDEX `added`');
Mysql::getInstance()->query('optimize table master_log');
Mysql::getInstance()->query('ALTER TABLE `master_log` ADD INDEX `added` (`added`)');
}
}
echo 1;