当前位置: 首页>>代码示例>>PHP>>正文


PHP Core\Session类代码示例

本文整理汇总了PHP中XLite\Core\Session的典型用法代码示例。如果您正苦于以下问题:PHP Session类的具体用法?PHP Session怎么用?PHP Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getGaqOptions

 /**
  * Get _gaq options list
  *
  * @return array
  */
 protected function getGaqOptions()
 {
     $list = array(sprintf('\'_setAccount\', \'%s\'', \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_account));
     if (2 == \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_tracking_type) {
         $list[] = '\'_setDomainName\', \'.\' + self.location.host.replace(/^[^\\.]+\\./, \'\')';
     } elseif (3 == \XLite\Core\Config::getInstance()->CDev->GoogleAnalytics->ga_tracking_type) {
         $list[] = '\'_setDomainName\', \'none\'';
         $list[] = '\'_setAllowLinker\', true';
     }
     $list[] = '\'_trackPageview\'';
     $controller = \XLite::getController();
     if ($this->isEcommercePartEnabled() && $controller instanceof \XLite\Controller\Customer\CheckoutSuccess) {
         $orders = \XLite\Core\Session::getInstance()->gaProcessedOrders;
         if (!is_array($orders)) {
             $orders = array();
         }
         $order = $this->getOrder();
         if ($order->getProfile() && !in_array($order->getOrderId(), $orders)) {
             $bAddress = $order->getProfile()->getBillingAddress();
             $city = $bAddress ? $bAddress->getCity() : '';
             $state = $bAddress && $bAddress->getState() ? $bAddress->getState()->getState() : '';
             $country = $bAddress && $bAddress->getCountry() ? $bAddress->getCountry()->getCountry() : '';
             $tax = $order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_TAX);
             $shipping = $order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_SHIPPING);
             $list[] = '\'_addTrans\', ' . '\'' . $order->getOrderNumber() . '\', ' . '\'' . $this->escapeJavascript(\XLite\Core\Config::getInstance()->Company->company_name) . '\', ' . '\'' . $order->getTotal() . '\', ' . '\'' . $tax . '\', ' . '\'' . $shipping . '\', ' . '\'' . $this->escapeJavascript($city) . '\', ' . '\'' . $this->escapeJavascript($state) . '\', ' . '\'' . $this->escapeJavascript($country) . '\'';
             foreach ($order->getItems() as $item) {
                 $list[] = '\'_addItem\', ' . '\'' . $order->getOrderNumber() . '\', ' . '\'' . $this->escapeJavascript($item->getSku()) . '\', ' . '\'' . $this->escapeJavascript($item->getName()) . '\', ' . '\'\', ' . '\'' . $item->getPrice() . '\', ' . '\'' . $item->getAmount() . '\'';
             }
             $list[] = '\'_trackTrans\'';
             $orders[] = $order->getOrderId();
             \XLite\Core\Session::getInstance()->gaProcessedOrders = $orders;
         }
     }
     return $list;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:40,代码来源:Traditional.php

