move egw_include_mgr class to Api\Framework\IncludeMgr

This commit is contained in:
Ralf Becker 2016-04-07 11:16:58 +00:00
parent 2e3bd32721
commit 6e3da3d7e3
2 changed files with 12 additions and 10 deletions

View File

@ -12,6 +12,8 @@
* @version $Id$
*/
namespace EGroupware\Api\Framework;
/**
* Syntax for including JS files form others
* -----------------------------------------
@ -42,11 +44,11 @@
*
* Class can be tested by opening it in browser:
*
* http://localhost/egroupware/phpgwapi/inc/class.egw_incluce_mgr.inc.php?path=/api/js/jsapi/egw_calendar.js
* http://localhost/egroupware/api/src/Framework/IncludeMgr.inc.php?path=/api/js/jsapi/egw_calendar.js
*
* This will then show the parsed dependencies of the given path.
*/
class egw_include_mgr
class IncludeMgr
{
static private $DEBUG_MODE = true;
@ -177,8 +179,8 @@ class egw_include_mgr
private function file_processed($file)
{
return (array_key_exists($file, $this->included_files) ||
array_key_exists($file, $this->parsed_files));
return array_key_exists($file, $this->included_files) ||
array_key_exists($file, $this->parsed_files);
}
/**
@ -414,10 +416,10 @@ class egw_include_mgr
// specify one or more files in url, eg. path[]=/phpgwapi/js/jsapi/egw.js&path[]=/etemplate/js/etemplate2.js
if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
{
define('EGW_SERVER_ROOT', dirname(dirname(__DIR__)));
define('EGW_SERVER_ROOT', dirname(dirname(dirname(__DIR__))));
include_once(EGW_SERVER_ROOT.'/phpgwapi/inc/common_functions.inc.php');
$mgr = new egw_include_mgr();
$mgr = new IncludeMgr();
echo "<html>\n<head>\n\t<title>Dependencies</title>\n</head>\n<body>\n";
$paths = !empty($_GET['path']) ? (array)$_GET['path'] : (array)'/stylite/js/filemanager/filemanager.js';

View File

@ -203,8 +203,8 @@ abstract class egw_framework
*/
public static function init_static()
{
self::$js_include_mgr = new egw_include_mgr(array(
// We need LABjs, but putting it through egw_include_mgr causes it to re-load itself
self::$js_include_mgr = new Api\Framework\IncludeMgr(array(
// We need LABjs, but putting it through Api\Framework\IncludeMgr causes it to re-load itself
//'/api/js/labjs/LAB.src.js',
// allways load jquery (not -ui) first
@ -2119,7 +2119,7 @@ abstract class egw_framework
*/
public static function get_bundles()
{
$inc_mgr = new egw_include_mgr();
$inc_mgr = new Api\Framework\IncludeMgr();
$bundles = array();
$max_mod = array();
@ -2169,7 +2169,7 @@ abstract class egw_framework
{
if (@file_exists(EGW_SERVER_ROOT.$file))
{
$inc_mgr = new egw_include_mgr($stock_files); // reset loaded files to stock files
$inc_mgr = new Api\Framework\IncludeMgr($stock_files); // reset loaded files to stock files
$inc_mgr->include_js_file($file);
$bundles[$bundle] = array_diff($inc_mgr->get_included_files(), $stock_files);
self::bundle_urls($bundles[$bundle], $max_mod[$bundle]);