当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::set方法代码示例

本文整理汇总了PHP中Config::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::set方法的具体用法?PHP Config::set怎么用?PHP Config::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Config的用法示例。


在下文中一共展示了Config::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preload

 public function preload()
 {
     $this->mdata['objlang'] = $this->language;
     $this->mdata['objurl'] = $this->url;
     $this->load->model('tool/image');
     $this->load->language('module/pavblog');
     $this->load->model("pavblog/blog");
     $this->load->model("pavblog/comment");
     $mparams = $this->config->get('pavblog');
     $default = $this->model_pavblog_blog->getDefaultConfig();
     $mparams = !empty($mparams) ? $mparams : array();
     if ($mparams) {
         $mparams = array_merge($default, $mparams);
     } else {
         $mparams = $default;
     }
     $config = new Config();
     if ($mparams) {
         foreach ($mparams as $key => $value) {
             $config->set($key, $value);
         }
     }
     $this->mparams = $config;
     if (!defined("_PAVBLOG_MEDIA_")) {
         if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css')) {
             $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css');
         } else {
             $this->document->addStyle('catalog/view/theme/default/stylesheet/pavblog.css');
         }
         define("_PAVBLOG_MEDIA_", true);
     }
 }
开发者ID:ravindram,项目名称:choco,代码行数:32,代码来源:blogs.php

示例2: register

 static function register($table, $key, $value = "")
 {
     // create the global config object if not available
     if (!array_key_exists('config', $GLOBALS)) {
         $GLOBALS['config'] = array();
     }
     // exit now if variable already available
     $key_exists = array_key_exists($table, $GLOBALS['config']) && array_key_exists($key, $GLOBALS['config'][$table]) && !(empty($GLOBALS['config'][$table][$key]) && is_null($GLOBALS['config'][$table][$key]));
     if ($key_exists) {
         return;
     }
     // then check if the table exists
     if (empty($GLOBALS['config'][$table])) {
         $config = new Config(0, $table);
         // FIX: The id needs to be setup as autoincrement
         //$config->create_table($table, "id INTEGER PRIMARY KEY ASC," . implode(",", array_keys( $config->rs )) );
         $config->create_table($table, "id INTEGER PRIMARY KEY ASC, key, value");
         $GLOBALS['config'][$table] = array();
     }
     // we already know the key doesn't exist - just create it
     $config = new Config(0, $table);
     $config->set('key', "{$key}");
     // FIX: special case for admin password (use cipher if available)
     $cipher = is_null(CIPHER) ? $value : CIPHER;
     $value = $key == "admin_password" ? crypt($value, $cipher) : $value;
     $config->set('value', "{$value}");
     $config->create();
     // save in the global object
     $GLOBALS['config'][$table][$key] = $value;
 }
开发者ID:makesites,项目名称:kisscms,代码行数:30,代码来源:Config.php

示例3: secondstageAction

	function secondstageAction()
	{
		$request = new RivetyCore_Request($this->getRequest());
		$appNamespace = new Zend_Session_Namespace('RivetyCore_Temp');
		$basepath = Zend_Registry::get('basepath');
		$config_table = new Config();
		$config_table->set('default', 'upload_path', $basepath."/uploads", true);
		$config_table->set('default', 'theme', 'default', true);
		$config_table->set('default', 'missing_image', $basepath . "/themes/frontend/default/images/image-missing.jpg", true);
		$config_table->set('default', 'site_url', 'http://' . $_SERVER['SERVER_NAME']);
		$config_table->set('default', 'salt', substr(md5(rand(1, 1000)), 0, 10));
		$config_table->cache();
		$username = $request->username;
		$users_table = new Users();
		$user = $users_table->fetchByUsername($username);
		$password = substr(md5(rand(50000, 100000)), 0, 8);
		if (!is_null($user))
		{
			$user->password = $password;
			$user->save();
			// $users_table->setMetaData($username, "is_installer", 1);
			$appNamespace->autoLogin = true;
       		$appNamespace->autoLoginUsername = $username;
       		$appNamespace->autoLoginPassword = $password;
			$appNamespace->autoLoginPasswordHash = md5($password);
		}
		else
		{
			die("Somehow the admin user didn't get created or didn't get sent with the request. This is bad. Really, really bad.");
		}
		$this->_redirect("/default/install/finished/username/" . $username);
	}
开发者ID:richjoslin,项目名称:rivety,代码行数:32,代码来源:InstallController.php

