本文整理汇总了PHP中XLite\Core\Config::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getInstance方法的具体用法?PHP Config::getInstance怎么用?PHP Config::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\Core\Config
的用法示例。
在下文中一共展示了Config::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpCheckoutViaHTTPS
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;
}
示例2: doActionSwitch
/**
* 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'));
}
示例3: setReturnURL
/**
* 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);
}
示例4: getSearchCondition
/**
* 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;
}
示例5: doActionUpdate
/**
* 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.');
}
}
}
示例6: handleRequest
/**
* 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();
}
示例7: getPublisherId
/**
* 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;
}
示例8: send
/**
* 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();
}
示例9: isEnabled
/**
* 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;
}
示例10: handleRequest
/**
* 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();
}
示例11: isEnabled
/**
* 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;
}
示例12: 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;
}
示例13: defineItems
/**
* 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;
}
示例14: sendContactUsMessage
/**
* 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();
}
示例15: handleRequest
/**
* 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));
}