本文整理汇总了PHP中ClassLoader::import方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::import方法的具体用法?PHP ClassLoader::import怎么用?PHP ClassLoader::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::import方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(LiveCart $application)
{
if ($application->getConfig()->get('SSL_BACKEND')) {
$application->getRouter()->setSslAction('');
}
parent::__construct($application);
if (!isset($_SERVER['HTTP_USER_AGENT'])) {
$_SERVER['HTTP_USER_AGENT'] = 'Firefox';
}
// no IE yet
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
ClassLoader::import('application.controller.backend.UnsupportedBrowserException');
throw new UnsupportedBrowserException();
}
if (!$this->user->hasBackendAccess() && !$this instanceof SessionController) {
SessionUser::destroy();
$url = $this->router->createUrl(array('controller' => 'backend.session', 'action' => 'index', 'query' => array('return' => $_SERVER['REQUEST_URI'])));
if (!$this->isAjax()) {
header('Location: ' . $url);
} else {
header('Content-type: text/javascript');
echo json_encode(array('__redirect' => $url));
}
exit;
}
}
示例2: setUp
public function setUp()
{
ActiveRecordModel::getApplication()->clearCachedVars();
ActiveRecordModel::beginTransaction();
if (empty($this->autoincrements)) {
foreach ($this->getUsedSchemas() as $table) {
$res = $this->db->executeQuery("SHOW TABLE STATUS LIKE '{$table}'");
$res->next();
$this->autoincrements[$table] = (int) $res->getInt("Auto_increment");
}
}
if ($this instanceof BackendControllerTestCase) {
ClassLoader::import('application.model.user.SessionUser');
ClassLoader::import('application.model.user.UserGroup');
// set up user
$group = UserGroup::getNewInstance('Unit tester');
$group->save();
$group->setAllRoles();
$group->save();
$user = User::getNewInstance('unittest@test.com', null, $group);
$user->save();
SessionUser::setUser($user);
}
if ($this instanceof ControllerTestCase) {
$this->request = self::getApplication()->getRequest();
}
}
示例3: run
public static function run($accessString)
{
if (empty($accessString)) {
return true;
}
if (preg_match_all('/([\\w\\.]+)(?:\\(([\\w\\.]*)(?:\\/(\\w*))?\\))?,?/', $accessString, $roles)) {
ClassLoader::import('application.model.user.SessionUser');
$currentUser = SessionUser::getUser();
$controller = Controller::getCurrentController();
$rolesParser = $controller->getRoles();
$currentControllerName = $controller->getRequest()->getControllerName();
$currentActionName = $controller->getRequest()->getActionName();
$rolesCount = count($roles[0]);
for ($i = 0; $i < $rolesCount; $i++) {
$roleString = $roles[0][$i];
$roleName = $roles[1][$i];
$roleControllerName = empty($roles[3][$i]) ? $currentControllerName : $roles[2][$i];
$roleActionName = empty($roles[3][$i]) ? empty($roles[2][$i]) ? $currentActionName : $roles[2][$i] : $currentActionName;
if ($roleControllerName == $currentControllerName && $roleActionName == $currentActionName) {
$aRoleName = $rolesParser->getRole($roleActionName);
if ($currentUser->hasAccess($aRoleName) && $currentUser->hasAccess($roleName)) {
return true;
}
}
}
return false;
}
throw new ApplicationException('Access string ("' . $accessString . '") has illegal format');
}
示例4: getGenerator
public static function getGenerator(CustomerOrder $order)
{
$class = ActiveRecordModel::getApplication()->getConfig()->get('INVOICE_NUMBER_GENERATOR');
self::loadGeneratorClass($class);
ClassLoader::import('application.model.order.invoiceNumber.' . $class);
return new $class($order);
}
示例5: isValid
public function isValid($value)
{
ClassLoader::import('application.model.user.User');
$filter = new ARSelectFilter();
$cond = new EqualsCond(new ARFieldHandle('User', 'email'), $value);
$filter->setCondition($cond);
return ActiveRecordModel::getRecordCount('User', $filter) == 0;
}
示例6: smarty_block_denied
/**
* Display a tip block
*
* @package application.helper.smarty
* @author Integry Systems
*
* @package application.helper.smarty
*/
function smarty_block_denied($params, $content, LiveCartSmarty $smarty, &$repeat)
{
if (!$repeat) {
ClassLoader::import('application.helper.AccessStringParser');
if (!AccessStringParser::run($params['role'])) {
return $content;
}
}
}
示例7: smarty_block_allowed
/**
* Display a tip block
*
* @package application.helper.smarty
* @author Integry Systems
*
* @package application.helper.smarty
*/
function smarty_block_allowed($params, $content, Smarty_Internal_Template $smarty, &$repeat)
{
if (!$repeat) {
ClassLoader::import('application.helper.AccessStringParser');
if (AccessStringParser::run($params['role'])) {
return $content;
}
}
}
示例8: loadActionRuleClass
private function loadActionRuleClass($className)
{
ClassLoader::import('application.model.businessrule.action.' . $className);
if (!class_exists($className, false)) {
foreach (self::getApplication()->getPlugins('businessrule/action/' . $className) as $plugin) {
include_once $plugin['path'];
}
}
return $className;
}
示例9: canParse
public static function canParse(Request $request, $parserClassNames = array())
{
foreach ($parserClassNames as $parserClassName) {
ClassLoader::import('application.model.datasync.api.reader.' . $parserClassName);
if (call_user_func_array(array($parserClassName, "canParse"), array($request, $parserClassName))) {
return true;
}
}
return false;
}
示例10: smarty_function_pageName
/**
* Generates static page title
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_pageName($params, Smarty_Internal_Template $smarty)
{
if (!class_exists('StaticPage', false)) {
ClassLoader::import('application.model.staticpage.StaticPage');
}
if (!isset($params['id'])) {
return '<span style="color: red; font-weight: bold; font-size: larger;">No static page ID provided</span>';
}
$page = StaticPage::getInstanceById($params['id'], StaticPage::LOAD_DATA)->toArray();
return $page[!empty($params['text']) ? 'text_lang' : 'title_lang'];
}
示例11: smarty_function_pageUrl
/**
* Generates static page URL
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_pageUrl($params, LiveCartSmarty $smarty)
{
if (!class_exists('StaticPage', false)) {
ClassLoader::import('application.model.staticpage.StaticPage');
}
if (isset($params['id'])) {
$params['data'] = StaticPage::getInstanceById($params['id'], StaticPage::LOAD_DATA)->toArray();
}
$urlParams = array('controller' => 'staticPage', 'action' => 'view', 'handle' => $params['data']['handle']);
return $smarty->getApplication()->getRouter()->createUrl($urlParams, true);
}
示例12: smarty_function_json
/**
* ...
*
* @param array $params
* @param Smarty $smarty
* @return string
*
* @package application.helper.smarty
* @author Integry Systems
*/
function smarty_function_json($params, LiveCartSmarty $smarty)
{
$array = $params['array'];
$assign = isset($params['assign']) ? $params['assign'] : false;
ClassLoader::import('library.json.json');
$javaObject = @json_encode($array);
if (!$assign) {
return $javaObject;
} else {
$smarty->assign($assign, $javaObject);
}
}
示例13: getShippingMethods
private function getShippingMethods()
{
ClassLoader::import('application.model.delivery.ShippingService');
$methods = array();
$f = select();
$f->setOrder(f('DeliveryZone.ID'));
$f->setOrder(f('ShippingService.position'));
foreach (ActiveRecord::getRecordSetArray('ShippingService', $f, array('DeliveryZone')) as $service) {
$methods[$service['ID']] = $service['name_lang'] . ' (' . $service['DeliveryZone']['name'] . ')';
}
return $methods;
}
示例14: processBatch
private function processBatch($plugins, $interval = null)
{
if ($plugins && !class_exists('CronPlugin', false)) {
ClassLoader::import('application.CronPlugin');
}
foreach ($plugins as $plugin) {
include_once $plugin['path'];
$inst = new $plugin['class']($this->application, $plugin['path']);
if ($inst->isExecutable($interval)) {
$res = $inst->process();
$inst->markCompletedExecution();
}
}
}
示例15: processPlugins
protected function processPlugins()
{
if (!$this->isPluginProcessed) {
foreach ($this->application->getPlugins('validator/' . $this->getName()) as $plugin) {
if (!class_exists('ValidatorPlugin', false)) {
ClassLoader::import('application.ValidatorPlugin');
}
include_once $plugin['path'];
$inst = new $plugin['class']($this, $this->application);
$inst->process();
}
}
$this->isPluginProcessed = true;
}