本文整理汇总了PHP中config::item方法的典型用法代码示例。如果您正苦于以下问题:PHP config::item方法的具体用法?PHP config::item怎么用?PHP config::item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config::item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteCounters
public function deleteCounters($resource, $itemID)
{
// Get resource ID
$resourceID = config::item('resources', 'core', $resource, 'resource_id');
$reval = $this->db->delete('core_counters', array('resource_id' => $resourceID, 'item_id' => $itemID), is_array($itemID) ? count($itemID) : 1);
return $reval;
}
示例2: __construct
public function __construct()
{
parent::__construct();
if (!config::item('news_blog', 'news') && uri::segment(1) != 'news') {
router::redirect('news/' . utf8::substr(uri::getURI(), 5));
}
}
示例3: _saveSubject
protected function _saveSubject($subjectID)
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Create rules
$rules = $input = array();
// Get subject data
$subjectData = array();
foreach (config::item('languages', 'core', 'keywords') as $languageID => $language) {
$rules['name_' . $language] = array('label' => __('name', 'system') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required', 'max_length' => 255));
$input[] = 'name_' . $language;
}
// Assign rules
validate::setRules($rules);
// Validate fields
if (!validate::run()) {
return false;
}
// Get subject data
$subject = input::post($input);
$subject['active'] = input::post('active') ? 1 : 0;
// Save subject
if (!($subjectID = $this->reports_subjects_model->saveSubject($subjectID, $subject))) {
view::setError(__('save_error', 'system'));
return false;
}
// Success
view::setInfo(__('subject_saved', 'reports_subjects'));
router::redirect('cp/content/reports/subjects/edit/' . $subjectID);
}
示例4: postBlog
public function postBlog($items, $users)
{
$stream = array();
loader::model('blogs/blogs');
$params = array('select_users' => false);
// Get blogs
$columns = array('`b`.`blog_id` IN (' . implode(',', array_keys($items)) . ')');
$blogs = codebreeder::instance()->blogs_model->getBlogs('in_list', $columns, array(), false, count($items), $params);
foreach ($items as $itemID => $data) {
if (isset($blogs[$itemID]) && isset($users[$blogs[$itemID]['user_id']])) {
foreach ($data as $actionID => $item) {
$stream[$itemID][$actionID]['html'] = view::load('blogs/timeline/blog', array('user' => $users[$blogs[$itemID]['user_id']], 'blog' => $blogs[$itemID], 'params' => $item['params']), true);
$stream[$itemID][$actionID]['rating']['total_votes'] = $blogs[$itemID]['total_votes'];
$stream[$itemID][$actionID]['rating']['total_score'] = $blogs[$itemID]['total_score'];
$stream[$itemID][$actionID]['rating']['total_rating'] = $blogs[$itemID]['total_rating'];
$stream[$itemID][$actionID]['rating']['total_likes'] = $blogs[$itemID]['total_likes'];
$stream[$itemID][$actionID]['rating']['type'] = config::item('blog_rating', 'blogs');
$stream[$itemID][$actionID]['comments']['total_comments'] = $blogs[$itemID]['total_comments'];
$stream[$itemID][$actionID]['comments']['privacy'] = $blogs[$itemID]['comments'];
$stream[$itemID][$actionID]['comments']['post'] = $blogs[$itemID]['comments'] && codebreeder::instance()->users_model->getPrivacyAccess($blogs[$itemID]['user_id'], $blogs[$itemID]['comments'], false, $users[$blogs[$itemID]['user_id']]['friends'] ? 1 : 0) ? true : false;
}
}
}
return $stream;
}
示例5: invoices
public function invoices()
{
// Get page
$page = is_numeric(input::get('page')) && input::get('page') > 0 ? input::get('page') : 1;
// Parameters
$params = array('join_columns' => array('`t`.`user_id`=' . session::item('user_id')));
// Process query string
$qstring = $this->parseQuerystring(config::item('invoices_per_page', 'billing'), session::item('total_transactions'));
// Get invoices
$invoices = array();
if (session::item('total_transactions')) {
$invoices = $this->transactions_model->getTransactions($params['join_columns'], '', $qstring['limit']);
} else {
view::setInfo(__('no_invoices_user', 'billing_transactions'));
}
// Set pagination
$config = array('base_url' => config::siteURL('billing/invoices?'), 'total_items' => session::item('total_transactions'), 'items_per_page' => config::item('invoices_per_page', 'billing'), 'current_page' => $page, 'uri_segment' => 'page');
$pagination = loader::library('pagination', $config, null);
// Assign vars
view::assign(array('invoices' => $invoices, 'pagination' => $pagination));
// Set title
view::setTitle(__('invoices', 'billing_transactions'));
// Load view
view::load('billing/invoices');
}
示例6: _sendFeedback
protected function _sendFeedback()
{
// Check if demo mode is enabled
if (input::demo()) {
return false;
}
// Extra rules
$rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000)));
if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
$rules['captcha'] = array('rules' => array('is_captcha'));
}
validate::setRules($rules);
// Validate form values
if (!validate::run($rules)) {
return false;
}
// Get values
$email = input::post('email');
$subject = input::post('subject');
$message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress();
// Send feedback
if (!$this->feedback_model->sendFeedback($email, $subject, $message)) {
if (!validate::getTotalErrors()) {
view::setError(__('send_error', 'system'));
}
return false;
}
// Success
view::setInfo(__('message_sent', 'feedback'));
router::redirect('feedback');
}
示例7: sendTemplate
public function sendTemplate($keyword, $email, $tags = array(), $language = '')
{
loader::model('system/emailtemplates');
if (!$language) {
$language = config::item('language_id', 'system');
}
if (is_numeric($language)) {
$language = config::item('languages', 'core', 'keywords', $language);
} elseif (!in_array($language, config::item('languages', 'core', 'keywords'))) {
return false;
}
if (!($template = config::item($keyword . '_' . $language, '_system_emails_cache'))) {
if (!($template = $this->cache->item('core_email_template_' . $keyword . '_' . $language))) {
$template = $this->emailtemplates_model->prepareTemplate($keyword, $language);
if (count($template) == 3) {
if ($template[$keyword]['active']) {
$template = array('subject' => $template[$keyword]['subject'], 'message_html' => utf8::trim($template['header']['message_html'] . $template[$keyword]['message_html'] . $template['footer']['message_html']), 'message_text' => utf8::trim($template['header']['message_text'] . "\n\n" . $template[$keyword]['message_text'] . "\n\n" . $template['footer']['message_text']));
} else {
$template = 'none';
}
} else {
error::show('Could not fetch email template from the database: ' . $keyword);
}
$this->cache->set('core_email_template_' . $keyword . '_' . $language, $template, 60 * 60 * 24 * 30);
}
config::set(array($keyword . '_' . $language => $template), '', '_system_emails_cache');
}
$retval = true;
if (is_array($template) && $template) {
$retval = $this->sendEmail($email, $template['subject'], $template['message_text'], $template['message_html'], $tags);
}
return $retval;
}
示例8: formatDate
public static function formatDate($time = '', $format = 'stamp', $usa = true, $offset = 0, $dst = null)
{
$usa = config::item('time_euro', 'system') ? false : true;
$offset = session::item('time_zone') * 60 * 60;
$dst = date('i') ? 3600 : 0;
return parent::formatDate($time, $format, $usa, $offset, $dst);
}
示例9: getTimeline
public static function getTimeline($user = array(), $privacy = 2, $template = 'timeline/helpers/timeline')
{
loader::model('timeline/timeline');
// Get actions
$actions = codebreeder::instance()->timeline_model->getActions($user ? $user['user_id'] : 0, true, 0, config::item('actions_per_page', 'timeline'));
$ratings = array();
// Do we have actions and are we logged in?
if ($actions && users_helper::isLoggedin()) {
foreach ($actions as $action) {
if ($action['rating']) {
$ratings[$action['relative_resource']][] = $action['item_id'];
} else {
$ratings['timeline'][] = $action['action_id'];
}
}
// Load votes and like models
loader::model('comments/votes');
loader::model('comments/likes');
// Get likes and votes
$likes = codebreeder::instance()->likes_model->getMultiLikes($ratings);
$votes = codebreeder::instance()->votes_model->getMultiVotes($ratings);
$ratings = $likes + $votes;
}
// Can we post messages?
$post = session::permission('messages_post', 'timeline') && codebreeder::instance()->users_model->getPrivacyAccess($user['user_id'], $privacy, false) ? true : false;
view::assign(array('actions' => $actions, 'user' => $user, 'post' => $post, 'ratings' => $ratings), '', $template);
// Update comments pagination
config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
return view::load($template, array(), 1);
}
示例10: style
/**
* Generates a style tag
* @param string $name style name
* @return void
*/
public static function style($name)
{
$format = '<link rel="stylesheet" href="%s" />';
$name .= '.css';
config::load('locations');
$location = config::item('location_css');
printf($format, BASE . $location . $name);
}
示例11: usersSignup
public function usersSignup($userID, $user)
{
if (config::item('credits_signup_bonus', 'billing') && (!isset($user['total_credits']) || $user['total_credits'] == 0)) {
loader::model('billing/credits');
$this->credits_model->addCredits($userID, config::item('credits_signup_bonus', 'billing'));
}
return true;
}
示例12: saveThumbnail
public function saveThumbnail($pictureID, $x, $y, $w, $h)
{
$files = $this->storage_model->getFiles($pictureID, 2, array('', 't'));
$retval = $this->storage_model->thumbnail($files[''], $x, $y, $w, $h, config::item('picture_dimensions_t', 'classifieds'), $files['t']['suffix'], $files['t']['file_id']);
// Action hook
hook::action('classifieds/pictures/thumbnail', $pictureID);
return $retval;
}
示例13: cronRun
public function cronRun()
{
if (config::item('notices_cleanup_delay', 'timeline')) {
loader::model('timeline/notices', array(), 'timeline_notices_model');
$this->timeline_notices_model->cleanup();
}
return true;
}
示例14: cronRun
public function cronRun()
{
$this->users_model->cleanup();
if (config::item('cleanup_delay', 'users')) {
loader::model('users/visitors', array(), 'users_visitors_model');
$this->users_visitors_model->cleanup();
}
return true;
}
示例15: captcha
public static function captcha($name, $value = '')
{
$service = config::item('default_captcha', 'security');
$settings = config::item('default_captcha_settings', 'security');
// Load library
loader::library('captchas/' . $service, $settings, 'captcha_' . $service);
$str = codebreeder::instance()->{'captcha_' . $service}->getCaptcha($name);
return $str;
}