本文整理汇总了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);
}
}
示例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;
}
示例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];
}
示例4: testAutoloadReturnsFalseIfClassDoesNotExist
public function testAutoloadReturnsFalseIfClassDoesNotExist()
{
$this->assertFalse(ClassLoader::getInstance()->autoload('Omlex\\Invalid'));
}