本文整理汇总了PHP中Zend_Config_Xml类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Xml类的具体用法?PHP Zend_Config_Xml怎么用?PHP Zend_Config_Xml使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Config_Xml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadParams
/**
* Do detection of content type, and retrieve parameters from raw body if
* present
*
* @return void
*/
protected function _loadParams()
{
$request = $this->getRequest();
$contentType = $request->getHeader('Content-Type');
$rawBody = $request->getRawBody();
if (!$rawBody) {
return;
}
switch (true) {
case strstr($contentType, 'application/json'):
$this->setBodyParams(Zend_Json::decode($rawBody));
break;
case strstr($contentType, 'application/xml'):
$config = new Zend_Config_Xml($rawBody);
$this->setBodyParams($config->toArray());
break;
default:
if ($request->isPut()) {
parse_str($rawBody, $params);
$this->setBodyParams($params);
}
break;
}
self::$_paramsLoaded = true;
}
示例2: __construct
/**
*
*/
public function __construct($object = null)
{
$this->_object = $object;
if (file_exists('/var/www/html/MaisVenda/cron.php')) {
$this->_documentRoot = '/var/www/html/MaisVenda';
} else {
$this->_documentRoot = str_replace("\\", "/", realpath('.'));
}
/**
* Busca as configurações do ambiente PHP
*/
$filenameConfig = $this->_documentRoot . "/job/Config.xml";
if (file_exists($filenameConfig)) {
$xml = file_get_contents($filenameConfig);
$config = new Zend_Config_Xml($xml);
$this->_config = $config->toArray();
}
if (!isset($this->_config['Config']['Path'])) {
$this->_config['Config']['Path'] = $this->_documentRoot . '/job/data';
}
if (!isset($this->_config['Config']['OperationSystem'])) {
$this->_config['Config']['OperationSystem'] = 'Linux';
}
if (!isset($this->_config['Config']['PathPhpExe'])) {
$this->_config['Config']['PathPhpExe'] = 'php';
}
if (!isset($this->_config['Config']['PathPhpExe'])) {
$this->_config['Config']['PathPhpIni'] = '/etc/php.ini';
}
$this->_path = $this->_config['Config']['Path'];
$this->_path = str_replace('\\', '/', $this->_path) . '/';
//$this->_clearFiles();
}
示例3: load
/**
* Склеивает все файлы в единый конфиг, попутно задействуя кеш
*
* @param string $path Путь к папке с файлами
* @param string $env APPLICATION_ENV
* @return array
*/
public static function load($path, $env)
{
$masterfiles = array();
if (file_exists($path . 'application.xml')) {
$handler = opendir($path);
while (($file = readdir($handler)) !== false) {
if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'xml') {
$masterfiles[] = $path . $file;
}
}
sort($masterfiles);
closedir($handler);
$cache = self::getCache($masterfiles);
$cacheid = md5($path);
if ($cache->test($cacheid)) {
return $cache->load($cacheid);
} else {
$config = new Zend_Config_Xml($path . 'application.xml', $env, array('allowModifications' => true));
foreach ($masterfiles as $file) {
if ($file != 'application.xml') {
$config->merge(new Zend_Config_Xml($file, $env));
}
}
$config = $config->toArray();
$cache->save($config, $cacheid);
return $config;
}
}
return false;
}
示例4: __construct
/**
* @param String $rawXmlResponse The response that comes back directly from the AT SOAP service.
* @param String $methodName Name of the SOAP method called.
*/
public function __construct($rawXmlResponse, $methodName)
{
$resultKey = $methodName . 'Result';
$xml = $rawXmlResponse->{$resultKey};
$xmlParser = new Zend_Config_Xml($xml);
$resultArray = $xmlParser->toArray();
$this->exchangeArray($resultArray);
}
示例5: getConfig
public static function getConfig()
{
if (!self::$pluginConfig) {
$xml = new \Zend_Config_Xml(self::getConfigFile());
self::$pluginConfig = $xml->toArray();
}
return self::$pluginConfig;
}
示例6: navbarMainMenu
function navbarMainMenu()
{
$config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/configs/navbar.xml', 'main');
$container = new Zend_Navigation();
$container->setPages($config->toArray());
$view = new Zend_View();
echo $view->navigation($container)->menu()->setUlClass('nav navbar-nav')->setMaxDepth(0)->render();
}
示例7: sidebarMenu
function sidebarMenu()
{
$config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/configs/sidebar.xml', 'sidebar');
$container = new Zend_Navigation();
$container->setPages($config->toArray());
$view = new Zend_View();
echo $view->navigation($container)->menu()->setMaxDepth(1)->render();
}
示例8: __construct
public function __construct()
{
try {
$config = new Zend_Config_Xml(SPHINX_VAR . DIRECTORY_SEPARATOR . "config.xml");
$this->config = $config->toArray();
} catch (Zend_Config_Exception $e) {
$this->config = $this->defaults;
}
}
示例9: country
public function country($elementName = "countryId", $selectedValue)
{
$config = new Zend_Config_Xml(CONFIG_PATH . '/countries.xml', 'countries');
$aCountries = array();
foreach ($config->get('country') as $country) {
$aCountries[$country->alpha2] = $country->name;
}
return $this->formSelect($elementName, $selectedValue, null, $aCountries);
}
示例10: formSelectCountries
public function formSelectCountries($elementName = "countryId", $selectedValue)
{
$config = new Zend_Config_Xml(KUTU_ROOT_DIR . '/application/configs/countries.xml', 'countries');
$aCountries = array();
foreach ($config->get('country') as $country) {
//echo $country->name." ($country->alpha2)<br>";
$aCountries[$country->alpha2] = $country->name;
}
return $this->formSelect($elementName, $selectedValue, null, $aCountries);
}
示例11: _initNavigation
protected function _initNavigation()
{
$this->bootstrap('view');
$this->bootstrap('frontController');
$this->bootstrap('acl');
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
$resource = new Zend_Application_Resource_Navigation(array('pages' => $config->toArray()));
$resource->setBootstrap($this);
return $resource->init();
}
示例12: unsetClassmap
public function unsetClassmap()
{
$classmapXml = PIMCORE_CONFIGURATION_DIRECTORY . '/classmap.xml';
try {
$conf = new Zend_Config_Xml($classmapXml);
$classmap = $conf->toArray();
unset($classmap['Object_BlogEntry']);
$writer = new Zend_Config_Writer_Xml(array('config' => new Zend_Config($classmap), 'filename' => $classmapXml));
$writer->write();
} catch (Exception $e) {
}
}
示例13: authenticate
/**
* (non-PHPdoc)
*
* @see Zend_Auth_Adapter_Interface::authenticate()
*/
public function authenticate()
{
$users = new Zend_Config_Xml(APPLICATION_PATH . "/modules/utils/configs/auth.xml");
foreach ($users->toArray() as $user) {
if ($user['email'] == $this->user) {
if ($user['password'] == sha1($this->password)) {
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, (object) $user);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $user);
}
}
}
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $user);
}
示例14: navbarRightMenu
function navbarRightMenu()
{
$config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/configs/navbar.xml', 'nav');
$container = new Zend_Navigation();
$container->setPages($config->toArray());
/*$container->addPage(
array(
'label' => Zend_Auth::getInstance()->getIdentity()->email,
'title' => 'Dashboard',
'uri' => '/admin/'
));*/
$view = new Zend_View();
echo $view->navigation($container)->menu()->setUlClass('dropdown-menu')->render();
}
示例15: databaseDetails
function databaseDetails()
{
switch ($this->whichShoppingCart()) {
case 'prestashop':
require_once $this->shoppingCartRoot() . '/config/settings.inc.php';
return array('dbname' => _DB_NAME_, 'username' => _DB_USER_, 'password' => _DB_PASSWD_, 'product_table' => 'ps_product', 'product_sku_field' => 'reference', 'product_id_field' => 'id_product');
case 'magento':
$config = new \Zend_Config_Xml($this->shoppingCartRoot() . 'app/etc/local.xml');
$dbConfig = $config->toArray();
$dbinfo = $dbConfig['global']['resources']['default_setup']['connection'];
$dbinfo = $dbinfo + array('product_table' => 'catalog_product_entity', 'product_sku_field' => 'sku', 'product_id_field' => 'entity_id');
return $dbinfo;
default:
throw new \Exception('Unable to detect shopping cart');
}
}