예제 #1
0
파일: Method.php 프로젝트: kingsj/core
 /**
  * Adds additional condition to the query for checking if method is enabled
  *
  * @param \Doctrine\ORM\QueryBuilder $qb    Query builder object
  * @param string                     $alias Entity alias OPTIONAL
  *
  * @return \Doctrine\ORM\QueryBuilder
  */
 protected function addEnabledCondition(\Doctrine\ORM\QueryBuilder $qb, $alias = 'm')
 {
     if (!\XLite::getInstance()->isAdminZone()) {
         $qb->andWhere($alias . '.enabled = 1');
     }
     return $qb;
 }
예제 #2
0
 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()));
 }
예제 #3
0
파일: Rate.php 프로젝트: kingsj/core
 public function testGetTotalRate()
 {
     $tax = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\VAT\\Model\\Tax')->getTax();
     foreach ($tax->getRates() as $rate) {
         \XLite\Core\Database::getEM()->remove($rate);
     }
     $tax->getRates()->clear();
     $tax->setEnabled(true);
     $rate = new \XLite\Module\CDev\VAT\Model\Tax\Rate();
     $rate->setValue(10);
     $rate->setPosition(1);
     \XLite\Core\Database::getEM()->persist($rate);
     $tax->addRates($rate);
     $rate->setTax($tax);
     $rate = new \XLite\Module\CDev\VAT\Model\Tax\Rate();
     $rate->setValue(20);
     $rate->setPosition(0);
     \XLite\Core\Database::getEM()->persist($rate);
     $tax->addRates($rate);
     $rate->setTax($tax);
     $memberships = \XLite\Core\Database::getRepo('XLite\\Model\\Membership')->findAll();
     $membership = array_shift($memberships);
     $rate->setMembership($membership);
     $tax->setVATMembership($membership);
     \XLite\Core\Database::getEM()->flush();
     $method = new \XLite\Model\Shipping\Method();
     $method->setEnabled(true);
     $rate = new \XLite\Model\Shipping\Rate();
     $rate->setBaseRate(10);
     $rate->setMarkupRate(10);
     $rate->setMethod($method);
     $this->assertEquals(16.67, \XLite::getInstance()->getCurrency()->formatValue($rate->getTotalRate()), 'check cost');
 }
예제 #4
0
 /**
  * We make the full location path for the provided URL
  *
  * @return string
  */
 protected function getLocationURL()
 {
     $repo = \XLite\Core\Database::getRepo('XLite\\Model\\Module');
     $module = $repo->find($this->getParam(static::PARAM_MODULE_ID));
     $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);
     return \XLite::getInstance()->getShopURL(sprintf('%s#%s', $this->buildURL('addons_list_installed', '', $params), $module->getName()));
 }
예제 #5
0
 /**
  * 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.');
     }
 }
예제 #6
0
 /**
  * Returns current currency code
  *
  * @return string
  */
 protected function getCurrentCurrencyId()
 {
     if (!isset($this->currency)) {
         if (\XLite\Core\Request::getInstance()->currency) {
             $this->currency = \XLite\Core\Database::getRepo('XLite\\Model\\Currency')->find(\XLite\Core\Request::getInstance()->currency);
         }
         if (!$this->currency) {
             $this->currency = \XLite::getInstance()->getCurrency();
         }
     }
     return $this->currency->getCurrencyId();
 }
