本文整理匯總了PHP中Axis::translate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Axis::translate方法的具體用法?PHP Axis::translate怎麽用?PHP Axis::translate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Axis
的用法示例。
在下文中一共展示了Axis::translate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: indexAction
public function indexAction()
{
$this->view->pageTitle = Axis::translate('sitemap')->__('Sitemap');
$this->view->sitesList = Axis::single('core/site')->fetchAll()->toArray();
$this->view->crawlers = array_values(Axis::model('sitemap/crawler')->toArray());
$this->render();
}
示例2: ratings
/**
* Build rating stars, according to recieved ratings array
*
* @param array $ratings
* array(
* array(
* 'mark' => int,
* 'title' => string,
* 'product_id' => int[optional]
* ),...
* )
* @param string $url [optional]
* @param boolean $smallStars [optional]
* @return string
*/
public function ratings($ratings, $url = '', $smallStars = true)
{
if (isset($this->_config['rating_enabled']) && !$this->_config['rating_enabled']) {
return '';
}
if (!is_array($ratings)) {
$ratings = array();
}
$url = empty($url) ? '#' : $url;
$hasRating = false;
$html = '';
foreach ($ratings as $rating) {
if (!count($rating)) {
continue;
}
$hasRating = true;
$html .= '<li>';
$html .= $this->_getRatingTitle($rating['title']);
$html .= '<a href="' . $url . '" class="review-stars review-rate' . ($smallStars ? '-sm' : '') . ' "title="' . $rating['title'] . ': ' . $rating['mark'] . ' ' . Axis::translate('community')->__('stars') . '">
<span style="width: ' . $rating['mark'] * 100 / 5 . '%">' . Axis::translate('community')->__("%s stars", $rating['mark']) . '</span>
</a>';
$html .= '</li>';
}
if ($hasRating) {
$html = '<ul class="review-ratings">' . $html . '</ul>';
}
return $html;
}
示例3: registerAction
public function registerAction()
{
if (Axis::getCustomerId()) {
$this->_redirect('account');
}
$this->setTitle(Axis::translate('account')->__('Create an Account'));
$form = Axis::single('account/form_signup');
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
if ($form->isValid($data)) {
$model = Axis::single('account/customer');
$data['site_id'] = Axis::getSiteId();
$data['is_active'] = 1;
list($row, $password) = $model->create($data);
$row->setDetails($data);
Axis::dispatch('account_customer_register_success', array('customer' => $row, 'password' => $password));
$model->login($data['email'], $password);
return $this->_redirect('account');
} else {
$form->populate($data);
}
}
$this->view->formSignup = $form;
$this->render();
}
示例4: 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);
}
示例5: viewAction
public function viewAction()
{
$this->setTitle(Axis::translate('sales')->__('Order Information'));
if ($this->_hasParam('orderId')) {
$orderId = $this->_getParam('orderId');
} else {
$this->_redirect('/account/order');
}
$order = Axis::single('sales/order')->fetchAll(array($this->db->quoteInto('customer_id = ?', Axis::getCustomerId()), $this->db->quoteInto('site_id = ?', Axis::getSiteId()), $this->db->quoteInto('id = ?', intval($orderId))));
if (!sizeof($order)) {
$this->_redirect('/account/order');
}
$order = $order->current();
$this->view->order = $order->toArray();
$this->view->order['products'] = $order->getProducts();
foreach ($this->view->order['products'] as &$product) {
// convert price with rates that was available
// during order was created (not current rates)
$product['price'] = Axis::single('locale/currency')->from($product['price'] * $order->currency_rate, $order->currency);
$product['final_price'] = Axis::single('locale/currency')->from($product['final_price'] * $order->currency_rate, $order->currency);
}
$this->view->order['totals'] = $order->getTotals();
foreach ($this->view->order['totals'] as &$total) {
// convert price with rates that was available
// during order was created (not current rates)
$total['value'] = Axis::single('locale/currency')->from($total['value'] * $order->currency_rate, $order->currency);
}
$this->view->order['billing'] = $order->getBilling();
$this->view->order['delivery'] = $order->getDelivery();
// convert price with rates that was available
// during order was created (not current rates)
$this->view->order['order_total'] = Axis::single('locale/currency')->from($order->order_total * $order->currency_rate, $order->currency);
$this->render();
}
示例6: __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;
}
示例7: addAction
public function addAction()
{
$pageId = $this->_getParam('page');
$this->view->page = array();
$currentPage = Axis::single('cms/page')->cache()->find($pageId)->current();
if (!$currentPage) {
$this->setTitle(Axis::translate('cms')->__('Page not found'));
$this->render();
return;
}
$categories = Axis::single('cms/category')->getParentCategory($pageId, true);
foreach ($categories as $_category) {
$label = empty($_category['title']) ? $_category['link'] : $_category['title'];
$this->_helper->breadcrumbs(array('label' => $label, 'params' => array('cat' => $_category['link']), 'route' => 'cms_category'));
}
$rowContent = $currentPage->cache()->getContent();
$this->setTitle($rowContent->title);
$page = array('content' => $rowContent->content, 'is_commented' => (bool) $currentPage->comment);
if ($currentPage->comment) {
// get all comments
$comments = $currentPage->cache()->getComments();
foreach ($comments as $comment) {
$page['comment'][] = $comment;
}
$this->_addCommentForm($pageId);
}
$this->view->page = $page;
$metaTitle = empty($rowContent->meta_title) ? $rowContent->title : $rowContent->meta_title;
$this->view->meta()->setTitle($metaTitle, 'cms_page', $pageId)->setDescription($rowContent->meta_description)->setKeywords($rowContent->meta_keyword);
$this->_helper->layout->setLayout($currentPage->layout);
$this->render();
}
示例8: 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);
}
示例9: init
public function init()
{
$product = $this->getAttrib('productId');
$this->removeAttrib('productId');
$this->addElement('hidden', 'product', array('value' => $product));
// ratings
$ratings = array();
if (!Axis::single('community/review_mark')->isCustomerVoted(Axis::getCustomerId(), $product)) {
$marks = array('0.5' => 0.5, '1' => 1, '1.5' => 1.5, 2 => 2, '2.5' => 2.5, '3' => 3, '3.5' => 3.5, '4' => 4, '4.5' => 4.5, '5' => 5);
//@todo make configurable
foreach (Axis::single('community/review_rating')->getList() as $rating) {
$this->addElement('select', 'rating_' . $rating['id'], array('required' => true, 'id' => $rating['name'], 'label' => $rating['title'], 'class' => 'required review-rating'));
$this->getElement('rating_' . $rating['id'])->addMultiOptions($marks)->addDecorator('Label', array('tag' => '', 'class' => 'rating-title', 'placement' => 'prepend', 'separator' => ''))->setDisableTranslator(true);
$ratings[] = 'rating_' . $rating['id'];
}
}
$this->addElement('text', 'author', array('required' => true, 'label' => 'Nickname', 'value' => Axis::single('community/common')->getNickname(), 'class' => 'input-text required', 'description' => 'Your nickname. All users will be able to see it', 'validators' => array(new Axis_Community_Validate_Nickname())));
$this->addElement('text', 'title', array('required' => true, 'label' => 'One-line summary', 'class' => 'input-text required', 'description' => 'Summarize your review in one line. up to 55 characters', 'minlength' => '10', 'maxlength' => '55', 'validators' => array(new Zend_Validate_StringLength(10, 55, 'utf-8'))));
$this->addElement('textarea', 'pros', array('required' => true, 'label' => Axis::translate('community')->__('Pros'), 'class' => 'input-text required', 'description' => 'Tell us what you like about this product. up to 250 characters', 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
$this->addElement('textarea', 'cons', array('required' => true, 'label' => 'Cons', 'class' => 'input-text required', 'description' => "Tell us what you don't like about this product. up to 250 characters", 'rows' => '2', 'cols' => '50', 'minlength' => '10', 'maxlength' => '250', 'validators' => array(new Zend_Validate_StringLength(10, 250, 'utf-8'))));
$this->addElement('textarea', 'summary', array('label' => 'Summary', 'class' => 'input-text', 'description' => "Explain to us in detail why you like or dislike the product, focusing your comments on the product's features and functionality, and your experience using the product. This field is optional.", 'rows' => '3', 'cols' => '50', 'minlength' => '10', 'validators' => array(new Zend_Validate_StringLength(10, null, 'utf-8'))));
$this->addDisplayGroup($this->getElements(), 'review');
if (Axis::single('community/review')->canAdd()) {
$this->addElement('button', 'submit', array('type' => 'submit', 'class' => 'button', 'label' => 'Add Review'));
$this->addActionBar(array('submit'));
}
}
示例10: addAction
/**
* Customer add new tag on product
* @return void
*/
public function addAction()
{
$tags = array_filter(explode(',', $this->_getParam('tags')));
$productId = $this->_getParam('productId');
$modelCustomer = Axis::model('tag/customer');
$modelProduct = Axis::model('tag/product');
$defaultStatus = $modelCustomer->getDefaultStatus();
$customerId = Axis::getCustomerId();
$siteId = Axis::getSiteId();
$_row = array('customer_id' => $customerId, 'site_id' => $siteId, 'status' => $modelCustomer->getDefaultStatus());
foreach ($tags as $tag) {
$row = $modelCustomer->select()->where('name = ?', $tag)->where('customer_id = ?', $customerId)->where('site_id = ?', $siteId)->fetchRow();
if (!$row) {
$_row['name'] = $tag;
$row = $modelCustomer->createRow($_row);
$row->save();
Axis::message()->addSuccess(Axis::translate('tag')->__("Tag '%s' was successfully added to product", $tag));
} else {
Axis::message()->addNotice(Axis::translate('tag')->__("Your tag '%s' is already added to this product", $tag));
}
// add to product relation
$isExist = (bool) $modelProduct->select('id')->where('customer_tag_id = ?', $row->id)->where('product_id = ?', $productId)->fetchOne();
if (!$isExist) {
$modelProduct->createRow(array('customer_tag_id' => $row->id, 'product_id' => $productId))->save();
}
Axis::dispatch('tag_product_add_success', array('tag' => $tag, 'product_id' => $productId));
}
$this->_redirect($this->getRequest()->getServer('HTTP_REFERER'));
}
示例11: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
Axis::model('account/customer_valueSet')->delete($this->db->quoteInto('id IN (?)', $data));
Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例12: getHtml
/**
*
* @param array $value
* @param Zend_View_Interface $view
* @return string
*/
public static function getHtml($value, Zend_View_Interface $view = null)
{
$value = json_decode($value, true);
foreach (self::_getOptions() as $options) {
switch ($options['type']) {
case 'bool':
$html .= $view->formRadio('confValue[' . $options['name'] . ']', $value[$options['id']], null, array('1' => Axis::translate()->__(' Yes'), '0' => Axis::translate()->__(' No')));
break;
case 'select':
$html .= $view->formSelect('confValue[' . $options['name'] . ']', $value[$options['id']], null, $options['config_options']);
break;
case 'multiple':
$html .= '<br />';
foreach ($options['config_options'] as $key => $dataItem) {
$html .= $view->formCheckbox('confValue[' . $options['name'] . '][' . $key . ']', isset($value[$options['name']][$key]) && $value[$options['name']][$key] ? 1 : null, null, array(1, 0)) . " {$dataItem} <br /> ";
}
break;
case 'text':
$html .= $view->formTextarea('confValue[' . $options['name'] . ']', $value[$options['id']], array('rows' => 8, 'cols' => 45));
break;
default:
$html .= $view->formText('confValue[' . $options['name'] . ']', $value[$options['id']], array('size' => '50'));
}
}
return $html;
}
示例13: 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));
}
示例14: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
Axis::single('catalog/product_option')->delete($this->db->quoteInto('id IN (?)', $data));
Axis::message()->addSuccess(Axis::translate('catalog')->__('Option was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例15: save
/**
* Update or insert product.
* Returns last saved product
*
* @param array $data
* @return Axis_Catalog_Model_Product_Row
*/
public function save(array $data)
{
$row = $this->getRow($data);
//before save
$isExist = (bool) $this->select()->where('sku = ?', $row->sku)->where('id <> ?', (int) $row->id)->fetchOne();
if ($isExist) {
throw new Axis_Exception(Axis::translate('catalog')->__('Product sku must be unique value'));
}
if (empty($row->new_from)) {
$row->new_from = new Zend_Db_Expr('NULL');
}
if (empty($row->new_to)) {
$row->new_to = new Zend_Db_Expr('NULL');
}
if (empty($row->featured_from)) {
$row->featured_from = new Zend_Db_Expr('NULL');
}
if (empty($row->featured_to)) {
$row->featured_to = new Zend_Db_Expr('NULL');
}
if (empty($row->weight)) {
$row->weight = 0;
}
if (empty($row->cost)) {
$row->cost = 0;
}
$row->modified_on = Axis_Date::now()->toSQLString();
if (empty($row->created_on)) {
$row->created_on = $row->modified_on;
}
$row->save();
return $row;
}