本文整理汇总了PHP中Config::item方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::item方法的具体用法?PHP Config::item怎么用?PHP Config::item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: item
function item($items)
{
static $instance = array();
$item = explode('.', $items, 2);
$lg = $item[0];
$it = $item[1];
if (!file_exists(BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'languages' . DS . Config::item('lang') . DS . $lg . '.php')) {
$lang_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'languages' . DS . 'english' . DS . $lg . '.php';
} else {
$lang_file = BASE_DIR . 'plugins' . DS . 'forum' . DS . 'forum' . DS . 'languages' . DS . DS . Config::item('lang') . DS . $lg . '.php';
}
if (!isset($instance[$lg])) {
include $lang_file;
$instance[$lg] = $lang;
}
if (isset($instance[$lg][$it])) {
if ($it) {
return $instance[$lg][$it];
} else {
return $instance[$lg];
}
} else {
return $items;
}
}
示例2: img
function img($src, $size = '100%', $params = array())
{
if (!$size) {
$size = Config::item('thumb_size');
}
$image_info = @getimagesize($src);
if ($image_info[3]) {
$sizes = explode('"', $image_info[3]);
$image_info[0] = $sizes[1];
$image_info[1] = $sizes[3];
}
if (strpos($size, '%') !== false) {
$image_info[0] = round($image_info[0] * (int) $size / 100);
$image_info[1] = round($image_info[1] * (int) $size / 100);
} else {
if (max($image_info[0], $image_info[1]) > $size) {
$ratio = $size / max($image_info[0], $image_info[1]);
$image_info[0] = round($image_info[0] * $ratio);
$image_info[1] = round($image_info[1] * $ratio);
}
}
if ($image_info[1] && $image_info[1]) {
return "<img border=\"0\" src=\"{$src}\" width=\"{$image_info[0]}\" height=\"{$image_info[1]}\" " . html::params($params) . "/>";
} else {
return "<img border=\"0\" src=\"{$src}\" " . html::params($params) . "/>";
}
}
示例3: __construct
function __construct($method)
{
$dcUrl = Config::item('dcInfo');
$this->ip = $dcUrl['ip'];
$this->method = $method;
$this->user = array('user' => $dcUrl['user'], 'ip' => \common\Client::getIp());
}
示例4: __construct
public function __construct($config = array())
{
// Check for GD library before doing anything
if (extension_loaded('gd')) {
$config += Config::item('dynamicimage');
$this->config = $config;
// Check for a filename and check it is a file
if ($this->config['filename'] && is_file($this->config['filename'])) {
// Set filename
$this->filename = $this->config['filename'];
$this->gd_data = getimagesize($this->filename);
$this->gd_image_out = FALSE;
// Get filesize
$this->filesize = filesize($this->filename);
// Get the Mimetype
$this->mime_type = $this->gd_data['mime'];
// Get dimensions
$this->width = $this->gd_data[0];
$this->height = $this->gd_data[1];
$this->background_colour = $this->config['background'];
$this->maintain_transparency = $this->config['maintain_transparency'];
// Setup GD object
switch ($this->gd_data['mime']) {
// If image is PNG, load PNG file
case "image/png":
$this->gd_image = imagecreatefrompng($this->filename);
break;
// If image is JPG, load JPG file
// If image is JPG, load JPG file
case "image/jpg":
$this->gd_image = imagecreatefromjpeg($this->filename);
break;
// If image is GIF, load GIF file
// If image is GIF, load GIF file
case "image/gif":
$this->gd_image = imagecreatefromgif($this->filename);
break;
// Otherwise image is not supported in this version (more to follow)
// Otherwise image is not supported in this version (more to follow)
default:
throw new Kohana_Exception("DynamicImage.__construct() Filetype {$this->mime_type} not supported yet.");
return;
}
$this->print_image($this->config['width'], $this->config['height'], $this->config['maintain_ratio'], $this->config['format']);
} else {
// Otherwise die horribly
return FALSE;
}
} else {
// Die informing user of lack of extentions
throw new Kohana_Exception('GD Library not installed');
return;
}
}
示例5: Controller
function Controller()
{
$this->validate = Inspekt::makeSuperCage();
$this->db = Database::getInstance(array('conn_id' => Config::item('LINK_ID')));
$this->view = new View();
// auto load helper
load_helper(array('php', 'time', 'html', 'form', 'table', 'forum'));
// load forum model
load_model('forum', FALSE);
load_model('check', FALSE);
$this->forum = forum_model::getInstance();
}
示例6: pailemai_categorylist
public static function pailemai_categorylist(\ApiParam $params)
{
//拍了卖专用
$mobileCategoryList = array();
$coverImageList = \Config::item('app.categoryCoverImages');
$blackCategoryList = array('huochepiao', 'shoujihaoma', 'cheliangqiugou', 'qiumai');
foreach ($coverImageList as $categoryEnglishName => $imageUrl) {
if (in_array($categoryEnglishName, $blackCategoryList)) {
continue;
}
$category = \Category::loadByName($categoryEnglishName);
if ($category->name) {
$mobileCategoryList[] = array('name' => $category->name, 'queryUri' => 'categoryEnglishName:' . $categoryEnglishName, 'pic' => $imageUrl, 'categoryEnglishName' => $categoryEnglishName);
}
}
return $mobileCategoryList;
}
示例7: tds
function tds($tds = array())
{
$table_level = (int) Config::item('table_level');
$html = '';
// normalize the data
if (!is_array($tds[0])) {
$tds = array($tds);
}
if (count($tds) > 0) {
$html .= table::create_element('tr');
foreach ($tds as $td) {
$html .= table::create_element('td', $td, TRUE);
}
$html .= table::create_element('/tr');
}
return $html;
}
示例8: call
public function call()
{
$cacheEnabled = array_get($this->action, "cacheEnabled") && Config::item("application", "cache", true);
if ($cacheEnabled && ($data = Cache::get(URI::current()))) {
$headersEnd = strpos($data, "\n\n");
if ($headersEnd > 0) {
$headers = explode("\n", substr($data, 0, $headersEnd));
foreach ($headers as $header) {
header($header);
}
}
$data = substr($data, $headersEnd + 2);
return $data;
}
$response = $this->response();
if ($cacheEnabled) {
$headersList = implode("\n", headers_list());
Cache::save(URI::current(), $headersList . "\n\n" . $response, array_get($this->action, "cacheExpirationTime"));
} else {
Cache::remove(URI::current());
}
return $response;
}
示例9: conn
public static function conn($name = null)
{
if (is_null($name)) {
$keys = array_keys(Config::group("databases"));
if (count($keys) > 0) {
$name = $keys[0];
}
}
if (!isset(static::$connections[$name])) {
$config = Config::item("databases", $name);
switch ($config["type"]) {
case "mysql":
include_once J_SYSTEMPATH . "database" . DS . "mysql" . DS . "MysqlDB" . EXT;
include_once J_SYSTEMPATH . "database" . DS . "mysql" . DS . "MysqlRecordSet" . EXT;
static::$connections[$name] = new MysqlDB($config);
break;
default:
trigger_error("Database type <b>'" . $config["type"] . "'</b> not suported.");
break;
}
}
return static::$connections[$name];
}
示例10: render
function render($template, $vars = array(), $debug = FALSE)
{
if ($debug) {
echo '<pre>';
var_dump($vars);
echo '</pre>';
}
if (is_array($vars) && count($vars) > 0) {
$this->setVars($vars);
}
$viewPath = $this->getViewPath($template);
if (!file_exists($viewPath)) {
cpg_die(ERROR, sprintf(Lang::item('error.missing_vw_file'), $viewPath), __FILE__, __LINE__);
}
extract($this->vars);
// checking model
$authorizer = check_model::getInstance();
ob_start();
include_once $viewPath;
$fr_contents = ob_get_contents();
ob_end_clean();
if (empty($fr_title) || !$fr_title) {
$fr_title = $vars[nagavitor][0][1] . " - " . Config::item('fr_title');
}
include_once $this->getMainPath();
}
示例11: reply
function reply()
{
include BASE_DIR . 'include' . DS . 'smilies.inc.php';
include BASE_DIR . 'include' . DS . 'mailer.inc.php';
$vars = array();
$errors = array();
$authorizer = check_model::getInstance();
$vars['topic_id'] = $this->validate->get->getInt('id');
if (!$authorizer->is_topic_id($vars['topic_id'])) {
cpg_die(ERROR, Lang::item('error.wrong_topic_id'), __FILE__, __LINE__);
}
if (!$authorizer->can_reply($vars['topic_id'])) {
cpg_die(ERROR, Lang::item('error.perm_denied'), __FILE__, __LINE__);
}
$vars['nagavitor'] = $this->forum->get_nagavitor();
$vars['icons'] = $this->forum->get_icons();
$topic = $this->forum->get_topic_data($vars['topic_id'], 'board_id');
$messages = $this->forum->get_message($vars['topic_id'], 'subject', 'msg_id asc', '1');
$data = array('icon' => 'icon1', 'subject' => Lang::item('topic.re') . $messages[0]['subject']);
if ($this->validate->post->keyExists('submit')) {
$data = array('topic_id' => $vars['topic_id'], 'icon' => $this->validate->post->getRaw('icon'), 'subject' => $this->validate->post->getEscaped('subject'), 'body' => $this->validate->post->getRaw('body'), 'board_id' => $topic['board_id'], 'poster_time' => time(), 'poster_id' => USER_ID, 'poster_name' => USER_NAME, 'poster_ip' => Config::item('hdr_ip'), 'smileys_enabled' => 1);
if (Config::item('fr_msg_icons') == 0 && $data['icon'] == '') {
$data['icon'] = 'icon1';
}
if ($data['subject'] == '') {
$errors[] = Lang::item('error.empty_subject');
}
if ($data['icon'] == '') {
$errors[] = Lang::item('error.no_msg_icon');
}
if ($data['body'] == '') {
$errors[] = Lang::item('error.empty_body');
}
if (strlen($data['body']) > Config::item('fr_msg_max_size') && Config::item('fr_msg_max_size')) {
$data['body'] = substr($data['body'], 0, Config::item('fr_msg_max_size'));
}
global $CONFIG;
if ($CONFIG['comment_captcha'] == 1 || $CONFIG['comment_captcha'] == 2 && !USER_ID) {
if (!captcha_plugin_enabled('comment')) {
global $lang_errors;
$superCage = Inspekt::makeSuperCage();
require "include/captcha.inc.php";
$matches = $superCage->post->getMatched('confirmCode', '/^[a-zA-Z0-9]+$/');
if (!$matches[0] || !PhpCaptcha::Validate($matches[0])) {
$errors[] = $lang_errors['captcha_error'];
}
} else {
CPGPluginAPI::action('captcha_comment_validate', null);
}
}
if (count($errors) == 0) {
if ($authorizer->double_post()) {
cpg_die(ERROR, Lang::item('error.already_post'), __FILE__, __LINE__);
} else {
$msg_id = $this->forum->insert_message($data);
// to-do: send notify email
$users = $this->forum->get_notify_user('', $vars['topic_id']);
foreach ($users as $user) {
if ($user['user_id'] == USER_ID) {
continue;
}
$user = $this->forum->get_user_data($user['user_id'], 'user_email');
// prepare email
$email_subject = Lang::item('topic.topic_reply') . $data['subject'];
$email_body = sprintf(Lang::item('topic.notify_email'), Config::item('fr_prefix_url') . 'profile.php?uid=' . USER_ID, USER_NAME, Config::item('fr_prefix_url') . forum::link('message', '', $msg_id), Config::item('fr_prefix_url') . forum::link('message', '', $msg_id), Config::item('fr_prefix_url') . forum::link('topic', 'notify', $vars['topic_id']), Config::item('fr_prefix_url') . forum::link('topic', 'notify', $vars['topic_id']), Config::item('fr_title'));
// send mail
cpg_mail($user['user_email'], $email_subject, $email_body, 'text/html', Config::item('fr_title'), Config::item('gallery_admin_email'));
// set send = 0
$this->forum->set_topic_notify($vars['topic_id'], 0, $user['user_id']);
}
if ($this->validate->post->getInt('notify') === 1) {
$this->forum->set_topic_notify($vars['topic_id'], $this->validate->post->getInt('notify'));
}
if ($this->validate->post->getInt('notify') === 0) {
$this->forum->unnotify_topic($vars['topic_id']);
}
forum::message(Lang::item('common.message'), sprintf(Lang::item('message.new_msg_success'), $data['subject']), 'forum.php?c=message&id=' . $msg_id);
}
}
}
$vars['errors'] = $errors;
$vars['form'] = $data;
$this->view->render('topic/reply', $vars);
}
示例12:
echo $styles;
?>
<title><?php
echo $page_title;
?>
</title>
</head>
<body>
<div id="<?php
echo $page_id;
?>
">
<h1>Hanami</h1>
<h2><?php
echo $title;
?>
</h2>
<?php
echo $content;
echo Kohana::debug(Config::item('core.modules'));
?>
<p class="copyright hanami">Powerd by HanamiCMS v{hanami_version}<br/>Copyright ©2008 Hanami Team</p>
<p class="copyright kohana">Rendered in {execution_time} seconds, using {memory_usage} of memory<br/>Copyright ©2007-2008 Kohana Team</p>
</div>
</body>
</html>
示例13: pets_categorylist
public static function pets_categorylist(\ApiParam $params)
{
return \Config::item('app.petsCategoryList');
}
示例14: Copyright
<?php
/**************************************************
Coppermine 1.5.x Plugin - forum
*************************************************
Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
*************************************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
********************************************
$HeadURL$
$Revision$
$LastChangedBy$
$Date$
**************************************************/
echo table::open();
echo form::open('forum.php?c=profile&id=' . $user['user_id'], 'profile', 'post', TRUE);
echo table::td(Lang::item('profile.profile_title'), 4);
echo table::td(Lang::item('profile.avatar'), 4, 'tableh2');
echo table::tds(array(array('class' => 'tableb', 'width' => '5%', 'align' => 'center', 'text' => form::radio('avatar_type', 'url', '', $user['fr_avatar'] ? 'url' : '')), array('class' => 'tableb', 'width' => '20%', 'text' => Lang::item('profile.url')), array('class' => 'tableb', 'width' => '50%', 'text' => form::text('fr_avatar_url', $user['fr_avatar'])), array('class' => 'tableb', 'width' => '25%', 'align' => 'center', 'rowspan' => 2, 'text' => !php::is_empty_string($user['fr_avatar']) ? html::img($user['fr_avatar'], Config::item('fr_avatar_size')) . BR . BR . html::button('forum.php?c=profile&m=remove_avatar', Lang::item('profile.remove_avatar')) : '')));
echo table::tds(array(array('class' => 'tableb', 'align' => 'center', 'text' => form::radio('avatar_type', 'file')), array('class' => 'tableb', 'text' => Lang::item('profile.file')), array('class' => 'tableb', 'text' => form::file('fr_avatar_file'))));
echo table::td(Lang::item('profile.profile'), 4, 'tableh2');
echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'rowspan' => 3, 'text' => Lang::item('profile.signature')), array('class' => 'tableb', 'colspan' => 2, 'text' => forum::generate_bbcode_tags('profile', 'fr_signature'))));
echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'align' => 'center', 'text' => form::textarea('fr_signature', $user['fr_signature']))));
echo table::tds(array(array('class' => 'tableb', 'colspan' => 2, 'text' => generate_smilies('profile', 'fr_signature'))));
echo table::tds(array(array('class' => 'tablef', 'colspan' => 4, 'text' => form::submit(Lang::item('common.change'), 'submit'))));
echo form::close();
echo table::close();
示例15: mobile_mobile_config
public static function mobile_mobile_config(\ApiParam $params)
{
//app mobile tracking config
$apiKey = $params->api_key;
//todo udid 区分限制
//load config data
$mktConfig = \MktConfig::loadByConfigKey("mktTrackMobileData");
$configValue = $mktConfig->configValue;
$values = json_decode($configValue, true);
$configArray = array();
if (isset($values['all'])) {
$configArray = $values['all'];
}
if ($apiKey == "api_mobile_android" && isset($values['android'])) {
$configArray = array_merge($configArray, $values['android']);
//从配置中加载最新版本
$versions = \Mobile_Logic::androidVersions();
$lastVersion = array_shift(array_keys($versions));
if ($lastVersion) {
$configArray['serverVersion'] = $lastVersion;
}
} else {
if (isset($values['iphone'])) {
$configArray = array_merge($configArray, $values['iphone']);
}
}
// 加载图片服务器配置
$img_space = \Config::item("env.img.upyun");
$img_space_name = $img_space['policy']['bucket'];
$img_space_policy = base64_encode(json_encode($img_space['policy'] + array("expiration" => time() + 3600 * 24)));
$img_space_sign = md5("{$img_space_policy}&{$img_space['form_api_secret']}");
$imgConfig = array();
$imgConfig['server'] = "http://v0.api.upyun.com/{$img_space_name}";
$imgConfig['fileKey'] = 'file';
$imgConfig['returnKey'] = 'url';
$imgConfig['params'] = array('policy' => $img_space_policy, 'signature' => $img_space_sign);
$configArray['imageConfig'] = $imgConfig;
return $configArray;
}