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


PHP Config::settings方法代码示例

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


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

示例1: __construct

 /**
  * set config keys and isntance wide settings
  *
  * @param key string Our instance key
  *
  * @return void
  */
 private function __construct($key)
 {
     //our instance and distingushing key
     $this->key = $key;
     //if our key is the default
     if ($this->key == 'default') {
         //generate our cache key from the full url
         $this->key = md5(Uri::full());
     }
     //get our cache settings
     $this->config = Config::settings('cache');
     //get our cache config from both system and app settings
     $this->duration = $this->config['duration'];
     //if we are in debug mode, force the duration to 0 (as in off)
     $this->duration = IS_DEBUG === true ? $this->duration : 0;
     //create our cache path
     $this->dir = PUBLIC_PATH . rtrim($this->config['dir'], '/') . '/';
     //set our language code
     $this->lang_code = defined('LANG_CODE') ? '-' . LANG_CODE : '';
     //create our filename default and append a language code to the filename if it exists
     $this->file = $this->checkDir() . $this->key . $this->lang_code . '.' . ltrim($this->config['file_ext'], '.');
     //has our file type been passed into the init: self::init('css')->concat($array);
     if (isset($this->config[$this->key])) {
         //check the cache dir is in place and add our file name
         $this->file = $this->checkDir() . $this->config[$this->key];
     }
     //for debugging
     $this->timestamp = Timer::mtime();
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:36,代码来源:cache.php

示例2: decrypt

 /**
  * Decode a string from the values that have been generated
  *
  * @param text string The string that has been encoded
  * 
  * @return string
  */
 public static function decrypt($text)
 {
     $config = Config::settings('encrypt');
     $base64key = $config['key'];
     $base64ivector = $config['iv'];
     return bzdecompress(trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, base64_decode($base64key), base64_decode($text), MCRYPT_MODE_CBC, base64_decode($base64ivector))));
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:14,代码来源:encrypt.php