예제 #7
0
파일: Storage.php 프로젝트: kingsj/core
 /**
  * testLoading
  *
  * @return void
  * @see    ____func_see____
  * @since  1.0.12
  */
 public function testLoading()
 {
     \Includes\Utils\FileManager::unlinkRecursive(LC_DIR_FILES . 'attachments');
     $product = $this->getProduct();
     $attach = new \XLite\Module\CDev\FileAttachments\Model\Product\Attachment();
     $product->addAttachments($attach);
     $attach->setProduct($product);
     $storage = $attach->getStorage();
     // Success
     $this->assertTrue($storage->loadFromLocalFile(__DIR__ . LC_DS . '..' . LC_DS . 'max_ava.png'), 'check loading');
     $this->assertEquals('application/octet-stream', $storage->getMime(), 'check mime');
     $this->assertEquals('max_ava.png', $storage->getFileName(), 'check file name');
     $this->assertEquals(12673, $storage->getSize(), 'check size');
     $this->assertEquals(file_get_contents(__DIR__ . '/../max_ava.png'), $storage->getBody(), 'check body');
     $this->assertRegExp('/^http:\\/\\//Ss', $storage->getURL(), 'check URL');
     $this->assertEquals($storage->getURL(), $storage->getFrontURL(), 'check front url');
     $this->assertEquals('png', $storage->getExtension(), 'check extension');
     $this->assertEquals('mime-icon-png', $storage->getMimeClass(), 'check MIME class');
     $this->assertEquals('png file type', $storage->getMimeName(), 'check MIME name');
     // Fail
     $this->assertFalse($storage->loadFromLocalFile(__DIR__ . LC_DS . '..' . LC_DS . 'wrong.png'), 'check loading (fail)');
     // Duplicate
     $this->assertTrue($storage->loadFromLocalFile(__DIR__ . LC_DS . '..' . LC_DS . 'max_ava.png'), 'check loading (dup)');
     $this->assertRegExp('/^max_ava.png$/Ss', $storage->getFileName(), 'check file name (rename)');
     // Forbid extension
     $this->assertFalse($storage->loadFromLocalFile(__FILE__), 'check loading (forbid ext)');
     $this->assertEquals('extension', $storage->getLoadError(), 'check load error code');
     // Duplicate
     \Includes\Utils\FileManager::unlinkRecursive(LC_DIR_FILES . 'attachments');
     $s1 = $this->getTestStorage();
     $s2 = $this->getTestStorage();
     $path = LC_DIR_FILES . 'attachments' . LC_DS . $s1->getPath();
     $this->assertTrue($s2->loadFromLocalFile($path), 'check duplicate loading');
     \XLite\Core\Database::getEM()->flush();
     $pid = $s1->getAttachment()->getProduct()->getProductId();
     $url = XLite::getInstance()->getShopURL('files/attachments/' . $pid . '/' . basename($path));
     $this->assertEquals($url, $s1->getFrontURL(), 'check 1 storage URL');
     $this->assertEquals($url, $s2->getFrontURL(), 'check 2 storage URL');
     $body = file_get_contents($path);
     $this->assertEquals(md5($body), md5($s1->getBody()), 'check 1 body');
     $this->assertEquals(md5($body), md5($s2->getBody()), 'check 2 body');
     ob_start();
     $s1->readOutput();
     $b1 = ob_get_contents();
     ob_end_clean();
     ob_start();
     $s2->readOutput();
     $b2 = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($body, $b1, 'check 1 output');
     $this->assertEquals($body, $b2, 'check 2 output');
 }
예제 #8
0
파일: Cart.php 프로젝트: kirkbauer2/kirkxc
 /**
  * URL to return after product is added
  *
  * @return string
  */
 protected function setURLToReturn()
 {
     if (\XLite\Core\Request::getInstance()->expressCheckout) {
         $params = array('cancelUrl' => \XLite\Core\Request::getInstance()->cancelUrl);
         if (\XLite\Core\Request::getInstance()->inContext) {
             $params['inContext'] = true;
         }
         $url = \XLite::getInstance()->getShopURL($this->buildURL('checkout', 'start_express_checkout', $params), \XLite\Core\Config::getInstance()->Security->customer_security);
         $this->setReturnURL($url);
     } else {
         parent::setURLToReturn();
     }
 }
예제 #9
0
파일: AView.php 프로젝트: kingsj/core
 /**
  * Return relative path from web directory path to the XLite web directory
  *
  * @return string
  */
 protected static function getDrupalRelativePath()
 {
     if (!isset(static::$drupalRelativePath)) {
         $basePath = static::prepareBasePath(base_path());
         $xlitePath = static::prepareBasePath(\XLite::getInstance()->getOptions(array('host_details', 'web_dir')));
         $basePathSize = count($basePath);
         $minPathSize = min($basePathSize, count($xlitePath));
         for ($i = 0; $i < $minPathSize; $i++) {
             if ($basePath[$i] === $xlitePath[$i]) {
                 unset($xlitePath[$i]);
             } else {
                 break;
             }
         }
         static::$drupalRelativePath = str_repeat('..' . LC_DS, $basePathSize - $i) . implode(LC_DS, $xlitePath) . LC_DS;
     }
     return static::$drupalRelativePath;
 }
