本文整理汇总了PHP中Zend_Config_Xml::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Xml::toArray方法的具体用法?PHP Zend_Config_Xml::toArray怎么用?PHP Zend_Config_Xml::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Xml
的用法示例。
在下文中一共展示了Zend_Config_Xml::toArray方法的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: 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();
}
示例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: __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;
}
}
示例8: _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();
}
示例9: 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) {
}
}
示例10: 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);
}
示例11: 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();
}
示例12: 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');
}
}
示例13: testClassCreate
/**
* creates a class called "unittest" containing all Object_Class_Data Types currently available.
* @return void
* @depends testFieldCollectionCreate
*/
public function testClassCreate()
{
$conf = new Zend_Config_Xml(TESTS_PATH . "/resources/objects/class-import.xml");
$importData = $conf->toArray();
$layout = Object_Class_Service::generateLayoutTreeFromArray($importData["layoutDefinitions"]);
$class = Object_Class::create();
$class->setName("unittest");
$class->setUserOwner(1);
$class->save();
$id = $class->getId();
$this->assertTrue($id > 0);
$class = Object_Class::getById($id);
$class->setLayoutDefinitions($layout);
$class->setUserModification(1);
$class->setModificationDate(time());
$class->save();
}
示例14: getWebsiteConfig
/**
* @static
* @return mixed|Zend_Config
*/
public static function getWebsiteConfig()
{
try {
$config = Zend_Registry::get("pimcore_config_website");
} catch (Exception $e) {
$cacheKey = "website_config";
if (!($config = Pimcore_Model_Cache::load($cacheKey))) {
$websiteSettingFile = PIMCORE_CONFIGURATION_DIRECTORY . "/website.xml";
$settingsArray = array();
if (is_file($websiteSettingFile)) {
$rawConfig = new Zend_Config_Xml($websiteSettingFile);
$arrayData = $rawConfig->toArray();
foreach ($arrayData as $key => $value) {
$s = null;
if ($value["type"] == "document") {
$s = Document::getByPath($value["data"]);
} else {
if ($value["type"] == "asset") {
$s = Asset::getByPath($value["data"]);
} else {
if ($value["type"] == "object") {
$s = Object_Abstract::getByPath($value["data"]);
} else {
if ($value["type"] == "bool") {
$s = (bool) $value["data"];
} else {
if ($value["type"] == "text") {
$s = (string) $value["data"];
}
}
}
}
}
if ($s) {
$settingsArray[$key] = $s;
}
}
}
$config = new Zend_Config($settingsArray, true);
Pimcore_Model_Cache::save($config, $cacheKey, array("websiteconfig", "system", "config"), null, 998);
}
self::setWebsiteConfig($config);
}
return $config;
}
示例15: _loadOptions
/**
* Load the config file
*
* @param string $fullpath
* @return array
*/
protected function _loadOptions($fullpath)
{
if (file_exists($fullpath)) {
switch (substr(trim(strtolower($fullpath)), -3)) {
case 'ini':
$cfg = new Zend_Config_Ini($fullpath, $this->getBootstrap()->getEnvironment());
break;
case 'xml':
$cfg = new Zend_Config_Xml($fullpath, $this->getBootstrap()->getEnvironment());
break;
default:
throw new Zend_Config_Exception('Invalid format for config file');
break;
}
} else {
throw new Zend_Application_Resource_Exception('File does not exist');
}
return $cfg->toArray();
}