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


PHP XLite::getInstance方法代码示例

本文整理汇总了PHP中XLite::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP XLite::getInstance方法的具体用法?PHP XLite::getInstance怎么用?PHP XLite::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XLite的用法示例。


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

示例1: addEnabledCondition

 /**
  * 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;
 }
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:Method.php

示例2: getMarketplaceURL

 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()));
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:7,代码来源:AutomateShippingRoutine.php

示例3: testGetTotalRate

 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');
 }
开发者ID:kingsj,项目名称:core,代码行数:33,代码来源:Rate.php

示例4: getLocationURL

 /**
  * 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()));
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:13,代码来源:BackToModulesLink.php

示例5: requestProbe

 /**
  * 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.');
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:Measure.php

示例6: getCurrentCurrencyId

 /**
  * 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();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:CurrencySelector.php

示例7: testLoading

 /**
  * 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');
 }
开发者ID:kingsj,项目名称:core,代码行数:59,代码来源:Storage.php

示例8: setURLToReturn

 /**
  * 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();
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:Cart.php

示例9: getDrupalRelativePath

 /**
  * 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;
 }
开发者ID:kingsj,项目名称:core,代码行数:23,代码来源:AView.php

示例10: xlite_restore_sql_from_backup

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;
}
开发者ID:kingsj,项目名称:core,代码行数:44,代码来源:AllTests.php

示例11: doActionLocate

 /**
  * 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));
                 }
             }
         }
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:24,代码来源:Sitemap.php

示例12: isActiveItem

 /**
  * 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;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:26,代码来源:ACustomer.php

示例13: sendMoneybookersActivation

 /**
  * 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, 'ecommerce@moneybookers.com', 'modules/CDev/Moneybookers/activation');
 }
开发者ID:kingsj,项目名称:core,代码行数:24,代码来源:Mailer.php

示例14: getButtonAttributes

 /**
  * 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;
 }
开发者ID:kingsj,项目名称:core,代码行数:25,代码来源:Tweet.php

示例15: sendMoneybookersActivation

 /**
  * 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(), 'ecommerce@skrill.com', 'modules/CDev/Moneybookers/activation');
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:26,代码来源:Mailer.php


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