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


PHP ClassLoader::getInstance方法代码示例

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


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

示例1: bootstrapInitShop

 private function bootstrapInitShop()
 {
     if (FALSE == $this->CI->config->item('is_installed') || FALSE === ($shopPath = getModulePath('shop'))) {
         return;
     }
     define('SHOP_DIR', $shopPath);
     ClassLoader::getInstance()->registerNamespacedPath(SHOP_DIR . 'models2/generated-classes')->registerClassesPath(SHOP_DIR . 'models2/generated-classes')->registerClassesPath(SHOP_DIR . 'classes')->registerNamespacedPath(SHOP_DIR . 'classes');
     ShopCore::init();
     // Diable CSRF library form web money service
     $this->CI =& get_instance();
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['result'] == 'true' && $_GET['pm'] > 0) {
         define('ICMS_DISBALE_CSRF', true);
     }
     // Support for robokassa
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['getResult'] == 'true') {
         define('ICMS_DISBALE_CSRF', true);
     }
     // Support for privat
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'order' && $this->CI->uri->segment(3) == 'view' && $_POST) {
         define('ICMS_DISBALE_CSRF', true);
     }
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['succes'] == 'true') {
         define('ICMS_DISBALE_CSRF', true);
     }
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['fail'] == 'true') {
         define('ICMS_DISBALE_CSRF', true);
     }
     if (isset($_SERVER['HTTP_REFERER']) and strpos($_SERVER['HTTP_REFERER'] . "", 'facebook.com')) {
         define('ICMS_DISBALE_CSRF', true);
     }
     // Support for privat
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'order' && $this->CI->uri->segment(3) == 'view') {
         define('ICMS_DISBALE_CSRF', true);
     }
     //new payment system
     if (preg_match("/payment_method_/i", $this->CI->uri->segment(1)) || preg_match("/payment_method_/i", $this->CI->uri->segment(2))) {
         define('ICMS_DISBALE_CSRF', true);
     }
 }
开发者ID:RandomUsernameHere,项目名称:megainfo-corporate-cms,代码行数:39,代码来源:lib_init.php

示例2: getControllerPaths

 /**
  * 获取控制目录
  *
  * @return array
  */
 public static function getControllerPaths()
 {
     $paths = array();
     foreach ((array) static::$controllerNamespace as $ns) {
         $ps = ClassLoader::getInstance()->getNamespacePaths(strstr($ns, '\\', true));
         foreach ($ps as &$v) {
             $v .= strtr(strstr($ns, '\\'), '\\', DS);
         }
         $paths[$ns] = $ps;
     }
     return $paths;
 }
开发者ID:saoyor,项目名称:php-framework,代码行数:17,代码来源:App.php

示例3: spl_autoload_register

<?php

spl_autoload_register(array(ClassLoader::getInstance(), 'loadClass'));
require_once dirname(__FILE__) . "/Interfaces.php";
class ClassLoader
{
    private static $SAVE_FILE = 'ClassLoader.class.php';
    private static $instance = null;
    private static $moduleDirs = array('framework/core', 'framework/schema', 'framework/servlets', 'framework/utils');
    private $classList = array();
    private $refreshed;
    private $path;
    public static function getInstance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new ClassLoader();
        }
        return self::$instance;
    }
    private function __construct()
    {
        $this->path = $_SERVER['DOCUMENT_ROOT'] . "/framework/core/";
        $this->initClassList();
    }
    public function loadClass($className)
    {
        if (!array_key_exists($className, $this->classList) && !$this->refreshed) {
            $this->refreshClassList();
        }
        require_once $this->classList[$className];
    }
开发者ID:BackupTheBerlios,项目名称:frameorm-svn,代码行数:31,代码来源:autoload.php

示例4: testAutoloadReturnsFalseIfClassDoesNotExist

 public function testAutoloadReturnsFalseIfClassDoesNotExist()
 {
     $this->assertFalse(ClassLoader::getInstance()->autoload('Omlex\\Invalid'));
 }
开发者ID:excelwebzone,项目名称:omlex,代码行数:4,代码来源:ClassLoaderTest.php


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