openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 9c8e4c2e366bef8f5dfabaf4fc7a7c9b31b863cf
parent ae704ffc593ecfdd11834686937e89ee98a9a755
Author: Jan Dankert <develop@jandankert.de>
Date:   Wed, 14 Oct 2020 22:36:29 +0200

Refactoring: Fixed the namespace in component classes, now the are able to be load by the standard autoloader.

Diffstat:
Mmodules/template_engine/TemplateCompiler.php | 26--------------------------
Mmodules/template_engine/components/html/component_button/ButtonComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_checkbox/CheckboxComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_column/ColumnComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_date/DateComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_editor/EditorComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_else/ElseComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_form/FormComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_group/GroupComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_hidden/HiddenComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_if/IfComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_image/ImageComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_include/IncludeComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_input/InputComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_inputarea/InputareaComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_insert/InsertComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_label/LabelComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_link/LinkComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_list/ListComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_logo/LogoComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_newline/NewlineComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_output/OutputComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_part/PartComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_password/PasswordComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_qrcode/QrcodeComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_radio/RadioComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_radiobox/RadioboxComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_row/RowComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_selectbox/SelectboxComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_selector/SelectorComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_set/SetComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_table/TableComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_text/TextComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_upload/UploadComponent.class.php | 2+-
Mmodules/template_engine/components/html/component_user/UserComponent.class.php | 2+-
Mmodules/template_engine/engine/TemplateEngine.class.php | 2+-
36 files changed, 35 insertions(+), 61 deletions(-)

