php XLite-Core-Config类(方法)实例源码

下面列出了php XLite-Core-Config 类(方法)源码代码实例,从而了解它的用法。

作者:kings    项目:cor   
protected function setUpCheckoutViaHTTPS($value)
 {
     \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->createOption(array('category' => 'Security', 'name' => 'customer_security', 'value' => $value ? 'Y' : 'N'));
     // Reset cache - DO NOT CHANGE!
     \XLite\Core\Database::getCacheDriver()->deleteAll();
     \XLite\Core\Config::getInstance()->Security->customer_security;
 }

作者:kirkbauer    项目:kirkx   
/**
  * Switch state
  *
  * @return void
  */
 protected function doActionSwitch()
 {
     $value = !\XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
     \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'XC\\ThemeTweaker', 'name' => 'edit_mode', 'value' => $value));
     \XLite\Core\TopMessage::addInfo($value ? 'Webmaster mode is enabled' : 'Webmaster mode is disabled');
     $this->setReturnURL($this->buildURL('theme_tweaker_templates'));
 }

作者:kewaunite    项目:xcar   
/**
  * Set return URL
  *
  * @param string $url URL to set
  *
  * @return void
  */
 public function setReturnURL($url)
 {
     if (\XLite\Module\CDev\Paypal\Main::isExpressCheckoutEnabled() && \XLite\Module\CDev\Paypal\Main::isInContextCheckoutAvailable() && \XLite\Core\Request::getInstance()->cancelUrl) {
         $url = $this->getShopURL(\XLite\Core\Request::getInstance()->cancelUrl, \XLite\Core\Config::getInstance()->Security->customer_security);
     }
     parent::setReturnURL($url);
 }

作者:kewaunite    项目:xcar   
/**
  * Return params list to use for search
  *
  * @return \XLite\Core\CommonCell
  */
 protected function getSearchCondition()
 {
     $result = parent::getSearchCondition();
     $carrierParam = \XLite\Model\Repo\Shipping\Method::P_CARRIER;
     if (!empty($result->{$carrierParam}) && 'auctionInc' == $result->{$carrierParam} && \XLite\Module\XC\AuctionInc\Main::isSSAvailable()) {
         $result->{$carrierParam} = '';
     }
     if (!empty($result->{$carrierParam}) && 'auctionInc' == $result->{$carrierParam}) {
         $filter = array();
         $filter[] = 'FF%';
         $filter[] = 'NOCHG%';
         // UPS Next Day Air Early AM is a commercial only service.
         // Rather than ask you to implement differential code based
         // on the module Residential setting, lets just eliminate
         // this service method for the XS trial.
         $filter[] = 'UPS_UPSNDE';
         // The two “Saturday” services have special handling in AuctionInc.
         // It would be best just to eliminate these two service methods as well for the XS trial
         $filter[] = 'FEDEX_FDXPOS';
         $filter[] = 'UPS_UPSNDAS';
         foreach (array('DHL', 'FEDEX', 'UPS', 'USPS') as $carrier) {
             $entryPoint = \XLite\Core\Config::getInstance()->XC->AuctionInc->{'entryPoint' . $carrier};
             if (\XLite\Module\XC\AuctionInc\View\FormField\Select\AEntryPoint::STATE_DISABLED == $entryPoint) {
                 $filter[] = $carrier . '%';
             }
         }
         $result->{\XLite\Model\Repo\Shipping\Method::P_AUCTION_INC_FILTER} = $filter;
     }
     return $result;
 }

