本文整理汇总了PHP中Settings::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::get方法的具体用法?PHP Settings::get怎么用?PHP Settings::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Logs one user on the admin panel
*
*/
function login()
{
$default_admin_lang = Settings::get_default_admin_lang();
$uri_lang = Settings::get_uri_lang();
// If the user is already logged and if he is in the correct minimum group, go to Admin
if ($this->connect->logged_in() && $this->connect->is('editors', true)) {
redirect(base_url() . $uri_lang . '/' . config_item('admin_url'));
}
if (!empty($_POST)) {
unset($_POST['submit']);
if ($this->_try_validate_login()) {
// Syntax talks from itself, isn't it? :)
// The login method will check for a 'remember_me' value
// If found it will remember the user until he log out.
// Remember time is specified time in the access config file (default is 7 days)
try {
$this->connect->login($_POST);
redirect(base_url() . $uri_lang . '/' . config_item('admin_url'));
} catch (Exception $e) {
$this->login_errors = $e->getMessage();
}
} else {
$this->login_errors = lang('ionize_login_error');
}
} else {
if (!in_array($uri_lang, Settings::get('displayed_admin_languages')) or $uri_lang == config_item('admin_uri')) {
redirect(base_url() . $default_admin_lang . '/' . config_item('admin_url') . '/user/login');
}
}
$this->output('access/login');
}
示例2: __construct
function __construct()
{
$auth = Settings::get('auth');
if (isset($auth[$this->name])) {
$this->settings = $auth[$this->name];
}
}
示例3: get_current_usage
public static function get_current_usage()
{
/* Permission check. */
if (Permission::has('operator_parking_usage')) {
/* Select query. */
$select = Database::query("SELECT rc.type_card FROM parking AS p INNER JOIN rfid_card AS rc ON rc.id = p.rfid_id WHERE start_date IS NOT NULL AND end_date IS NULL");
/* Controleren of query is gelukt. */
if ($select) {
/* Return array. */
$return = array();
/* Vul het aantal in. */
$return['aantal'] = array('totaal' => $select->num_rows, 'ad-hoc' => 0, 'subscription' => 0, 'guest' => 0);
/* Loop elk item bij langs. */
while ($obj = $select->fetch_object()) {
/* Tel de huidige kaart in de array op. */
$return['aantal'][strtolower($obj->type_card)]++;
}
/* Bereken procenten. */
$procent = $return['aantal']['totaal'] / Settings::get('citypark_parking_space') * 100;
/* Vul procenten in. */
$return['procent'] = round($procent);
/* Return de array als object. */
return (object) $return;
} else {
/* Foutmelding. */
throw new Exception('Er ging wat fout bij het berekenen van het parkeer verbruik.');
}
} else {
/* Geen rechten. */
throw new Exception('U heeft geen rechten om het parkeer verbruik te mogen zien.');
}
}
示例4: watermark
private function watermark($data = array())
{
$this->load->library('files/files');
$mark_text = isset($data['text']) ? $data['text'] : Settings::get('site_name');
$font_color = isset($data['font_color']) ? $data['font_color'] : 'ffffff';
$opacity = isset($data['opacity']) ? (int) $data['opacity'] : 100;
$font_size = isset($data['font_size']) ? (int) $data['font_size'] : 12;
$files = $data['files'];
$font_path = './' . SHARED_ADDONPATH . 'modules/watermark/fonts/Gabrielle.ttf';
if (is_array($files) && count($files) > 0) {
foreach ($files as $file) {
$filedata = Files::get_file($file);
if ($filedata['status'] === TRUE) {
$dirpath = FCPATH . '/uploads/default/files/';
$source = $dirpath . $filedata['data']->filename;
$imageLayer = ImageWorkshop::initFromPath($source);
//var_dump($imageLayer);exit;
$textLayer = ImageWorkshop::initTextLayer($mark_text, $font_path, $font_size, $font_color, $data['rotation']);
$textLayer->opacity($opacity);
$imageLayer->addLayerOnTop($textLayer, 12, 12, $data['position']);
$image = $imageLayer->getResult();
$imageLayer->save($dirpath, $filedata['data']->filename, false, null, 100);
$wm_data = array('file_id' => $filedata['data']->id, 'folder_id' => $filedata['data']->folder_id);
$this->watermark_m->insert($wm_data);
}
}
$this->session->set_flashdata('success', lang('watermark:submit_success'));
redirect('admin/watermark');
} else {
$this->session->set_flashdata('error', lang('watermark:no_files_remaining'));
redirect('admin/watermark');
}
}
示例5: index
/**
* List all FAQs using Streams CP Driver
*
* @access public
* @return void
*/
public function index()
{
$extra['title'] = lang('faq:faqs');
$extra['sorting'] = true;
$extra['buttons'] = array(array('label' => lang('global:edit'), 'url' => 'admin/faq/edit/-entry_id-'), array('label' => lang('global:delete'), 'url' => 'admin/faq/delete/-entry_id-', 'confirm' => true));
$this->streams->cp->entries_table('faqs', 'faq', Settings::get('records_per_page'), 'admin/faq/index', true, $extra);
}
示例6: init
function init()
{
$this->_helper->Init->init();
if (!$this->user->isLogged()) {
Functions::redirect('//' . Settings::get('root_domain') . '/login/');
}
}
示例7: save
/**
* Saves one Page
*
* @param array Page data table
* @param array Page Lang depending data table
*
* @return string The inserted / updated page ID
*
*/
function save($data, $lang_data)
{
// Dates
$data['publish_on'] = $data['publish_on'] ? getMysqlDatetime($data['publish_on'], Settings::get('date_format')) : '0000-00-00';
$data['publish_off'] = $data['publish_off'] ? getMysqlDatetime($data['publish_off'], Settings::get('date_format')) : '0000-00-00';
$data['logical_date'] = $data['logical_date'] ? getMysqlDatetime($data['logical_date'], Settings::get('date_format')) : '0000-00-00';
// Creation date
if (!$data['id_page'] or $data['id_page'] == '') {
$data['created'] = date('Y-m-d H:i:s');
} else {
$data['updated'] = date('Y-m-d H:i:s');
}
// Be sure URLs are unique
$this->set_unique_urls($lang_data, $data['id_page']);
// Clean metas data
foreach ($lang_data as $lang => $row) {
foreach ($row as $key => $value) {
if ($key == 'meta_description') {
$lang_data[$lang][$key] = preg_replace('[\\"]', '', $value);
}
if ($key == 'meta_keywords') {
$lang_data[$lang][$key] = preg_replace('/[\\"\\.;]/i ', '', $value);
}
}
}
// Base model save method call
return parent::save($data, $lang_data);
}
示例8: __construct
function __construct($user)
{
$this->settings = Settings::get($this->user['database'])->toArray();
$this->shipment = new ShipOnline($this->settings['shiponline']['user'], $this->settings['shiponline']['password'], $this->settings['shiponline']['token']);
$this->carrier = 'UPS';
// fix me
}
示例9: newPropertyTableInfoFetcher
/**
* @since 2.3
*
* @return PropertyTableInfoFetcher
*/
public function newPropertyTableInfoFetcher()
{
$propertyTableInfoFetcher = new PropertyTableInfoFetcher();
$propertyTableInfoFetcher->setCustomFixedPropertyList($this->settings->get('smwgFixedProperties'));
$propertyTableInfoFetcher->setCustomSpecialPropertyList($this->settings->get('smwgPageSpecialProperties'));
return $propertyTableInfoFetcher;
}
示例10: get_ionize_notifications
public function get_ionize_notifications()
{
if ($this->notification_model->should_refresh()) {
$this->load->library('curl');
$this->curl->option(CURLOPT_USERAGENT, $this->input->user_agent());
$this->curl->option(CURLOPT_RETURNTRANSFER, TRUE);
$h = $this->input->request_headers();
$h = array_change_key_case($h);
$headers = array('X-source: ionize', 'X-version: ' . Settings::get('ionize_version'), 'X-host: ' . (isset($h['host']) ? $h['host'] : ''));
if (!empty($h['accept-language'])) {
$headers[] = 'accept-language:' . $h['accept-language'];
}
$this->curl->option(CURLOPT_HTTPHEADER, $headers);
$result = $this->curl->simple_get('http://ionizecms.com/ionize_notification');
$result = json_decode($result, TRUE);
$this->notification_model->set_refreshed();
if (!empty($result)) {
if (!empty($result['version'])) {
$this->notification_model->set_last_version($result['version']);
}
if (!empty($result['notifications'])) {
$this->notification_model->update_ionize_notifications($result['notifications']);
}
$this->xhr_output($result);
} else {
$this->xhr_output(array());
}
} else {
$result = $this->notification_model->get_networked_ionize_notifications();
$this->xhr_output($result);
}
}
示例11: getSiteName
public static function getSiteName()
{
if ($name = Settings::get('site', 'name')) {
return $name;
}
return Yii::app()->name;
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->_table = 'choices';
$this->primary_key = 'id';
$this->site_lang = Settings::get('site_lang');
}
示例13: login
/**
* Logs one user on the admin panel
*
*/
function login()
{
$default_admin_lang = Settings::get_default_admin_lang();
$uri_lang = Settings::get_uri_lang();
// If the user is already logged and if he is in the correct minimum group, go to Admin
if ($this->connect->logged_in() && $this->connect->is('editors', true)) {
redirect(base_url() . $uri_lang . '/' . config_item('admin_url'));
}
if (!empty($_POST)) {
unset($_POST['submit']);
if ($this->_try_validate_login()) {
// User can log with email OR username
if (strpos($_POST['username'], '@') !== FALSE) {
$email = $_POST['username'];
unset($_POST['username']);
$_POST['email'] = $email;
}
try {
$this->connect->login($_POST);
redirect(base_url() . $uri_lang . '/' . config_item('admin_url'));
} catch (Exception $e) {
$this->login_errors = $e->getMessage();
}
} else {
$this->login_errors = lang('ionize_login_error');
}
} else {
if (!in_array($uri_lang, Settings::get('displayed_admin_languages')) or $uri_lang != $default_admin_lang) {
redirect(base_url() . $default_admin_lang . '/' . config_item('admin_url') . '/user/login');
}
}
$this->output('access/login');
}
示例14: get
public function get($id_media)
{
// Pictures data from database
$picture = $id_media ? $this->media_model->get($id_media) : FALSE;
$options = $this->uri->uri_to_assoc();
unset($options['get']);
if (empty($options['size'])) {
$options['size'] = 120;
}
// Path to the picture
if ($picture && file_exists($picture_path = DOCPATH . $picture['path'])) {
$thumb_path = DOCPATH . Settings::get('files_path') . str_replace(Settings::get('files_path') . '/', '/.thumbs/', $picture['base_path']);
$thumb_file_path = $this->medias->get_thumb_file_path($picture, $options);
$refresh = !empty($options['refresh']) ? TRUE : FALSE;
// If no thumb, try to create it
if (!file_exists($thumb_file_path) or $refresh === TRUE) {
try {
$thumb_file_path = $this->medias->create_thumb(DOCPATH . $picture['path'], $thumb_file_path, $options);
} catch (Exception $e) {
// $return_thumb_path = FCPATH.'themes/'.Settings::get('theme_admin').'/styles/'.Settings::get('backend_ui_style').'/images/icon_48_no_folder_rights.png';
}
}
$mime = get_mime_by_extension($thumb_file_path);
$content = read_file($thumb_file_path);
$this->push_thumb($content, $mime, 0);
} else {
$mime = 'image/png';
$content = read_file(FCPATH . 'themes/' . Settings::get('theme_admin') . '/styles/' . Settings::get('backend_ui_style') . '/images/icon_48_no_source_picture.png');
$this->push_thumb($content, $mime, 0);
}
}
示例15: early_checks
/**
* Check that the API is enabled
*/
public function early_checks()
{
if (!Settings::get('api_enabled')) {
$this->response(array('status' => false, 'error' => 'This API is currently disabled.'), 505);
exit;
}
}