示例3: __construct

 /**
  * create our instance and setup class wide variables 
  *
  * @return void
  */
 function __construct()
 {
     //get our debug callback and store it incase of debugging
     $this->debug_backtrace = Debug::backtrace();
     //keep just the second element sa that tells us where the calling class is
     $this->debug_backtrace = $this->debug_backtrace[1];
     //get our config
     $config = Config::settings('email');
     $this->header = $config['header'];
     $this->footer = $config['footer'];
     //init our email instance
     $this->email = new PHPMailer(true);
     //check if we want to use smtp and set all our required values from the config
     if ($config['smtp'] === true) {
         // telling the class to use SMTP
         $this->email->IsSMTP();
         // set the host address
         $this->email->Host = $config['smtp-host'];
         // enable SMTP authentication
         $this->email->SMTPAuth = true;
         // SMTP connection will not close after each email sent
         $this->email->SMTPKeepAlive = true;
         // set the SMTP port for the GMAIL server
         $this->email->Port = $config['smtp-port'];
         // SMTP account username
         $this->email->Username = $config['smtp-username'];
         // SMTP account password
         $this->email->Password = $config['smtp-password'];
     }
     //add the default from address
     $this->addFrom($config['from-address'], $config['fromt-name']);
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:37,代码来源:email.php

示例4: __construct

 public function __construct($path = null)
 {
     if ($path) {
         include $path;
         self::$settings = $set;
     }
 }
开发者ID:VictorSproot,项目名称:AtomXCMS-2,代码行数:7,代码来源:config.class.php

示例5: __construct

 /**
  * prevent direct instantition
  *
  * @param lang string Our current language code
  *
  * @return void
  */
 private function __construct($lang)
 {
     $this->config = Config::settings('language');
     //maintain our language code
     $this->lang = $lang;
     //load our translations file
     $this->load();
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:15,代码来源:lang.php

示例6: init

 public static function init()
 {
     if (!isset(self::$bInit)) {
         $data = parse_ini_file(BASE_DIR . '/admin/configuration.ini', true);
         self::$database = (object) $data['database'];
         self::$settings = (object) $data['settings'];
         self::$bInit = 'y';
     }
 }
开发者ID:pontifechs,项目名称:reports,代码行数:9,代码来源:Config.php

示例7: __construct

 /**
  * prevent normal instantiation 
  *
  * @param key string The key that is used to seperate our instances
  *
  * @return void
  */
 private function __construct($key)
 {
     //if our key is the default
     if ($this->key == 'default') {
         //generate our meta key from the full url - and make sure its just alphanumeric
         $this->key = md5(Uri::full());
     }
     $this->config = Config::settings('meta');
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:16,代码来源:meta.php

示例8: Save

 public static function Save($new_settings, $overwrite = false)
 {
     self::$settings = $overwrite ? $new_settings : array_merge(self::$settings, $new_settings);
     self::$settings['random_value'] = sha1(uniqid(rand(), true));
     $elements = array();
     foreach (self::$settings as $setting => $value) {
         $elements[] = "'{$setting}' => '" . addslashes($value) . "'";
     }
     $config = preg_replace('~//<' . self::TAG_NAME . '>.*?//</' . self::TAG_NAME . '>~msi', "//<" . self::TAG_NAME . ">\n              " . join(",\n              ", $elements) . "\n//</" . self::TAG_NAME . ">", str_replace(array("\r\n", "\r"), "\n", file_get_contents(BASE_DIR . '/classes/Config.php')));
     file_put_contents(BASE_DIR . '/classes/Config.php', $config);
 }
开发者ID:hackingman,项目名称:TubeX,代码行数:11,代码来源:Config.php

示例9: __construct

 /**
  * refuse normal instantiation
  *
  * @param connection_name 	string 	Inorder to maintain different connections and instances
  *
  * @return void
  */
 private function __construct($connection_name)
 {
     //get the ftp config
     $config = Config::settings('ftp');
     //if we have a set of connection details for the required connection
     if (isset($config[$connection_name]) and is_array($config[$connection_name])) {
         //loop through our config and assign to instance variables
         foreach ($config[$connection_name] as $k => $v) {
             $this->{$k} = $v;
         }
     }
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:19,代码来源:ftp.php

示例10: main

	public function main ($query, $count = 0, $limit = 0) {

		$perpage = empty($count) ? Config::settings('per_page') : $count;
		$page = isset($query['page']) && $query['page'] > 0 ? $query['page'] : 1;
		$start = ($page - 1) * $perpage;
		
		$params = array('deleted');
		$condition = "area != ? group by place, item_id order by max(date) desc limit $start, $perpage";

		$items = Database::set_counter()->
			get_table('comment', array('place', 'item_id'), $condition, $params);

		$condition = "";
		foreach ($items as $item) {
			$condition .= " or (place = ? and item_id = ?)";
			$params[] = $item['place'];
			$params[] = $item['item_id'];
		}
		$condition = "area != ? and (".substr($condition,4).") order by date";
		
		$comments = Database::get_full_vector('comment', $condition, $params);
	
		foreach ($items as $item) {
			$item_comments = array();
			
			foreach ($comments as $id => $comment) {
				if (
					$comment['item_id'] == $item['item_id'] && 
					$comment['place'] == $item['place']
				) {
					$item_comments[$id] = new Item_Comment(
						$comment, 
						Globals::user_settings('display')
					);
				}
			}
			
			$this->items[] = new Item_Comment_Block(array(
				'limit' =>  empty($limit) ? 
								Globals::user_settings('last_comments') : 
								$limit,
				'place' => $item['place'],
				'id' => $item['item_id'],
				'items' => $item_comments,
			));
		}
		
		$this->get_navi($query, Database::get_counter(), $page, $perpage);
	}
开发者ID:4otaku,项目名称:draw,代码行数:49,代码来源:output.php

示例11: check

 /**
  * check the db table for the need to update it
  *
  * @return void
  */
 function check()
 {
     $class = $this->class;
     $this->table = $class::$table;
     //db config
     $connect = Config::settings('database');
     //check for the existance of the table
     $table_check = static::$db->query("SHOW TABLES LIKE '" . $this->table . "' ")->fetch();
     //if we dont find the table, make it
     if ($table_check[0] !== $this->table) {
         return $this->forgeModel();
     }
     //if we have the table, check if we want to alter if
     return $this->alterTable();
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:20,代码来源:schema.php

示例12: init

 private static function init()
 {
     $config_file = PROJECT_PATH . '/config.ini';
     if (!is_readable($config_file)) {
         throw new ConfigException('Cannot read config file');
     }
     self::$settings = parse_ini_file($config_file);
     $custom_config = PROJECT_PATH . '/custom.ini';
     if (is_readable($custom_config)) {
         $custom = parse_ini_file(PROJECT_PATH . '/custom.ini');
         if ($custom !== false) {
             self::$settings = array_merge(self::$settings, $custom);
         }
     }
 }
开发者ID:kamekun,项目名称:WrapperPHP,代码行数:15,代码来源:config.class.php

示例13: addRoutes

 /**
  * add our routes to the routes array as instances of the Route object
  *
  * @return object
  */
 public function addRoutes($array = null)
 {
     //get all of our routes from the config (plus all environments)
     $routes = Config::settings('routes');
     //incase more routes where added merge the arrays
     if (!is_null($array)) {
         $routes = $routes + $array;
     }
     //loop though our routes and add them new route instances
     foreach ($routes as $route) {
         //create our new Route instance and store
         $this->addRoute(new Route($route['uri'], $route['pattern'], $route['filter']));
     }
     return $this;
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:20,代码来源:router.php

示例14: get_latest_art

	protected function get_latest_art () {	
		$latest_art_count = Config::settings('latest_art', 'count');
		
		$latest = Database::get_table(
			'art',
			array('id', 'user_id', 'name'),
			'area != "deleted" order by date desc limit '.$latest_art_count
		);
		
		$galleries = array();
		$image_limit = Config::settings('latest_art', 'image_limit');
		$galleries_limit =Config::settings('latest_art', 'galleries_limit');
		
		foreach ($latest as $art) {
			
			if (
				!empty($galleries[$art['user_id']]['images']) &&
				count($galleries[$art['user_id']]['images']) >= $image_limit
			) {
				continue;
			}
			
			$galleries[$art['user_id']]['images'][] = array(
				'id' => $art['id'],
				'name' => $art['name'],
			);
		}
		
		$galleries = array_slice($galleries, 0, $galleries_limit, true);
		
		$users = Database::get_vector(
			'user', 
			array('id', 'username'), 
			Database::array_in('id', $galleries),
			array_keys($galleries)
		);

		foreach ($users as $id => $user) {
			$alias = Meta_Author::get_alias_by_name($user);
			$galleries[$id]['link'] = empty($alias) ? $user : $alias;
			$galleries[$id]['username'] = $user;
		}

		$this->items['new'] = $galleries;
	}
开发者ID:4otaku,项目名称:draw,代码行数:45,代码来源:output.php

示例15: __construct

 /**
  * our construct
  * setup config details and instantiate the s3 instance
  *
  * @return void
  */
 private function __construct()
 {
     //get our s3 connection details
     $s3_config = Config::settings('s3');
     //if the bucket name isnt provided, use the default site bucket from the config
     if (is_null($bucket_name)) {
         $bucket_name = $s3_config['bucket_name'];
     }
     //set our instance variables including our required bucket
     $this->bucket_name = $bucket_name;
     //set our keys
     $this->key = $s3_config['key'];
     $this->secret = $s3_config['secret'];
     //create and cache our new instance
     $this->s3 = new \Meagr\Vender\S3\S3($this->key, $this->secret);
     //set the default endpoint
     $this->setEndpoint($this->endpoints[$this->location]);
 }
开发者ID:prwhitehead,项目名称:meagr,代码行数:24,代码来源:s3.php


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