diff --git a/modules/template_engine/TemplateCompiler.php b/modules/template_engine/TemplateCompiler.php @@ -26,32 +26,6 @@ echo "Searching in $searchDir\n"; $count = 0; -spl_autoload_register( - -/** - * Loads component classes. - * - * @param $className Class name - * @return void - */ - function ($className) { - - if ( substr($className,-9) == 'Component') - { - $pos = strrpos($className, '\\'); - $className = substr($className, $pos + 1); - - $componentName = substr($className,0,-9 ); - - $c = __DIR__.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'html'.DIRECTORY_SEPARATOR.strtolower($componentName).DIRECTORY_SEPARATOR.$componentName.'Component.class.php'; - - if ( is_file($c) ) - require($c); - } - },true,true -); - - foreach(FileUtils::readDir( $searchDir ) as $action ) { if ( !is_dir($searchDir.'/'.$action ) ) diff --git a/modules/template_engine/components/html/component_button/ButtonComponent.class.php b/modules/template_engine/components/html/component_button/ButtonComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_button; use cms\base\Startup; use template_engine\components\html\Component; diff --git a/modules/template_engine/components/html/component_checkbox/CheckboxComponent.class.php b/modules/template_engine/components/html/component_checkbox/CheckboxComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_checkbox; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_column/ColumnComponent.class.php b/modules/template_engine/components/html/component_column/ColumnComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_column; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_date/DateComponent.class.php b/modules/template_engine/components/html/component_date/DateComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_date; use template_engine\components\html\Component; use template_engine\element\PHPBlockElement; diff --git a/modules/template_engine/components/html/component_editor/EditorComponent.class.php b/modules/template_engine/components/html/component_editor/EditorComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_editor; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_else/ElseComponent.class.php b/modules/template_engine/components/html/component_else/ElseComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_else; use template_engine\components\html\Component; use template_engine\element\PHPBlockElement; diff --git a/modules/template_engine/components/html/component_form/FormComponent.class.php b/modules/template_engine/components/html/component_form/FormComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_form; use cms\action\RequestParams; use language\Messages; diff --git a/modules/template_engine/components/html/component_group/GroupComponent.class.php b/modules/template_engine/components/html/component_group/GroupComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_group; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_hidden/HiddenComponent.class.php b/modules/template_engine/components/html/component_hidden/HiddenComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_hidden; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_if/IfComponent.class.php b/modules/template_engine/components/html/component_if/IfComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components\html\_if; +namespace template_engine\components\html\component_if; use template_engine\components\html\Component; use template_engine\element\PHPBlockElement; diff --git a/modules/template_engine/components/html/component_image/ImageComponent.class.php b/modules/template_engine/components/html/component_image/ImageComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_image; use cms\base\Startup; use template_engine\components\html\Component; diff --git a/modules/template_engine/components/html/component_include/IncludeComponent.class.php b/modules/template_engine/components/html/component_include/IncludeComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_include; use template_engine\components\html\Component; diff --git a/modules/template_engine/components/html/component_input/InputComponent.class.php b/modules/template_engine/components/html/component_input/InputComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_input; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_inputarea/InputareaComponent.class.php b/modules/template_engine/components/html/component_inputarea/InputareaComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_inputarea; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_insert/InsertComponent.class.php b/modules/template_engine/components/html/component_insert/InsertComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_insert; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_label/LabelComponent.class.php b/modules/template_engine/components/html/component_label/LabelComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_label; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_link/LinkComponent.class.php b/modules/template_engine/components/html/component_link/LinkComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_link; use cms\action\RequestParams; use template_engine\components\html\Component; diff --git a/modules/template_engine/components/html/component_list/ListComponent.class.php b/modules/template_engine/components/html/component_list/ListComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_list; use template_engine\components\html\Component; use template_engine\element\PHPBlockElement; diff --git a/modules/template_engine/components/html/component_logo/LogoComponent.class.php b/modules/template_engine/components/html/component_logo/LogoComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_logo; use template_engine\components\html\Component; use template_engine\element\CMSElement;use template_engine\element\HtmlElement; diff --git a/modules/template_engine/components/html/component_newline/NewlineComponent.class.php b/modules/template_engine/components/html/component_newline/NewlineComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_newline; use template_engine\components\html\Component; use template_engine\element\Element; diff --git a/modules/template_engine/components/html/component_output/OutputComponent.class.php b/modules/template_engine/components/html/component_output/OutputComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_output; use template_engine\components\html\Component; use template_engine\element\Element; diff --git a/modules/template_engine/components/html/component_part/PartComponent.class.php b/modules/template_engine/components/html/component_part/PartComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_part; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_password/PasswordComponent.class.php b/modules/template_engine/components/html/component_password/PasswordComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_password; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_qrcode/QrcodeComponent.class.php b/modules/template_engine/components/html/component_qrcode/QrcodeComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_qrcode; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_radio/RadioComponent.class.php b/modules/template_engine/components/html/component_radio/RadioComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_radio; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_radiobox/RadioboxComponent.class.php b/modules/template_engine/components/html/component_radiobox/RadioboxComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_radiobox; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_row/RowComponent.class.php b/modules/template_engine/components/html/component_row/RowComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_row; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_selectbox/SelectboxComponent.class.php b/modules/template_engine/components/html/component_selectbox/SelectboxComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_selectbox; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_selector/SelectorComponent.class.php b/modules/template_engine/components/html/component_selector/SelectorComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_selector; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_set/SetComponent.class.php b/modules/template_engine/components/html/component_set/SetComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_set; use template_engine\components\html\Component; use template_engine\element\PHPBlockElement; diff --git a/modules/template_engine/components/html/component_table/TableComponent.class.php b/modules/template_engine/components/html/component_table/TableComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_table; use template_engine\components\html\HtmlComponent; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_text/TextComponent.class.php b/modules/template_engine/components/html/component_text/TextComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_text; use template_engine\components\html\HtmlComponent; use template_engine\element\CMSElement;use template_engine\element\HtmlElement; diff --git a/modules/template_engine/components/html/component_upload/UploadComponent.class.php b/modules/template_engine/components/html/component_upload/UploadComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_upload; use template_engine\components\html\Component; use template_engine\element\CMSElement; diff --git a/modules/template_engine/components/html/component_user/UserComponent.class.php b/modules/template_engine/components/html/component_user/UserComponent.class.php @@ -1,6 +1,6 @@ <?php -namespace template_engine\components; +namespace template_engine\components\html\component_user; use template_engine\components\html\Component; use template_engine\element\PHPBlockElement; diff --git a/modules/template_engine/engine/TemplateEngine.class.php b/modules/template_engine/engine/TemplateEngine.class.php @@ -142,7 +142,7 @@ class TemplateEngine } $className = ucfirst($tag); - $className = 'template_engine\components\\'.$className.'Component'; + $className = 'template_engine\\components\\html\\component_'.$tag.'\\'.$className.'Component'; if ( !class_exists($className )) throw new LogicException("Component class ".$className.' does not exist');