本文整理汇总了PHP中XLite\Core\Converter类的典型用法代码示例。如果您正苦于以下问题:PHP Converter类的具体用法?PHP Converter怎么用?PHP Converter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Converter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doActionUpdate
/**
* Update coupon
*
* @return void
*/
public function doActionUpdate()
{
$this->getModelForm()->performAction('modify');
if ($this->getModelForm()->isValid()) {
$this->setReturnURL(\XLite\Core\Converter::buildURL('promotions', '', array('page' => \XLite\Controller\Admin\Promotions::PAGE_COUPONS)));
}
}
示例2: getOrderActions
/**
* Get order actions
*
* @param \XLite\Model\Order $entity Order
*
* @return array
*/
protected function getOrderActions(\XLite\Model\Order $entity)
{
$list = array();
foreach ($this->defineOrderActions($entity) as $action) {
$parameters = empty($action[static::ACTION_PARAMS]) || !is_array($action[static::ACTION_PARAMS]) ? array() : $action[static::ACTION_PARAMS];
$parameters['entity'] = $entity;
// Build URL
if (!empty($action[static::ACTION_ACTION]) && empty($action[static::ACTION_URL])) {
$action[static::ACTION_URL] = \XLite\Core\Converter::buildURL('order', $action[static::ACTION_ACTION], array('order_number' => $entity->getOrderNumber()));
}
if (!isset($action[static::ACTION_CLASS]) && !isset($action[static::ACTION_TEMPLATE])) {
// Define widget as link-button
$action[static::ACTION_CLASS] = 'XLite\\View\\Button\\Link';
$parameters['label'] = $action[static::ACTION_NAME];
$parameters['location'] = $action[static::ACTION_URL];
} elseif (!empty($action[static::ACTION_CLASS])) {
// Prepare widget parameters
if (!empty($action[static::ACTION_URL])) {
$parameters['url'] = $action[static::ACTION_URL];
}
if (!empty($action[static::ACTION_ACTION])) {
$parameters['action'] = $action[static::ACTION_ACTION];
}
}
if (!empty($action[static::ACTION_TEMPLATE])) {
$parameters['template'] = $action[static::ACTION_TEMPLATE];
}
$list[] = empty($action[static::ACTION_CLASS]) ? $this->getWidget($parameters) : $this->getWidget($parameters, $action[static::ACTION_CLASS]);
}
return $list;
}
示例3: doNoAction
/**
* Preprocessor for no-action reaction
*
* @return void
*/
protected function doNoAction()
{
parent::doNoAction();
$content = \XLite\Core\Request::getInstance()->id ? \XLite\Core\Database::getRepo('XLite\\Model\\IframeContent')->find(\XLite\Core\Request::getInstance()->id) : null;
if ($content) {
$method = $content->getMethod();
$url = $content->getUrl();
$body = $this->assembleFormBody($content);
$html = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body onload="javascript: document.getElementById('payment_form').submit();">
<form method="{$method}" id="payment_form" name="payment_form" action="{$url}">
<fieldset style="display: none;">
{$body}
</fieldset>
</form>
</body>
</html>
HTML;
print $html;
exit;
} else {
$this->redirect(\XLite\Core\Converter::buildURL('checkout'));
}
}
示例4: doActionUpdate
/**
* Update coupon
*
* @return void
*/
public function doActionUpdate()
{
$this->getModelForm()->performAction('modify');
if ($this->getModelForm()->getModelObject()->getId()) {
$this->setReturnUrl(\XLite\Core\Converter::buildURL('roles'));
}
}
示例5: getMarketplaceURL
protected function getMarketplaceURL($module)
{
list(, $limit) = $this->getWidget(array(), 'XLite\\View\\Pager\\Admin\\Module\\Install')->getLimitCondition()->limit;
$pageId = $module->getRepository()->getMarketplacePageId($module->getAuthor(), $module->getName(), $limit);
$params = array('clearCnd' => 1, 'clearSearch' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId, \XLite\View\ItemsList\AItemsList::PARAM_SORT_BY => \XLite\View\ItemsList\Module\AModule::SORT_OPT_ALPHA);
return \XLite::getInstance()->getShopURL(sprintf('%s#%s', \XLite\Core\Converter::buildURL('addons_list_marketplace', '', $params), $module->getName()));
}
示例6: doActionStartExpressCheckout
/**
* doActionStartExpressCheckout
*
* @return void
*/
protected function doActionStartExpressCheckout()
{
if (Paypal\Main::isExpressCheckoutEnabled()) {
$paymentMethod = $this->getExpressCheckoutPaymentMethod();
$this->getCart()->setPaymentMethod($paymentMethod);
$this->updateCart();
\XLite\Core\Session::getInstance()->ec_type = Paypal\Model\Payment\Processor\ExpressCheckout::EC_TYPE_SHORTCUT;
$processor = $paymentMethod->getProcessor();
$token = $processor->doSetExpressCheckout($paymentMethod);
if (isset($token)) {
\XLite\Core\Session::getInstance()->ec_token = $token;
\XLite\Core\Session::getInstance()->ec_date = \XLite\Core\Converter::time();
\XLite\Core\Session::getInstance()->ec_payer_id = null;
$processor->redirectToPaypal($token);
exit;
} else {
if (\XLite\Core\Request::getInstance()->inContext) {
\XLite\Core\Session::getInstance()->cancelUrl = \XLite\Core\Request::getInstance()->cancelUrl;
\XLite\Core\Session::getInstance()->inContextRedirect = true;
$this->setReturnURL($this->buildURL('checkout_failed'));
}
\XLite\Core\TopMessage::getInstance()->addError($processor->getErrorMessage() ?: 'Failure to redirect to PayPal.');
}
}
}
示例7: getUserTime
/**
* Return converted into user time current timestamp
*
* @return integer
*/
public static function getUserTime()
{
if (!isset(static::$userTime)) {
static::$userTime = \XLite\Core\Converter::convertTimeToUser();
}
return static::$userTime;
}
示例8: testCreate
/**
* testCreate
*
* @return void
* @access public
* @see ____func_see____
* @since 1.0.0
*/
public function testCreate()
{
$c = new \XLite\Model\Country();
foreach ($this->entityData as $field => $testValue) {
$setterMethod = 'set' . \XLite\Core\Converter::getInstance()->convertToCamelCase($field);
$getterMethod = 'get' . \XLite\Core\Converter::getInstance()->convertToCamelCase($field);
$c->{$setterMethod}($testValue);
$value = $c->{$getterMethod}();
$this->assertEquals($testValue, $value, 'Creation checking (' . $field . ')');
}
$s = new \XLite\Model\State();
$s->setState('test state');
$s->setCode('ttt');
$c->addStates($s);
$em = \XLite\Core\Database::getEM();
$em->persist($c);
$em->flush();
$em->clear();
$c = \XLite\Core\Database::getEM()->merge($c);
foreach ($this->entityData as $field => $testValue) {
$getterMethod = 'get' . \XLite\Core\Converter::getInstance()->convertToCamelCase($field);
$this->assertEquals($testValue, $c->{$getterMethod}(), 'Creation checking (' . $field . ') #2');
}
$this->assertEquals($s->getStateId(), $c->getStates()->get(0)->getStateId(), 'check state');
$em->remove($c);
$em->flush();
}
示例9: testCreate
/**
* testCreate
*
* @return void
* @access public
* @see ____func_see____
* @since 1.0.0
*/
public function testCreate()
{
$c = new \XLite\Model\Category();
foreach ($this->categoryData as $field => $testValue) {
$setterMethod = 'set' . \XLite\Core\Converter::getInstance()->convertToCamelCase($field);
$getterMethod = 'get' . \XLite\Core\Converter::getInstance()->convertToCamelCase($field);
$c->{$setterMethod}($testValue);
$value = $c->{$getterMethod}();
$this->assertEquals($testValue, $value, 'Creation checking (' . $field . ')');
}
$qf = new \XLite\Model\Category\QuickFlags();
$qf->setCategory($c);
$c->setQuickFlags($qf);
$this->assertEquals($qf, $c->getQuickFlags(), 'test quick flags');
$m = \XLite\Core\Database::getRepo('XLite\\Model\\Membership')->findAll();
$c->setMembership($m[0]);
$this->assertEquals($m[0], $c->getMembership(), 'check membership');
$i = new \XLite\Model\Image\Category\Image();
$c->setImage($i);
$this->assertEquals($i, $c->getImage(), 'check image');
$cp = new \XLite\Model\CategoryProducts();
$c->addCategoryProducts($cp);
$this->assertEquals($cp, $c->getCategoryProducts()->get(0), 'check category products');
$this->assertEquals(1, count($c->getCategoryProducts()), 'check category products length');
$child = new \XLite\Model\Category();
$c->addChildren($child);
$child->setParent($c);
$this->assertEquals($child, $c->getChildren()->get(0), 'check childs');
$this->assertEquals(1, count($c->getChildren()), 'check childs length');
$this->assertEquals($c, $child->getParent(), 'check parent');
}
示例10: getViewValue
/**
* Get view value
*
* @param array $field Field
*
* @return mixed
*/
protected function getViewValue(array $field)
{
$value = parent::getViewValue($field);
if (is_scalar($value)) {
$value = \XLite\Core\Converter::formatDate($value);
}
return $value;
}
示例11: testCreate
public function testCreate()
{
$session = $this->getTestSession();
$this->assertTrue(0 < $session->getId(), 'check session id');
foreach ($this->testSession as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $session->{$m}(), 'Check ' . $k);
}
}
示例12: getTitle
/**
* Return the current page title (for the content area)
*
* @return string
*/
public function getTitle()
{
if ($this->checkAccess()) {
$title = static::t('Order #X, Y', array('id' => $this->getOrderNumber(), 'date' => \XLite\Core\Converter::getInstance()->formatTime($this->getOrder()->getDate())));
} else {
$title = static::t('Order not found');
}
return $title;
}
示例13: testCreate
/**
* testCreate
*
* @return void
* @see ____func_see____
* @since 1.0.22
*/
public function testCreate()
{
$method = $this->getTestMethod();
$this->assertTrue(0 < $method->getMethodId(), 'check method id');
foreach ($this->testMethod as $k => $v) {
$m = 'get' . \XLite\Core\Converter::convertToCamelCase($k);
$this->assertEquals($v, $method->{$m}(), 'Check ' . $k);
}
}
示例14: getOrderActions
/**
* Get order aActions
*
* @param \XLite\Model\Order $entity Order
*
* @return array
*/
protected function getOrderActions(\XLite\Model\Order $entity)
{
$list = array();
foreach ($this->defineOrderActions($entity) as $action) {
$parameters = array('label' => ucfirst($action), 'location' => \XLite\Core\Converter::buildURL('order', $action, array('order_id' => $this->getOrder()->getOrderId())));
$list[] = $this->getWidget($parameters, 'XLite\\View\\Button\\Link');
}
return $list;
}
示例15: requestProbe
/**
* Request probe script
*
* @return void
*/
protected function requestProbe()
{
$url = \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('', '', array('key' => \XLite\Core\Config::getInstance()->Internal->probe_key), 'probe.php'));
set_time_limit(0);
$request = new \XLite\Core\HTTP\Request($url);
$response = $request->sendRequest();
if (200 != $response->code) {
\XLite\Core\TopMessage::addError('Measuring productivity in manual mode failed.');
}
}