本文整理汇总了PHP中ClassLoader::importNow方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::importNow方法的具体用法?PHP ClassLoader::importNow怎么用?PHP ClassLoader::importNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::importNow方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldType
<?php
ClassLoader::importNow("application.helper.getDateFromString");
ClassLoader::importNow("application.model.eav.EavField");
ClassLoader::importNow("application.model.category.SpecField");
/**
* @package application.helper
* @author Integry Systems
*/
class ActiveGrid
{
const SORT_HANDLE = 0;
const FILTER_HANDLE = 1;
private $filter;
private $application;
private $modelClass;
private $columnTypes;
public static function getFieldType(ARField $field)
{
$fieldType = $field->getDataType();
if ($field instanceof ARForeignKeyField || $field instanceof ARPrimaryKeyField) {
return null;
}
if ($fieldType instanceof ARBool) {
$type = 'bool';
} elseif ($fieldType instanceof ARNumeric) {
$type = 'numeric';
} elseif ($fieldType instanceof ARPeriod) {
$type = 'date';
} else {
$type = 'text';
示例2: doCopyTheme
private function doCopyTheme()
{
ClassLoader::importNow('application.helper.CopyRecursive');
$request = $this->getRequest();
$this->fromTheme = $request->get('id');
$this->toTheme = $request->get('name');
$files = $this->getThemeFiles($this->fromTheme);
$copyFiles = $this->getThemeFiles($this->toTheme, false);
$baseDir = ClassLoader::getBaseDir();
foreach ($files as $key => $orginalFileName) {
if (array_key_exists($key, $copyFiles)) {
$copyToFileName = $copyFiles[$key];
} else {
if (preg_match('/public.?upload.?css.?delete/', $orginalFileName)) {
// orginal theme files matching glob('public/upload/css/delete/<theme>-*.php')
// get copyTo file name by replacing
$copyToFileName = str_replace('public/upload/css/delete/' . $this->fromTheme . '-', 'public/upload/css/delete/' . $this->toTheme . '-', $orginalFileName);
$copyFiles[] = $copyToFileName;
} else {
continue;
// only if new type of files added in themes
}
}
copyRecursive($baseDir . DIRECTORY_SEPARATOR . $orginalFileName, $baseDir . DIRECTORY_SEPARATOR . $copyToFileName, array($this, 'onThemeFileCopied'));
}
return array('status' => 'success', 'id' => $this->toTheme, 'message' => $this->maketext('_theme_copied', array($this->fromTheme, $this->toTheme)));
}
示例3: getFieldType
<?php
ClassLoader::importNow("application.helper.getDateFromString");
ClassLoader::importNow("application.model.eav.EavField");
/**
* @package application.helper
* @author Integry Systems
*/
class ActiveGrid
{
const SORT_HANDLE = 0;
const FILTER_HANDLE = 1;
private $filter;
private $application;
private $modelClass;
private $columnTypes;
public static function getFieldType(ARField $field)
{
$fieldType = $field->getDataType();
if ($field instanceof ARForeignKeyField || $field instanceof ARPrimaryKeyField) {
return null;
}
if ($fieldType instanceof ARBool) {
$type = 'bool';
} elseif ($fieldType instanceof ARNumeric) {
$type = 'numeric';
} elseif ($fieldType instanceof ARPeriod) {
$type = 'date';
} else {
$type = 'text';
}
示例4: canParse
<?php
ClassLoader::import('application.model.datasync.ModelApi');
ClassLoader::import('application.model.datasync.api.reader.XmlCustomerOrderApiReader');
ClassLoader::import('application.model.datasync.import.CustomerOrderImport');
ClassLoader::import('application/model.datasync.CsvImportProfile');
ClassLoader::import('application/model.order.CustomerOrder');
ClassLoader::import('application.helper.LiveCartSimpleXMLElement');
ClassLoader::importNow("application.helper.AppleAPNService");
/**
* Web service access layer for CustomerOrder model
*
* @package application.model.datasync
* @author Integry Systems <http://integry.com>
*
*/
class CustomerOrderApi extends ModelApi
{
private $listFilterMapping = null;
protected $application;
public static function canParse(Request $request)
{
return parent::canParse($request, array('XmlCustomerOrderApiReader'));
}
public function __construct(LiveCart $application)
{
parent::__construct($application, 'CustomerOrder', array());
$this->addSupportedApiActionName('test');
$this->addSupportedApiActionName('invoice');
$this->addSupportedApiActionName('capture');
$this->addSupportedApiActionName('cancel');
示例5: init
<?php
ClassLoader::import('application.controller.FrontendController');
ClassLoader::import('application.model.product.Product');
ClassLoader::import('application.model.category.Category');
ClassLoader::import('application.model.staticpage.StaticPage');
ClassLoader::import('application.model.sitenews.NewsPost');
ClassLoader::importNow('application.helper.smarty.function#categoryUrl');
ClassLoader::importNow('application.helper.smarty.function#productUrl');
ClassLoader::importNow('application.helper.smarty.function#newsUrl');
ClassLoader::import('application.model.system.OutputCache');
/**
* Generates XML sitemaps
*
* @author Integry Systems
* @package application.controller
*/
class SitemapController extends FrontendController
{
const MAX_URLS = 5000;
public function init()
{
$this->setLayout('empty');
if (!$this->config->get('ENABLE_SITEMAPS')) {
throw new ActionNotFoundException($this);
}
}
public function index()
{
$languages = $this->application->getLanguageArray(true);
$defaultLanguage = $this->application->getDefaultLanguageCode();
示例6: isRated
private function isRated(Product $product, $isRating = false)
{
if (!empty($_COOKIE['rating_' . $product->getID()])) {
return true;
}
if ($isRating) {
ClassLoader::importNow("application.helper.getDateFromString");
$f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('ProductRating', 'productID'), $product->getID()));
if (!$this->user->isAnonymous()) {
$cond = new EqualsCond(new ARFieldHandle('ProductRating', 'userID'), $this->user->getID());
} else {
if ($hours = $this->config->get('RATING_SAME_IP_TIME')) {
$cond = new EqualsCond(new ARFieldHandle('ProductRating', 'ip'), $this->request->getIPLong());
$cond->addAnd(new MoreThanCond(new ARFieldHandle('ProductRating', 'dateCreated'), getDateFromString('-' . $hours . ' hours')));
}
}
if (isset($cond)) {
$f->mergeCondition($cond);
return ActiveRecordModel::getRecordCount('ProductRating', $f) > 0;
}
}
}
示例7: smarty_function_categoryUrl
<?php
ClassLoader::importNow('application.helper.CreateHandleString');
/**
* Generates category page URL
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_categoryUrl($params, LiveCartSmarty $smarty)
{
return createCategoryUrl($params, $smarty->getApplication());
}
function createCategoryUrl($params, LiveCart $application)
{
static $simpleUrlTemplate = null;
// create URL template
$router = $application->getRouter();
if (!$simpleUrlTemplate) {
$simpleUrlTemplate = $router->createUrl(array('controller' => 'category', 'action' => 'index', 'cathandle' => '---', 'id' => 999));
$simpleUrlTemplate = strtr($simpleUrlTemplate, array(999 => '#', '---' => '|'));
}
$category = $params['data'];
if (!isset($category['ID'])) {
$category['ID'] = 1;
}
$handle = isset($category['name_lang']) ? createHandleString($category['name_lang']) : '';
示例8: getPaymentHandler
public function getPaymentHandler($className, LiveCartTransaction $details = null)
{
if (!class_exists($className, false)) {
if ('OfflineTransactionHandler' == $className) {
ClassLoader::import('application.model.order.OfflineTransactionHandler');
} else {
ClassLoader::importNow('library.payment.method.*');
ClassLoader::importNow('library.payment.method.cc.*');
ClassLoader::importNow('library.payment.method.express.*');
}
}
if (is_null($details)) {
$details = new TransactionDetails();
}
$inst = new $className($details);
if ($details instanceof LiveCartTransaction) {
$inst->setOrder($details->getOrder());
}
$c = $this->config->getSection('payment/' . $className);
foreach ($c as $key => $value) {
$value = $this->config->get($key);
$key = substr($key, strlen($className) + 1);
$inst->setConfigValue($key, $value);
}
// check if the currency is supported by the payment handler
$currency = $inst->getValidCurrency($details->currency->get());
if ($details->currency->get() != $currency && !is_null($details->currency->get())) {
$newAmount = Currency::getInstanceById($currency, Currency::LOAD_DATA)->convertAmount(Currency::getInstanceById($details->currency->get(), Currency::LOAD_DATA), $details->amount->get());
$details->currency->set($currency);
$details->amount->set(round($newAmount, 2));
}
$inst->setApplication($this);
return $inst;
}
示例9: info
public function info()
{
ClassLoader::importNow("application.helper.getDateFromString");
$product = Product::getInstanceById($this->request->get('id'), ActiveRecord::LOAD_DATA, array('DefaultImage' => 'ProductImage', 'Manufacturer', 'Category'));
$thisMonth = date('m');
$lastMonth = date('Y-m', strtotime(date('m') . '/15 -1 month'));
$periods = array('_last_1_h' => "-1 hours | now", '_last_3_h' => "-3 hours | now", '_last_6_h' => "-6 hours | now", '_last_12_h' => "-12 hours | now", '_last_24_h' => "-24 hours | now", '_last_3_d' => "-3 days | now", '_this_week' => "w:Monday | now", '_last_week' => "w:Monday ~ -1 week | w:Monday", '_this_month' => $thisMonth . "/1 | now", '_last_month' => $lastMonth . "-1 | " . $lastMonth . "/1", '_this_year' => "January 1 | now", '_last_year' => "January 1 last year | January 1", '_overall' => "now | now");
$purchaseStats = array();
$prevCount = 0;
foreach ($periods as $key => $period) {
list($from, $to) = explode(' | ', $period);
$cond = new EqualsCond(new ARFieldHandle('OrderedItem', 'productID'), $product->getID());
if ('now' != $from) {
$cond->addAND(new EqualsOrMoreCond(new ARFieldHandle('CustomerOrder', 'dateCompleted'), getDateFromString($from)));
}
if ('now' != $to) {
$cond->addAnd(new EqualsOrLessCond(new ARFieldHandle('CustomerOrder', 'dateCompleted'), getDateFromString($to)));
}
$f = new ARSelectFilter($cond);
$f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
$f->removeFieldList();
$f->addField('SUM(OrderedItem.count)');
$query = new ARSelectQueryBuilder();
$query->setFilter($f);
$query->includeTable('OrderedItem');
$query->joinTable('CustomerOrder', 'OrderedItem', 'ID', 'customerOrderID');
if (($count = array_shift(array_shift(ActiveRecordModel::getDataBySql($query->getPreparedStatement(ActiveRecord::getDBConnection()))))) && ($count > $prevCount || '_overall' == $key)) {
$purchaseStats[$key] = $count;
}
if ($count > $prevCount) {
$prevCount = $count;
}
}
$response = new ActionResponse();
$response->set('together', $product->getProductsPurchasedTogether(10));
$response->set('product', $product->toArray());
$response->set('purchaseStats', $purchaseStats);
return $response;
}
示例10: index
<?php
ClassLoader::import("application.controller.backend.abstract.StoreManagementController");
ClassLoader::import("application.model.report.*");
ClassLoader::importNow("application.helper.getDateFromString");
ClassLoader::importNow("library.openFlashChart.open-flash-chart");
/**
* Generate reports and stats
*
* @package application.controller.backend
* @author Integry Systems
*/
class ReportController extends StoreManagementController
{
/**
* Main settings page
*/
public function index()
{
$response = new ActionResponse();
$response->set('thisMonth', date('m'));
$response->set('lastMonth', date('Y-m', strtotime(date('m') . '/15 -1 month')));
return $response;
}
public function sales()
{
$report = new SalesReport();
$this->initReport($report);
$this->loadLanguageFile('backend/CustomerOrder');
$this->application->loadLanguageFiles();
$type = $this->getOption('sales', 'number_orders');
示例11: index
<?php
ClassLoader::import("application.controller.backend.abstract.StoreManagementController");
ClassLoader::import("application.model.product.Product");
ClassLoader::import("application.model.product.ProductSet");
ClassLoader::import("application.model.product.ProductVariationType");
ClassLoader::importNow("application.model.product.ProductVariationTypeSet");
/**
* Product variations
*
* @package application.controller.backend
* @author Integry Systems
* @role option
*/
class ProductVariationController extends StoreManagementController
{
/**
* @return ActionResponse
*/
public function index()
{
$response = new ActionResponse();
$parent = Product::getInstanceByID($this->request->get('id'), true);
$variationTypes = $parent->getRelatedRecordSet('ProductVariationType');
$variations = $variationTypes->getVariations();
$parentArray = $parent->toArray();
$response->set('parent', $parentArray);
$response->set('params', array('parent' => $parentArray, 'variationTypes' => $variationTypes->toArray(), 'variations' => $variations->toArray(), 'matrix' => $parent->getVariationMatrix(), 'currency' => $this->application->getDefaultCurrencyCode()));
return $response;
}
public function save()
示例12: index
<?php
ClassLoader::import("application.controller.backend.abstract.StoreManagementController");
ClassLoader::importNow("application.model.delivery.DeliveryZone");
ClassLoader::import("application.model.delivery.State");
/**
* Application settings management
*
* @package application.controller.backend
* @author Integry Systems
* @role delivery
*/
class DeliveryZoneController extends StoreManagementController
{
/**
* Main settings page
*/
public function index()
{
$zones = array(0 => array('ID' => -1, 'name' => $this->translate('_default_zone')), 1 => array('ID' => -2, 'name' => $this->translate('_delivery_zones')), 2 => array('ID' => -3, 'name' => $this->translate('_tax_zones')));
foreach (DeliveryZone::getAll()->toArray() as $zone) {
$zones[1]['items'][] = array('ID' => $zone['ID'], 'name' => $zone['name'], 'type' => $zone['type']);
$zones[2]['items'][] = array('ID' => $zone['ID'], 'name' => $zone['name'], 'type' => $zone['type']);
}
$response = new ActionResponse();
$response->set('zones', json_encode($zones));
$response->set('countryGroups', json_encode($this->locale->info()->getCountryGroups()));
$response->set('testAddress', new Form(new RequestValidator('testAddress', $this->request)));
$response->set('countries', array_merge(array('' => ''), $this->application->getEnabledCountries()));
return $response;
}
示例13: index
<?php
ClassLoader::import("application.controller.backend.abstract.StoreManagementController");
ClassLoader::import("application.model.order.CustomerOrder");
ClassLoader::import("application.model.order.OrderNote");
ClassLoader::import("application.model.category.Category");
ClassLoader::importNow("application.helper.getDateFromString");
/**
* Main backend controller which stands as an entry point to administration functionality
*
* @package application.controller.backend
* @author Integry Systems <http://integry.com>
*/
class IndexController extends StoreManagementController
{
public function index()
{
$this->updateApplicationUri();
// order stats
$conditions = array('last' => new EqualsOrMoreCond(new ARFieldHandle('CustomerOrder', 'dateCompleted'), time() - 86400), 'new' => new IsNullCond(new ARFieldHandle('CustomerOrder', 'status')), 'processing' => new EqualsCond(new ARFieldHandle('CustomerOrder', 'status'), CustomerOrder::STATUS_PROCESSING), 'total' => new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
foreach ($conditions as $key => $cond) {
$f = new ARSelectFilter($cond);
$f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
$f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isCancelled'), false));
$orderCount[$key] = ActiveRecordModel::getRecordCount('CustomerOrder', $f);
}
// messages
$f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('OrderNote', 'isAdmin'), 0));
$f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'isRead'), 0));
$orderCount['messages'] = ActiveRecordModel::getRecordCount('OrderNote', $f);
// inventory stats
示例14: dirname
<?php
if (!defined('TEST_SUITE')) {
require_once dirname(__FILE__) . '/../../Initialize.php';
}
ClassLoader::importNow("application.helper.smarty.prefilter#config");
/**
* @author Integry Systems
* @package test.helper.smarty
*/
class PrefilterTest extends LiveCartTest
{
public function testErrShorthand()
{
$code = '{err for="firstName"}{{label {t _your_first_name}:}}{textfield class="text"}{/err}';
$replaced = smarty_prefilter_config($code, null);
$expected = '<label for="firstName"><span class="label">{translate text="_your_first_name"}:</span></label><fieldset class="error">{textfield name="firstName" class="text"}
<div class="errorText hidden{error for="firstName"} visible{/error}">{error for="firstName"}{$msg}{/error}</div>
</fieldset>';
$this->assertEqual($replaced, $expected);
}
public function testErrShorthandTranslation()
{
$code = '{err for="firstName"}{label _your_first_name}{textfield class="text"}{/err}';
$replaced = smarty_prefilter_config($code, null);
$expected = '<label for="firstName"><span class="label">{translate text="_your_first_name"}</span></label><fieldset class="error">{textfield name="firstName" class="text"}
<div class="errorText hidden{error for="firstName"} visible{/error}">{error for="firstName"}{$msg}{/error}</div>
</fieldset>';
$this->assertEqual($replaced, $expected);
}
public function testBlockAsParamValue()