作者:kirkbauer    项目:kirkx   
/**
  * Do action update languages
  *
  * @return void
  */
 protected function doActionUpdate()
 {
     // Update 'enabled' and 'added' properties editable in the item list
     $list = new \XLite\View\ItemsList\Model\Translation\Languages();
     $list->processQuick();
     // Update default languages settings
     $defaultCustomerLanguage = \XLite\Core\Request::getInstance()->defaultCustomer;
     $defaultAdminLanguage = \XLite\Core\Request::getInstance()->defaultAdmin;
     if ($defaultCustomerLanguage != \XLite\Core\Config::getInstance()->General->default_language) {
         $lng = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findOneBy(array('code' => $defaultCustomerLanguage));
         if ($lng && $lng->getEnabled()) {
             \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('name' => 'default_language', 'category' => 'General', 'value' => $defaultCustomerLanguage));
         } else {
             \XLite\Core\TopMessage::addWarning('Disabled language cannot be default.');
         }
     }
     if ($defaultAdminLanguage != \XLite\Core\Config::getInstance()->General->default_admin_language) {
         $lng = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findOneBy(array('code' => $defaultAdminLanguage));
         if ($lng && $lng->getEnabled()) {
             \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('name' => 'default_admin_language', 'category' => 'General', 'value' => $defaultAdminLanguage));
         } else {
             \XLite\Core\TopMessage::addWarning('Disabled language cannot be default.');
         }
     }
 }

作者:kirkbauer    项目:kirkx   
/**
  * Save requested product ID in the recently viewed statistics
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Config::getInstance()->CDev->ProductAdvisor->rv_enabled) {
         \XLite\Module\CDev\ProductAdvisor\Main::saveProductIds($this->getProductId());
     }
     return parent::handleRequest();
 }

作者:kirkbauer    项目:kirkx   
/**
  * Get publisher id
  *
  * @param string $email Email
  *
  * @return string
  */
 public function getPublisherId($email)
 {
     $publisherId = null;
     $sellerName = \XLite\Core\Config::getInstance()->Company->company_name;
     $data = array('sellerName' => $sellerName, 'emailAddress' => $email, 'bnCode' => static::BN_CODE);
     $request = new \XLite\Core\HTTP\Request(static::END_POINT);
     if (function_exists('curl_version')) {
         $request->setAdditionalOption(\CURLOPT_SSLVERSION, 1);
         $curlVersion = curl_version();
         if ($curlVersion && $curlVersion['ssl_version'] && 0 !== strpos($curlVersion['ssl_version'], 'NSS')) {
             $request->setAdditionalOption(\CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
         }
     }
     $request->body = json_encode($data);
     $request->verb = 'POST';
     $timeStamp = LC_START_TIME . '000';
     $authorization = 'FPA ' . static::CLIENT_KEY;
     $authorization .= ':' . sha1(static::SHARED_SECRET . $timeStamp);
     $authorization .= ':' . $timeStamp;
     $request->setHeader('Authorization', $authorization);
     $request->setHeader('Accept', 'application/json');
     $request->setHeader('Content-Type', 'application/json');
     $response = $request->sendRequest();
     \XLite\Module\CDev\Paypal\Main::addLog('getPublisherId', $response->body);
     if (201 == $response->code) {
         $responseData = json_decode($response->body, true);
         if ($responseData && isset($responseData['publisherId'])) {
             $publisherId = $responseData['publisherId'];
         }
     }
     return $publisherId;
 }

作者:kirkbauer    项目:kirkx   
/**
  * Send message
  *
  * @return boolean
  */
 public function send()
 {
     if (\XLite\Core\Config::getInstance()->XC->WebmasterKit->logMail) {
         \XLite\Logger::getInstance()->logCustom('mail-messages', 'From: ' . $this->mail->From . PHP_EOL . 'To: ' . $this->get('to') . PHP_EOL . 'Subject: ' . $this->mail->Subject . PHP_EOL . $this->mail->Body . PHP_EOL . PHP_EOL);
     }
     return parent::send();
 }

作者:kirkbauer    项目:kirkx   
/**
  * Check - cache is enabled or not
  *
  * @return boolean
  */
 public function isEnabled()
 {
     if (!isset($this->enableCache)) {
         $this->enableCache = \XLite\Core\Config::getInstance()->Performance->use_view_cache;
     }
     return $this->enableCache;
 }

作者:kings    项目:cor   
/**
  * Handles the request.
  * Create installation timestamp if empty (at first software launch)
  *
  * @return string
  */
 public function handleRequest()
 {
     if (empty(\XLite\Core\Config::getInstance()->Version->timestamp)) {
         \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'Version', 'name' => 'timestamp', 'value' => time()));
     }
     parent::handleRequest();
 }

