diff --git a/boot.php b/boot.php index 5beaa4ca9..7b919bbdd 100644 --- a/boot.php +++ b/boot.php @@ -14,6 +14,9 @@ class_alias('Yakamara\YForm\Rest\Route', 'rex_yform_rest_route'); class_alias('Yakamara\YForm\Rest\AuthToken', 'rex_yform_rest_auth_token'); class_alias('Yakamara\YForm\List\YList', 'rex_yform_list'); class_alias('Yakamara\YForm\List\Tools', 'rex_yform_list_tools'); +class_alias('Yakamara\YForm\RexVar\Data', 'rex_var_yform_data'); +class_alias('Yakamara\YForm\RexVar\TableData', 'rex_var_yform_data'); +class_alias('Yakamara\YForm\Email\Template', 'rex_yform_email_template'); YForm::addTemplatePath(rex_path::addon('yform', 'ytemplates')); diff --git a/fragments/yform/manager/page/list.php b/fragments/yform/manager/page/list.php index 176caea0f..6771c53c1 100644 --- a/fragments/yform/manager/page/list.php +++ b/fragments/yform/manager/page/list.php @@ -13,8 +13,8 @@ $popup = $this->getVar('popup'); $hasDataPageFunctions = $this->getVar('hasDataPageFunctions'); -/** @var rex_yform_list $list */ -$list = rex_yform_list::factory($query, $table->getListAmount()); +/** @var \Yakamara\YForm\List\YList $list */ +$list = \Yakamara\YForm\List\YList::factory($query, $table->getListAmount()); $list->addTableAttribute('class', 'table-striped table-hover yform-table-' . rex_string::normalize($this->table->getTableName())); diff --git a/lib/email_template.php b/lib/Email/Template.php similarity index 94% rename from lib/email_template.php rename to lib/Email/Template.php index 2e0f87c0f..f025d6cf0 100644 --- a/lib/email_template.php +++ b/lib/Email/Template.php @@ -7,7 +7,24 @@ * @author www.yakamara.de */ -class rex_yform_email_template +namespace Yakamara\YForm\Email; + +use PHPMailer\PHPMailer\Exception; +use rex; +use rex_article; +use rex_extension; +use rex_extension_point; +use rex_file; +use rex_mailer; +use rex_sql; +use rex_sql_exception; +use rex_stream; +use rex_var; + +use function count; +use function is_array; + +class Template { /** * @throws rex_sql_exception @@ -91,7 +108,7 @@ public static function makeSingleLine(string $str): string } /** - * @throws \PHPMailer\PHPMailer\Exception + * @throws Exception * @return bool */ public static function sendMail(array $template, string $template_name = '') diff --git a/lib/yform/action/tpl2email.php b/lib/yform/action/tpl2email.php index c0a80356c..5e2502114 100644 --- a/lib/yform/action/tpl2email.php +++ b/lib/yform/action/tpl2email.php @@ -12,7 +12,7 @@ class rex_yform_action_tpl2email extends rex_yform_action_abstract public function executeAction(): void { $template_name = $this->getElement(2); - if ($etpl = rex_yform_email_template::getTemplate($template_name)) { + if ($etpl = \Yakamara\YForm\Email\Template::getTemplate($template_name)) { $email_to = rex::getErrorEmail(); if (filter_var($this->getElement(3), FILTER_VALIDATE_EMAIL)) { @@ -41,7 +41,7 @@ public function executeAction(): void dump($etpl); } - $etpl = rex_yform_email_template::replaceVars($etpl, $this->params['value_pool']['email']); + $etpl = \Yakamara\YForm\Email\Template::replaceVars($etpl, $this->params['value_pool']['email']); $etpl['mail_to'] = $email_to; $etpl['mail_to_name'] = $email_to_name; @@ -66,7 +66,7 @@ public function executeAction(): void dump($etpl); } - if (!rex_yform_email_template::sendMail($etpl, $template_name)) { + if (!\Yakamara\YForm\Email\Template::sendMail($etpl, $template_name)) { if ($this->params['debug']) { dump('email could not be sent'); } diff --git a/pages/email.php b/pages/email.php index 3634dc7cf..bc374e90d 100644 --- a/pages/email.php +++ b/pages/email.php @@ -1,5 +1,8 @@ setObjectparams('form_action', 'index.php?page=yform/email'); $yform->setObjectparams('form_name', 'yform-email-template'); diff --git a/rector.php b/rector.php index 3cb7a3557..3eb23ea4c 100644 --- a/rector.php +++ b/rector.php @@ -19,5 +19,6 @@ 'rex_yform_list_tools' => 'Yakamara\YForm\List\Tools', 'rex_var_yform_data' => 'Yakamara\YForm\RexVar\Data', 'rex_var_yform_table_data' => 'Yakamara\YForm\RexVar\TableData', + 'rex_yform_email_template' => 'Yakamara\YForm\Email\Template', ], ); diff --git a/ytemplates/bootstrap/value.be_manager_relation.tpl.php b/ytemplates/bootstrap/value.be_manager_relation.tpl.php index 1f561af56..e25210856 100644 --- a/ytemplates/bootstrap/value.be_manager_relation.tpl.php +++ b/ytemplates/bootstrap/value.be_manager_relation.tpl.php @@ -64,7 +64,7 @@ getRelationType()) { - echo \rex_var_yform_table_data::getRelationWidget($id, $this->getFieldName(), $this->getValue(), $link, $this->params['main_id']); + echo \Yakamara\YForm\RexVar\TableData::getRelationWidget($id, $this->getFieldName(), $this->getValue(), $link, $this->params['main_id']); } elseif (2 == $this->getRelationType()) { $name = $this->getFieldName(); $args = []; @@ -74,7 +74,7 @@ $_csrf_key = rex_yform_manager_table::get($this->relation['target_table'])->getCSRFKey(); $args += rex_csrf_token::factory($_csrf_key)->getUrlParams(); $value = implode(',', $this->getValue()); - echo \rex_var_yform_table_data::getSingleWidget($id, $name, $value, $args); + echo \Yakamara\YForm\RexVar\TableData::getSingleWidget($id, $name, $value, $args); } else { $name = $this->getFieldName(); $args = []; @@ -86,7 +86,7 @@ $_csrf_key = rex_yform_manager_table::get($this->relation['target_table'])->getCSRFKey(); $args += rex_csrf_token::factory($_csrf_key)->getUrlParams(); $value = implode(',', $this->getValue()); - echo \rex_var_yform_table_data::getMultipleWidget($id, $name, $value, $args); + echo \Yakamara\YForm\RexVar\TableData::getMultipleWidget($id, $name, $value, $args); } ?>