當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config::get方法代碼示例

本文整理匯總了PHP中Config::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::get方法的具體用法?PHP Config::get怎麽用?PHP Config::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Config的用法示例。


在下文中一共展示了Config::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDefault

 /**
  * Try to retrieve a default setting from a config fallback.
  *
  * @param string $key
  * @param mixed  $default
  *
  * @return mixed config setting or default when not found
  */
 protected function getDefault($key, $default)
 {
     if (!$this->fallback) {
         return $default;
     }
     return $this->fallback->get($key, $default);
 }
開發者ID:Ceciceciceci,項目名稱:MySJSU-Class-Registration,代碼行數:15,代碼來源:Config.php

示例2: CreateOnePlanetRecord

/**
 *  2Moons
 *  Copyright (C) 2012 Jan Kröpke
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Jan Kröpke <info@2moons.cc>
 * @copyright 2012 Jan Kröpke <info@2moons.cc>
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.7.3 (2013-05-19)
 * @info $Id: CreateOnePlanetRecord.php 2640 2013-03-23 19:23:26Z slaver7 $
 * @link http://2moons.cc/
 */
function CreateOnePlanetRecord($Galaxy, $System, $Position, $Universe, $PlanetOwnerID, $PlanetName, $HomeWorld = false, $AuthLevel = 0, $Iron, $Gold, $Crystal, $Elyrium, $iPlanetCount)
{
    global $LNG;
    $CONF = Config::getAll(NULL, $Universe);
    if (Config::get('max_galaxy') < $Galaxy || 1 > $Galaxy) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (Config::get('max_system') < $System || 1 > $System) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (Config::get('max_planets') < $Position || 1 > $Position) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (CheckPlanetIfExist($Galaxy, $System, $Position, $Universe)) {
        return false;
    }
    $tp = 0;
    if ($iPlanetCount >= 3) {
        $tp = 1;
    }
    $FieldFactor = Config::get('planet_factor');
    require 'includes/PlanetData.php';
    $Pos = ceil($Position / (Config::get('max_planets') / count($PlanetData)));
    $TMax = $PlanetData[$Pos]['temp'];
    $TMin = $TMax - 40;
    $Fields = $PlanetData[$Pos]['fields'] * Config::get('planet_factor');
    $Types = $PlanetData[$Pos]['image'];
    $Name = !empty($PlanetName) ? $GLOBALS['DATABASE']->sql_escape($PlanetName) : $LNG['type_planet'][1];
    $GLOBALS['DATABASE']->query("INSERT INTO " . PLANETS . " SET\n\t\t\t\tname = '" . $Name . "',\n\t\t\t\tuniverse = " . $Universe . ",\n\t\t\t\tid_owner = " . $PlanetOwnerID . ",\n\t\t\t\tgalaxy = " . $Galaxy . ",\n\t\t\t\tsystem = " . $System . ",\n\t\t\t\tplanet = " . $Position . ",\n\t\t\t\tlast_update = " . TIMESTAMP . ",\n\t\t\t\tplanet_type = '1',\n\t\t\t\tcolo_metal = " . $Iron . ",\n\t\t\t\tcolo_crystal = " . $Gold . ",\n\t\t\t\tcolo_deut = " . $Crystal . ",\n\t\t\t\tcolo_elyrium = " . $Elyrium . ",\n\t\t\t\tteleport_portal = " . $tp . ",\n\t\t\t\timage = '" . $Types . "',\n\t\t\t\tdiameter = " . floor(1000 * sqrt($Fields)) . ",\n\t\t\t\tfield_max = " . ($HomeWorld ? Config::get('initial_fields') : floor($Fields)) . ",\n\t\t\t\ttemp_min = " . $TMin . ",\n\t\t\t\ttemp_max = " . $TMax . ",\n\t\t\t\tmetal = " . Config::get('metal_start') . ",\n\t\t\t\tmetal_perhour = " . Config::get('metal_basic_income') . ",\n\t\t\t\tcrystal = " . Config::get('crystal_start') . ",\n\t\t\t\tcrystal_perhour = " . Config::get('crystal_basic_income') . ",\n\t\t\t\tdeuterium = " . Config::get('deuterium_start') . ",\n\t\t\t\tdeuterium_perhour = " . Config::get('deuterium_basic_income') . ",\n\t\t\t\telyrium = " . Config::get('deuterium_start') . ",\n\t\t\t\telyrium_perhour = " . Config::get('deuterium_basic_income') . ";");
    return $GLOBALS['DATABASE']->GetInsertID();
}
開發者ID:fuding,項目名稱:Antaris,代碼行數:56,代碼來源:CreateOnePlanetRecord.php