예제 #10
0
파일: AllTests.php 프로젝트: kingsj/core
function xlite_restore_sql_from_backup($path = null, $verbose = true, $drop = true, &$message = null)
{
    !$verbose && ob_start();
    echo PHP_EOL . 'DB restore ... ';
    \Includes\Utils\FileManager::copyRecursive(__DIR__ . '/images', LC_DIR_IMAGES);
    $result = true;
    if (!isset($path)) {
        $path = dirname(__FILE__) . LC_DS . 'dump.sql';
    }
    if (file_exists($path)) {
        $config = \XLite::getInstance()->getOptions('database_details');
        $cmd = defined('TEST_MYSQL_BIN') ? TEST_MYSQL_BIN : 'mysql';
        $cmd .= ' -h' . $config['hostspec'];
        if ($config['port']) {
            $cmd .= ' -P' . $config['port'];
        }
        $cmd .= ' -u' . $config['username'] . ('' == $config['password'] ? '' : ' -p' . $config['password']);
        if ($config['socket']) {
            $cmd .= ' -S' . $config['socket'];
        }
        $message = '';
        if ($drop) {
            // Drop&Create database
            exec($cmd . ' -e"drop database ' . $config['database'] . '"', $message);
            if (empty($message)) {
                exec($cmd . ' -e"create database ' . $config['database'] . '"', $message);
            }
        }
        if (empty($message)) {
            exec($cmd . ' ' . $config['database'] . ' < ' . $path, $message);
        }
        if (empty($message)) {
            echo 'done' . PHP_EOL;
        } else {
            $result = false;
            echo 'failed: ' . $message . PHP_EOL;
        }
    } else {
        echo 'ignored (sql-dump file not found)' . PHP_EOL;
        $result = false;
    }
    !$verbose && ob_end_clean();
    return $result;
}
예제 #11
0
파일: Sitemap.php 프로젝트: kingsj/core
 /**
  * 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));
                 }
             }
         }
     }
 }
예제 #12
0
 /**
  * Check - specified item is active or not
  *
  * @param array $item Menu item
  *
  * @return boolean
  */
 protected function isActiveItem(array $item)
 {
     $result = parent::isActiveItem($item);
     if (false === $item['controller']) {
         $result = \XLite::getInstance()->getShopURL($item['url']) === \XLite\Core\URLManager::getCurrentURL() ?: $result;
     } else {
         if (!is_array($item['controller'])) {
             $item['controller'] = array($item['controller']);
         }
         $controller = \XLite::getController();
         foreach ($item['controller'] as $controllerName) {
             if ($controller instanceof $controllerName) {
                 $result = true;
                 break;
             }
         }
     }
     return $result;
 }
예제 #13
0
파일: Mailer.php 프로젝트: kingsj/core
 /**
  * Send Moneybookers activation message
  * 
  * @return void
  */
 public static function sendMoneybookersActivation()
 {
     // Register variables
     static::register('platform_name', \XLite\Module\CDev\Moneybookers\Model\Payment\Processor\Moneybookers::getPlatformName());
     $address = \XLite\Core\Auth::getInstance()->getProfile()->getBillingAddress();
     if ($address) {
         static::register('first_name', $address->getFirstName());
         static::register('last_name', $address->getLastName());
     } else {
         static::register('first_name', '');
         static::register('last_name', '');
     }
     static::register('email', \XLite\Core\Config::getInstance()->CDev->Moneybookers->email);
     static::register('id', \XLite\Core\Config::getInstance()->CDev->Moneybookers->id);
     static::register('url', \XLite::getInstance()->getShopURL());
     static::register('language', \XLite\Core\Session::getInstance()->getLanguage()->getCode());
     // Compose and send email
     static::compose(\XLite\Core\Config::getInstance()->Company->site_administrator, '*****@*****.**', 'modules/CDev/Moneybookers/activation');
 }
예제 #14
0
파일: Tweet.php 프로젝트: kingsj/core
 /**
  * Get button attributes
  *
  * @return array
  */
 protected function getButtonAttributes()
 {
     $url = \XLite::getInstance()->getShopURL($this->getURL());
     $list = array('url' => $url, 'counturl' => $url);
     if (!\XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_show_count) {
         $list['count'] = 'none';
     }
     if (\XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_via) {
         $list['via'] = \XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_via;
     }
     if (\XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_recommend) {
         $list['related'] = \XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_recommend;
     }
     if (\XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_hashtag) {
         $list['hashtags'] = \XLite\Core\Config::getInstance()->CDev->GoSocial->tweet_hashtag;
     }
     $language = \XLite\Core\Session::getInstance()->getLanguage()->getCode();
     $list['lang'] = in_array($language, $this->languages) ? $language : 'en';
     return $list;
 }