作者:kirkbauer    项目:kirkx   
/**
  * Check - cache is enabled or not
  *
  * @return boolean
  */
 public function isEnabled()
 {
     if (!isset($this->editMode)) {
         $this->editMode = \XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
     }
     return parent::isEnabled() && !$this->editMode;
 }

作者:kirkbauer    项目:kirkx   
/**
  * 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;
 }

作者:kings    项目:cor   
/**
  * Define menu items
  *
  * @return array
  */
 protected function defineItems()
 {
     $menu = parent::defineItems();
     if (\XLite\Core\Config::getInstance()->CDev->ContactUs->enable_form) {
         $menu[] = array('target' => 'contact_us', 'url' => $this->buildURL('contact_us'), 'label' => static::t('Contact us'));
     }
     return $menu;
 }

作者:kings    项目:cor   
/**
  * Send contact us message
  *
  * @param array  $data  Data
  * @param string $email Email
  *
  * @return string | null
  */
 public static function sendContactUsMessage(array $data, $email)
 {
     static::setMailInterface(\XLite::MAIL_INTERFACE);
     $data['message'] = htmlspecialchars($data['message']);
     static::register('data', $data);
     static::compose(\XLite\Core\Config::getInstance()->Company->site_administrator, $email, 'modules/CDev/ContactUs/message');
     return static::getMailer()->getLastError();
 }

作者:kirkbauer    项目:kirkx   
/**
  * handleRequest
  *
  * @return void
  */
 public function handleRequest()
 {
     $apiClient = ServiceApiClient::getInstance();
     $apiClient->requestSecretKey();
     Config::updateInstance();
     $secretKey = Config::getInstance()->QSL->CloudSearch->secret_key;
     $this->redirect($apiClient->getDashboardIframeUrl($secretKey));
 }

作者:kewaunite    项目:xcar   
/**
  * Initialize widget (set attributes)
  *
  * @param array $params Widget params
  *
  * @return void
  */
 public function setWidgetParams(array $params)
 {
     parent::setWidgetParams($params);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_SHOW_ITEMS_PER_PAGE_SELECTOR]->setValue(false);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_ITEMS_COUNT]->setValue(\XLite\Core\Config::getInstance()->XC->Reviews->reviewsCountPerTab);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_ITEMS_PER_PAGE]->setValue(\XLite\Core\Config::getInstance()->XC->Reviews->reviewsCountPerTab);
     $this->widgetParams[\XLite\View\Pager\APager::PARAM_ONLY_PAGES]->setValue(true);
 }

作者:kings    项目:cor   
/**
  * Define query builder for findClassList()
  *
  * @param string $list Class list name
  * @param string $zone Current interface name
  *
  * @return \Doctrine\ORM\QueryBuilder
  */
 protected function defineClassListQuery($list, $zone)
 {
     $qb = parent::defineClassListQuery($list, $zone);
     if (\XLite\Core\Config::getInstance()->CDev->Catalog->disable_checkout) {
         $qb->andWhere($qb->expr()->notIn('v.tpl', $this->templatesToHide));
     }
     return $qb;
 }

作者:kirkbauer    项目:kirkx   
/**
  * Get JS files
  *
  * @return array
  */
 public function getJSFiles()
 {
     $list = parent::getJSFiles();
     if (!\XLite\Core\Config::getInstance()->Security->customer_security || $this->isHTTPS()) {
         $list[] = 'js/login.js';
     }
     return $list;
 }

作者:kings    项目:cor   
/**
  * Register JS files
  *
  * @return array
  */
 public function getJSFiles()
 {
     $list = parent::getJSFiles();
     if (\XLite\Core\Config::getInstance()->CDev->Catalog->disable_checkout) {
         $list[] = 'modules/CDev/Catalog/disable_dragging.js';
     }
     return $list;
 }

作者:kings    项目:cor   
/**
  * Get SDK URL hash query
  *
  * @return array
  */
 protected function getQuery()
 {
     $query = array('xfbml' => 1);
     if (\XLite\Core\Config::getInstance()->CDev->GoSocial->fb_app_id) {
         $query['appId'] = \XLite\Core\Config::getInstance()->CDev->GoSocial->fb_app_id;
     }
     return $query;
 }


问题


面经


文章

微信
公众号

扫码关注公众号