本文整理汇总了PHP中Axis::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis::config方法的具体用法?PHP Axis::config怎么用?PHP Axis::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setRequest
/**
* Set request params
* @param array $request
*/
protected function _setRequest($request)
{
$r = new Axis_Object();
$r->service = implode(',', $this->_config->allowedTypes->toArray());
$r->account = $this->_config->account;
$r->dropoff = $this->_config->dropoff;
$r->package = $this->_config->package;
$r->measure = $this->_config->measure;
// Set Origin detail
$r->originPostalCode = Axis::config()->core->store->zip;
$r->origStateOrProvinceCode = Axis::single('location/zone')->getCode(Axis::config()->core->store->zone);
$r->originCountryCode = Axis::single('location/country')->find(Axis::config()->core->store->country)->current()->iso_code_2;
// Set Destination information
if ($request['country']['iso_code_2'] == 'US') {
$r->destPostalCode = substr(str_replace(' ', '', $request['postcode']), 0, 5);
} else {
$r->destPostalCode = substr(str_replace(' ', '', $request['postcode']), 0, 6);
}
$r->destCountryCode = $request['country']['iso_code_2'];
$r->weight = $request['weight'];
$r->value = Axis::single('locale/currency')->to($request['price'], 'USD');
$r->currency = 'USD';
//$request['currency'];
$this->_request = $r;
return $this->_request;
}
示例2: address
/**
*
* @param Axis_Address $address
* @param string $EOL
* @return string
*/
public function address(Axis_Address $address, $EOL = '<br/>')
{
// $template = '{{firstname}} {{lastname}}EOL' .
// '{{if company}}{{company}}EOL{{/if}}' .
// '{{street_address}}EOL' .
// '{{if suburb}}{{suburb}}EOL{{/if}}'.
// '{{city}} {{if zone.name}}{{zone.name}} {{/if}}{{postcode}}EOL' .
// '{{country.name}}EOL' .
// 'T: {{phone}}EOL' .
// '{{if fax}}F: {{fax}}EOL{{/if}}'
// ;
$address = $address->toArray();
$addressFormatId = !empty($address['address_format_id']) ? $address['address_format_id'] : Axis::config('locale/main/addressFormat');
if (empty($this->_addressFormats[$addressFormatId])) {
throw new Axis_Exception(Axis::translate('location')->__('Not correct address format id'));
}
$template = $this->_addressFormats[$addressFormatId]['address_format'];
if (isset($address['zone']['id']) && 0 == $address['zone']['id']) {
unset($address['zone']);
}
$matches = array();
preg_match_all('/{{if (.+)(?:\\.(.+))?}}(.+){{\\/if}}/U', $template, $matches);
foreach ($matches[0] as $key => $condition) {
$replaced = empty($matches[2][$key]) ? empty($address[$matches[1][$key]]) ? '' : $matches[3][$key] : (empty($address[$matches[1][$key]][$matches[2][$key]]) ? '' : $matches[3][$key]);
$template = str_replace($condition, $replaced, $template);
}
preg_match_all('/{{(.+)(?:\\.(.+))?}}/U', $template, $matches);
foreach ($matches[0] as $key => $condition) {
$replaced = empty($matches[2][$key]) ? $address[$matches[1][$key]] : $address[$matches[1][$key]][$matches[2][$key]];
$template = str_replace($condition, $this->view->escape($replaced), $template);
}
return str_replace('EOL', $EOL, $template);
}
示例3: collect
public function collect(Axis_Checkout_Model_Total $total)
{
$checkout = Axis::single('checkout/checkout');
if (null === $checkout->shipping()) {
return false;
}
if (!($taxClassId = $checkout->shipping()->config()->taxClass)) {
if (!($taxClassId = Axis::config()->tax->shipping->taxClass)) {
return false;
}
}
if (!($taxBasis = $checkout->shipping()->config()->taxBasis)) {
if (!($taxBasis = Axis::config()->tax->shipping->taxBasis)) {
return false;
}
}
$address = $checkout->getStorage()->{$taxBasis};
if (!$address || !$address->hasCountry()) {
return false;
}
$countryId = $address->country->id;
$zoneId = $address->hasZone() && $address->zone->hasId() ? $address->zone->id : null;
$geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
if (!count($geozoneIds)) {
return false;
}
$customerGroupId = Axis::single('account/customer')->getGroupId();
if (!$customerGroupId) {
return false;
}
$type = $checkout->shipping()->getType($checkout->getShippingRequest(), $checkout->getShippingMethodCode());
$tax = Axis::single('tax/rate')->calculateByPrice($type['price'], $taxClassId, $geozoneIds, $customerGroupId);
$total->addCollect(array('code' => $this->getCode(), 'title' => $this->getTitle(), 'total' => $tax, 'sortOrder' => $this->_config->sortOrder));
}
示例4: __construct
/**
* Construct, create index
*
* @param string $indexPath[optional]
* @param string $encoding[optional]
* @throws Axis_Exception
*/
public function __construct(array $params)
{
$encoding = $this->_encoding;
$indexPath = array_shift($params);
if (count($params)) {
$encoding = array_shift($params);
}
if (null === $indexPath) {
$site = Axis::getSite()->id;
$locale = Axis::single('locale/language')->find(Axis_Locale::getLanguageId())->current()->locale;
$indexPath = Axis::config()->system->path . '/var/index/' . $site . '/' . $locale;
}
if (!is_readable($indexPath)) {
throw new Axis_Exception(Axis::translate('search')->__('Please, update search indexes, to enable search functionality'));
}
/*
$mySimilarity = new Axis_Similarity();
Zend_Search_Lucene_Search_Similarity::setDefault($mySimilarity);
*/
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding($encoding);
// add filter by words
$stopWords = array('a', 'an', 'at', 'the', 'and', 'or', 'is', 'am');
$stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords);
$analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
$analyzer->addFilter($stopWordsFilter);
Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
$this->_index = Zend_Search_Lucene::open($indexPath);
$this->_encoding = $encoding;
}
示例5: _initConfig
protected function _initConfig()
{
$this->bootstrap('Loader');
$config = Zend_Registry::get('config');
Zend_Registry::set('config', new Axis_Config($config, true));
return Axis::config();
}
示例6: log
public function log($observer)
{
if (!Axis::config('log/main/enabled')) {
return false;
}
/**
* @var $request Zend_Controller_Request_Abstract
*/
$request = $observer->getController()->getRequest();
$url = $request->getScheme() . '://' . $request->getHttpHost() . $request->getRequestUri();
$refer = $request->getServer('HTTP_REFERER', '');
$timestamp = Axis_Date::now()->toSQLString();
$siteId = Axis::getSiteId();
// add new url request
$modelUrlInfo = Axis::single('log/url_info');
$rowUrlInfo = $modelUrlInfo->select()->where('url = ?', $url)->where('refer = ?', $refer)->fetchRow();
if (!$rowUrlInfo) {
$rowUrlInfo = $modelUrlInfo->createRow(array('url' => $url, 'refer' => $refer));
$rowUrlInfo->save();
}
//add/update visitor
$visitor = Axis::single('log/visitor')->getVisitor();
//add/update visitor info
Axis::single('log/visitor_info')->getRow(array('visitor_id' => $visitor->id, 'user_agent' => $request->getServer('HTTP_USER_AGENT', ''), 'http_accept_charset' => $request->getServer('HTTP_ACCEPT_CHARSET', ''), 'http_accept_language' => $request->getServer('HTTP_ACCEPT_LANGUAGE', ''), 'server_addr' => $request->getServer('SERVER_ADDR', ''), 'remote_addr' => $request->getServer('REMOTE_ADDR', '')))->save();
Axis::single('log/url')->insert(array('url_id' => $rowUrlInfo->id, 'visitor_id' => $visitor->id, 'visit_at' => $timestamp, 'site_id' => $siteId));
}
示例7: postProcess
public function postProcess(Axis_Sales_Model_Order_Row $order)
{
$number = $this->getCreditCard()->getCcNumber();
switch (Axis::config("payment/{$order->payment_method_code}/saveCCAction")) {
case 'last_four':
$number = str_repeat('X', strlen($number) - 4) . substr($number, -4);
break;
case 'first_last_four':
$number = substr($number, 0, 4) . str_repeat('X', strlen($number) - 8) . substr($number, -4);
break;
case 'partial_email':
$number = substr($number, 0, 4) . str_repeat('X', strlen($number) - 8) . substr($number, -4);
try {
$mail = new Axis_Mail();
$mail->setLocale(Axis::config('locale/main/language_admin'));
$mail->setConfig(array('subject' => Axis::translate('sales')->__('Order #%s. Credit card number'), 'data' => array('text' => Axis::translate('sales')->__('Order #%s, Credit card middle digits: %s', $order->number, substr($number, 4, strlen($number) - 8))), 'to' => Axis_Collect_MailBoxes::getName(Axis::config('sales/order/email'))));
$mail->send();
} catch (Zend_Mail_Transport_Exception $e) {
}
break;
case 'complete':
$number = $number;
break;
default:
return true;
}
$crypt = Axis_Crypt::factory();
$data = array('order_id' => $order->id, 'cc_type' => $crypt->encrypt($card->getCcType()), 'cc_owner' => $crypt->encrypt($card->getCcOwner()), 'cc_number' => $crypt->encrypt($number), 'cc_expires_year' => $crypt->encrypt($card->getCcExpiresYear()), 'cc_expires_month' => $crypt->encrypt($card->getCcExpiresMonth()), 'cc_cvv' => Axis::config()->payment->{$order->payment_method_code}->saveCvv ? $crypt->encrypt($card->getCcCvv()) : '', 'cc_issue_year' => $crypt->encrypt($card->getCcIssueYear()), 'cc_issue_month' => $crypt->encrypt($card->getCcIssueMonth()));
Axis::single('sales/order_creditcard')->save($data);
}
示例8: getInstance
/**
* Retrieve singleton instance of Axis_HumanUri_Adapter
*
* @static
* @return Axis_HumanUri_Adapter_Abstact
*/
public static function getInstance()
{
if (null === self::$_instance) {
self::$_instance = Axis_HumanUri::factory(Axis::config()->front->humanUrlAdapter);
}
return self::$_instance;
}
示例9: removeAction
public function removeAction()
{
$customerGroupIds = Zend_Json::decode($this->_getParam('data'));
$isValid = true;
if (in_array(Axis_Account_Model_Customer_Group::GROUP_GUEST_ID, $customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default Guest group id: %s ", Axis_Account_Model_Customer_Group));
}
if (in_array(Axis_Account_Model_Customer_Group::GROUP_ALL_ID, $customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default All group id: %s ", Axis_Account_Model_Customer_Group::GROUP_ALL_ID));
}
if (true === in_array(Axis::config()->account->main->defaultCustomerGroup, $customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default customer group id: %s ", $id));
}
if (!sizeof($customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__('No data to delete'));
}
if ($isValid) {
Axis::single('account/customer_group')->delete($this->db->quoteInto('id IN(?)', $customerGroupIds));
Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
}
$this->_helper->json->sendJson(array('success' => $isValid));
}
示例10: _loadCollection
/**
*
* @return array
*/
protected function _loadCollection()
{
if (empty($this->_collection)) {
$themes = Axis::model('core/option_theme');
$layouts = array();
$designPath = Axis::config('system/path') . '/app/design/front';
foreach ($themes as $theme) {
$path = $designPath . '/' . $theme . '/layouts';
if (!file_exists($path)) {
continue;
}
$dir = opendir($path);
while ($file = readdir($dir)) {
if (is_dir($path . '/' . $file) || substr($file, 0, 7) != 'layout_') {
continue;
}
$layout = substr($file, 0, -6);
if (isset($layouts[$layout])) {
$layouts[$layout]['themes'][] = $theme;
continue;
}
$layouts[$layout] = array('name' => $layout, 'themes' => array($theme));
}
}
$collection = array();
foreach ($layouts as $key => $layout) {
$collection[$key] = $layout['name'] . ' (' . implode(', ', $layout['themes']) . ')';
}
$this->_collection = $collection;
}
return $this->_collection;
}
示例11: collect
/**
*
* @static
* @return array
*/
public static function collect()
{
if (null === self::$_collection) {
$themes = Axis_Collect_Theme::collect();
$layouts = array();
$designPath = Axis::config('system/path') . '/app/design/front';
foreach ($themes as $theme) {
$path = $designPath . '/' . $theme . '/layouts';
if (!file_exists($path)) {
continue;
}
$dir = opendir($path);
while ($file = readdir($dir)) {
if (is_dir($path . '/' . $file) || substr($file, 0, 7) != 'layout_') {
continue;
}
$layout = substr($file, 0, -6);
if (isset($layouts[$layout])) {
$layouts[$layout]['themes'][] = $theme;
continue;
}
$layouts[$layout] = array('name' => $layout, 'themes' => array($theme));
}
}
$collection = array();
foreach ($layouts as $key => $layout) {
$collection[$key] = $layout['name'] . ' (' . implode(', ', $layout['themes']) . ')';
}
self::$_collection = $collection;
}
return self::$_collection;
}
示例12: _calculateShippingTax
function _calculateShippingTax($price, Axis_Method_Shipping_Model_Abstract $shipping, array $params)
{
$customerGroupId = $params['customer_group_id'];
if (!($taxClassId = $shipping->config()->taxClass)) {
if (!($taxClassId = Axis::config()->tax->shipping->taxClass)) {
return 0;
}
}
if (!($taxBasis = $shipping->config()->taxBasis)) {
if (!($taxBasis = Axis::config()->tax->shipping->taxBasis)) {
return 0;
}
}
if ('billing' === $taxBasis) {
$countryId = $params['billing_country_id'];
$zoneId = $params['billing_zone_id'];
} else {
$countryId = $params['delivery_country_id'];
$zoneId = $params['delivery_zone_id'];
}
if (empty($zoneId)) {
$zoneId = null;
}
$geozoneIds = Axis::single('location/geozone')->getIds($countryId, $zoneId);
if (empty($geozoneIds)) {
return 0;
}
return Axis::single('tax/rate')->calculateByPrice($price, $taxClassId, $geozoneIds, $customerGroupId);
}
示例13: getSaveValue
/**
*
* @param mixed $value
* @return mixed
*/
public static function getSaveValue($value)
{
if (!is_array($value)) {
return $value;
}
function remove_quotes(&$str)
{
$str = str_replace(array('"', "'"), '', $str);
}
$filename = Axis::config()->system->path . '/var/export/' . current($value);
if (@(!($fp = fopen($filename, 'r')))) {
Axis::message()->addError(Axis::translate('core')->__("Can't open file : %s", $filename));
return current($value);
}
$titles = fgetcsv($fp, 2048, ',', "'");
array_walk($titles, 'remove_quotes');
$rowSize = count($titles);
Axis::table('shippingtable_rate')->delete("site_id = " . $value['siteId']);
while (!feof($fp)) {
$data = fgetcsv($fp, 2048, ',', "'");
if (!is_array($data)) {
continue;
}
$data = array_pad($data, $rowSize, '');
array_walk($data, 'remove_quotes');
$data = array_combine($titles, $data);
Axis::table('shippingtable_rate')->insert(array('site_id' => $value['siteId'], 'country_id' => Axis::single('location/country')->getIdByIsoCode3($data['Country']), 'zone_id' => Axis::single('location/zone')->getIdByCode($data['Region/State']), 'zip' => $data['Zip'], 'value' => $data['Value'], 'price' => $data['Price']));
}
return current($value);
}
示例14: init
public function init()
{
parent::init();
$this->view->languages = Axis::model('locale/option_language')->toArray();
$this->view->sites = Axis::model('core/option_site')->toArray();
$this->view->locales = Axis::single('locale/language')->select()->fetchAssoc();
$this->view->adminUrl = '/' . trim(Axis::config('core/backend/route'), '/ ');
}
示例15: hurl
public function hurl(array $options = array(), $ssl = false, $reset = false)
{
$baseUrl = $ssl && $this->_enabledSsl ? $this->view->secureUrl : $this->view->baseUrl;
$locale = isset($options['locale']) ? $options['locale'] : Axis_Locale::getLanguageUrl();
if (!empty($locale)) {
$locale = '/' . $locale;
}
return $baseUrl . $locale . '/' . Axis::config('catalog/main/route') . $this->_hurl->url($options, $reset);
}