예제 #15
0
파일: Mailer.php 프로젝트: kewaunited/xcart
 /**
  * Send Moneybookers activation message
  *
  * @return void
  */
 public static function sendMoneybookersActivation()
 {
     // Register variables
     static::register('platform_name', \XLite\Module\CDev\Moneybookers\Model\Payment\Processor\Moneybookers::getPlatformName());
     $address = \XLite\Core\Auth::getInstance()->getProfile()->getBillingAddress();
     if ($address) {
         static::register('first_name', $address->getFirstName());
         static::register('last_name', $address->getLastName());
     } else {
         static::register('first_name', '');
         static::register('last_name', '');
     }
     static::register('email', \XLite\Core\Config::getInstance()->CDev->Moneybookers->email);
     static::register('id', \XLite\Core\Config::getInstance()->CDev->Moneybookers->id);
     static::register('url', \XLite::getInstance()->getShopURL());
     static::register('language', \XLite\Core\Session::getInstance()->getLanguage()->getCode());
     static::getMailer()->setSubjectTemplate('modules/CDev/Moneybookers/activation/subject.tpl');
     static::getMailer()->setLayoutTemplate('modules/CDev/Moneybookers/activation/body.tpl');
     // Compose and send email
     static::compose(static::TYPE_MONEYBOOKERS_ACTIVATION, static::getSiteAdministratorMail(), '*****@*****.**', 'modules/CDev/Moneybookers/activation');
 }
예제 #16
0
 /**
  * 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();
     }
 }
예제 #17
0
 /**
  * Clone
  *
  * @return \XLite\Model\Profile
  */
 public function cloneEntity()
 {
     $newProfile = parent::cloneEntity();
     if (!$newProfile->update(true) || !$newProfile->getProfileId()) {
         // TODO - add throw exception
         \XLite::getInstance()->doGlobalDie('Can not clone profile');
     }
     $newProfile->setMembership($this->getMembership());
     $newProfile->setPendingMembership($this->getPendingMembership());
     $newProfile->setPassword('');
     $billingAddress = $this->getBillingAddress();
     if (null !== $billingAddress) {
         $newBillingAddress = $billingAddress->cloneEntity();
         $newBillingAddress->setProfile($newProfile);
         $newProfile->addAddresses($newBillingAddress);
         $newBillingAddress->update();
     }
     $shippingAddress = $this->getShippingAddress();
     if ($shippingAddress && (!$billingAddress || $billingAddress->getAddressId() != $shippingAddress->getAddressId())) {
         $newShippingAddress = $shippingAddress->cloneEntity();
         $newShippingAddress->setProfile($newProfile);
         $newProfile->addAddresses($newShippingAddress);
         $newShippingAddress->update();
     }
     $newProfile->update(true);
     return $newProfile;
 }
예제 #18
0
파일: Stats.php 프로젝트: kingsj/core
 /**
  * Get currency from request
  *
  * @return \XLite\Model\Currency
  */
 public function getCurrency()
 {
     return \XLite\Core\Request::getInstance()->currency ? \XLite\Core\Database::getRepo('XLite\\Model\\Currency')->findOneBy(array('currency_id' => \XLite\Core\Request::getInstance()->currency)) : \XLite::getInstance()->getCurrency();
 }
예제 #19
0
파일: Version.php 프로젝트: kingsj/core
 /**
  * Return info about current LC version
  *
  * @return string
  */
 protected function getVersionMessage()
 {
     return static::t('Version') . ': ' . \XLite::getInstance()->getVersion() . LC_EOL;
 }
예제 #20
0
 /**
  * Send notification to admin about product low limit
  *
  * @return void
  */
 protected function sendLowLimitNotification()
 {
     if (!\XLite::getInstance()->getController() instanceof \XLite\Controller\Admin\EventTask && \XLite\Core\Request::getInstance()->event !== 'import') {
         \XLite\Core\Mailer::sendLowLimitWarningAdmin($this->prepareDataForNotification());
     }
 }
예제 #21
0
 * to licensing@x-cart.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not modify this file if you wish to upgrade X-Cart to newer versions
 * in the future. If you wish to customize X-Cart for your needs please
 * refer to http://www.x-cart.com/ for more information.
 *
 * @category  X-Cart 5
 * @author    Qualiteam software Ltd <*****@*****.**>
 * @copyright Copyright (c) 2011-2015 Qualiteam software Ltd <*****@*****.**>. All rights reserved
 * @license   http://www.x-cart.com/license-agreement.html X-Cart 5 License Agreement
 * @link      http://www.x-cart.com/
 */
