Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1172391
class_locator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Sep 29, 6:43 PM
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Oct 1, 6:43 PM (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
759792
Attached To
rINP In-Portal
class_locator.php
View Options
<?php
/**
* @version $Id: class_locator.php 16800 2024-10-19 19:54:58Z alex $
* @package In-Portal
* @copyright Copyright (C) 1997 - 2016 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
use
Composer\Autoload\ClassLoader
;
$start
=
microtime
(
true
);
define
(
'DBG_ZEND_PRESENT'
,
1
);
define
(
'INDEX_FILE'
,
'index.php'
);
define
(
'FULL_PATH'
,
realpath
(
dirname
(
__FILE__
)
.
'/..'
));
include_once
(
FULL_PATH
.
'/core/kernel/startup.php'
);
$application
=
kApplication
::
Instance
();
$application
->
Init
();
/** @var ClassLoader $composer_class_loader */
$composer_class_loader
=
require
FULL_PATH
.
'/vendor/autoload.php'
;
return
function
(
$class
)
use
(
$application
,
$composer_class_loader
)
{
// 1. Search for class within In-Portal.
$file
=
$application
->
findClassFile
(
$class
);
if
(
$file
!==
false
)
{
return
$file
;
}
// 2. Search for class within Composer + register custom autoloaders.
$file
=
$composer_class_loader
->
findFile
(
$class
);
if
(
$file
!==
false
)
{
return
$file
;
}
// 3. Use custom autoloaders.
$dynamic_autoloader_namespaces
=
array
(
'ConsoleHelpers
\\
PHPUnitCompat
\\
'
,
'Yoast
\\
PHPUnitPolyfills
\\
'
,
);
foreach
(
$dynamic_autoloader_namespaces
as
$dynamic_autoloader_namespace
)
{
if
(
strpos
(
$class
,
$dynamic_autoloader_namespace
)
!==
0
)
{
continue
;
}
return
(
new
ReflectionClass
(
$class
))->
getFileName
();
}
return
false
;
};
Event Timeline
Log In to Comment