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$ * @version $Id$
*/ */
namespace EGroupware\Api\Framework;
/** /**
* Syntax for including JS files form others * Syntax for including JS files form others
* ----------------------------------------- * -----------------------------------------
@ -42,11 +44,11 @@
* *
* Class can be tested by opening it in browser: * 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. * This will then show the parsed dependencies of the given path.
*/ */
class egw_include_mgr class IncludeMgr
{ {
static private $DEBUG_MODE = true; static private $DEBUG_MODE = true;
@ -177,8 +179,8 @@ class egw_include_mgr
private function file_processed($file) private function file_processed($file)
{ {
return (array_key_exists($file, $this->included_files) || return array_key_exists($file, $this->included_files) ||
array_key_exists($file, $this->parsed_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 // 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__) 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'); 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"; 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'; $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() public static function init_static()
{ {
self::$js_include_mgr = new egw_include_mgr(array( self::$js_include_mgr = new Api\Framework\IncludeMgr(array(
// We need LABjs, but putting it through egw_include_mgr causes it to re-load itself // We need LABjs, but putting it through Api\Framework\IncludeMgr causes it to re-load itself
//'/api/js/labjs/LAB.src.js', //'/api/js/labjs/LAB.src.js',
// allways load jquery (not -ui) first // allways load jquery (not -ui) first
@ -2119,7 +2119,7 @@ abstract class egw_framework
*/ */
public static function get_bundles() public static function get_bundles()
{ {
$inc_mgr = new egw_include_mgr(); $inc_mgr = new Api\Framework\IncludeMgr();
$bundles = array(); $bundles = array();
$max_mod = array(); $max_mod = array();
@ -2169,7 +2169,7 @@ abstract class egw_framework
{ {
if (@file_exists(EGW_SERVER_ROOT.$file)) 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); $inc_mgr->include_js_file($file);
$bundles[$bundle] = array_diff($inc_mgr->get_included_files(), $stock_files); $bundles[$bundle] = array_diff($inc_mgr->get_included_files(), $stock_files);
self::bundle_urls($bundles[$bundle], $max_mod[$bundle]); self::bundle_urls($bundles[$bundle], $max_mod[$bundle]);