return function () {
    $tablePrefix = \XLite::getInstance()->getOptions(array('database_details', 'table_prefix'));
    $tables = array('news' => 'id');
    foreach ($tables as $table => $tableKey) {
        $tableName = $tablePrefix . $table;
        $tableColumns = \XLite\Core\Database::getEM()->getConnection()->getSchemaManager()->listTableColumns($tableName);
        $found = false;
        foreach (array_keys($tableColumns) as $column) {
            if (strtolower($column) == 'cleanurl') {
                $found = true;
                break;
            }
        }
        if ($found) {
            $items = array();
            $query = 'SELECT ' . $tableKey . ', cleanURL FROM ' . $tableName;
            $result = \Includes\Utils\Database::fetchAll($query);
예제 #22
0
 /**
  * Install uploaded add-on
  *
  * @return void
  */
 protected function doActionUploadAddon()
 {
     $this->setReturnURL($this->buildURL('addons_list_installed'));
     $path = \Includes\Utils\FileManager::moveUploadedFile('modulePack');
     if ($path) {
         \XLite\Upgrade\Cell::getInstance()->clear(true, true, false);
         $entry = \XLite\Upgrade\Cell::getInstance()->addUploadedModule($path);
         if (!isset($entry)) {
             $this->showError(__FUNCTION__, static::t('unable to add module entry to the installation list: X', array('path' => $path)));
         } elseif (\XLite::getInstance()->checkVersion($entry->getMajorVersionNew(), '!=')) {
             $this->showError(__FUNCTION__, static::t('module version X is not equal to the core one (Y)', array('module_version' => $entry->getMajorVersionNew(), 'core_version' => \XLite::getInstance()->getMajorVersion())));
         } elseif ($this->isNextStepAvailable()) {
             $this->setReturnURL($this->buildURL('upgrade', 'download', $this->getActionParamsCommon(true)));
         } else {
             $this->showError(__FUNCTION__);
         }
     } else {
         $this->showError(__FUNCTION__, static::t('unable to upload module'));
     }
 }
예제 #23
0
파일: Price.php 프로젝트: kingsj/core
 /**
  * Define widget params
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams += array(self::PARAM_CURRENCY => new \XLite\Model\WidgetParam\Object('Currency', \XLite::getInstance()->getCurrency(), false, 'XLite\\Model\\Currency'));
 }
예제 #24
0
 /**
  * Get default options
  *
  * @return array
  */
 protected function getDefaultOptions()
 {
     return array('%' => static::t('Percent'), '$' => static::t('X off', array('currency' => \XLite::getInstance()->getCurrency()->getSymbol())));
 }
예제 #25
0
 /**
  * Get module major version
  *
  * @return string
  */
 public static function getMajorVersion()
 {
     return \XLite::getInstance()->getMajorVersion();
 }
예제 #26
0
 /**
  * Send headers
  *
  * @return void
  */
 public static function sendHeaders()
 {
     // send no-cache headers
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     header('Cache-Control: no-store, no-cache, must-revalidate');
     header('Cache-Control: post-check=0, pre-check=0', false);
     header('Pragma: no-cache');
     header('Content-Type: text/html; charset=utf-8');
     if (\XLite::isAdminZone()) {
         header('X-Robots-Tag: noindex, nofollow');
     }
     foreach (\XLite\Core\URLManager::getAllowedDomains() as $domain) {
         header('Access-Control-Allow-Origin: ' . $domain, false);
     }
     $option = \XLite::getInstance()->getOptions(array('other', 'x_frame_options'));
     if (isset($option) && 'disabled' !== $option) {
         header('X-Frame-Options:' . $option);
     }
 }
예제 #27
0
 /**
  * Check if notifications should be sended in current situation
  * 
  * @return boolean
  */
 protected function isShouldSend()
 {
     $currentController = \XLite::getInstance()->getController();
     $isControllerFirbidden = array_reduce($this->getForbiddenControllers(), function ($carry, $controllerName) use($currentController) {
         return $carry ?: $currentController instanceof $controllerName;
     }, false);
     return \XLite\Core\Request::getInstance()->event !== 'import' && !$isControllerFirbidden;
 }
예제 #28
0
파일: Page.php 프로젝트: kirkbauer2/kirkxc
 /**
  * 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;
 }
예제 #29
0
 /**
  * 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);
 }
예제 #30
0
 /**
  * Get currency formatted value
  *
  * @return string
  */
 public function getCurrencySymbol()
 {
     return \XLite::getInstance()->getCurrency()->getSymbol();
 }