本文整理汇总了PHP中Zend_Config_Xml::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Xml::get方法的具体用法?PHP Zend_Config_Xml::get怎么用?PHP Zend_Config_Xml::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Xml
的用法示例。
在下文中一共展示了Zend_Config_Xml::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Prepares the environment before running a test
*
*/
protected function setUp()
{
// read navigation config
$this->_files = dirname(__FILE__) . '/_files/navigation';
$config = new Zend_Config_Xml($this->_files . '/navigation.xml');
// create nav structures
$this->_nav1 = new Zym_Navigation($config->get('nav_test1'));
$this->_nav2 = new Zym_Navigation($config->get('nav_test2'));
// create view
$view = new Zend_View();
$view->addHelperPath('Zym/View/Helper', 'Zym_View_Helper');
// create helper
$this->_helper = new $this->_helperName();
$this->_helper->setView($view);
// set nav1 in helper as default
$this->_helper->setNavigation($this->_nav1);
}
示例2: 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);
}
示例3: 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);
}
示例4: __construct
/**
*
* @param string $config
*/
public function __construct($url)
{
if (false === ($dom = file_get_contents($url))) {
throw new ZtChart_Model_Identification_Exception('The identification config file read error.');
}
$xml = '<?xml version="1.0" ?>' . PHP_EOL;
$xml .= '<config>' . PHP_EOL;
$xml .= mb_convert_encoding($dom, 'UTF-8', $this->_encoding);
$xml .= '</config>';
$config = new Zend_Config_Xml($xml, 'GameCenter');
$this->_config = $config->get('Game');
}
示例5: testxmlcountryAction
function testxmlcountryAction()
{
//var_dump($this); die();
$layout = Zend_Layout::getMvcInstance();
$layout->disableLayout();
$config = new Zend_Config_Xml(CONFIG_PATH . '/countries.xml', 'countries');
//var_dump($config->database->params->get(0));
//var_dump($config->get('country')->get(0));
foreach ($config->get('country') as $country) {
echo $country->name . " ({$country->alpha2})<br>";
}
//$view = App_
//die();
}
示例6: _getRequestInfo
private function _getRequestInfo($request)
{
if (Mage::getStoreConfig('easynfe_nfe/config/tpamb') == '1') {
$url = self::NFE_REQUEST_URL;
} else {
$url = self::NFE_TEST_REQUEST_URL;
}
if (Mage::getStoreConfig('easynfe_nfe/config/tpamb') == '1') {
$url_base = self::NFE_REQUEST_URL_BASE;
$url_base_key = self::NFE_REQUEST_PUT_URL;
} else {
$url_base = self::NFE_TEST_REQUEST_URL_BASE;
$url_base_key = self::NFE_TEST_REQUEST_PUT_URL;
}
//$httpmessage = file($url . $request->getMessages() );
$defaults = array(CURLOPT_HEADER => 0, CURLOPT_TIMEOUT => 120, CURLOPT_USERPWD => Mage::getStoreConfig('easynfe_nfe/acesso/chave') . ":" . Mage::getStoreConfig('easynfe_nfe/acesso/pass'), CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true);
$ch = curl_init($url . $request->getMessages());
curl_setopt_array($ch, $defaults);
$result = curl_exec($ch);
$httpmessage = explode(PHP_EOL, $result);
$mRequest = Mage::getModel('easynfe_nfe/sales_order_request')->load($request->getId());
$orderId = Mage::getModel('easynfe_nfe/sales_order')->load(Mage::getModel('easynfe_nfe/sales_order_nf')->load($mRequest->getNfeNfId())->getNfOrderId())->getOrderId();
$mOrder = Mage::getModel('sales/order')->load($orderId);
/* @var $mOrder Mage_Sales_Model_Order */
if (is_array($httpmessage)) {
if ('AUTHORIZED' == str_replace(PHP_EOL, '', $httpmessage[0])) {
$context = stream_context_create(array('http' => array('header' => "Authorization: Basic " . base64_encode(Mage::getStoreConfig('easynfe_nfe/acesso/chave') . ":" . Mage::getStoreConfig('easynfe_nfe/acesso/pass')))));
$access_key = file_get_contents($url_base_key . '/' . Mage::getStoreConfig('easynfe_nfe/acesso/chave') . '/' . Mage::getStoreConfig('easynfe_nfe/config/serie') . '/' . $httpmessage[1] . '/accessKey', false, $context);
if ($access_key) {
/**
* check directories
*/
$ioObject = new Varien_Io_File();
$destDirectory = Mage::getBaseDir('media') . '/nf/pdf';
try {
$ioObject->open(array('path' => $destDirectory));
} catch (Exception $e) {
$ioObject->mkdir($destDirectory, 0777, true);
$ioObject->open(array('path' => $destDirectory));
}
$destDirectory = Mage::getBaseDir('media') . '/nf/tmp';
try {
$ioObject->open(array('path' => $destDirectory));
} catch (Exception $e) {
$ioObject->mkdir($destDirectory, 0777, true);
$ioObject->open(array('path' => $destDirectory));
}
$destDirectory = Mage::getBaseDir('media') . '/nf/xml';
try {
$ioObject->open(array('path' => $destDirectory));
} catch (Exception $e) {
$ioObject->mkdir($destDirectory, 0777, true);
$ioObject->open(array('path' => $destDirectory));
}
/**
* save tmp xml
*/
$tmp_filename = Mage::getBaseDir('media') . '/nf/tmp/' . $access_key . '.xml';
$xml_content = file_get_contents($url_base . 'nfe/' . Mage::getStoreConfig('easynfe_nfe/acesso/chave') . '/' . Mage::getStoreConfig('easynfe_nfe/config/serie') . '/' . $httpmessage[1] . '?accessKey=' . $access_key);
file_put_contents($tmp_filename, $xml_content);
$nfXML = new Zend_Config_Xml($tmp_filename);
if ($nfXML->protNFe->infProt->chNFe) {
$xml_filename = Mage::getBaseDir('media') . '/nf/xml/' . $nfXML->protNFe->infProt->chNFe . '.xml';
file_put_contents($xml_filename, $xml_content);
$pdf_filename = Mage::getBaseDir('media') . '/nf/pdf/' . $nfXML->protNFe->infProt->chNFe . '.pdf';
$pdf_content = file_get_contents($url_base . 'nfe/' . Mage::getStoreConfig('easynfe_nfe/acesso/chave') . '/' . Mage::getStoreConfig('easynfe_nfe/config/serie') . '/' . $httpmessage[1] . '/danfe?accessKey=' . $access_key);
file_put_contents($pdf_filename, $pdf_content);
$mRequest->setData('messages', $nfXML->protNFe->infProt->chNFe);
$mRequest->setData('status', Easynfe_Nfe_Helper_Data::NFE_SHIPMENT_STATUS_FINISHED);
$mRequest->setData('finished_at', date('Y-m-d H:i:s'));
/**
* change status order
*/
if ($mOrder->canShip()) {
$mOrder->setStatus('pending_nf')->save();
} else {
$mOrder->setStatus('complete_nf')->save();
}
unlink($tmp_filename);
/**/
if (Mage::getStoreConfig('easynfe_nfe/email/status')) {
try {
// send email
$objEmail = new Varien_Object();
$config = new Zend_Config_Xml($xml_filename);
$objEmail->setData('nf', $config->get('NFe')->get('infNFe')->get('ide')->get('nNF'));
$objEmail->setData('mod', $config->get('NFe')->get('infNFe')->get('ide')->get('mod'));
$objEmail->setData('cpf', $config->get('NFe')->get('infNFe')->get('dest')->get('CPF'));
$objEmail->setData('serie', $config->get('NFe')->get('infNFe')->get('ide')->get('serie'));
$objEmail->setData('chave', $config->get('protNFe')->get('infProt')->get('chNFe'));
// create email and attach files
$sendMail = Mage::getModel('core/email_template');
$sendMail->getMail()->createAttachment($pdf_content, 'application/pdf', Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, basename($pdf_filename));
$sendMail->getMail()->createAttachment($xml_content, 'text/xml', Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, basename($xml_filename));
if (Mage::getStoreConfig('easynfe_nfe/email/cc')) {
$sendMail->getMail()->addCc(Mage::getStoreConfig('easynfe_nfe/email/cc'));
}
if (Mage::getStoreConfig('easynfe_nfe/email/email') && Mage::getStoreConfig('easynfe_nfe/email/nome')) {
$senderEmail = array('name' => Mage::getStoreConfig('easynfe_nfe/email/nome'), 'email' => Mage::getStoreConfig('easynfe_nfe/email/email'));
} else {
//.........这里部分代码省略.........