Exemple #1
0
 function init()
 {
     $config = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
     $this->_config = @$config['pay'] ? $config['pay'] : array();
     $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
     $mt = new Default_Model_Txt();
     $config_db = $mt->fetchCol('key', 'SUBSTRING(`key`, 1, 4) = "pay_"');
     if ($config_db) {
         foreach ($config_db as $v) {
             $p = explode('_', $v);
             array_shift($p);
             $p0 = array_shift($p);
             if ($p0 && $p) {
                 $p = implode('_', $p);
                 $this->_config[$p0] = isset($this->_config[$p0]) ? $this->_config[$p0] : array();
                 $this->_config[$p0][$p] = $view->txt($v);
             }
         }
     }
 }
Exemple #2
0
 public function txt($key = null, $field = 'value')
 {
     if ($key === null) {
         return $this;
     } else {
         if ($this->_data === null) {
             $model = new Default_Model_Txt();
             $all = $model->fetchAll();
             if (count($all)) {
                 $all = $this->view->override($all, 'txt');
                 foreach ($all as $el) {
                     $this->_data[$el->key] = $el;
                 }
             } else {
                 $this->_data = array();
             }
         }
         return @$this->_data[$key]->{$field};
     }
 }
Exemple #3
0
 function init()
 {
     $config = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
     $this->_config = @$config['taobao'] ? $config['taobao'] : array();
     $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
     $mt = new Default_Model_Txt();
     $config_db = $mt->fetchCol('key', 'SUBSTRING(`key`, 1, 14) = "bingtranslate_"');
     if ($config_db) {
         foreach ($config_db as $v) {
             $p = explode('_', $v);
             $p0 = array_shift($p);
             if ($p) {
                 $p = implode('_', $p);
             }
             if ($p0 && $p) {
                 $this->_config[$p] = $view->txt($v);
             }
         }
     }
     $this->_appId = $this->getTokens("client_credentials", $this->_bingTranslateBaseUrl, $this->_config['id'], $this->_config['secret'], $this->_authUrl);
 }
Exemple #4
0
 function init()
 {
     $config = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
     $this->_config = @$config['taobao'] ? $config['taobao'] : array();
     $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
     $mt = new Default_Model_Txt();
     $config_db = $mt->fetchCol('key', 'SUBSTRING(`key`, 1, 7) = "taobao_"');
     if ($config_db) {
         foreach ($config_db as $v) {
             $p = explode('_', $v);
             $p0 = array_shift($p);
             if ($p) {
                 $p = implode('_', $p);
             }
             if ($p0 && $p) {
                 $this->_config[$p] = $view->txt($v);
             }
         }
     }
     $this->_config['url'] = $this->_config['apimode'] == 'test' ? 'http://gw.api.tbsandbox.com/router/rest' : 'http://gw.api.taobao.com/router/rest';
     $this->_config['param'] = array('app_key' => $this->_config['appkey'], 'format' => 'json', 'sign_method' => 'md5', 'v' => '2.0', 'timestamp' => date('Y-m-d H:i:s'));
 }