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


PHP Config::load方法代码示例

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


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

示例1: get

 /**
  * @param string $key
  * @return mixed
  */
 public static function get($scope)
 {
     if (!isset(self::$settings[$scope])) {
         self::$instance->load($scope);
     }
     return self::$settings[$scope];
 }
开发者ID:Calmacil,项目名称:Mf,代码行数:11,代码来源:Config.php

示例2: _init

 /**
  * Init
  *
  * Loads in the config and sets the variables
  *
  * @access	public
  * @return	void
  */
 public static function _init()
 {
     \Config::load('breadcrumb', 'breadcrumb');
     if (\Config::get('breadcrumb.auto_render', static::$auto_render) === true) {
         static::initialise();
     }
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:15,代码来源:breadcrumb.php

示例3: install

 public static function install($package = null)
 {
     // Make sure something is set
     if ($package === null) {
         static::help();
         return;
     }
     $config = \Config::load('package');
     $version = \Cli::option('version', 'master');
     // Check to see if this package is already installed
     if (is_dir(PKGPATH . $package)) {
         throw new Exception('Package "' . $package . '" is already installed.');
         return;
     }
     foreach ($config['sources'] as $source) {
         $packages = array('fuel-' . $package, $package);
         foreach ($packages as $package) {
             $zip_url = 'http://' . rtrim($source, '/') . '/' . $package . '/zipball/' . $version;
             if ($fp = @fopen($zip_url, 'r')) {
                 // We don't actually need this, just checking the file is there
                 fclose($fp);
                 // Now, lets get this package
                 // If a direct download is requested, or git is unavailable, download it!
                 if (\Cli::option('direct') or static::_use_git() === false) {
                     static::_download_package_zip($zip_url, $package, $version);
                     exit;
                 } else {
                     static::_clone_package_repo($source, $package, $version);
                     exit;
                 }
             }
         }
     }
     throw new Exception('Could not find package "' . $package . '".');
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:35,代码来源:package.php

示例4: instance

 /**
  * Get a instance.
  *
  * @return \Jobqueue\Context
  */
 public static function instance()
 {
     if (is_null(static::$instance)) {
         static::$instance = new static(\Fuel::$env, \Config::load('jobqueue', 'jobqueue'));
     }
     return static::$instance;
 }
开发者ID:hosopy,项目名称:fuel-jobqueue,代码行数:12,代码来源:context.php

示例5: _init

 /**
  * Loads in the config and sets the variables
  */
 public static function _init()
 {
     // Prevent multiple initializations
     if (static::$initialized) {
         return;
     }
     \Config::load('casset', true);
     $paths = \Config::get('casset.paths', static::$asset_paths);
     foreach ($paths as $key => $path) {
         static::add_path($key, $path);
     }
     static::$asset_url = \Config::get('casset.url', \Config::get('base_url'));
     static::$default_folders = array('css' => \Config::get('casset.css_dir', static::$default_folders['css']), 'js' => \Config::get('casset.js_dir', static::$default_folders['js']), 'img' => \Config::get('casset.img_dir', static::$default_folders['img']));
     static::$cache_path = \Config::get('casset.cache_path', static::$cache_path);
     static::$min_default = \Config::get('casset.min', static::$min_default);
     static::$combine_default = \Config::get('casset.combine', static::$combine_default);
     $group_sets = \Config::get('casset.groups', array());
     foreach ($group_sets as $group_type => $groups) {
         foreach ($groups as $group_name => $group) {
             $enabled = array_key_exists('enabled', $group) ? $group['enabled'] : true;
             $combine = array_key_exists('combine', $group) ? $group['combine'] : null;
             $min = array_key_exists('min', $group) ? $group['min'] : null;
             static::add_group($group_type, $group_name, $enabled, $combine, $min);
             foreach ($group['files'] as $files) {
                 if (!is_array($files)) {
                     $files = array($files, false);
                 }
                 static::add_asset($group_type, $files[0], $files[1], $group_name);
             }
         }
     }
     static::$show_files = \Config::get('casset.show_files', static::$show_files);
     static::$show_files_inline = \Config::get('casset.show_files_inline', static::$show_files_inline);
     static::$initialized = true;
 }
开发者ID:huglester,项目名称:fuelphp-casset,代码行数:38,代码来源:casset.php

示例6: load

 protected function load($menu = null)
 {
     $menu = $menu ?: $this->menu;
     $data = \Config::load('menu/' . $menu, true, true, true);
     $this->meta = array('name' => \Arr::get($data, 'name'), 'identifier' => \Arr::get($data, 'slug'), 'num_items' => $this->count($data['children']));
     return $data;
 }
开发者ID:indigophp,项目名称:fuel-menu,代码行数:7,代码来源:static.php

示例7: __construct

	/**
	 * Sets the initial Ftp filename and local data.
	 *
	 * @param   string  Ftp filename
	 * @param   array   array of values
	 * @return  void
	 */
	public function __construct($config = 'default')
	{
		\Config::load('ftp', true);

		// If it is a string we're looking at a predefined config group
		if (is_string($config))
		{
			$config_arr = \Config::get('ftp.'.$config);

			// Check that it exists
			if ( ! is_array($config_arr) or $config_arr === array())
			{
				throw new \Exception('You have specified an invalid ftp connection group: '.$config);
			}

			$config = $config_arr;
		}

		// Prep the hostname
		$this->_hostname = preg_replace('|.+?://|', '', $config['hostname']);
		$this->_username = $config['username'];
		$this->_password = $config['password'];
		$this->_port = ! empty($config['port']) ? (int) $config['port'] : 21;
		$this->_passive = (bool) $config['passive'];
		$this->_ssl_mode = (bool) $config['ssl_mode'];
		$this->_debug = (bool) $config['debug'];

		static::$initialized = true;
	}
开发者ID:ralf57,项目名称:fuel,代码行数:36,代码来源:ftp.php

示例8: _init

 /**
  * Initialize
  */
 public static function _init()
 {
     $config = \Config::load('sentry', true);
     static::$config = $config[\Fuel::$env];
     // create instance for PHP
     static::$client = new \Raven_Client(static::$config['php']['dsn']);
 }
开发者ID:core-tech,项目名称:fuel-packages-sentry,代码行数:10,代码来源:sentry.php

示例9: run

 public function run()
 {
     $url = 'http://' . (getenv('WEB_HOST') ? getenv('WEB_HOST') : 'localhost');
     $output = APPPATH . '/cache/benchmark-results.json';
     \Config::load('orms', true);
     $orms = \Config::get('orms.list');
     $data = [];
     $errors = [];
     foreach ($orms as $orm) {
         echo 'Benchmarking ' . $orm . ' ...';
         try {
             $time = 0;
             $memory = 0;
             for ($i = 0; $i < 100; $i++) {
                 $result = file_get_contents($url . '/orm/' . $orm . '/get_one');
                 $tmp = explode("\n", $result);
                 //                var_dump($tmp);
                 $time += (double) trim($tmp[2], ' sec');
                 $memory += (double) trim($tmp[3], ' KB');
             }
             $time = $time / $i * 1000;
             $memory = $memory / $i;
             echo "\t" . substr($time, 0, 9) . 'ms ' . "\t" . $memory . 'KB' . PHP_EOL;
             $data[$orm] = array('time' => $time, 'memory' => $memory);
         } catch (\Exception $e) {
             $errors[$orm] = (string) $e;
             echo "\tfailed!\n";
         }
     }
     foreach ($errors as $orm => $error) {
         echo "\n{$orm} failed with exception:\n{$error}\n";
     }
     file_put_contents($output, json_encode($data));
 }
开发者ID:motin,项目名称:php-orm-benchmark,代码行数:34,代码来源:benchmark.php

示例10: __construct

 function __construct($app_name)
 {
     $config = \Config::load('google', true);
     $this->_client = new \apiClient();
     if ($app_name != null && $app_name != "") {
         $this->_client->setApplicationName($app_name);
     }
     foreach ($config as $key => $value) {
         if ($value != null && $value != "") {
             switch ($key) {
                 case "client_id":
                     $this->_client->setClientId($value);
                     break;
                 case "client_secret":
                     $this->_client->setClientSecret($value);
                     break;
                 case "redirect_uri":
                     $this->_client->setRedirectUri($value);
                     break;
                 case "developer_key":
                     $this->_client->setDeveloperKey($value);
                     break;
             }
         }
     }
 }
开发者ID:beingsane,项目名称:TTII_2012,代码行数:26,代码来源:google.php

示例11: _init

 public static function _init()
 {
     \Config::load('complexauth', true, true, true);
     if (\Config::get('complexauth.remember_me.enabled', false)) {
         static::$remember_me = \Session::forge(array('driver' => 'cookie', 'cookie' => array('cookie_name' => \Config::get('complexauth.remember_me.cookie_name', 'rmcookie')), 'encrypt_cookie' => true, 'expire_on_close' => false, 'expiration_time' => \Config::get('complexauth.remember_me.expiration', 86400 * 31)));
     }
 }
开发者ID:khoapossible,项目名称:vision_system,代码行数:7,代码来源:complexauth.php

示例12: action_settings

 /**
  * Setting the display of pages
  *
  * @uses  Arr::merge
  * @uses  Config::load
  * @uses  Message::success
  */
 public function action_settings()
 {
     $this->title = __('Page Settings');
     $post = Config::load('page');
     $action = Route::get('admin/page')->uri(array('action' => 'settings'));
     $vocabs = array(__('none'));
     $view = View::factory('admin/page/settings')->set('vocabs', $vocabs)->set('post', $post)->set('action', $action);
     $vocabs = Arr::merge($vocabs, ORM::factory('term')->where('lft', '=', 1)->where('type', '=', 'page')->find_all()->as_array('id', 'name'));
     if ($this->valid_post('page_settings')) {
         unset($_POST['page_settings'], $_POST['_token'], $_POST['_action']);
         $cats = $post->get('category', array());
         foreach ($_POST as $key => $value) {
             if ($key == 'category') {
                 $terms = array_diff($cats, $value);
                 if ($terms) {
                     DB::delete('posts_terms')->where('parent_id', 'IN', array_values($terms))->execute();
                 }
             }
             $post->set($key, $value);
         }
         Log::info('Page Settings updated.');
         Message::success(__('Page Settings updated!'));
         $this->request->redirect(Route::get('admin/page')->uri(array('action' => 'settings')), 200);
     }
     $this->response->body($view);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:33,代码来源:page.php

示例13: action_main

 public function action_main($params = array())
 {
     $config = $this->config;
     $gConfig = \Config::load('novius_social_widget::config', true);
     if (Arr::get($gConfig, 'embed_js', true)) {
         if (!empty($config['js'])) {
             foreach ($config['js'] as $script) {
                 Nos::main_controller()->addJavascript($script);
             }
         }
     }
     $chrome = array();
     $typeList = array('chrome');
     foreach ($params as $param => $value) {
         if ($value) {
             foreach ($typeList as $type) {
                 $typePrefix = "{$type}-";
                 if ($value && \Str::starts_with($param, $typePrefix)) {
                     array_push(${$type}, \Str::sub($param, \Str::length($typePrefix)));
                 }
             }
         }
     }
     return \View::forge('novius_social_widget::front/enhancer/twitter', array('widgetId' => $params['widget-id'], 'chrome' => $chrome, 'limit' => \Arr::get($params, 'limit'), 'width' => \Arr::get($params, 'width'), 'height' => \Arr::get($params, 'height')), false);
 }
开发者ID:novius,项目名称:novius_social_widget,代码行数:25,代码来源:twitter.ctrl.php

示例14: __construct

 /**
  * Construct
  * 
  * Called when the class is initialised
  * 
  * @access	protected
  * @return	PDF\PDF
  */
 protected function __construct($driver = null)
 {
     // Load Config
     \Config::load('pdf', true);
     // Default Driver
     if ($driver == null) {
         $driver = \Config::get('pdf.default_driver');
     }
     // Set the lib path
     $this->set_lib_path(PKGPATH . 'pdf' . DS . 'lib' . DS);
     $drivers = \Config::get('pdf.drivers');
     $temp_driver = isset($drivers[$driver]) ? $drivers[$driver] : false;
     if ($temp_driver === false) {
         throw new \Exception(sprintf('Driver \'%s\' doesn\'t exist.', $driver));
     }
     $driver = $temp_driver;
     // Include files
     foreach ($driver['includes'] as $include) {
         include_once $this->_get_include_file($include);
     }
     $this->set_driver_class($driver['class']);
     // Return this object. User must now call init and provide the parameters that
     // the driver wants. This action is caught by __call()
     return $this;
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:33,代码来源:pdf.php

示例15: split

 /**
  * Return all defined permissions (results get stored at the first run)
  *
  *
  *
  * @return array
  */
 public function split($exclude)
 {
     static $list = null;
     if ($list == null) {
         $perms = array('free' => array(), 'excluded' => array());
         $paths = array_keys(Kohana::list_files('permissions'));
         foreach ($paths as $path) {
             $set = str_replace(array('permissions' . DIRECTORY_SEPARATOR, '.php'), '', $path);
             $list = $this->_list->load($set)->as_array();
             foreach ($list as $k => $v) {
                 if (is_int($k)) {
                     if (!in_array($set . '.' . $v, $exclude)) {
                         $perms['free'][] = $set . '.' . $v;
                     } else {
                         $perms['excluded'][] = $set . '.' . $v;
                     }
                 } else {
                     $perms = $this->_process_perms_split($v, $set . '.' . $k, $perms, $exclude);
                 }
             }
         }
         $list = $perms;
     }
     sort($perms['excluded']);
     sort($perms['free']);
     return $list;
 }
开发者ID:happydemon,项目名称:s4k,代码行数:34,代码来源:Permissions.php


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