本文整理汇总了PHP中Conf::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Conf::get方法的具体用法?PHP Conf::get怎么用?PHP Conf::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conf
的用法示例。
在下文中一共展示了Conf::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
static function init()
{
$fh = fopen("./log.txt", "w");
try {
fputs($fh, "start\n");
$conf = new Conf(dirname(__FILE__) . "/../public/conf01.xml");
print "user: " . $conf->get('user') . "\n";
print "host: " . $conf->get('host') . "\n";
$conf->set("pass", "newpass");
$conf->write();
} catch (FileException $e) {
// permissions issue or non-existent file
fputs($fh, "file exception\n");
throw $e;
} catch (XmlException $e) {
fputs($fh, "xml exception\n");
// broken xml
} catch (ConfException $e) {
fputs($fh, "conf exception\n");
// wrong kind of XML file
} catch (Exception $e) {
fputs($fh, "general exception\n");
// backstop: should not be called
} finally {
fputs($fh, "end\n");
fclose($fh);
}
}
示例2: _getProperModule
private function _getProperModule()
{
$key = $this->_conf->get('module_url_variable_name');
$moduleUrlName = $this->_get->{$key};
$moduleName = $this->_appMap->getModuleNameFromUrlName($moduleUrlName);
if (!is_null($moduleName)) {
return new $moduleName($this->_get, $this->_post, $this->_conf, $this->_view, $this->_appMap);
}
throw new ControllerException('No module has been choosen for execution');
}
示例3: __construct
public function __construct(Map $map, Conf $conf)
{
$this->setImageHandler($map->getImageHandler());
$this->_logoLayout = LogoLayout::factory($conf->get('logo_layout'));
$this->_logoFiles = $conf->get('logo_files');
$this->setWorldMap($map->getWorldMap());
$leftUpCorner = $map->getLeftUpCorner();
$this->setLeftUpCorner($leftUpCorner['lon'], $leftUpCorner['lat']);
$rightDownCorner = $map->getRightDownCorner();
$this->setRightDownCorner($rightDownCorner['lon'], $rightDownCorner['lat']);
parent::__construct($map->getImage());
}
示例4: index
function index()
{
/* 取得列表数据 */
$conditions = $this->_get_query_conditions(array(array('field' => 'state', 'name' => 'state', 'handler' => 'groupbuy_state_translator'), array('field' => 'group_name', 'name' => 'group_name', 'equal' => 'LIKE')));
// 标识有没有过滤条件
if ($conditions) {
$this->assign('filtered', 1);
}
$page = $this->_get_page(10);
//获取分页信息
$groupbuy_list = $this->_groupbuy_mod->find(array('join' => 'be_join', 'order' => 'gb.group_id DESC', 'limit' => $page['limit'], 'count' => true, 'conditions' => 'user_id=' . $this->visitor->info['user_id'] . $conditions));
$page['item_count'] = $this->_groupbuy_mod->getCount();
//获取统计的数据
foreach ($groupbuy_list as $key => $groupbuy) {
$groupbuy['ican'] = $this->_ican($groupbuy['group_id']);
$groupbuy_list[$key] = $groupbuy;
$groupbuy_list[$key]['spec_quantity'] = unserialize($groupbuy['spec_quantity']);
$groupbuy['default_image'] || ($groupbuy_list[$key]['default_image'] = Conf::get('default_goods_image'));
}
//dump($groupbuy_list);
/* 当前位置 */
$this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_groupbuy'), 'index.php?app=buyer_groupbuy', LANG::get('groupbuy_list'));
/* 当前用户中心菜单 */
$this->_curitem('my_groupbuy');
/* 当前所处子菜单 */
$this->_curmenu('groupbuy_list');
$this->_format_page($page);
$this->assign('page_info', $page);
//将分页信息传递给视图,用于形成分页条
$this->assign('groupbuy_list', $groupbuy_list);
$this->assign('state', array('all' => Lang::get('group_all'), 'on' => Lang::get('group_on'), 'end' => Lang::get('group_end'), 'finished' => Lang::get('group_finished'), 'canceled' => Lang::get('group_canceled')));
$this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_groupbuy'));
$this->display('buyer_groupbuy.index.html');
}
示例5: configure
public function configure()
{
// Init category
$category = new Model_Category(Conf::get('MAIN_CATEGORY'));
if ($category->getQuestionsTotal(true, true) == 0) {
return;
}
// Get questions
$questions = $category->getQuestions('latest', $this->page, true, true);
if ($category->getQuestionsTotal(true, true) <= ($this->page + 1) * Conf::get('QUESTION_PER_PAGE')) {
header('X-JSON: (Question.setEndReached())');
}
$colors = Conf::get('GRAPH_COLORS');
// Loop through all questions
foreach ($questions as $key => $question) {
// Get question's answers
$answers = $question->getAnswers();
$data = array();
foreach (array_reverse($answers) as $key => $answer) {
$data[] = array('value' => $answer->getPercentResultsMatching() / 100, 'color' => $colors[$key]);
}
// Assign question infos
Globals::$tpl->assignLoopVar('question_archive', array('id' => $question->getId(), 'label' => $question->getLabel(), 'guid' => Tool::makeGuid($question->getLabel()), 'data' => json_encode($data), 'time' => Tool::timeWarp($question->getEndDate())));
// Assign answers infos
foreach ($answers as $key => $answer) {
Globals::$tpl->assignLoopVar('question_archive.answer', array('percentFormated' => round($answer->getPercentResultsMatching()), 'label' => $answer->getLabel(), 'key' => $key));
}
}
}
示例6: __construct
public function __construct()
{
$dispatcher = Conf::get('global.dispatcher_path', PI_CORE . 'RouteDispatcher.php');
if (!is_readable($dispatcher) || !Pi::inc($dispatcher)) {
throw new Exception('can not find the dispatcher config : global.dispatcher_path', 1032);
}
}
示例7: configure
public function configure()
{
// Get answers
$answers = $this->question->getAnswers();
$colors = Conf::get('GRAPH_COLORS');
$dataWomen = array();
$dataMen = array();
// Percent MALE
foreach (array_reverse($answers) as $key => $answer) {
$dataMen[] = array('value' => $answer->getPercentResultsMatchingMale() / 100 * 0.95 + 0.05, 'color' => $colors[$key]);
}
foreach ($answers as $key => $answer) {
Globals::$tpl->assignLoopVar('question_men', array('key' => $key, 'label' => $answer->getLabel(), 'percent' => number_format($answer->getPercentResultsMatchingMale(), 1, ',', ' ')));
}
// Percent FEMALE
foreach (array_reverse($answers) as $key => $answer) {
$dataWomen[] = array('value' => $answer->getPercentResultsMatchingFemale() / 100 * 0.95 + 0.05, 'color' => $colors[$key]);
}
foreach ($answers as $key => $answer) {
Globals::$tpl->assignLoopVar('question_women', array('key' => $key, 'label' => $answer->getLabel(), 'percent' => number_format($answer->getPercentResultsMatchingFemale(), 1, ',', ' ')));
}
Globals::$tpl->assignVar('question_men_data', json_encode($dataMen));
Globals::$tpl->assignVar('question_women_data', json_encode($dataWomen));
Globals::$tpl->assignVar('question_label', $this->question->getLabel());
}
示例8: login
function login()
{
if ($this->visitor->has_login) {
$this->show_warning('has_login');
return;
}
if (!IS_POST) {
if (Conf::get('captcha_status.backend')) {
$this->assign('captcha', 1);
}
$this->display('login.html');
} else {
if (Conf::get('captcha_status.backend') && base64_decode($_SESSION['captcha']) != strtolower($_POST['captcha'])) {
$this->show_warning('captcha_faild');
return;
}
$user_name = trim($_POST['user_name']);
$password = $_POST['password'];
$ms =& ms();
$user_id = $ms->user->auth($user_name, $password);
if (!$user_id) {
/* 未通过验证,提示错误信息 */
$this->show_warning($ms->user->get_error());
return;
}
/* 通过验证,执行登陆操作 */
if (!$this->_do_login($user_id)) {
return;
}
$this->show_message('login_successed', 'go_to_admin', 'index.php');
}
}
示例9: getPDO
/**
* Get PDO instance
*
* @return PDO
*/
public static function getPDO()
{
if (empty(self::$_pdo)) {
self::$_pdo = new PDO(Conf::get(self::DSN), Conf::get(self::USER), Conf::get(self::PASSWORD));
}
return self::$_pdo;
}
示例10: get_recommended_goods
/**
* 取得某推荐下商品
* @param int $recom_id 推荐类型
* @param int $num 取商品数量
* @param bool $default_image 如果商品没有图片,是否取默认图片
* @param int $mall_cate_id 分类(最新商品用到)
*/
function get_recommended_goods($recom_id, $num, $default_image = true, $mall_cate_id = 0)
{
$goods_list = array();
$conditions = "g.if_show = 1 AND g.closed = 0 AND s.state = 1 ";
if ($recom_id == REC_NEW) {
/* 最新商品 */
if ($mall_cate_id > 0) {
$gcategory_mod =& m('gcategory');
$conditions .= " AND g.cate_id " . db_create_in($gcategory_mod->get_descendant($mall_cate_id));
}
$sql = "SELECT g.goods_id, g.goods_name, g.default_image, gs.price, gs.stock, gs.spec_id " . "FROM " . DB_PREFIX . "goods AS g " . "LEFT JOIN " . DB_PREFIX . "goods_spec AS gs ON g.default_spec = gs.spec_id " . "LEFT JOIN " . DB_PREFIX . "store AS s ON g.store_id = s.store_id " . "WHERE " . $conditions . "ORDER BY g.add_time DESC " . "LIMIT {$num}";
} else {
/* 推荐商品 */
$sql = "SELECT g.goods_id, g.goods_name, g.default_image, gs.price, gs.stock, gs.spec_id " . "FROM " . DB_PREFIX . "recommended_goods AS rg " . " LEFT JOIN " . DB_PREFIX . "goods AS g ON rg.goods_id = g.goods_id " . " LEFT JOIN " . DB_PREFIX . "goods_spec AS gs ON g.default_spec = gs.spec_id " . " LEFT JOIN " . DB_PREFIX . "store AS s ON g.store_id = s.store_id " . "WHERE " . $conditions . "AND rg.recom_id = '{$recom_id}' " . "AND g.goods_id IS NOT NULL " . "ORDER BY rg.sort_order " . "LIMIT {$num}";
}
$res = $this->db->query($sql);
$promotion_mod =& m('promotion');
while ($row = $this->db->fetchRow($res)) {
$default_image && empty($row['default_image']) && ($row['default_image'] = Conf::get('default_goods_image'));
/* 读取促销价格 */
$row['price'] = $promotion_mod->get_promotion_price($row['goods_id'], $row['spec_id']);
$goods_list[] = $row;
}
return $goods_list;
}
示例11: configureData
public function configureData()
{
// Look if this login exists
$rs = DB::select('
SELECT `id`
FROM `user`
WHERE `login`="' . $_POST['login'] . '" AND `valided`=1
');
// If this user is not already registered
// TODO : check if the email is not allready taken
if ($rs['total'] == 0) {
// Encrypte password
$key = md5(rand(0, 1000) + microtime());
// Insert user's infos in the base
$id = DB::insert('INSERT INTO `user` (`login`, `zip`, `male`, `email`, `password`, `key`, `register_date`) VALUES
(
"' . $_POST['login'] . '",
"' . $_POST['zip'] . '",
"' . $_POST['gender'] . '",
"' . $_POST['email'] . '",
"' . md5($_POST['password']) . '",
"' . $key . '",
"' . time() . '"
)');
// TODO : register informations should be sent by email
echo $key . chr(13) . Conf::get('ROO_PATH') . $_POST['login'] . '/confirm?u=' . $id . '&k=' . $key;
}
}
示例12: configureData
public function configureData()
{
// Look if this login exists
$rs = DB::select('
SELECT `id`
FROM `user`
WHERE `login`="' . $_POST['login'] . '" AND `valided`=1
');
// If this user is not already registered
// TODO : check if the email is not allready taken
if ($rs['total'] == 0) {
// Encrypte password
$key = md5(rand(0, 1000) + microtime());
// Insert user's infos in the base
$id = DB::insert('INSERT INTO `user` (`login`, `zip`, `male`, `email`, `password`, `key`, `register_date`) VALUES
(
"' . $_POST['login'] . '",
"' . $_POST['zip'] . '",
"' . $_POST['gender'] . '",
"' . $_POST['email'] . '",
"' . md5($_POST['password']) . '",
"' . $key . '",
"' . time() . '"
)');
$subject = 'Bienvenue sur Opipop - confirmation de votre enregistrement';
$message = 'Clicked ici pour activer votre compte : ' . Conf::get('ROOT_PATH') . $_POST['login'] . '/confirm?u=' . $id . '&k=' . $key;
Tool::sendMail(Conf::get('SITE_NAME'), Conf::get('ADMIN_EMAIL'), $_POST['email'], $subject, $message);
}
}
示例13: configureData
public function configureData()
{
if (!Tool::isOk($_POST['id']) || !($user = Model_User::getLoggedUser()) || $user->getId() != $_POST['id'] || !Tool::isOk($_POST['zip']) || !isset($_POST['gender']) || !Tool::isOk($_POST['login'])) {
header('Location: ' . Conf::get('ROOT_PATH'));
exit;
}
DB::update('UPDATE `user` SET
`zip`="' . $_POST['zip'] . '",
`male`="' . $_POST['gender'] . '"
WHERE `id`="' . $_POST['id'] . '"');
if (isset($_FILES) && isset($_FILES['avatar']) && $_FILES['avatar']['error'] != 4) {
$size = filesize($_FILES['avatar']['tmp_name']);
$stat = stat($_FILES['avatar']['tmp_name']);
if ($size[0] <= 1680 && $size[1] <= 1680 && $stat['size'] <= 450 * 1024) {
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['avatar']['name']));
$original = Conf::get('MEDIA_DIR') . 'avatar/original/' . $_POST['id'] . '.' . $extention;
move_uploaded_file($_FILES['avatar']['tmp_name'], $original);
$sizeSmall = explode('x', Conf::get('AVATAR_SMALL_SIZE'));
$sizeMedium = explode('x', Conf::get('AVATAR_MEDIUM_SIZE'));
$sizeLarge = explode('x', Conf::get('AVATAR_LARGE_SIZE'));
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_LARGE_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeLarge[0], isset($sizeLarge[1]) ? $sizeLarge[1] : false, true);
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_MEDIUM_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeMedium[0], isset($sizeMedium[1]) ? $sizeMedium[1] : false, true);
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_SMALL_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeSmall[0], isset($sizeSmall[1]) ? $sizeSmall[1] : false, true);
}
}
$_SESSION['feedback'] = 'Your informations has been updated';
header('Location: ' . Conf::get('ROOT_PATH') . $_POST['login']);
}
示例14: ops_ro
/**
* OPS read only db connector
*
* @return db connection handler
*/
public static function ops_ro()
{
$dsn = "mysql:host=" . Conf::get('ops_ro_host', 'db', 'dsn') . ";dbname=" . Conf::get('ops_ro_db', 'db', 'dsn');
$dsn .= ";port=" . Conf::get('ops_ro_port', 'db', 'dsn');
$user = Conf::get('ops_ro_user', 'db', 'dsn');
$pass = Conf::get('ops_ro_pwd', 'db', 'dsn');
return self::connect($dsn, $user, $pass);
}
示例15: displayArchives
private function displayArchives()
{
if (!isset($this->displayArchives)) {
$category = new Model_Category(Conf::get('MAIN_CATEGORY'));
$this->displayArchives = $category->getQuestionsTotal(true, true) == 0 ? false : true;
}
return $this->displayArchives;
}