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


PHP ClassLoader::import方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:26,代码来源:BackendController.php

示例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();
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:27,代码来源:UnitTest.php

示例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');
 }
开发者ID:saiber,项目名称:livecart,代码行数:29,代码来源:AccessStringParser.php

示例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);
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:InvoiceNumberGenerator.php

示例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;
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:IsUniqueEmailCheck.php

示例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;
        }
    }
}
开发者ID:saiber,项目名称:www,代码行数:17,代码来源:block.denied.php

示例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;
        }
    }
}
开发者ID:saiber,项目名称:livecart,代码行数:17,代码来源:block.allowed.php

示例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;
 }
开发者ID:saiber,项目名称:livecart,代码行数:10,代码来源:DiscountAction.php

示例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;
 }
开发者ID:saiber,项目名称:livecart,代码行数:10,代码来源:ModelApi.php

示例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'];
}
开发者ID:saiber,项目名称:livecart,代码行数:21,代码来源:function.pageName.php

示例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);
}
开发者ID:saiber,项目名称:www,代码行数:21,代码来源:function.pageUrl.php

示例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);
    }
}
开发者ID:saiber,项目名称:www,代码行数:22,代码来源:function.json.php

示例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;
 }
开发者ID:saiber,项目名称:www,代码行数:12,代码来源:DiscountController.php

示例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();
         }
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:Cron.php

示例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;
 }
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:LiveCartValidator.php


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