lib framework, michelf lib restructure, saimod docu update, sai better error messages
This commit is contained in:
parent
bb54a0ae37
commit
c795a4aacb
3
lib/Michelf/autoload.inc
Normal file
3
lib/Michelf/autoload.inc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'LIB');
|
||||||
|
\LIB\lib_controll::register('\LIB\lib_michelf');
|
||||||
10
lib/Michelf/lib_michelf.php
Normal file
10
lib/Michelf/lib_michelf.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
class lib_michelf extends \LIB\lib_php{
|
||||||
|
public static function get_class($params = null){
|
||||||
|
return self::class;}
|
||||||
|
|
||||||
|
public static function php_autoload(){
|
||||||
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/lib','Michelf');
|
||||||
|
return true;}
|
||||||
|
}
|
||||||
@ -1,2 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/Michelf','Michelf');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'LIB');
|
||||||
|
require_once dirname(__FILE__).'/Michelf/autoload.inc';
|
||||||
18
lib/lib.php
Normal file
18
lib/lib.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
abstract class lib {
|
||||||
|
public static function php(){
|
||||||
|
if(!\method_exists(static::get_class(), 'php_autoload')){
|
||||||
|
throw new \SYSTEM\LOG\ERROR('Function php_autoload not implemented in '.static::get_class());}
|
||||||
|
return static::php_autoload();}
|
||||||
|
public static function css(){
|
||||||
|
if(!\method_exists(static::get_class(), 'css_path')){
|
||||||
|
throw new \SYSTEM\LOG\ERROR('Function css_path not implemented in '.static::get_class());}
|
||||||
|
return static::css_path(); //use tpl here? yes? any negative effex?
|
||||||
|
}
|
||||||
|
public static function js(){
|
||||||
|
if(!\method_exists(static::get_class(), 'js_path')){
|
||||||
|
throw new \SYSTEM\LOG\ERROR('Function js_path not implemented in '.static::get_class());}
|
||||||
|
return static::js_path();
|
||||||
|
}
|
||||||
|
}
|
||||||
17
lib/lib_controll.php
Normal file
17
lib/lib_controll.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
class lib_controll {
|
||||||
|
private static $libs = array();
|
||||||
|
private static function check_lib($lib){
|
||||||
|
if( !\class_exists($lib) ||
|
||||||
|
!\is_array($parents = \class_parents($lib)) ||
|
||||||
|
!\array_search('LIB\lib', $parents)){
|
||||||
|
return false;}
|
||||||
|
return true;}
|
||||||
|
|
||||||
|
public static function register($classname){
|
||||||
|
if(!self::check_lib($classname)){
|
||||||
|
throw new \SYSTEM\LOG\ERROR('Problem with your lib class: '.$classname.'; it might not be available or inherits from the wrong class!');}
|
||||||
|
array_push(self::$libs,$classname);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
lib/lib_css.php
Normal file
5
lib/lib_css.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
abstract class lib_css extends lib{
|
||||||
|
protected static abstract function css_path(); //css webpath
|
||||||
|
}
|
||||||
5
lib/lib_js.php
Normal file
5
lib/lib_js.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
abstract class lib_js extends lib{
|
||||||
|
protected static function js_path(){} //js webpath
|
||||||
|
}
|
||||||
6
lib/lib_jscss.php
Normal file
6
lib/lib_jscss.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
abstract class lib_jscss extends lib{
|
||||||
|
protected static abstract function js_path();
|
||||||
|
protected static abstract function css_path();
|
||||||
|
}
|
||||||
8
lib/lib_php.php
Normal file
8
lib/lib_php.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
namespace LIB;
|
||||||
|
//dont use system paths? for php yes - for js css not possibledue webpath -> PLIB object?
|
||||||
|
//or mask all paths using api
|
||||||
|
abstract class lib_php extends lib{
|
||||||
|
protected static function php_autoload(){} //autload magic? require_once lib\autoload.inc -> should do the trick -> do that in lib
|
||||||
|
}
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_docu_action_doc($cat = 'System',$doc = '1_system_md'){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_docu_action_doc($cat = 'System',$doc = '1_system_md'){
|
||||||
|
\LIB\lib_michelf::php();
|
||||||
$document = \SYSTEM\DOCU\docu::getDocuments()[$cat];
|
$document = \SYSTEM\DOCU\docu::getDocuments()[$cat];
|
||||||
foreach($document as $docu){
|
foreach($document as $docu){
|
||||||
if(str_replace(array('.',' ','\\','/'), '_', basename($docu)) == $doc){
|
if(str_replace(array('.',' ','\\','/'), '_', basename($docu)) == $doc){
|
||||||
|
|||||||
@ -16,15 +16,15 @@ class sai {
|
|||||||
|
|
||||||
public static function register_start($module){
|
public static function register_start($module){
|
||||||
if(!self::check_module($module)){
|
if(!self::check_module($module)){
|
||||||
throw new \SYSTEM\LOG\ERROR('Problem with your Sysmodule class: '.$module);}
|
throw new \SYSTEM\LOG\ERROR('Problem with your Sysmodule class: '.$module.'; it might not be available or inherits from the wrong class!');}
|
||||||
self::$module_start = $module;}
|
self::$module_start = $module;}
|
||||||
public static function register($module){
|
public static function register($module){
|
||||||
if(!self::check_module($module)){
|
if(!self::check_module($module)){
|
||||||
throw new \SYSTEM\LOG\ERROR('Problem with your Sysmodule class: '.$module);}
|
throw new \SYSTEM\LOG\ERROR('Problem with your Sysmodule class: '.$module.'; it might not be available or inherits from the wrong class!');}
|
||||||
array_push(self::$modules,$module);}
|
array_push(self::$modules,$module);}
|
||||||
public static function register_sys($module){
|
public static function register_sys($module){
|
||||||
if(!self::check_module($module)){
|
if(!self::check_module($module)){
|
||||||
throw new \SYSTEM\LOG\ERROR('Problem with your Sysmodule class: '.$module);}
|
throw new \SYSTEM\LOG\ERROR('Problem with your Sysmodule class: '.$module.'; it might not be available or inherits from the wrong class!');}
|
||||||
array_push(self::$modules_sys,$module);}
|
array_push(self::$modules_sys,$module);}
|
||||||
|
|
||||||
public static function getStartModule(){
|
public static function getStartModule(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user