Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1098815
D234.diff
No One
Temporary
Actions
View 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
Thu, Aug 14, 5:58 AM
Size
6 KB
Mime Type
text/x-diff
Expires
Fri, Aug 15, 5:58 AM (2 h, 36 m)
Engine
blob
Format
Raw Data
Handle
711465
Attached To
D234: INP-1570 - Make In-Portal Class Locator externally usable
D234.diff
View Options
Index: branches/5.2.x/core/kernel/application.php
===================================================================
--- branches/5.2.x/core/kernel/application.php
+++ branches/5.2.x/core/kernel/application.php
@@ -2148,6 +2148,18 @@
}
/**
+ * Finds the absolute path to the file where the class is defined.
+ *
+ * @param string $class The name of the class.
+ *
+ * @return string|false
+ */
+ public function findClassFile($class)
+ {
+ return $this->Factory->findClassFile($class);
+ }
+
+ /**
* Add new scheduled task
*
* @param string $short_name name to be used to store last maintenance run info
Index: branches/5.2.x/core/kernel/utility/factory.php
===================================================================
--- branches/5.2.x/core/kernel/utility/factory.php
+++ branches/5.2.x/core/kernel/utility/factory.php
@@ -85,6 +85,24 @@
}
/**
+ * Finds the absolute path to the file where the class is defined.
+ *
+ * @param string $class The name of the class.
+ *
+ * @return string|false
+ */
+ public function findClassFile($class)
+ {
+ $file = $this->findFile($class);
+
+ if ( $file ) {
+ return FULL_PATH . $file;
+ }
+
+ return false;
+ }
+
+ /**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
@@ -344,4 +362,4 @@
class kFactoryException extends Exception {
-}
\ No newline at end of file
+}
Index: branches/5.2.x/core/units/structure/structure_config.php
===================================================================
--- branches/5.2.x/core/units/structure/structure_config.php
+++ branches/5.2.x/core/units/structure/structure_config.php
@@ -15,11 +15,11 @@
defined('FULL_PATH') or die('restricted access!');
$config = Array (
- 'Prefix' => 'st',
- 'ItemClass' => Array('class'=>'CategoriesItem','file'=>'structure_item.php', 'build_event'=>'OnItemBuild'),
- 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
- 'EventHandlerClass' => Array('class'=>'CategoriesEventHandler','file'=>'structure_eh.php', 'build_event'=>'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'CategoriesTagProcessor','file'=>'structure_tp.php', 'build_event'=>'OnBuild'),
+ 'Prefix' => 'st',
+ 'ItemClass' => array('class' => 'CategoriesItem', 'file' => '../categories/categories_item.php', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => array('class' => 'CategoriesEventHandler', 'file' => '../categories/categories_event_handler.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => array('class' => 'CategoriesTagProcessor', 'file' => '../categories/categories_tag_processor.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
@@ -273,4 +273,4 @@
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
- );
\ No newline at end of file
+ );
Index: branches/5.2.x/core/units/structure/structure_eh.php
===================================================================
--- branches/5.2.x/core/units/structure/structure_eh.php
+++ branches/5.2.x/core/units/structure/structure_eh.php
@@ -1,15 +0,0 @@
-<?php
-/**
-* @version $Id$
-* @package In-Portal
-* @copyright Copyright (C) 1997 - 2009 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.
-*/
-
-kUtil::includeOnce(FULL_PATH . '/core/units/categories/categories_event_handler.php');
\ No newline at end of file
Index: branches/5.2.x/core/units/structure/structure_item.php
===================================================================
--- branches/5.2.x/core/units/structure/structure_item.php
+++ branches/5.2.x/core/units/structure/structure_item.php
@@ -1,15 +0,0 @@
-<?php
-/**
-* @version $Id$
-* @package In-Portal
-* @copyright Copyright (C) 1997 - 2009 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.
-*/
-
-kUtil::includeOnce(FULL_PATH . '/core/units/categories/categories_item.php');
\ No newline at end of file
Index: branches/5.2.x/core/units/structure/structure_tp.php
===================================================================
--- branches/5.2.x/core/units/structure/structure_tp.php
+++ branches/5.2.x/core/units/structure/structure_tp.php
@@ -1,15 +0,0 @@
-<?php
-/**
-* @version $Id$
-* @package In-Portal
-* @copyright Copyright (C) 1997 - 2009 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.
-*/
-
-kUtil::includeOnce(FULL_PATH . '/core/units/categories/categories_tag_processor.php');
\ No newline at end of file
Index: branches/5.2.x/tools/class_locator.php
===================================================================
--- branches/5.2.x/tools/class_locator.php
+++ branches/5.2.x/tools/class_locator.php
@@ -0,0 +1,37 @@
+<?php
+/**
+* @version $Id$
+* @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.
+*/
+
+$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 \Composer\Autoload\ClassLoader $composer_class_loader */
+$composer_class_loader = require FULL_PATH . '/vendor/autoload.php';
+
+return function ($class) use ($application, $composer_class_loader) {
+ $file = $application->findClassFile($class);
+
+ if ( $file !== false ) {
+ return $file;
+ }
+
+ return $composer_class_loader->findFile($class);
+};
Event Timeline
Log In to Comment