本文整理汇总了PHP中Settings类的典型用法代码示例。如果您正苦于以下问题:PHP Settings类的具体用法?PHP Settings怎么用?PHP Settings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
function get()
{
$settings = new Settings();
$atlantis = array('lat' => doubleval($settings->getSettings('Atlantis', 'lat')), 'long' => doubleval($settings->getSettings('Atlantis', 'long')));
$bdd = getBDD();
$req = $bdd->query('SELECT arr.*, IFNULL(arr2.nom, at_users.nom) nom FROM (SELECT t1.* FROM at_geo t1 LEFT JOIN at_geo t2 ON (t1.mac = t2.mac AND t1.timestamp < t2.timestamp) WHERE t2.timestamp IS NULL AND t1.date = CURDATE()) AS arr LEFT JOIN (SELECT at_devices.mac, at_users.nom FROM at_devices INNER JOIN at_users ON at_devices.username = at_users.id) AS arr2 ON arr.mac = arr2.mac LEFT JOIN at_users ON arr.mac = at_users.cle');
$result = $req->fetchAll(PDO::FETCH_ASSOC);
$req->closeCursor();
http_response_code(202);
$output = array('atlantis' => $atlantis, 'positions' => $result);
return $output;
}
示例2: getConfigurationEntries
public function getConfigurationEntries($tprefix)
{
require_once 'Settings.php';
$obj_sett = new Settings();
$arr_config = $obj_sett->getSettings($tprefix);
return $arr_config;
}
示例3: writeToDB
/**
* writeToDb writes the OBJECT to the database
* @param Array $data
*/
function writeToDB($data)
{
// echo print_r(array_keys($data), true);
require_once dirname(realpath(__FILE__)) . '/../includes/classes/settings.class.php';
$settings = new Settings();
$settings->writeObject($data);
}
示例4: __construct
function __construct()
{
$settings = new Settings();
$this->oc = $settings->getSettings('ownCloud', 'path');
$this->admin_username = $settings->getSettings('ownCloud', 'username');
$this->admin_password = $settings->getSettings('ownCloud', 'password');
}
示例5: get
function get()
{
$pid = (new Settings())->getSettings('Daemon', 'pid');
if ($pid == -1) {
$daemon = false;
} else {
exec("ps -p {$pid}", $result);
if (count($result) > 1) {
$result = $result[1];
$result = preg_replace("/\\s+/", " ", $result);
$data = explode(" ", $result);
if ($data[count($data) - 1] == 'php') {
$daemon = true;
} else {
$daemon = false;
}
} else {
$daemon = false;
}
}
$free_disk = disk_free_space('/') / disk_total_space('/');
$settings = new Settings();
$output = array('daemon' => $daemon, 'free_hdd' => $free_disk, 'nightFrom' => $settings->getSettings('Mode', 'nightFrom'), 'nightTo' => $settings->getSettings('Mode', 'nightTo'), 'nightAuto' => $settings->getSettings('Mode', 'nightAuto'));
return $output;
}
示例6: triggerWebtreesAdminTasks
public function triggerWebtreesAdminTasks()
{
$settings = new Settings();
$this->logger = \Piwik\Container\StaticContainer::get('Psr\\Log\\LoggerInterface');
$this->logger->info('Webtrees Admin Task triggered');
$rooturl = $settings->getSetting('webtreesRootUrl');
if (!$rooturl || strlen($rooturl->getValue()) === 0) {
return;
}
$token = $settings->getSetting('webtreesToken');
if (!$token || strlen($token->getValue()) === 0) {
return;
}
$taskname = $settings->getSetting('webtreesTaskName');
if (!$taskname || strlen($taskname->getValue()) === 0) {
return;
}
$url = sprintf('%1$s/module.php?mod=perso_admintasks&mod_action=trigger&force=%2$s&task=%3$s', $rooturl->getValue(), $token->getValue(), $taskname->getValue());
$this->logger->info('webtrees url : {url}', array('url' => $url));
try {
\Piwik\Http::sendHttpRequest($url, Webtrees::SOCKET_TIMEOUT);
} catch (Exception $e) {
$this->logger->warning('an error occured', array('exception' => $e));
}
}
示例7: action_index
public function action_index()
{
$settings = new Settings();
$settings->add_setting(new Setting_Preferences($this->user));
$settings->add_setting(new Setting_Profile($this->user));
$settings->add_setting(new Setting_Account($this->user));
// Run the events.
Event::fire('user.settings', array($this->user, $settings));
if ($this->request->method() == HTTP_Request::POST) {
$setting = $settings->get_by_id($this->request->post('settings-tab'));
if ($setting) {
$post = $this->request->post();
$validation = $setting->get_validation($post);
if ($validation->check()) {
try {
$setting->save($post);
Hint::success('Updated ' . $setting->title . '!');
} catch (ORM_Validation_Exception $e) {
Hint::error($e->errors('models'));
}
} else {
Hint::error($validation->errors());
}
} else {
Hint::error('Invalid settings id!');
}
}
$this->view = new View_User_Settings();
$this->view->settings = $settings;
}
示例8: testDefaultSettings
public function testDefaultSettings()
{
$settings = new Settings();
$this->assertEquals(Settings::DEFAULT_LENGTH, $settings->getLength());
$this->assertEquals(Settings::DEFAULT_WIDTH, $settings->getWidth());
$this->assertEquals(Settings::DEFAULT_BOMB_COUNT, $settings->getBombCount());
}
示例9: testResolvePartialPath
public function testResolvePartialPath()
{
$resolver = $this->prophesize('asylgrp\\workbench\\PathResolver');
$resolver->resolve('foo')->willReturn('resolved');
$settings = new Settings(['baz' => '[path:foo]/bar'], $resolver->reveal());
$this->assertSame('resolved/bar', $settings->read('baz'));
}
示例10: save
/**
* Save settings
*
* @param Newscoop\News\Item $item
* @return void
*/
public function save(array $values, Settings $settings)
{
$settings->setArticleTypeName($values['article_type']);
$settings->setPublicationId($values['publication']);
$settings->setSectionNumber($values['section']);
$this->odm->persist($settings);
$this->odm->flush();
}
示例11: __construct
function __construct($json, $supported_protocols)
{
$s = new Settings();
if ($json !== "") {
$s->fromJson($json);
}
$this->settings = $s;
}
示例12: writeablePathsCreated
public function writeablePathsCreated()
{
$Settings = new Settings();
$Settings->loadSettings();
if (trim($Settings->settings['TemplatesWriteablePath'] . chr(32)) != "" && trim($Settings->settings['SrcWriteablePath'] . chr(32)) != "" && trim($Settings->settings['ClassesWriteablePath'] . chr(32)) != "") {
return true;
}
return false;
}
示例13: message
function message($arr)
{
light_notification(false);
$settings = new Settings();
if ($settings->getSettings('CallNotifier', 'voice')) {
(new Player())->sound(Player::NOTIFICATION);
(new Player())->sound(Player::INCOMING_MESSAGE);
}
}
示例14: isAuth
protected function isAuth()
{
$Settings = new Settings();
$settings = $Settings->get('admin');
if (@$_COOKIE['pass'] == $settings['s_val']) {
return true;
} else {
return false;
}
}
示例15: del
function del()
{
$model = new Settings();
$model->del();
if ($_GET['parent'] != 0) {
$this->redirect('/settings/' . $_GET['parent'] . '/');
} else {
$this->redirect('/settings/');
}
}