本文整理汇总了PHP中Cx\Core\Setting\Controller\Setting::getArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getArray方法的具体用法?PHP Setting::getArray怎么用?PHP Setting::getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Setting\Controller\Setting
的用法示例。
在下文中一共展示了Setting::getArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSettings
/**
* Creates an array containing all important cache-settings
*
* @global object $objDatabase
* @return array $arrSettings
*/
function getSettings()
{
$arrSettings = array();
\Cx\Core\Setting\Controller\Setting::init('Config', NULL, 'Yaml');
$ymlArray = \Cx\Core\Setting\Controller\Setting::getArray('Config', null);
foreach ($ymlArray as $key => $ymlValue) {
$arrSettings[$key] = $ymlValue['value'];
}
return $arrSettings;
}
示例2: updatePhpCache
/**
* Write all settings to the config file
*
*/
public static function updatePhpCache()
{
global $_ARRAYLANG, $_CONFIG;
if (!\Cx\Lib\FileSystem\FileSystem::makeWritable(self::getSettingsFile())) {
\Message::add(self::getSettingsFile() . ' ' . $_ARRAYLANG['TXT_SETTINGS_ERROR_WRITABLE'], \Message::CLASS_ERROR);
return false;
}
//get values from ymlsetting
\Cx\Core\Setting\Controller\Setting::init('Config', NULL, 'Yaml');
$ymlArray = \Cx\Core\Setting\Controller\Setting::getArray('Config', null);
$intMaxLen = 0;
$ymlArrayValues = array();
foreach ($ymlArray as $key => $ymlValue) {
$_CONFIG[$key] = $ymlValue['value'];
$ymlArrayValues[$ymlValue['group']][$key] = $ymlValue['value'];
// special case to add legacy domainUrl configuration option
if ($key == 'mainDomainId') {
$domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
$objMainDomain = $domainRepository->findOneBy(array('id' => $ymlArray[$key]['value']));
if ($objMainDomain) {
$domainUrl = $objMainDomain->getName();
} else {
$domainUrl = $_SERVER['SERVER_NAME'];
}
$ymlArrayValues[$ymlValue['group']]['domainUrl'] = $domainUrl;
if ($_CONFIG['xmlSitemapStatus'] == 'on') {
\Cx\Core\PageTree\XmlSitemapPageTree::write();
}
}
$intMaxLen = strlen($key) > $intMaxLen ? strlen($key) : $intMaxLen;
}
$intMaxLen += strlen('$_CONFIG[\'\']') + 1;
//needed for formatted output
// update environment
\Env::set('config', $_CONFIG);
$strHeader = "<?php\n";
$strHeader .= "/**\n";
$strHeader .= "* This file is generated by the \"settings\"-menu in your CMS.\n";
$strHeader .= "* Do not try to edit it manually!\n";
$strHeader .= "*/\n\n";
$strFooter = "?>";
//Write values
$data = $strHeader;
$strBody = '';
foreach ($ymlArrayValues as $group => $sectionValues) {
$strBody .= "/**\n";
$strBody .= "* -------------------------------------------------------------------------\n";
$strBody .= "* " . ucfirst($group) . "\n";
$strBody .= "* -------------------------------------------------------------------------\n";
$strBody .= "*/\n";
foreach ($sectionValues as $sectionName => $sectionNameValue) {
$strBody .= sprintf("%-" . $intMaxLen . "s", '$_CONFIG[\'' . $sectionName . '\']');
$strBody .= "= ";
$strBody .= (self::isANumber($sectionNameValue) ? $sectionNameValue : '"' . str_replace('"', '\\"', $sectionNameValue) . '"') . ";\n";
}
$strBody .= "\n";
}
$data .= $strBody;
$data .= $strFooter;
try {
$objFile = new \Cx\Lib\FileSystem\File(self::getSettingsFile());
$objFile->write($data);
return true;
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
\DBG::msg($e->getMessage());
}
return false;
}
示例3: testFileSystemGetArrayOfAllGroups
public function testFileSystemGetArrayOfAllGroups()
{
\DBG::log('*** testFileSystemGetArrayOfAllGroups ***');
$this->addValuesFileSystem();
Setting::init('MultiSiteTest', null, 'FileSystem');
$val = Setting::getArray('MultiSiteTest');
$this->assertEquals(4, count($val));
$this->deleteValuesFileSystem();
}
示例4: checkIn
/**
* Verifies the parameters posted back by Payrexx
* @return boolean True on success, false otherwise
*/
public static function checkIn()
{
if (empty($_POST['transaction']['invoice']['paymentRequestId']) || empty($_POST['transaction']['status'])) {
return false;
}
if ($_POST['transaction']['status'] === 'waiting') {
die;
// we don't want the shop to update the status to cancelled or confirmed
}
if ($_POST['transaction']['status'] !== 'confirmed') {
return false;
}
$invoiceId = $_POST['transaction']['invoice']['paymentRequestId'];
$arrSettings = \Cx\Core\Setting\Controller\Setting::getArray('Shop', 'config');
if (empty($arrSettings)) {
return false;
}
$instanceName = !empty($arrSettings['payrexx_instance_name']['value']) ? $arrSettings['payrexx_instance_name']['value'] : '';
$apiSecret = !empty($arrSettings['payrexx_api_secret']['value']) ? $arrSettings['payrexx_api_secret']['value'] : '';
if (empty($instanceName) || empty($apiSecret)) {
return false;
}
$payrexx = new \Payrexx\Payrexx($instanceName, $apiSecret);
$invoice = new \Payrexx\Models\Request\Invoice();
$invoice->setId($invoiceId);
try {
$invoice = $payrexx->getOne($invoice);
} catch (\Payrexx\PayrexxException $e) {
return false;
}
return $invoice->getStatus() === $_POST['transaction']['status'];
}
示例5: getForm
/**
* Creates and returns the HTML Form for requesting the payment service.
*
* The parameters in $uriparam are appended to the base index URI.
* If empty, this defaults to "section=Shop&cmd=success".
*
* @access public
* @global array $_ARRAYLANG
* @param array $arrFields The parameter array
* @param string $submitValue The optional label for the submit button
* @param boolean $autopost If true, the form is automatically submitted. Defaults to false.
* @param array $arrSettings Settings from \Cx\Core\Setting
* @param object $landingPage The optional URI parameter string
* @return string The HTML form code
*/
static function getForm($arrFields, $submitValue = 'Send', $autopost = false, $arrSettings = null, $landingPage = null)
{
global $_ARRAYLANG;
if (gettype($landingPage) != 'object' || get_class($landingPage) != 'Cx\\Core\\ContentManager\\Model\\Entity\\Page') {
self::$arrError[] = 'No landing page passed.';
}
if (($sectionName = $landingPage->getModule()) && !empty($sectionName)) {
self::$sectionName = $sectionName;
} else {
self::$arrError[] = 'Passed landing page is not an application.';
}
if (empty($arrSettings)) {
$settingDb = \Cx\Core\Setting\Controller\Setting::getArray(self::$sectionName, 'config');
if (!empty($settingDb) && $settingDb['postfinance_active']['value']) {
$arrSettings = $settingDb;
} else {
self::$arrError[] = "Could not load settings.";
}
}
if (empty($arrFields['PSPID'])) {
$arrFields['PSPID'] = $arrSettings['postfinance_shop_id']['value'];
}
if (empty($arrFields['OPERATION'])) {
$arrFields['OPERATION'] = $arrSettings['postfinance_authorization_type']['value'];
}
if (empty($arrFields['LANGUAGE'])) {
$arrFields['LANGUAGE'] = strtolower(FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID)) . '_' . strtoupper(FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID));
}
$baseUri = Cx\Core\Routing\Url::fromPage($landingPage)->toString() . '?result=';
if (empty($arrFields['ACCEPTURL'])) {
$arrFields['ACCEPTURL'] = $baseUri . '1';
}
if (empty($arrFields['DECLINEURL'])) {
$arrFields['DECLINEURL'] = $baseUri . '2';
}
if (empty($arrFields['EXCEPTIONURL'])) {
$arrFields['EXCEPTIONURL'] = $baseUri . '2';
}
if (empty($arrFields['CANCELURL'])) {
$arrFields['CANCELURL'] = $baseUri . '0';
}
if (empty($arrFields['BACKURL'])) {
$arrFields['BACKURL'] = $baseUri . '2';
}
if (!self::setFields($arrFields)) {
self::$arrError[] = 'Failed to verify keys.';
return false;
}
$arrFields['SHASIGN'] = self::signature($arrFields, $arrSettings['postfinance_hash_signature_in']['value']);
$server = $arrSettings['postfinance_use_testserver']['value'] ? 'test' : 'prod';
$charset = CONTREXX_CHARSET == 'UTF-8' ? '_utf8' : '';
$hiddenFields = '';
foreach ($arrFields as $name => $value) {
$hiddenFields .= Html::getHidden($name, $value);
}
$autoSubmit = !$autopost ? '' : '
<script type="text/javascript">
/* <![CDATA[ */
document.yellowpay.submit();
/* ]]> */
</script>
';
$form = $_ARRAYLANG['TXT_ORDER_LINK_PREPARED'] . '<br/><br/>' . '<form name="yellowpay" method="post" action="https://e-payment.postfinance.ch/ncol/' . $server . '/orderstandard' . $charset . '.asp">' . $hiddenFields . '<input type="submit" name="go" value="' . $submitValue . '" />' . '</form>' . $autoSubmit;
return $form;
}