本文整理汇总了PHP中ConfigManager::declareConfigValue方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::declareConfigValue方法的具体用法?PHP ConfigManager::declareConfigValue怎么用?PHP ConfigManager::declareConfigValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::declareConfigValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($PLANET)
{
$this->Config = ConfigManager::declareConfigValue();
$this->ReactionTime = $this->Config['ReactionTime'];
// if the attack will come within 10min, defend the planet
// ReactionTime should be longer than the attacks detecting period for the defender
$this->PLANET = $PLANET;
}
示例2: __construct
function __construct($this_coord, $s_coord, $_href, $_planet)
{
$this->shield_coord = $s_coord;
$this->p_coord = $this_coord;
$this->href = $_href;
$this->planet = $_planet;
$this->Config = ConfigManager::declareConfigValue();
$this->fCommander = new FleetCommander($this->p_coord, $this->shield_coord, $this->href);
}
示例3: __construct
function __construct($this_coord, $s_coord, $_href)
{
$this->coord = $this_coord;
$this->target_coord = $s_coord;
$this->href = $_href;
$this->duration = 0;
$this->fleetInfo = array("test");
$this->Config = ConfigManager::declareConfigValue();
//echo "\nFleet commander ".$this->href."\n";
}
示例4: run
function run()
{
$config = ConfigManager::declareConfigValue();
$period = 10 * 60;
while (1 == 1) {
for ($count = 1; $count <= 5; $count++) {
system("cmd.exe /c Syntime" . $count . ".bat");
sleep(30);
}
echo "Sleep for 10 mins\n";
sleep($period);
}
}
示例5: getPlanets
public static function getPlanets()
{
$Config = ConfigManager::declareConfigValue();
//get overview page html
$overview = GlobalFunc::httpGet($Config['OVERVIEW_URL'], $Config['COOKIE_FILE']);
$ov_dom = GlobalFunc::loadHtml($overview);
$planet_list_dom = $ov_dom->getElementById("planetList");
$pList = $planet_list_dom;
if (!is_object($pList)) {
echo "Error occur, Planet List not found, return empty planet list.\n";
return array();
}
//list 下 每個div都是一個星球
//每個div下都有兩個span
//<span class="planet-name ">jones4</span>
//<span class="planet-koords ">[1:83:6]</span>
$planets_dom = $pList->getElementsByTagName('div');
//echo "There ". $planets_dom->length . " Planet(s).";
//存放月亮的起始編號(最後一顆星球之後就是月亮)
$moon_num = $planets_dom->length + 1;
//create planets
$planets = array();
for ($i = 0; $i < $planets_dom->length; $i++) {
//get planet link
$a_list = $planets_dom->item($i)->getElementsByTagName('a');
$a_dom = $a_list->item(0);
//產生星球
$planet = Planet::createPlanetObj($a_dom, $planets_dom, $i);
//將星球obj 加入list
$planets[$i] = $planet;
//確認是否有月球
$has_moon = false;
$moon_href = "";
$moon_coord = array();
$a_count = $a_list->length;
$moon_obj = array();
Planet::updateMoonInfo($a_list, $a_count, $planet, $has_moon, $moon_href, $moon_coord);
if ($has_moon == true) {
//有月亮則加到清單最後面
$moon_obj = new Planet("月亮", $moon_coord, null, $moon_href, $moon_num);
//將月亮obj 加入list
//idx為編號-1
$planets[$moon_num - 1] = $moon_obj;
$moon_num++;
//月亮編號+1
}
}
return $planets;
}
示例6: date_default_timezone_set
require_once "GlobalFunc.php";
//Escape
require_once "EscapeFilter.php";
require_once "LoginManager.php";
require_once "AttackDetector.php";
require_once "RecourseManager.php";
//used in AttackDetector
require_once "Planet.php";
require_once "Defender.php";
//used in Defender
require_once "FleetCommander.php";
date_default_timezone_set('Asia/Taipei');
//error_reporting(E_DEPRECATED); 連error都沒有
//error_reporting(E_ERROR);
//error_reporting(-1);
$Config = ConfigManager::declareConfigValue();
//結束時會取得一次overview page
$loginManager = new LoginManager();
echo "\nThreaten Count: " . $Config['ThreatenCount'] . "\n";
//會取得一次overview page
$PLANETS = Planet::getPlanets();
if ($PLANETS) {
$loginManager->start();
$ResourceManager = new RecourseManager($PLANETS);
$ResourceManager->start();
if (isset($PLANETS)) {
echo "AttackDetector is Constructed, " . sizeof($PLANETS) . " planet(s) is protected.\n";
} else {
echo "Failed to get planet list, login and get planet list again.\n";
$loginManager->newSessionGetOverview();
$PLANETS = Planet::getPlanets();
示例7: newSession
function newSession()
{
$config = ConfigManager::declareConfigValue();
$COOKIE_FILE = $config['COOKIE_FILE'];
$USER_UNIVERSE = $config['USER_UNIVERSE'];
$USER_ACCOUNT = $config['USER_ACCOUNT'];
$USER_PASS = $config['USER_PASS'];
//First to ask for data
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://tw.ogame.gameforge.com/main/login");
curl_setopt($ch, CURLOPT_POST, true);
// 啟用POST
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//not output result
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
//Ignore redirection
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIE_FILE);
curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIE_FILE);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array("kid" => "", "uni" => $USER_UNIVERSE, "login" => $USER_ACCOUNT, "pass" => $USER_PASS)));
$login_result = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($login_result, 0, $header_size);
$body = substr($login_result, $header_size);
curl_close($ch);
//extract query url and data info
$location = $this->extractHeader($header);
//print_r("Out Location = ". $location . PHP_EOL);
//Ask for new session id
$login_return = GlobalFunc::httpGet($location, $COOKIE_FILE);
// modify cookie file for correcting cookie edit mistake (session live time is set to 0)
$this->editCookieFile($COOKIE_FILE);
// extract correct session id
$SESSION = $this->extractSeesion($login_return);
//updateConfigInfoByNewSession( $SESSION );
$over_page = GlobalFunc::httpGet($config['OVERVIEW_URL'] . "&" . $SESSION, $config['COOKIE_FILE']);
if ($SESSION) {
echo "Login Manager got a new session.\n";
} else {
echo "Get Session Fail.\n";
return 0;
}
return $SESSION;
}
示例8: __construct
function __construct($PLANETS)
{
$this->Config = ConfigManager::declareConfigValue();
$this->PLANETS = $PLANETS;
$R_List = array();
}
示例9: changeFocusPlanet
public static function changeFocusPlanet($href)
{
$Config = ConfigManager::declareConfigValue();
$COOKIE_FILE = $Config['COOKIE_FILE'];
return GlobalFunc::httpGet($href, $COOKIE_FILE);
}
示例10: getConfig
public static function getConfig()
{
if (isset(self::$Config)) {
return self::$Config;
} else {
self::$Config = ConfigManager::declareConfigValue();
return self::$Config;
}
}