diff --git a/src/BackendBehaviors.php b/src/BackendBehaviors.php index cfdb8a3..55f0309 100644 --- a/src/BackendBehaviors.php +++ b/src/BackendBehaviors.php @@ -14,20 +14,22 @@ declare(strict_types=1); namespace Dotclear\Plugin\tweakStores; -/* dotclear ns */ use dcCore; use dcModuleDefine; use dcModules; use dcPage; - -/* clearbricks ns */ -use files; -use form; -use html; -use text; -use xmlTag; - -/* php ns */ +use Dotclear\Helper\File\Files; +use Dotclear\Helper\Html\Form\{ + Hidden, + Label, + Para, + Password, + Select, + Textarea +}; +use Dotclear\Helper\Html\Html; +use Dotclear\Helper\Html\XmlTag; +use Dotclear\Helper\Text; use DOMDocument; use Exception; @@ -83,10 +85,10 @@ class BackendBehaviors $module = $modules->getDefine($_POST['ts_id'] ?? '-'); $combo = self::comboModules($modules, $excludes); - $form = '
' . - form::combo('ts_id', $combo, $module->isDefined() ? html::escapeHTML($module->get('id')) : '-') . - '
'; + $form = (new Para())->class('field')->items([ + (new Label(__('Module to parse:')))->for('ts_id')->class('required'), + (new Select('ts_id'))->default($module->isDefined() ? Html::escapeHTML($module->get('id')) : '-')->items($combo), + ])->render(); # check dcstore repo $url = ''; @@ -107,10 +109,10 @@ class BackendBehaviors curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $file_content = curl_exec($ch); + $file_content = (string) curl_exec($ch); curl_close($ch); } else { - $file_content = file_get_contents($url); + $file_content = (string) file_get_contents($url); } } catch (Exception $e) { $file_content = __('Failed to read third party repository'); @@ -169,11 +171,14 @@ class BackendBehaviors '' . $url . '
' . ( empty($file_content) ? '' : - '' . form::textArea('file_xml', 165, 14, [ - 'default' => html::escapeHTML(self::prettyXML($file_content)), - 'class' => 'maximal', - 'extra_html' => 'readonly="true"', - ]) . '' . + '
' . + (new Textarea('file_xml', Html::escapeHTML(self::prettyXML($file_content)))) + ->cols(165) + ->rows(14) + ->readonly(true) + ->class('maximal') + ->render() . + '' . ( !$user_ui_colorsyntax ? '' : dcPage::jsRunCodeMirror('editor', 'file_xml', 'dotclear', $user_ui_colorsyntax_theme) @@ -201,7 +206,7 @@ class BackendBehaviors if (!empty($_POST['build_xml'])) { echo '