示例2: capostValidateMerchant

 /**
  * Validate return from Canada Post merchant registration process
  *
  * @return void
  */
 protected function capostValidateMerchant()
 {
     $token = \XLite\Core\Request::getInstance()->{'token-id'};
     $status = \XLite\Core\Request::getInstance()->{'registration-status'};
     if (\XLite\Module\XC\CanadaPost\Core\Service\Platforms::REG_STATUS_SUCCESS === $status) {
         // Registration is complete
         // Send request to Canada Post server to retrieve merchant details
         $data = \XLite\Module\XC\CanadaPost\Core\Service\Platforms::getInstance()->callGetMerchantRegistrationInfoByToken($token);
         if (isset($data->merchantInfo)) {
             // Update Canada Post settings
             $this->updateCapostMerchantSettings($data->merchantInfo);
             // Disable wizard
             $this->disableCapostWizard();
             \XLite\Core\TopMessage::getInstance()->addInfo('Registration process has been completed successfully.');
         } else {
             foreach ($data->errors as $err) {
                 \XLite\Core\TopMessage::getInstance()->addError('ERROR: [' . $err->code . '] ' . $err->description);
             }
         }
     } else {
         // An error occurred
         if (\XLite\Module\XC\CanadaPost\Core\Service\Platforms::REG_STATUS_CANCELLED === $status) {
             \XLite\Core\TopMessage::getInstance()->addError('Registration process has been canceled.');
         } else {
             \XLite\Core\TopMessage::getInstance()->addError('Failure to finish registration process.');
         }
     }
     // Remove token from the session
     \XLite\Core\Session::getInstance()->capost_token_id = null;
     \XLite\Core\Session::getInstance()->capost_token_ts = null;
     // Redirect back to the Canada Post settings page
     $this->setReturnURL($this->buildURL('capost'));
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:38,代码来源:Main.php

示例3: getSearchTotals

 /**
  * Search total amount
  *
  * @return \Doctrine\ORM\PersistentCollection
  */
 protected function getSearchTotals()
 {
     // Get search conditions
     $name = \XLite\View\ItemsList\Model\Order\Admin\Search::getSessionCellName();
     $cnd = new \XLite\Core\CommonCell(\XLite\Core\Session::getInstance()->{$name});
     return \XLite\Core\Database::getRepo('XLite\\Model\\Order')->getSearchTotal($cnd);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:SearchTotal.php

示例4: getShopURL

 /**
  * Return full URL for the resource
  *
  * @param string  $url             URL part to add           OPTIONAL
  * @param boolean $isSecure        Use HTTP or HTTPS         OPTIONAL
  * @param array   $params          URL parameters            OPTIONAL
  * @param string  $output          URL output type           OPTIONAL
  * @param boolean $isSession       Use session ID parameter  OPTIONAL
  * @param boolean $isProtoRelative Use protocol-relative URL OPTIONAL
  *
  * @return string
  */
 public static function getShopURL($url = '', $isSecure = null, array $params = array(), $output = null, $isSession = null, $isProtoRelative = false)
 {
     $url = trim($url);
     if (!preg_match('/^https?:\\/\\//Ss', $url)) {
         // We are using the protocol-relative URLs for resources
         $protocol = true === $isSecure || is_null($isSecure) && static::isHTTPS() ? 'https' : 'http';
         if (!isset($output)) {
             $output = static::URL_OUTPUT_FULL;
         }
         $hostDetails = static::getOptions('host_details');
         $host = $hostDetails[$protocol . '_host'];
         if ($host) {
             if ('/' != substr($url, 0, 1)) {
                 $url = $hostDetails['web_dir_wo_slash'] . '/' . $url;
             }
             $isSession = !isset($isSession) ? true === $isSecure && !static::isHTTPS() : $isSession;
             if ($isSession) {
                 $session = \XLite\Core\Session::getInstance();
                 $url .= (false !== strpos($url, '?') ? '&' : '?') . $session->getName() . '=' . $session->getID();
             }
             foreach ($params as $name => $value) {
                 $url .= (false !== strpos($url, '?') ? '&' : '?') . $name . '=' . $value;
             }
             if (static::URL_OUTPUT_FULL == $output) {
                 if (substr($url, 0, 2) != '//') {
                     $url = '//' . $host . $url;
                 }
                 $url = ($isProtoRelative ? '' : $protocol . ':') . $url;
             }
         }
     }
     return $url;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:45,代码来源:URLManager.php

示例5: handleRequest

 /**
  * Handles the request.
  * Parses the request variables if necessary. Attempts to call the specified action function
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Session::getInstance()->inContextRedirect) {
         unset(\XLite\Core\Session::getInstance()->inContextRedirect);
     }
     parent::handleRequest();
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:13,代码来源:CheckoutSuccess.php

示例6: doNoAction

 /**
  * Preprocessor for no-action ren
  *
  * @return void
  */
 protected function doNoAction()
 {
     parent::doNoAction();
     if (!\XLite\Core\Request::getInstance()->isAJAX()) {
         \XLite\Core\Session::getInstance()->productListURL = $this->getURL();
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:Main.php

示例7: getShopURL

 /**
  * Return full URL for the resource
  *
  * @param string  $url       URL part to add          OPTIONAL
  * @param boolean $isSecure  Use HTTP or HTTPS        OPTIONAL
  * @param array   $params    URL parameters           OPTIONAL
  * @param string  $output    URL output type          OPTIONAL
  * @param boolean $isSession Use session ID parameter OPTIONAL
  *
  * @return string
  */
 public static function getShopURL($url = '', $isSecure = null, array $params = array(), $output = null, $isSession = null)
 {
     if (!preg_match('/^https?:\\/\\//Ss', $url)) {
         if (!isset($isSecure)) {
             $isSecure = static::isHTTPS();
         }
         if (!isset($output)) {
             $output = static::URL_OUTPUT_FULL;
         }
         $hostDetails = \Includes\Utils\ConfigParser::getOptions('host_details');
         $host = $hostDetails['http' . ($isSecure ? 's' : '') . '_host'];
         if ($host) {
             $proto = ($isSecure ? 'https' : 'http') . '://';
             if ('/' != substr($url, 0, 1)) {
                 $url = $hostDetails['web_dir_wo_slash'] . '/' . $url;
             }
             $isSession = is_null($isSession) ? $isSecure : $isSession;
             if ($isSession) {
                 $session = \XLite\Core\Session::getInstance();
                 $url .= (false !== strpos($url, '?') ? '&' : '?') . $session->getName() . '=' . $session->getID();
             }
             foreach ($params as $name => $value) {
                 $url .= (false !== strpos($url, '?') ? '&' : '?') . $name . '=' . $value;
             }
             if (static::URL_OUTPUT_FULL == $output) {
                 $url = $proto . $host . $url;
             }
         }
     }
     return $url;
 }
开发者ID:kingsj,项目名称:core,代码行数:42,代码来源:URLManager.php

示例8: doNoAction

    /**
     * Preprocessor for no-action run
     *
     * @return void
     */
    protected function doNoAction()
    {
        if (\XLite\Core\Session::getInstance()->inContextRedirect) {
            unset(\XLite\Core\Session::getInstance()->inContextRedirect);
            echo <<<HTML
            <html><head></head><body>
<script type="text/javascript">

(function(d, s, id){
  var js, ref = d.getElementsByTagName(s)[0];
  if (!d.getElementById(id)){
    js = d.createElement(s); js.id = id; js.async = true;
    js.src = "//www.paypalobjects.com/js/external/paypal.v1.js";
    ref.parentNode.insertBefore(js, ref);
  }
}(document, "script", "paypal-js"));

</script>
            </body></html>
HTML;
            exit;
        } elseif (\XLite\Core\Session::getInstance()->cancelUrl) {
            $this->setReturnURL(\XLite\Core\Session::getInstance()->cancelUrl);
            unset(\XLite\Core\Session::getInstance()->cancelUrl);
        } else {
            parent::doNoAction();
        }
    }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:33,代码来源:CheckoutFailed.php

示例9: defineWidgetParams

 /**
  * Define widget parameters
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams[self::PARAM_PARAMS]->setValue(array('target' => 'order_list', 'mode' => 'search'));
     $this->widgetParams[self::PARAM_SORT_CRITERIONS]->setValue(array('order_id' => 'Order id', 'date' => 'Date', 'status' => 'Status', 'total' => 'Total'));
     $this->widgetParams[self::PARAM_CELL]->setValue(\XLite\Core\Session::getInstance()->orders_search);
 }
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:Order.php

示例10: doNoAction

 /**
  * Preprocessor for no-action ren
  *
  * @return void
  */
 protected function doNoAction()
 {
     parent::doNoAction();
     if (!\XLite\Core\Request::getInstance()->isAJAX()) {
         \XLite\Core\Session::getInstance()->continueShoppingURL = $this->getURL();
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:12,代码来源:Category.php

示例11: doActionImport

 /**
  * Add codes from csv file
  *
  * @return void
  */
 protected function doActionImport()
 {
     $stream = fopen(\XLite\Core\Session::getInstance()->pinCodesImportFile, 'r');
     $this->addFromStreamAction($stream);
     if ($stream) {
         fclose($stream);
     }
     $this->setReturnUrl($this->buildUrl('product', '', array('product_id' => \XLite\Core\Request::getInstance()->product_id, 'page' => 'pin_codes')));
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:AddPinCodes.php

示例12: getConditions

 /**
  * Get search conditions
  *
  * @return array
  */
 protected function getConditions()
 {
     $cellName = \XLite\View\ItemsList\Model\AttributeOption::getSessionCellName();
     $searchParams = \XLite\Core\Session::getInstance()->{$cellName};
     if (!is_array($searchParams)) {
         $searchParams = array();
     }
     return $searchParams;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:14,代码来源:AttributeOptions.php

示例13: doActionChangeTemplate

 /**
  * Change template
  *
  * @return void
  */
 protected function doActionChangeTemplate()
 {
     \XLite\Core\Request::getInstance()->switch = $this->getSwitchData();
     unset(\XLite\Core\Session::getInstance()->returnURL);
     $controller = new \XLite\Controller\Admin\AddonsListInstalled(\XLite\Core\Request::getInstance()->getData());
     $controller->init();
     $controller->doActionSwitch();
     $this->setReturnURL($this->buildURL('layout', '', array('moduleId' => \Xlite\Core\Request::getInstance()->template)));
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:14,代码来源:Layout.php

示例14: getFilterValues

 /**
  * Get filter values
  *
  * @return array
  */
 protected function getFilterValues()
 {
     $filterValues = array();
     if ('category_filter' == $this->getTarget()) {
         $cellName = \XLite\Module\XC\ProductFilter\View\ItemsList\Product\Customer\Category\CategoryFilter::getSessionCellName();
         $filterValues = \XLite\Core\Session::getInstance()->{$cellName};
         $filterValues = is_array($filterValues) && isset($filterValues['filter']) && is_array($filterValues['filter']) ? $filterValues['filter'] : array();
     }
     return $filterValues;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:AFilter.php

示例15: getContinueURL

 /**
  * Get continue URL
  *
  * @return string
  */
 protected function getContinueURL()
 {
     if (\XLite\Core\Session::getInstance()->continueShoppingURL) {
         $url = $this->getURL(\XLite\Core\Session::getInstance()->continueShoppingURL);
     } elseif (isset($_SERVER['HTTP_REFERER'])) {
         $url = $_SERVER['HTTP_REFERER'];
     } else {
         $url = $this->buildURL();
     }
     return $url;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:ACheckoutFailed.php


注:本文中的XLite\Core\Session类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。