示例4: __construct

 public function __construct($app, $app_config = array())
 {
     $this->registry = new Registry();
     $this->registry->set("app", $app);
     $configs = new Config();
     if (!isset($app_config['controllers_path']) || !isset($app_config['models_path']) || !isset($app_config['library_path'])) {
         trigger_error("Directory information is required for controllers, models and library");
         return;
     }
     if (!file_exists($app_config['controllers_path']) || !file_exists($app_config['models_path']) || !file_exists($app_config['library_path'])) {
         trigger_error("Directory information is required for controllers, models and library");
         return;
     }
     if (isset($app_config['template_constants']) && $app_config['template_constants']) {
         $configs->set("template_constants", $app_config['template_constants']);
     } else {
         $configs->set("template_constants", array());
     }
     $configs->set("controllers_path", $app_config['controllers_path']);
     $configs->set("library_path", $app_config['library_path']);
     $configs->set("models_path", $app_config['models_path']);
     $this->registry->set("config", $configs);
     $this->registry->set("hooks", new Hooks((array) $this->config->get("hooks")));
     $loader = new Loader($this->registry);
     $this->registry->set("load", $loader);
 }
开发者ID:Esciner,项目名称:devoir2,代码行数:26,代码来源:BasicMVC.php

示例5: testSetterMultidimensionOverwritesNestedValues

 public function testSetterMultidimensionOverwritesNestedValues()
 {
     $c = new Config(array('config' => array('deploy' => array('release_dir' => '/var/www'))));
     $this->assertEquals('/var/www', $c->get('config.deploy.release_dir'));
     $c->set('config.deploy.release_dir', '/var/www');
     $c->set('config.deploy.release_dir', '/var/www');
     $this->assertEquals('/var/www', $c->get('config.deploy.release_dir'));
 }
开发者ID:Catapush,项目名称:Idephix,代码行数:8,代码来源:ConfigTest.php

示例6: setgetTest

 /**
  * Test adding settings
  *
  * @param Config $config
  */
 function setgetTest($config)
 {
     $this->assertEquals(array('grp1' => array('q' => 'abc', 'b' => 27), 'grp2' => array('a' => 'original')), $config->get());
     $config->set('grp2', array('b' => 'changed'));
     $config->set('grp3', array('rew' => 'MY VALUE', 'qq' => 2));
     $this->assertEquals(array('grp1' => array('q' => 'abc', 'b' => 27), 'grp2' => array('b' => 'changed'), 'grp3' => array('rew' => 'MY VALUE', 'qq' => 2)), $config->get());
     $this->assertEquals(array('rew' => 'MY VALUE', 'qq' => 2), $config->get('grp3'));
     $config->set(array('grp3', 'qq'), 19);
     $this->assertEquals(array('rew' => 'MY VALUE', 'qq' => 19), $config->get('grp3'));
 }
开发者ID:jasny,项目名称:Q,代码行数:15,代码来源:MainTest.php

示例7: testEmpty

 public function testEmpty()
 {
     file_put_contents($this->file, '');
     $this->assertEquals($this->object->get('test.trees.oak.fairies', 'default'), 'default');
     $this->object->set('test.trees.oak.second_fairy', 'Trixie');
     $this->assertEquals($this->object->get('test.trees.oak.second_fairy'), 'Trixie');
     $this->object->write('test');
     $group = $this->object->get('test');
     $this->assertArrayHasKey('trees', $group);
     $this->assertArrayHasKey('oak', $group['trees']);
     $this->assertArrayHasKey('second_fairy', $group['trees']['oak']);
     $this->assertEquals($group['trees']['oak']['second_fairy'], 'Trixie');
 }
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:13,代码来源:configTest.php

示例8: __construct

 /**
  * Construct
  * 
  * @param Config $config
  */
 public function __construct(Config $config)
 {
     $this->config = $config;
     $this->routes = $this->config->get('routes');
     $this->project_host = $this->config->get('project_host');
     if (empty($this->project_host) && isset($_SERVER['SERVER_PORT'], $_SERVER['HTTP_HOST'])) {
         $this->project_host = ($_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'];
     }
     if (empty($this->project_host)) {
         trigger_error('Not specified project host', E_USER_WARNING);
     }
     $this->project_host = rtrim($this->project_host, '/') . '/';
     $this->config->set('project_host', $this->project_host);
 }
开发者ID:stefanak-michal,项目名称:DragonMVC,代码行数:19,代码来源:Router.php

示例9: config

 function config($params = array())
 {
     // if saving...
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         // loop through all the other data and reorganise them properly
         foreach ($params as $k => $v) {
             // exit if the values is empty (but not false)?
             if (empty($v) && $v != "0") {
                 continue;
             }
             // get the controller from the field name
             $name = explode("|", $k);
             if (count($name) < 2) {
                 continue;
             }
             $table = $name[0];
             $key = $name[1];
             //#25 - encrypting 'password' fields
             $cipher = is_null(CIPHER) ? $v : CIPHER;
             $value = $key == "admin_password" ? crypt($v, $cipher) : $v;
             // only save the data that has changed
             if ($GLOBALS["config"][$table][$key] != $value) {
                 $config = new Config(0, $table);
                 // find the entry with the right key
                 $config->retrieve_one("key=?", $key);
                 //$config->pkname = 'key';
                 $config->set('key', $key);
                 $config->set('value', $value);
                 // update model
                 $config->update();
                 // update memory
                 $GLOBALS["config"][$table][$key] = $value;
             }
         }
         // generate the humans.txt file
         $humans = $this->humansText();
         // redirect back to the configuration page
         header('Location: ' . url('admin/config'));
     } else {
         // show the configuration
         //$this->data['body']['admin']=View::do_fetch( getPath('views/admin/config.php'),$this->data);
         $data['view'] = getPath('views/admin/config.php');
         $this->data['status'] = "config";
         $this->data['body'][] = $data;
         $this->data['template'] = ADMIN_TEMPLATE;
         // display the page
         Template::output($this->data);
     }
 }
