PHPのフレームワークです。オートローディング、ルーティング、ORマッパ、フォームバリデータ、その他ユーティリティがセットになっています。
Révision | 82 (tree) |
---|---|
l'heure | 2021-01-14 15:47:28 |
Auteur | ![]() |
メソッドの移動に対応
@@ -159,17 +159,17 @@ | ||
159 | 159 | case 'check': |
160 | 160 | case 'checkbox': |
161 | 161 | $attributes['type'] = $type; |
162 | - return HtmlUtil::choice($attributes); | |
162 | + return self::choice($attributes); | |
163 | 163 | |
164 | 164 | // <textarea> を作成する場合。 |
165 | 165 | case 'textarea': |
166 | 166 | $value = @ArrayUtil::eject($attributes, 'value'); |
167 | - return HtmlUtil::tag('textarea', $attributes, (string)$value); // stringキャストしているのは、null だったら閉じタグなしになってしまうため。 | |
167 | + return self::tag('textarea', $attributes, (string)$value); // stringキャストしているのは、null だったら閉じタグなしになってしまうため。 | |
168 | 168 | |
169 | 169 | // それ以外では <input> を生成する。 |
170 | 170 | default: |
171 | 171 | $attributes['type'] = $origtype; |
172 | - return HtmlUtil::tag('input', $attributes); | |
172 | + return self::tag('input', $attributes); | |
173 | 173 | } |
174 | 174 | } |
175 | 175 |
@@ -220,7 +220,7 @@ | ||
220 | 220 | } |
221 | 221 | |
222 | 222 | // options を <select> で囲んでリターン。 |
223 | - return HtmlUtil::tag('select', $attributes, $options, true); | |
223 | + return self::tag('select', $attributes, $options, true); | |
224 | 224 | |
225 | 225 | case 'radios': |
226 | 226 |
@@ -317,7 +317,7 @@ | ||
317 | 317 | |
318 | 318 | // <input> タグを作成。 |
319 | 319 | $attributes['type'] = $type; |
320 | - $result = HtmlUtil::tag('input', $attributes); | |
320 | + $result = self::tag('input', $attributes); | |
321 | 321 | |
322 | 322 | // 選択肢名があるなら <label> で囲む。 |
323 | 323 | if(strlen($label) > 0) { |
@@ -326,7 +326,7 @@ | ||
326 | 326 | // ただ、明示的に for 属性が指定されているならそちらを使う。jsでクローンするためにidやforを出したくないときなどに需要がある。 |
327 | 327 | $for = $attributes['for'] ?? $attributes['id']; |
328 | 328 | $pair = $result . ViewUtil::encode($label); |
329 | - return HtmlUtil::tag('label', array('for'=>$for), $pair, true); | |
329 | + return self::tag('label', array('for'=>$for), $pair, true); | |
330 | 330 | } |
331 | 331 | |
332 | 332 | return $result; |
@@ -335,7 +335,7 @@ | ||
335 | 335 | |
336 | 336 | if( !isset($attributes['selected']) ) $attributes['selected'] = $checked; |
337 | 337 | |
338 | - return HtmlUtil::tag($type, $attributes, $label); | |
338 | + return self::tag($type, $attributes, $label); | |
339 | 339 | |
340 | 340 | default: |
341 | 341 | trigger_error("'type' に指定された値 {$type} には対応していません。"); |
@@ -155,7 +155,7 @@ | ||
155 | 155 | // まずは親項目としてのエラーメッセージを処理する。 |
156 | 156 | if( !empty($this['error']) ) { |
157 | 157 | $message = $this->getMessage(); |
158 | - $errors[] = $message ? ViewUtil::tag('div', array('class'=>'error'), $message) : ''; | |
158 | + $errors[] = $message ? HtmlUtil::tag('div', array('class'=>'error'), $message) : ''; | |
159 | 159 | } |
160 | 160 | |
161 | 161 | // 次に子項目のエラーメッセージ。 |
@@ -162,7 +162,7 @@ | ||
162 | 162 | foreach($this['items'] as $item) { |
163 | 163 | if( !empty($item['error']) ) { |
164 | 164 | $message = $item->getMessage(true); |
165 | - $errors[] = $message ? ViewUtil::tag('div', array('class'=>'error'), $message) : ''; | |
165 | + $errors[] = $message ? HtmlUtil::tag('div', array('class'=>'error'), $message) : ''; | |
166 | 166 | } |
167 | 167 | } |
168 | 168 |
@@ -167,7 +167,7 @@ | ||
167 | 167 | $error = ''; |
168 | 168 | if( @$this['error'] ) { |
169 | 169 | $message = $this->getMessage(); |
170 | - $error = ViewUtil::tag('div', array('class'=>'error'), $message); | |
170 | + $error = HtmlUtil::tag('div', array('class'=>'error'), $message); | |
171 | 171 | } |
172 | 172 | |
173 | 173 | // 入力項目を取得。 |
@@ -241,11 +241,11 @@ | ||
241 | 241 | |
242 | 242 | //----------------------------------------------------------------------------------------------------- |
243 | 243 | /** |
244 | - * この項目を入力するためのコントロールを表すHTML文字列、あるいは、それを出力するための ViewUtil::input() へのパラメータを返す。 | |
244 | + * この項目を入力するためのコントロールを表すHTML文字列、あるいは、それを出力するための HtmlUtil::input() へのパラメータを返す。 | |
245 | 245 | * public になっているが、このメソッドを直接呼び出すよりも NovaForm::html() のようなユーティリティを利用したほうが良いだろう。 |
246 | 246 | * |
247 | 247 | * @param デフォルトからカスタムしたいパラメータの連想配列。 |
248 | - * @return 文字列ならHTMLそのものなのでそのまま出力されたい。連想配列の場合は ViewUtil::input() のパラメータなのでそちらに渡して出力されたい。 | |
248 | + * @return 文字列ならHTMLそのものなのでそのまま出力されたい。連想配列の場合は HtmlUtil::input() のパラメータなのでそちらに渡して出力されたい。 | |
249 | 249 | */ |
250 | 250 | public function getInputHtml($params = array()) { |
251 | 251 |
@@ -337,12 +337,12 @@ | ||
337 | 337 | |
338 | 338 | /** |
339 | 339 | * この項目に choice 属性が設定されているとき、引数で指定されたキーを持つ選択肢を表すHTML文字列、 |
340 | - * あるいは、それを出力するための ViewUtil::choice() へのパラメータを返す。 | |
340 | + * あるいは、それを出力するための HtmlUtil::choice() へのパラメータを返す。 | |
341 | 341 | * |
342 | 342 | * @param 出力したい選択肢のキー。 |
343 | - * @param ViewUtil::choice() へのパラメータのうち、特別に指定したいパラメータの連想配列。以下のキーも追加で処理される。 | |
343 | + * @param HtmlUtil::choice() へのパラメータのうち、特別に指定したいパラメータの連想配列。以下のキーも追加で処理される。 | |
344 | 344 | * format label を生成するための sprintf フォーマット文字列として処理される。%1$ が値、%2$ がキーとなる。省略した場合は "%1$s"。 |
345 | - * @return 文字列ならHTMLそのものなのでそのまま出力されたい。連想配列の場合は ViewUtil::choice() のパラメータなのでそちらに渡して出力されたい。 | |
345 | + * @return 文字列ならHTMLそのものなのでそのまま出力されたい。連想配列の場合は HtmlUtil::choice() のパラメータなのでそちらに渡して出力されたい。 | |
346 | 346 | */ |
347 | 347 | public function getChoiceHtml($key, $params = array()) { |
348 | 348 |
@@ -752,7 +752,7 @@ | ||
752 | 752 | * 引数に指定されたFormItemインスタンスの getInputHtml(), getChoiceHtml() を見ながら、フォームでの項目を表すHTML文字列を作成する。 |
753 | 753 | * |
754 | 754 | * @param FormItemインスタンス |
755 | - * @param ViewUtil::input() の引数と同じだが、基本的には type を指定するだけで良い。出力されるHTML要素に属性を設定したい場合はそれらを追加する | |
755 | + * @param HtmlUtil::input() の引数と同じだが、基本的には type を指定するだけで良い。出力されるHTML要素に属性を設定したい場合はそれらを追加する | |
756 | 756 | * 程度。default をここで指定することもできる。 |
757 | 757 | * なお、choice キーはFormItem にセットした choice 属性から取得されるので無視される。 |
758 | 758 | * @return 作成したHTML。 |
@@ -774,7 +774,7 @@ | ||
774 | 774 | $options = array(); |
775 | 775 | foreach($item['choice'] as $key => $dummy) { |
776 | 776 | $pars = $item->getChoiceHtml($key, array('type'=>$subtype, 'format'=>@$params['label-format'], 'checkif'=>@$params['value'])); |
777 | - $options[] = is_string($pars) ? $pars : ViewUtil::choice($pars); | |
777 | + $options[] = is_string($pars) ? $pars : HtmlUtil::choice($pars); | |
778 | 778 | } |
779 | 779 | |
780 | 780 | // 後の流れに合わせてパラメータを調整する。 |
@@ -782,8 +782,8 @@ | ||
782 | 782 | unset($params['label-format']); |
783 | 783 | } |
784 | 784 | |
785 | - // あとは ViewUtil::input() で処理できる。 | |
786 | - return ViewUtil::input($params); | |
785 | + // あとは HtmlUtil::input() で処理できる。 | |
786 | + return HtmlUtil::input($params); | |
787 | 787 | } |
788 | 788 | |
789 | 789 |
@@ -836,18 +836,18 @@ | ||
836 | 836 | // まずは親項目としての自身が直接持っているエラーメッセージを処理する。 |
837 | 837 | if( isset($this['error']) ) { |
838 | 838 | $message = $this->getMessage(); |
839 | - $td = ViewUtil::tag('td', array('colspan'=>'2', 'class'=>'error'), $message); | |
840 | - $rows[] = ViewUtil::tag('tr', array(), $td, true); | |
839 | + $td = HtmlUtil::tag('td', array('colspan'=>'2', 'class'=>'error'), $message); | |
840 | + $rows[] = HtmlUtil::tag('tr', array(), $td, true); | |
841 | 841 | } |
842 | 842 | |
843 | 843 | // 後は子項目を一つずつscaffold()していく。 |
844 | 844 | foreach($this['items'] as $item) { |
845 | - $th = ViewUtil::tag('th', array(), $item['caption']); | |
846 | - $td = ViewUtil::tag('td', array(), $item->scaffold(), true); | |
847 | - $rows[] = ViewUtil::tag('tr', array(), [$th, $td], true); | |
845 | + $th = HtmlUtil::tag('th', array(), $item['caption']); | |
846 | + $td = HtmlUtil::tag('td', array(), $item->scaffold(), true); | |
847 | + $rows[] = HtmlUtil::tag('tr', array(), [$th, $td], true); | |
848 | 848 | } |
849 | 849 | |
850 | - return ViewUtil::tag('table', $params, $rows, true); | |
850 | + return HtmlUtil::tag('table', $params, $rows, true); | |
851 | 851 | } |
852 | 852 | |
853 | 853 |
@@ -23,6 +23,6 @@ | ||
23 | 23 | // リンク文字列に「(id)」を付ける。 |
24 | 24 | $content .= sprintf('(%s)', htmlspecialchars($params['id'])); |
25 | 25 | |
26 | - // <a>で囲んで出力。ViewUtil::tag() を使ってないのは二重エンコードを避けるため。 | |
26 | + // <a>で囲んで出力。HtmlUtil::tag() を使ってないのは二重エンコードを避けるため。 | |
27 | 27 | return sprintf('<a href="%s">%s</a>', htmlspecialchars($href), $content); |
28 | 28 | } |
@@ -2,10 +2,10 @@ | ||
2 | 2 | |
3 | 3 | /** |
4 | 4 | * セレクトボックスの <option> やチェックボックス・ラジオボタンなどの、選択肢を示すHTML文字列を出力する。 |
5 | - * 基本的に ViewUtil::choice() や FormItem::getChoiceHtml() のラッパなので詳細はそちらを参照されたい。 | |
5 | + * 基本的に HtmlUtil::choice() や FormItem::getChoiceHtml() のラッパなので詳細はそちらを参照されたい。 | |
6 | 6 | * |
7 | 7 | * パラメータ) |
8 | - * ViewUtil::choice() に渡す引数をそのまま指定するが、以下のキーは特別に処理される。 | |
8 | + * HtmlUtil::choice() に渡す引数をそのまま指定するが、以下のキーは特別に処理される。 | |
9 | 9 | * item このキーを指定した場合は FormItem::getChoiceHtml() を呼ぶ。その他のキーはその第二引数として渡される。 |
10 | 10 | * key item を指定している場合に、getChoiceHtml() の第一引数を指定する。 |
11 | 11 | */ |
@@ -24,5 +24,5 @@ | ||
24 | 24 | return $params; |
25 | 25 | } |
26 | 26 | |
27 | - return ViewUtil::choice($params); | |
27 | + return HtmlUtil::choice($params); | |
28 | 28 | } |
@@ -28,5 +28,5 @@ | ||
28 | 28 | |
29 | 29 | // 残されたパラメータを基本的な属性としてデフォルトの属性に追加してエラーメッセージを出力する。 |
30 | 30 | $params += ['class'=>'error']; |
31 | - return ViewUtil::tag('div', $params, $text); | |
31 | + return HtmlUtil::tag('div', $params, $text); | |
32 | 32 | } |
@@ -1,11 +1,11 @@ | ||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** |
4 | - * <input> や <select> などの、フォームにおける一入力項目を出力する。基本的に ViewUtil::input() や | |
4 | + * <input> や <select> などの、フォームにおける一入力項目を出力する。基本的に HtmlUtil::input() や | |
5 | 5 | * NovaForm::html() のラッパなので詳細はそちらを参照されたい。 |
6 | 6 | * |
7 | 7 | * パラメータ) |
8 | - * ViewUtil::input() や NovaForm::html() に渡す引数をそのまま指定するが、 | |
8 | + * HtmlUtil::input() や NovaForm::html() に渡す引数をそのまま指定するが、 | |
9 | 9 | * 以下のキーは特別に処理される。 |
10 | 10 | * item このキーを指定した場合は NovaForm::html() を呼ぶ。値にはその第一引数を指定する。 |
11 | 11 | */ |
@@ -16,6 +16,6 @@ | ||
16 | 16 | return Nova::setting('process', 'form.top')::html($item, $params); |
17 | 17 | |
18 | 18 | }else { |
19 | - return ViewUtil::input($params); | |
19 | + return HtmlUtil::input($params); | |
20 | 20 | } |
21 | 21 | } |
@@ -1,3 +1,3 @@ | ||
1 | 1 | {[foreach from=$cols item='col']} |
2 | - <th {[ViewUtil::attributes($col.attr) nofilter]}>{[$col.caption]}</th> | |
2 | + <th {[HtmlUtil::attributes($col.attr) nofilter]}>{[$col.caption]}</th> | |
3 | 3 | {[/foreach]} |
@@ -1,5 +1,5 @@ | ||
1 | 1 | {[foreach $cols as $key => $col]} |
2 | - <{[$col.display.tag]} {[ViewUtil::attributes($col.attr) nofilter]}> | |
2 | + <{[$col.display.tag]} {[HtmlUtil::attributes($col.attr) nofilter]}> | |
3 | 3 | {[partial action='tablecell' value=$row.$key|default display=$col.display column=$key record=$row]} |
4 | 4 | </{[$col.display.tag]}> |
5 | 5 | {[/foreach]} |