示例3: applyDefaultParameters

 /**
  * @param array $params
  * @param Config $mainConfig
  * @return array
  */
 public static function applyDefaultParameters(array $params, Config $mainConfig)
 {
     $logger = LoggerFactory::getInstance('Mime');
     $params += ['typeFile' => $mainConfig->get('MimeTypeFile'), 'infoFile' => $mainConfig->get('MimeInfoFile'), 'xmlTypes' => $mainConfig->get('XMLMimeTypes'), 'guessCallback' => function ($mimeAnalyzer, &$head, &$tail, $file, &$mime) use($logger) {
         // Also test DjVu
         $deja = new DjVuImage($file);
         if ($deja->isValid()) {
             $logger->info(__METHOD__ . ": detected {$file} as image/vnd.djvu\n");
             $mime = 'image/vnd.djvu';
             return;
         }
         // Some strings by reference for performance - assuming well-behaved hooks
         Hooks::run('MimeMagicGuessFromContent', [$mimeAnalyzer, &$head, &$tail, $file, &$mime]);
     }, 'extCallback' => function ($mimeAnalyzer, $ext, &$mime) {
         // Media handling extensions can improve the MIME detected
         Hooks::run('MimeMagicImproveFromExtension', [$mimeAnalyzer, $ext, &$mime]);
     }, 'initCallback' => function ($mimeAnalyzer) {
         // Allow media handling extensions adding MIME-types and MIME-info
         Hooks::run('MimeMagicInit', [$mimeAnalyzer]);
     }, 'logger' => $logger];
     if ($params['infoFile'] === 'includes/mime.info') {
         $params['infoFile'] = __DIR__ . "/libs/mime/mime.info";
     }
     if ($params['typeFile'] === 'includes/mime.types') {
         $params['typeFile'] = __DIR__ . "/libs/mime/mime.types";
     }
     $detectorCmd = $mainConfig->get('MimeDetectorCommand');
     if ($detectorCmd) {
         $params['detectCallback'] = function ($file) use($detectorCmd) {
             return wfShellExec("{$detectorCmd} " . wfEscapeShellArg($file));
         };
     }
     return $params;
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:39,代碼來源:MimeMagic.php

示例4: getKafkaProducer

 /**
  * Get the producer object from kafka-php.
  * @return Produce
  */
 protected function getKafkaProducer()
 {
     if (!$this->producer) {
         $this->producer = Produce::getInstance(null, null, $this->config->get('KafkaEventHost'));
     }
     return $this->producer;
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:11,代碼來源:EventRelayerKafka.php

示例5: getAll

 /**
  * Gets all user limited with page and limit
  *
  * @param  int  $page
  * @param  into $limit
  * @return object
  */
 public function getAll($page = 1, $limit = 40)
 {
     $users = $this->dc->qb()->select('*')->from($this->dc->p($this->config->get('foolz/foolframe', 'foolauth', 'table_name')), 't')->setMaxResults($limit)->setFirstResult($page * $limit - $limit)->execute()->fetchAll();
     $users = User::forge($this->getContext(), $users);
     $count = $this->dc->qb()->select('COUNT(*) as count')->from($this->dc->p($this->config->get('foolz/foolframe', 'foolauth', 'table_name')), 't')->execute()->fetch();
     return ['result' => $users, 'count' => $count['count']];
 }
開發者ID:KasaiDot,項目名稱:FoolFrame,代碼行數:14,代碼來源:Users.php

示例6: __construct

 /**
  * @param array  $settings
  * @param string $environment
  */
 public function __construct(array $settings = [], $environment = self::ENV_DEVELOPMENT)
 {
     parent::__construct();
     if (!defined('INFUSE_BASE_DIR')) {
         die('INFUSE_BASE_DIR has not been defined!');
     }
     /* Load Configuration */
     $configWithDirs = ['dirs' => ['app' => INFUSE_BASE_DIR . '/app', 'assets' => INFUSE_BASE_DIR . '/assets', 'public' => INFUSE_BASE_DIR . '/public', 'temp' => INFUSE_BASE_DIR . '/temp', 'views' => INFUSE_BASE_DIR . '/views']];
     $settings = array_replace_recursive(static::$baseConfig, $configWithDirs, $settings);
     $config = new Config($settings);
     $this['config'] = $config;
     $this['environment'] = $environment;
     /* Base URL */
     $this['base_url'] = function () use($config) {
         $url = ($config->get('app.ssl') ? 'https' : 'http') . '://';
         $url .= $config->get('app.hostname');
         $port = $config->get('app.port');
         $url .= (!in_array($port, [0, 80, 443]) ? ':' . $port : '') . '/';
         return $url;
     };
     /* Services  */
     foreach ($config->get('services') as $name => $class) {
         $this[$name] = new $class($this);
     }
     // set the last created app instance
     self::$default = $this;
 }
開發者ID:idealistsoft,項目名稱:framework-bootstrap,代碼行數:31,代碼來源:Application.php

示例7: init

 /**
  * Initialize the internal static variables using the global variables
  *
  * @param Config $config Configuration object to load data from
  */
 public function init(Config $config)
 {
     foreach ($config->get('PasswordConfig') as $type => $options) {
         $this->register($type, $options);
     }
     $this->setDefaultType($config->get('PasswordDefault'));
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:12,代碼來源:PasswordFactory.php

示例8: init

 public static function init()
 {
     if (self::$hasinit) {
         return false;
     }
     // Load configuration.
     self::$config = new Config('realms.ini');
     if (!self::$config->get('general', 'service_requests')) {
         // Service unavaliable. :(
         http_response_code(503);
         // 503 Service Unavaliable.
         echo 'service unavaliable';
         exit;
         // terminate here.
     }
     // Load request registry
     self::$requestRegistry = new RequestRegistry();
     // create request registry instance
     // Dynamically load request handlers.
     $handler_files = scandir('inc/Requests');
     foreach ($handler_files as $handler_file) {
         if ($handler_file == '.' || $handler_file == '..') {
             continue;
         }
         // skip ghost files
         // Load PHP file
         require 'inc/Requests/' . $handler_file;
         // Register handler
         $classname = pathinfo($handler_file, PATHINFO_FILENAME);
         self::$requestRegistry->register(new $classname());
     }
     // Realms init finish.
     self::$hasinit = true;
     return true;
 }
開發者ID:harmjanhaisma,項目名稱:Realms,代碼行數:35,代碼來源:Realms.php

示例9: testGet3

 /**
  * Test root/production/host1 level config
  *
  * @covers Phossa\Config\Reference\Config::get()
  */
 public function testGet3()
 {
     $this->object = new Config(__DIR__ . '/testData/', 'production/host1');
     $this->assertEquals('bingo', $this->object->get('db.auth.user'));
     $this->assertEquals('nopass', $this->object->get('db.auth.pass'));
     $this->assertEquals('dbhost', $this->object->get('db.auth.host'));
     $this->assertEquals(3506, $this->object->get('db.auth.port'));
 }
開發者ID:phossa,項目名稱:phossa-config,代碼行數:13,代碼來源:ConfigTest.php

示例10: testFromArray

 public function testFromArray()
 {
     $expected = array('nome' => 'andre', 'sobrenome' => 'nascimento');
     $config = new Config();
     $config->fromArray($expected);
     $this->AssertEquals($expected['nome'], $config->get('nome'));
     $this->AssertEquals($expected['sobrenome'], $config->get('sobrenome'));
 }
開發者ID:ecomz,項目名稱:payment,代碼行數:8,代碼來源:ConfigTest.php

示例11: 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

示例12: httpsBool

 /**
  * HTTPS Bool
  *
  * Gets HTTPS status in bool form
  *
  * @param Config $config
  * @return bool
  * @throws Exception
  */
 public static function httpsBool(Config $config)
 {
     if ($config->get('server', 'protocol') === 'https://') {
         return true;
     } elseif ($config->get('server', 'protocol') === 'http://') {
         return false;
     }
     throw new Exception("Protocol is not known. " . $config->get('server', 'protocol') === 'https://');
 }
開發者ID:ZacharyDuBois,項目名稱:Digital-Footprint-Profile,代碼行數:18,代碼來源:Utility.php

示例13: get

 /**
  * @param $userID
  * @param $serverID
  * @return int|string
  */
 public function get($userID, $serverID)
 {
     foreach ($this->config->get("admins", "permissions") as $adminID) {
         if ($adminID == $userID) {
             return 2;
         }
     }
     return $this->db->queryField("SELECT permission FROM permissions WHERE userID = :userID AND serverID = :serverID", "permission", [":userID" => $userID, ":serverID" => $serverID]);
 }
開發者ID:sovereignbot,項目名稱:citadel,代碼行數:14,代碼來源:Permissions.php

示例14: testLoadConfig

 public function testLoadConfig()
 {
     $config = new Config(__DIR__, "/config.conf");
     $teste = $config->get('teste');
     $this->assertTrue(is_array($teste));
     $this->assertCount(2, $teste);
     $this->assertEquals('Ecomz\\Common', $teste['nome']);
     $this->assertEquals('Ivo Nascimento', $teste['author']);
     $this->assertEquals('qualquer data', $config->get('nosectiondata'));
 }
開發者ID:ecomz,項目名稱:common,代碼行數:10,代碼來源:ConfigTest.php

示例15: __construct

 public function __construct()
 {
     $conf = new Config();
     $this->base_url = $conf->get('app.base_url');
     $this->_module = $conf->get('app.default_module');
     $this->_page = $conf->get('app.default_page');
     $this->_page = $conf->get('app.default_act');
     $this->_params = $conf->get('app.default_params');
     $conf->close();
 }
開發者ID:indradaud,項目名稱:cms,代碼行數:10,代碼來源:Application.php


注:本文中的Config::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。