开发者ID:makesites,项目名称:kisscms,代码行数:49,代码来源:admin.php

示例10: __construct

 function __construct()
 {
     parent::__construct();
     if (!Config::get('RPC')) {
         Config::set('RPC', array('class' => 2, 'method' => 3, 'action' => 4, 'path' => 'procedure'));
     }
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:7,代码来源:RpcController.class.inc.php

示例11: redirect

 protected function redirect($link, $type = 301)
 {
     Config::set("Redirect", $link);
     Config::set("RedirectType", $type);
     Loader::loadNew('controller', '/controller/RedirectController')->activate();
     exit;
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:7,代码来源:Controller.class.inc.php

示例12: testReturnDifferentCompiledFiles

 public function testReturnDifferentCompiledFiles()
 {
     \Config::set('laravel-gcc::env', array('testing'));
     $scriptTagOne = javascript_compiled('file1.js');
     $scriptTagTwo = javascript_compiled('file2.js');
     $this->assertNotEquals($scriptTagOne, $scriptTagTwo);
 }
开发者ID:jboysen,项目名称:laravel-gcc,代码行数:7,代码来源:TestHelper.php

示例13: update

 public function update()
 {
     switch ($this->scenario) {
         case 'Save':
             Config::set(self::optionName . '_CLIENT_NAME', $this->clientName);
             Config::set(self::optionName . '_PERIOD', $this->period);
             Config::set(self::optionName . '_EMAIL', $this->email);
             Config::set(self::optionName . '_FTP', $this->ftp);
             Config::set(self::optionName . '_FTP_PORT', $this->ftpPort);
             Config::set(self::optionName . '_FTP_DIR', $this->ftpDir);
             Config::set(self::optionName . '_FTP_USER', $this->ftpUser);
             Config::set(self::optionName . '_FTP_PASSWORD', $this->ftpPassword);
             break;
         case 'Start':
             $this->status = 1;
             Config::set(self::optionName . '_STATUS', $this->status);
             break;
         case 'Stop':
             $this->status = 0;
             Config::set(self::optionName . '_STATUS', $this->status);
             break;
         case 'Add':
             $this->email[] = $this->newEMail;
             Config::set(self::optionName . '_EMAIL', $this->email);
             break;
         case 'Delete':
             Config::set(self::optionName . '_EMAIL', $this->email);
             break;
     }
 }
开发者ID:anton-itscript,项目名称:WM,代码行数:30,代码来源:HeartbeatReportForm.php

示例14: login

 public function login($id = null)
 {
     $user = $this->user;
     $this->data['user']['name'] = $user->data()->user;
     Config::set('html.title', 'Авторизация');
     Config::set('html.description.val', 'На этой странице можно залогиниться');
     //$user = new User();
     $salt = uniqid();
     if (!Session::exists(Config::get('session.token_name'))) {
         Token::generate();
     }
     if (Input::exists()) {
         if (Token::check(Input::get('token'))) {
             $validate = new VALIDATE();
             $validation = $validate->check($_POST, array('user' => array('required' => true), 'password' => array('required' => true)));
             if ($validate->passed()) {
                 $remember = Input::get('remember') === 'on' ? true : false;
                 $login = $user->login(Input::get('user'), Input::get('password'), null);
                 if ($login) {
                     Redirect::to('/');
                 } else {
                     echo '<p>Sorry, logging in failed</p>';
                 }
             } else {
                 foreach ($validation->errors() as $error) {
                     //echo $error, '<br/>';
                     $this->data['validate_errors'][] = $error;
                 }
             }
         }
     }
     //$this->data['id']=$id;
     //$this->data['name']=Input::get('name');
     $this->view('user/login');
 }
开发者ID:nanofelix,项目名称:sample-app,代码行数:35,代码来源:user.php

示例15: __construct

 public function __construct()
 {
     parent::__construct();
     Config::set('auth.driver', 'adminauth');
     Asset::add('bootstrap', 'bundles/adminify/css/bootstrap.min.css');
     Asset::add('style', 'bundles/adminify/css/style.css');
 }
开发者ID:SerdarSanri,项目名称:Adminify,代码行数:7,代码来源:loginbase.php


注:本文中的Config::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。