本文整理汇总了PHP中config_item函数的典型用法代码示例。如果您正苦于以下问题:PHP config_item函数的具体用法?PHP config_item怎么用?PHP config_item使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
// Not an admin and not allowed to see files
if ($this->current_user->group !== 'admin' and !array_key_exists('files', $this->permissions)) {
$this->load->language('files/files');
show_error(lang('files.no_permissions'));
}
ci()->admin_theme = $this->theme_m->get_admin();
// Using a bad slug? Weak
if (empty($this->admin_theme->slug)) {
show_error('This site has been set to use an admin theme that does not exist.');
}
// make a constant as this is used in a lot of places
defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug);
// Prepare Asset library
$this->asset->set_theme(ADMIN_THEME);
// Set the location of assets
$this->config->set_item('asset_dir', dirname($this->admin_theme->web_path) . '/');
$this->config->set_item('asset_url', BASE_URL . dirname($this->admin_theme->web_path) . '/');
$this->config->set_item('theme_asset_dir', dirname($this->admin_theme->web_path) . '/');
$this->config->set_item('theme_asset_url', BASE_URL . dirname($this->admin_theme->web_path) . '/');
$this->load->model('files/file_folders_m');
$this->load->model('files/file_m');
$this->lang->load('files/files');
$this->lang->load('wysiwyg');
$this->lang->load('buttons');
$this->template->set_theme(ADMIN_THEME)->set_layout('wysiwyg', 'admin')->enable_parser(FALSE)->set('editor_path', config_item('asset_dir') . 'js/ckeditor/')->append_metadata(css('wysiwyg.css', 'wysiwyg'))->append_metadata(css('jquery/ui-lightness/jquery-ui.css'))->append_metadata(js('jquery/jquery.min.js'))->append_metadata(js('plugins.js'))->append_metadata(js('jquery/jquery-ui.min.js'))->append_metadata(js('wysiwyg.js', 'wysiwyg'));
}
示例2: S
function S($name, $value = '', $options = null)
{
$this->load->driver('cache', array('adapter' => 'redis', 'backup' => 'file'));
if ($this->cache->redis->is_supported()) {
if ('' === $value) {
// 获取缓存
return $this->cache->redis->get($name);
} elseif (is_null($value)) {
// 删除缓存
return $this->cache->redis->delete($name);
} else {
// 缓存数据
$expire = is_numeric($options) ? $options : config_item('cache_time');
return $this->cache->redis->save($name, $value, $expire);
}
}
if ('' === $value) {
// 获取缓存
return $this->cache->get($name);
} elseif (is_null($value)) {
// 删除缓存
return $this->cache->delete($name);
} else {
// 缓存数据
$expire = is_numeric($options) ? $options : NULL;
return $this->cache->save($name, $value, $expire);
}
}
示例3: up
public function up()
{
$fields = ['name' => ['type' => 'varchar', 'constraint' => 255], 'id' => ['type' => 'int', 'constraint' => 9, 'auto_increment' => true, 'unsigned' => true], 'created_on' => ['type' => 'datetime'], 'modified_on' => ['type' => 'datetime'], 'age' => ['type' => 'int', 'constraint' => 2]];
$this->dbforge->add_field($fields);
$this->dbforge->add_key('id', true);
$this->dbforge->create_table('rabbits', true, config_item('migration_create_table_attr'));
}
示例4: create_authd_post
function create_authd_post()
{
// Validation Rules
$this->form_validation->set_rules('address', 'Address', 'required');
$this->form_validation->set_rules('title', 'Title', 'required');
$this->form_validation->set_rules('locality', 'City', 'required');
// Passes Validation
if ($this->form_validation->run() == true) {
if ($this->input->post('site_id')) {
$site_id = $this->input->post('site_id');
} else {
$site_id = config_item('site_id');
}
$content_data = array('site_id' => $site_id, 'parent_id' => $this->input->post('parent_id'), 'category_id' => $this->input->post('category_id'), 'module' => 'places', 'type' => 'place', 'source' => $this->input->post('source'), 'order' => 0, 'user_id' => $this->oauth_user_id, 'title' => $this->input->post('title'), 'title_url' => form_title_url($this->input->post('title'), $this->input->post('title_url')), 'content' => $this->input->post('content'), 'details' => $this->input->post('details'), 'access' => $this->input->post('access'), 'comments_allow' => config_item('places_comments_allow'), 'geo_lat' => $this->input->post('geo_lat'), 'geo_long' => $this->input->post('geo_long'), 'viewed' => 'Y', 'approval' => 'Y', 'status' => form_submit_publish($this->input->post('status')));
$activity_data = array('title' => $this->input->post('title'), 'address' => $this->input->post('address'), 'locality' => $this->input->post('locality'), 'region' => $this->input->post('region'), 'geo_lat' => $this->input->post('geo_lat'), 'geo_long' => $this->input->post('geo_long'));
// Insert
$result = $this->social_igniter->add_content($content_data, $activity_data);
if ($result) {
// Process Tags
if ($this->input->post('tags')) {
$this->social_tools->process_tags($this->input->post('tags'), $result['content']->content_id);
}
// Add Place
$place_data = array('content_id' => $result['content']->content_id, 'address' => $this->input->post('address'), 'district' => $this->input->post('district'), 'locality' => $this->input->post('locality'), 'region' => $this->input->post('region'), 'country' => $this->input->post('country'), 'postal' => $this->input->post('postal'));
$place = $this->social_tools->add_place($place_data);
$message = array('status' => 'success', 'message' => 'Awesome we created your place', 'data' => $result['content'], 'activity' => $result['activity'], 'place' => $place);
} else {
$message = array('status' => 'error', 'message' => 'Oops we were unable to create your place');
}
} else {
$message = array('status' => 'error', 'message' => validation_errors());
}
$this->response($message, 200);
}
示例5: index
function index()
{
$per_page = (int) $this->input->get_post('per_page');
$cupage = config_item('site_page_num');
//每页显示个数
$return_arr = array('total_rows' => true);
$where = array();
// if($this->user_info->key != 'root'){
$where['status >='] = 0;
$where['gid !='] = 1;
// }
$title = htmlspecialchars($this->input->get_post("title"));
$like = array();
$string = '';
if ($title = trim($title)) {
$like['title'] = $title;
$string .= "title=" . $title;
}
$options = array('page' => $cupage, 'per_page' => $per_page, 'like' => $like, 'where' => $where, 'order' => 'gid desc');
$lc_list = $this->model->getAll($options, $return_arr);
//查询所有信息
$url = admin_base_url('user/group?');
$page = $this->sharepage->showPage($url, $return_arr['total_rows'], $cupage);
$data = array('lc_list' => $lc_list, 'page' => $page, 'title' => $title, 'totals' => $return_arr['total_rows']);
$this->_template('admin/user/grouplist', $data);
}
示例6: array
/**
* Class registry
*
* This function acts as a singleton. If the requested class does not
* exist it is instantiated and set to a static variable. If it has
* previously been instantiated the variable is returned.
*
* @access public
* @param string the class name being requested
* @param bool optional flag that lets classes get loaded but not instantiated
* @return object
*/
function &load_class($class, $instantiate = TRUE)
{
static $objects = array();
// Does the class exist? If so, we're done...
if (isset($objects[$class])) {
return $objects[$class];
}
// If the requested class does not exist in the application/libraries
// folder we'll load the native class from the system/libraries folder.
if (file_exists(APPPATH . 'libraries/' . config_item('subclass_prefix') . $class . EXT)) {
require BASEPATH . 'libraries/' . $class . EXT;
require APPPATH . 'libraries/' . config_item('subclass_prefix') . $class . EXT;
$is_subclass = TRUE;
} else {
if (file_exists(APPPATH . 'libraries/' . $class . EXT)) {
require APPPATH . 'libraries/' . $class . EXT;
$is_subclass = FALSE;
} else {
require BASEPATH . 'libraries/' . $class . EXT;
$is_subclass = FALSE;
}
}
if ($instantiate == FALSE) {
$objects[$class] = TRUE;
return $objects[$class];
}
if ($is_subclass == TRUE) {
$name = config_item('subclass_prefix') . $class;
$objects[$class] =& new $name();
return $objects[$class];
}
$name = $class != 'Controller' ? 'CI_' . $class : $class;
$objects[$class] =& new $name();
return $objects[$class];
}
示例7: check_lang
public function check_lang()
{
$result = array('title' => lang('ionize_title_check_lang'), 'status' => 'success', 'message' => lang('ionize_message_check_ok'));
// Get the languages : DB + config/language.php
$db_languages = Settings::get_languages();
$config_available_languages = config_item('available_languages');
// Check differences between DB and config/language.php file
$result_status = TRUE;
foreach ($db_languages as $lang) {
if (!array_key_exists($lang['lang'], $config_available_languages)) {
$result_status = FALSE;
}
}
// Correct if needed
if ($result_status == FALSE) {
// Default language
$def_lang = '';
// Available languages array
$available_languages = array();
foreach ($db_languages as $l) {
// Set default lang code
if ($l['def'] == '1') {
$def_lang = $l['lang'];
}
$available_languages[$l['lang']] = $l['name'];
}
$this->config_model->change('language.php', 'default_lang_code', $def_lang);
if (!empty($available_languages)) {
$this->config_model->change('language.php', 'available_languages', $available_languages);
}
$result['message'] = lang('ionize_message_check_corrected');
}
$this->xhr_output($result);
}
示例8: send_to_email
public function send_to_email($name, $age, $email)
{
try {
$subject = "[KepoAbis.com] Happy Birthday " . $name;
$from = "contact@kepoabis.com";
$to = $email;
$message = "<p><strong>HAPPY BIRTHDAY " . $name . " yang ke-" . $age . "</strong></p>";
$message .= "<br><p>Semoga tercapai segala cita-citanya :D</p><br><br>";
$message .= "<strong>Best Regards,<br>\n\t\t\t\t\t\tHaamill Productions</strong>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<br>Jalan Pelita RT 02/09 No. 69 Kel. Tengah, Kec. Kramat Jati, Jakarta Timur 13540, Indonesia\n\t\t\t\t\t\t<br><a href='http://kepoabis.com'>KepoAbis.com</a> by Haamill Productions\n\t\t\t\t\t\t<br>Phone: 085697309204\n\t\t\t\t\t\t<br>Email: hi@kepoabis.com or contact@kepoabis.com";
$body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
body {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
<p>' . $message . '</p>
</body>
</html>';
//$body = $this->email->full_html($subject, $message);
$result = $this->email->from($from)->to($to)->subject($subject)->message($body)->send();
echo $result . "<br>" . $message;
} catch (Exception $e) {
print_r($e->getMessage());
}
}
示例9: up
public function up()
{
$this->load->config('install');
$this->load->library('installer');
// Add New Design Settings
$this->installer->install_settings('design', config_item('design_settings'), TRUE);
}
示例10: csrf_verify
/**
* CSRF Verify
*
* @return CI_Security
*/
public function csrf_verify()
{
// If it's not a POST request we will set the CSRF cookie
if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {
return $this->csrf_set_cookie();
}
// Check if URI has been whitelisted from CSRF checks
if ($exclude_uris = config_item('csrf_exclude_uris')) {
$uri = load_class('URI', 'core');
foreach ($exclude_uris as $excluded) {
if (preg_match('#^' . $excluded . '$#i' . (UTF8_ENABLED ? 'u' : ''), $uri->uri_string())) {
return $this;
}
}
}
// Do the tokens exist in both the _POST and _COOKIE arrays?
if (!isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) or $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) {
$this->csrf_show_error();
}
// We kill this since we're done and we don't want to polute the _POST array
unset($_POST[$this->_csrf_token_name]);
// Regenerate on every submission?
if (config_item('csrf_regenerate')) {
// Nothing should last forever
unset($_COOKIE[$this->_csrf_cookie_name]);
$this->_csrf_hash = NULL;
}
$this->_csrf_set_hash();
$this->csrf_set_cookie();
log_message('info', 'CSRF token verified');
return $this;
}
示例11: _error_view_path
private function _error_view_path()
{
if (!($_template_path = config_item('error_views_path'))) {
$_template_path = VIEWPATH . '/errors/';
}
return str_replace(VIEWPATH, '', $_template_path);
}
示例12: index
function index()
{
// Get Users
$users = $this->social_auth->get_users('active', 1);
$users_view = NULL;
// Title Stuff
$this->data['page_title'] = 'Users';
$this->data['sub_title'] = 'Manage';
// Users View Loop
foreach ($users as $user) {
$this->data['user_id'] = $user->user_id;
$this->data['name'] = $user->name;
$this->data['avatar'] = $this->social_igniter->profile_image($user->user_id, $user->image, $user->email);
$this->data['profile'] = base_url() . 'profile/' . $user->username;
$this->data['created_on'] = format_datetime('SIMPLE_ABBR', $user->created_on);
$this->data['last_login'] = format_datetime('SIMPLE_TIME_ABBR', $user->last_login);
// Alerts
$this->data['user_alerts'] = item_alerts_user($user);
// Actions
$this->data['user_state'] = item_user_state($user->active);
$this->data['user_edit'] = base_url() . 'users/manage/' . $user->user_id;
$this->data['user_delete'] = base_url() . 'api/users/destroy/id/' . $user->user_id;
// View
$users_view .= $this->load->view(config_item('dashboard_theme') . '/partials/item_users.php', $this->data, true);
}
// Final Output
$this->data['users_view'] = $users_view;
$this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
$this->render('dashboard_wide');
}
示例13: hashPassword
/**
* A standardized method for hasing a password before storing
* in the database.
*
* @param $password
* @return bool|mixed|string
*/
public static function hashPassword($password)
{
if (!config_item('auth.hash_cost')) {
get_instance()->load->config('auth');
}
return password_hash($password, PASSWORD_DEFAULT, ['cost' => config_item('auth.hash_cost')]);
}
示例14: form_open
/**
* Form Declaration
*
* Creates the opening portion of the form.
*
* @param string the URI segments of the form destination
* @param array a key/value pair of attributes
* @param array a key/value pair hidden data
* @return string
*/
function form_open($action = '', $attributes = array(), $hidden = array())
{
$CI =& get_instance();
// If no action is provided then set to the current url
if (!$action) {
// Modified by Deepak Patil <deepak.patil@relesol.com>, 23-FEB-2015.
//$action = $CI->config->site_url($CI->uri->uri_string());
$action = CURRENT_URL;
//
} elseif (strpos($action, '://') === FALSE) {
$action = $CI->config->site_url($action);
}
$attributes = _attributes_to_string($attributes);
if (stripos($attributes, 'method=') === FALSE) {
$attributes .= ' method="post"';
}
if (stripos($attributes, 'accept-charset=') === FALSE) {
$attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
}
$form = '<form action="' . $action . '"' . $attributes . ">\n";
// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
// Modified by Deepak Patil <deepak.patil@relesol.com>, 04-NOV-2011.
//if ($CI->config->item('csrf_protection') === TRUE && strpos($action, $CI->config->base_url()) !== FALSE && ! stripos($form, 'method="get"'))
// Aways add the hidden value for protecting AJAX requests, when the global configuration option 'csrf_protection' is off.
if (strpos($action, $CI->config->base_url()) !== FALSE && !stripos($form, 'method="get"')) {
$hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}
if (is_array($hidden)) {
foreach ($hidden as $name => $value) {
$form .= '<input type="hidden" name="' . $name . '" value="' . form_prep($value) . '" style="display:none;" />' . "\n";
}
}
return $form;
}
示例15: ip_address
function ip_address()
{
$ING =& get_instance();
if ($ING->input->fetch_ip_address() !== FALSE) {
return $ING->input->fetch_ip_address();
}
$proxy_ips = config_item('proxy_ips');
if (!empty($proxy_ips)) {
$proxy_ips = explode(',', str_replace(' ', '', $proxy_ips));
foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header) {
if (($spoof = server($header)) !== FALSE) {
// Some proxies typically list the whole chain of IP
// addresses through which the client has reached us.
// e.g. client_ip, proxy_ip1, proxy_ip2, etc.
if (strpos($spoof, ',') !== FALSE) {
$spoof = explode(',', $spoof, 2);
$spoof = $spoof[0];
}
if (!valid_ip($spoof)) {
$spoof = FALSE;
} else {
break;
}
}
}
$ING->input->set_ip_address($spoof !== FALSE && in_array($_SERVER['REMOTE_ADDR'], $proxy_ips, TRUE) ? $spoof : $_SERVER['REMOTE_ADDR']);
} else {
$ING->input->set_ip_address($_SERVER['REMOTE_ADDR']);
}
if (!valid_ip($ING->input->fetch_ip_address())) {
$ING->input->set_ip_address('0.0.0.0');
}
return $ING->input->fetch_ip_address();
}