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())); }
/** * 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; }
/** * Update coupon * * @return void */ public function doActionUpdate() { $this->getModelForm()->performAction('modify'); if ($this->getModelForm()->getModelObject()->getId()) { $this->setReturnUrl(\XLite\Core\Converter::buildURL('roles')); } }
/** * 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))); } }
/** * 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')); } }
/** * 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; }
/** * 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.'); } }
/** * Return icon URL * * @return string */ public function getIconURL() { $url = $this->getMetadata('IconLink'); if (!$url) { list($author, $name) = explode('\\', $this->getActualName()); $path = \Includes\Utils\ModulesManager::getModuleIconFile($author, $name); if (\Includes\Utils\FileManager::isFileReadable($path)) { $url = \XLite\Core\Converter::buildURL('module', null, array('author' => $author, 'name' => $name), 'image.php'); } } return $url ?: static::DEFAULT_ICON_URL; }
/** * Update model * * @return void */ protected function doActionUpdate() { if ($this->getModelForm()->performAction('modify')) { if (\Xlite\Core\Request::getInstance()->isCreate) { echo <<<HTML <script type="text/javascript">window.opener.location.reload();window.close()</script> HTML; exit; } else { $this->setReturnUrl(\XLite\Core\Converter::buildURL('theme_tweaker_templates')); } } }
/** * URL to redirect if action is forbidden * * @return string */ protected function getForbidInDemoModeRedirectURL() { if ('delete' == \XLite\Core\Request::getInstance()->action) { // Redirect for delete action $url = \XLite\Core\Converter::buildURL('users', '', array('mode' => 'search')); } elseif ($this->getProfile()->getProfileId()) { // Redirect if profile found $url = \XLite\Core\Converter::buildURL('profile', '', array('profile_id' => $this->getProfile()->getProfileId())); } else { $url = \XLite\Core\Converter::buildURL('profile', '', array('mode' => 'register')); } return $url; }
/** * Place URL into engine's endpoints * * @return void */ protected function doActionLocate() { $engines = \XLite\Core\Request::getInstance()->engines; if ($engines) { foreach ($this->getEngines() as $key => $engine) { if (in_array($key, $engines)) { $url = urlencode(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::CART_SELF))); $url = str_replace('%url%', $url, $engine['url']); $request = new \XLite\Core\HTTP\Request($url); $response = $request->sendRequest(); if (200 == $response->code) { \XLite\Core\TopMessage::addInfo('Site map successfully registred on X', array('engine' => $key)); } else { \XLite\Core\TopMessage::addWarning('Site map has not been registred in X', array('engine' => $key)); } } } } }
/** * Compose URL from target, action and additional params * * @param string $target Page identifier OPTIONAL * @param string $action Action to perform OPTIONAL * @param array $params Additional params OPTIONAL * @param string $interface Interface script OPTIONAL * * @return string */ public static function buildURL($target = '', $action = '', array $params = array(), $interface = null, $forceCleanURL = false) { if ('' === $target) { $target = \XLite::TARGET_DEFAULT; } if (\XLite\Module\CDev\DrupalConnector\Handler::getInstance()->checkCurrentCMS() || \XLite::CART_SELF == $interface && \XLite\Module\CDev\DrupalConnector\Core\Caller::getInstance()->isInitialized()) { $portal = \XLite\Module\CDev\DrupalConnector\Handler::getInstance()->getPortalByTarget($target); if ($portal) { // Drupal URL (portal) list($path, $args) = $portal->getDrupalArgs($target, $action, $params); $result = static::normalizeDrupalURL($path, $args); } else { // Drupal URL $result = static::buildDrupalURL($target, $action, $params); } } else { // Standalone URL $result = parent::buildURL($target, $action, $params, $interface); } return $result; }
/** * Place URL into engine's endpoints * * @return void */ protected function doActionLocate() { $engines = \XLite\Core\Request::getInstance()->engines; if ($engines) { foreach ($this->getEngines() as $key => $engine) { if (in_array($key, $engines)) { $url = urlencode(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::getCustomerScript()))); $url = str_replace('%url%', $url, $engine['url']); $request = new \XLite\Core\HTTP\Request($url); $response = $request->sendRequest(); if (200 == $response->code) { \XLite\Core\TopMessage::addInfo('Site map successfully registred on X', array('engine' => $key)); } else { \XLite\Core\TopMessage::addWarning('Site map has not been registred in X', array('engine' => $key)); } } } } $postedData = \XLite\Core\Request::getInstance()->getData(); $options = \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->findBy(array('category' => $this->getOptionsCategory())); $isUpdated = false; foreach ($options as $key => $option) { $name = $option->getName(); $type = $option->getType(); if (isset($postedData[$name]) || 'checkbox' == $type) { if ('checkbox' == $type) { $option->setValue(isset($postedData[$name]) ? 'Y' : 'N'); } else { $option->setValue($postedData[$name]); } $isUpdated = true; \XLite\Core\Database::getEM()->persist($option); } } if ($isUpdated) { \XLite\Core\Database::getEM()->flush(); } }
/** * Get front URL * * @return string * @see ____func_see____ * @since 1.0.15 */ public function getFrontURL() { return $this->getId() ? \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('page', '', array('id' => $this->getId()), 'cart.php', true)) : null; }
/** * Get front URL * * @return string */ public function getFrontURL() { $result = null; if ($this->getId()) { $result = \XLite\Core\Converter::makeURLValid(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('page', '', array('id' => $this->getId()), 'cart.php', true))); } return $result; }
/** * Build entity page URL * * @param \XLite\Model\AEntity $entity Entity * @param array $column Column data * * @return string */ protected function getFraudInfoXpcLink(\XLite\Model\AEntity $entity) { $result = \XLite\Core\Converter::buildURL('order', '', array('order_number' => $entity->getOrderNumber())); $result .= '#' . $entity->getFraudInfoXpcAnchor(); return $result; }
/** * Get sitemap URL * * @return string */ protected function getSitemapURL() { return \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::CART_SELF)); }
/** * Get latest Snapshot URL * * @return string */ public static function getLatestSnapshotURL() { $params = array(self::PARAM_SAFE_MODE => true, self::PARAM_ACCESS_KEY => static::getAccessKey()); if (static::getLatestSnapshot()) { $latest = static::getLatestSnapshot(); $params[self::PARAM_RESTORE_DATE] = $latest['date']; } return \Includes\Utils\URLManager::getShopURL(\XLite\Core\Converter::buildURL('main', '', $params, \XLite::getAdminScript())); }
/** * Returns payment cancel url * * @return string */ public function getPaymentCancelUrl() { if (static::EC_TYPE_MARK == \XLite\Core\Session::getInstance()->ec_type) { $url = $this->getReturnURL(null, true, true); } else { $url = \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('checkout', 'express_checkout_return', array('cancel' => 1)), \XLite\Core\Config::getInstance()->Security->customer_security); } if (\XLite\Core\Request::getInstance()->cancelUrl) { $url .= '&cancelUrl=' . urlencode(\XLite\Core\Request::getInstance()->cancelUrl); } return $url; }
/** * Update model * * @return void */ protected function doActionUpdate() { if ($this->getModelForm()->performAction('modify')) { $this->setReturnUrl(\XLite\Core\Converter::buildURL('product_classes')); } }
/** * Get transactionId-based callback URL * * @param string $fieldName TransactionId field name OPTIONAL * @param boolean $withId Add to URL transaction id or not OPTIONAL * * @return string */ protected function getCallbackURL($fieldName = self::RETURN_TXN_ID, $withId = false) { $query = array('txn_id_name' => $fieldName ?: self::RETURN_TXN_ID); if ($withId) { $query[$query['txn_id_name']] = $this->transaction->getPublicTxnId(); } return \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('callback', '', $query), \XLite\Core\Config::getInstance()->Security->customer_security); }
/** * Return link to settings form * * @return string */ public static function getSettingsForm() { return \XLite\Core\Converter::buildURL('aupost'); }
/** * Get payment method configuration page URL * * @param \XLite\Model\Payment\Method $method Payment method * @param boolean $justAdded Flag if the method is just added via administration panel. * Additional init configuration can be provided OPTIONAL * * @return string */ public function getConfigurationURL(\XLite\Model\Payment\Method $method, $justAdded = false) { return \XLite\Core\Converter::buildURL('paypal_settings', '', array('method_id' => $method->getMethodId())); }
/** * Module page URL getter * * @return string */ public function getModuleInstalledPageURL() { $result = ''; if ($this->isInstalled()) { $module = $this->getModuleInstalled(); $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($module->getAuthor(), $module->getName(), \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage()); $params = array('clearCnd' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId); $result = \XLite\Core\Converter::buildURL('addons_list_installed', '', $params) . '#' . $module->getName(); } return $result; }
/** * Update model * * @return void * @see ____func_see____ * @since 1.0.0 */ protected function doActionUpdate() { if ($this->getModelForm()->performAction('modify')) { $this->setReturnUrl(\XLite\Core\Converter::buildURL('page', '', array('id' => $this->getModelForm()->getModelObject()->getId()))); } }
/** * doActionDelete * * @return void */ protected function doActionDelete() { $address = $this->getAddress(); if (isset($address)) { \XLite\Core\Database::getEM()->remove($address); \XLite\Core\Database::getEM()->flush(); \XLite\Core\TopMessage::addInfo('Address has been deleted'); } $this->setReturnURL(\Xlite\Core\Converter::buildURL('address_book')); }
/** * Defines the link for the payment settings form * * @return string */ public static function getPaymentSettingsForm() { return \XLite\Core\Converter::buildURL('payment_settings'); }
/** * Get custom log URL * * @param string $type Type * * @return string */ public function getCustomLogURL($type) { return \XLite\Core\Converter::buildURL('log', '', array('log' => $this->getCustomLogFileName($type))); }
/** * Return link to settings form * * @return string */ public static function getSettingsForm() { return \XLite\Core\Converter::buildURL('add2_cart_popup'); }
/** * URL to redirect if action is forbidden * * @return string */ protected function getForbidInDemoModeRedirectURL() { return \XLite\Core\Converter::buildURL(\XLite\Core\Request::getInstance()->target); }