本文整理汇总了PHP中Piwik_Config::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Config::init方法的具体用法?PHP Piwik_Config::init怎么用?PHP Piwik_Config::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Config
的用法示例。
在下文中一共展示了Piwik_Config::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWritingConfigWithSpecialCharacters
public function testWritingConfigWithSpecialCharacters()
{
$userFile = PIWIK_INCLUDE_PATH . '/tests/resources/Config/config.written.ini.php';
$globalFile = PIWIK_INCLUDE_PATH . '/tests/resources/Config/global.ini.php';
$config = new Piwik_Config($userFile, $globalFile);
$config->init();
$stringWritten = '&6^ geagea\'\'\'";;&';
$config->Category = array('test' => $stringWritten);
$this->assertEqual($config->Category->test, $stringWritten);
unset($config);
$config = new Piwik_Config($userFile, $globalFile);
$config->init();
$this->assertEqual($config->Category->test, $stringWritten);
$config->Category = array('test' => $config->Category->test, 'test2' => $stringWritten);
$this->assertEqual($config->Category->test, $stringWritten);
$this->assertEqual($config->Category->test2, $stringWritten);
}
示例2: checkPreviousStepIsValid
/**
* The previous step is valid if it is either
* - any step before (OK to go back)
* - the current step (case when validating a form)
*/
protected function checkPreviousStepIsValid($currentStep)
{
$error = false;
// first we make sure that the config file is not present, ie. Installation state is expected
try {
$config = new Piwik_Config();
$config->init();
$error = true;
} catch (Exception $e) {
}
if (empty($this->session->currentStepDone)) {
$error = true;
} else {
// the currentStep
$currentStepId = array_search($currentStep, $this->steps);
// the step before
$previousStepId = array_search($this->session->currentStepDone, $this->steps);
// not OK if currentStepId > previous+1
if ($currentStepId > $previousStepId + 1) {
$error = true;
}
}
if ($error) {
$message = Piwik_Translate('Installation_ErrorInvalidState', array('<br /><b>', '</b>', '<a href=\'' . Piwik_Url::getCurrentUrlWithoutFileName() . '\'>', '</a>'));
Piwik::exitWithErrorMessage($message);
}
}