@@ -4,130 +4,130 @@ |
||
4 | 4 | * Marker, hommage to Christian François Bouche-Villeneuve aka Chris Marker |
5 | 5 | */ |
6 | 6 | |
7 | - /** |
|
8 | - * show off @method |
|
9 | - * |
|
10 | - * @method string abbr(string $innertext, array $attributes) creates an abbreviation or an acronym |
|
11 | - * @method string acronym(string $innertext, array $attributes) creates an acronym (not supported in HTML5. use abbr() instead) |
|
12 | - * @method string address(string $innertext, array $attributes) creates contact information for the author/owner of a document |
|
13 | - * @method string applet(string $innertext, array $attributes) creates an embedded applet (not supported in HTML5. use embed() or <object> instead) |
|
14 | - * @method string area(string $innertext, array $attributes) creates an area inside an image map |
|
15 | - * @method string article(string $innertext, array $attributes) creates an article |
|
16 | - * @method string aside(string $innertext, array $attributes) creates content aside from the page content |
|
17 | - * @method string audio(string $innertext, array $attributes) creates embedded sound content |
|
18 | - * @method string b(string $innertext, array $attributes) creates bold text |
|
19 | - * @method string base(string $innertext, array $attributes) creates an element that specifies the base url/target for all relative urls in a document |
|
20 | - * @method string basefont(string $innertext, array $attributes) creates an element that specifies a default color, size, and font for all text in a document (not supported in HTML5. use CSS instead) |
|
21 | - * @method string bdi(string $innertext, array $attributes) creates an element that isolates a part of text that might be formatted in a different direction from other text outside it |
|
22 | - * @method string bdo(string $innertext, array $attributes) creates an element that overrides the current text direction |
|
23 | - * @method string big(string $innertext, array $attributes) creates an element that defines big text (not supported in HTML5. use CSS instead) |
|
24 | - * @method string blockquote(string $innertext, array $attributes) creates a section that is quoted from another source |
|
25 | - * @method string body(string $innertext, array $attributes) creates the document's body |
|
26 | - * @method string br(string $innertext, array $attributes) creates a single line break |
|
27 | - * @method string button(string $innertext, array $attributes) creates a clickable button |
|
28 | - * @method string canvas(string $innertext, array $attributes) used to draw graphics, on the fly, via scripting (usually javascript) |
|
29 | - * @method string caption(string $innertext, array $attributes) creates a table caption |
|
30 | - * @method string center(string $innertext, array $attributes) defines centered text (not supported in HTML5. use CSS instead) |
|
31 | - * @method string cite(string $innertext, array $attributes) creates the title of a work |
|
32 | - * @method string code(string $innertext, array $attributes) creates a piece of computer code |
|
33 | - * @method string col(string $innertext, array $attributes) specifies column properties for each column within a <colgroup> element |
|
34 | - * @method string colgroup(string $innertext, array $attributes) specifies a group of one or more columns in a table for formatting |
|
35 | - * @method string data(string $innertext, array $attributes) adds a machine-readable translation of a given content |
|
36 | - * @method string datalist(string $innertext, array $attributes) specifies a list of pre-defined options for input controls |
|
37 | - * @method string dd(string $innertext, array $attributes) creates a description/value of a term in a description list |
|
38 | - * @method string del(string $innertext, array $attributes) creates text that has been deleted from a document |
|
39 | - * @method string details(string $innertext, array $attributes) creates additional details that the user can view or hide |
|
40 | - * @method string dfn(string $innertext, array $attributes) specifies a term that is going to be defined within the content |
|
41 | - * @method string dialog(string $innertext, array $attributes) creates a dialog box or window |
|
42 | - * @method string dir(string $innertext, array $attributes) defines a directory list (not supported in HTML5. use ul() instead) |
|
43 | - * @method string div(string $innertext, array $attributes) creates a section in a document |
|
44 | - * @method string dl(string $innertext, array $attributes) creates a description list |
|
45 | - * @method string dt(string $innertext, array $attributes) creates a term/name in a description list |
|
46 | - * @method string em(string $innertext, array $attributes) creates emphasized text |
|
47 | - * @method string embed(string $innertext, array $attributes) creates a container for an external application |
|
48 | - * @method string fieldset(string $innertext, array $attributes) groups related elements in a form |
|
49 | - * @method string figcaption(string $innertext, array $attributes) creates a caption for a <figure> element |
|
50 | - * @method string figure(string $innertext, array $attributes) specifies self-contained content |
|
51 | - * @method string font(string $innertext, array $attributes) defines font, color, and size for text (not supported in HTML5. use CSS instead) |
|
52 | - * @method string footer(string $innertext, array $attributes) creates a footer for a document or section |
|
53 | - * @method string form(string $innertext, array $attributes) creates an HTML form for user input |
|
54 | - * @method string frame(string $innertext, array $attributes) defines a window (a frame) in a frameset (not supported in HTML5) |
|
55 | - * @method string frameset(string $innertext, array $attributes) defines a set of frames (not supported in HTML5) |
|
56 | - * @method string h1(string $innertext, array $attributes) creates HTML headings 1 |
|
57 | - * @method string h2(string $innertext, array $attributes) creates HTML headings 2 |
|
58 | - * @method string h3(string $innertext, array $attributes) creates HTML headings 3 |
|
59 | - * @method string h4(string $innertext, array $attributes) creates HTML headings 4 |
|
60 | - * @method string h5(string $innertext, array $attributes) creates HTML headings 5 |
|
61 | - * @method string h6(string $innertext, array $attributes) creates HTML headings 6 |
|
62 | - * @method string head(string $innertext, array $attributes) contains metadata/information for the document |
|
63 | - * @method string header(string $innertext, array $attributes) creates a header for a document or section |
|
64 | - * @method string hr(string $innertext, array $attributes) creates a thematic change in the content |
|
65 | - * @method string html(string $innertext, array $attributes) creates the root of an HTML document |
|
66 | - * @method string i(string $innertext, array $attributes) creates a part of text in an alternate voice or mood |
|
67 | - * @method string iframe(string $innertext, array $attributes) creates an inline frame |
|
68 | - * @method string input(string $innertext, array $attributes) creates an input control |
|
69 | - * @method string ins(string $innertext, array $attributes) creates a text that has been inserted into a document |
|
70 | - * @method string kbd(string $innertext, array $attributes) creates keyboard input |
|
71 | - * @method string label(string $innertext, array $attributes) creates a label for an <input> element |
|
72 | - * @method string legend(string $innertext, array $attributes) creates a caption for a <fieldset> element |
|
73 | - * @method string li(string $innertext, array $attributes) creates a list item |
|
74 | - * @method string link(string $innertext, array $attributes) creates the relationship between a document and an external resource (most used to link to style sheets) |
|
75 | - * @method string main(string $innertext, array $attributes) specifies the main content of a document |
|
76 | - * @method string map(string $innertext, array $attributes) creates an image map |
|
77 | - * @method string mark(string $innertext, array $attributes) creates marked/highlighted text |
|
78 | - * @method string meta(string $innertext, array $attributes) creates metadata about an HTML document |
|
79 | - * @method string meter(string $innertext, array $attributes) creates a scalar measurement within a known range (a gauge) |
|
80 | - * @method string nav(string $innertext, array $attributes) creates navigation links |
|
81 | - * @method string noframes(string $innertext, array $attributes) defines an alternate content for users that do not support frames (not supported in HTML5) |
|
82 | - * @method string noscript(string $innertext, array $attributes) creates an alternate content for users that do not support client-side scripts |
|
83 | - * @method string object(string $innertext, array $attributes) creates a container for an external application |
|
84 | - * @method string ol(string $innertext, array $attributes) creates an ordered list |
|
85 | - * @method string optgroup(string $innertext, array $attributes) creates a group of related options in a drop-down list |
|
86 | - * @method string option(string $innertext, array $attributes) creates an option in a drop-down list |
|
87 | - * @method string output(string $innertext, array $attributes) creates the result of a calculation |
|
88 | - * @method string p(string $innertext, array $attributes) creates a paragraph |
|
89 | - * @method string param(string $innertext, array $attributes) creates a parameter for an object |
|
90 | - * @method string picture(string $innertext, array $attributes) creates a container for multiple image resources |
|
91 | - * @method string pre(string $innertext, array $attributes) creates preformatted text |
|
92 | - * @method string progress(string $innertext, array $attributes) represents the progress of a task |
|
93 | - * @method string q(string $innertext, array $attributes) creates a short quotation |
|
94 | - * @method string rp(string $innertext, array $attributes) creates what to show in browsers that do not support ruby annotations |
|
95 | - * @method string rt(string $innertext, array $attributes) creates an explanation/pronunciation of characters (for east asian typography) |
|
96 | - * @method string ruby(string $innertext, array $attributes) creates a ruby annotation (for east asian typography) |
|
97 | - * @method string s(string $innertext, array $attributes) creates text that is no longer correct |
|
98 | - * @method string samp(string $innertext, array $attributes) creates sample output from a computer program |
|
99 | - * @method string script(string $innertext, array $attributes) creates a client-side script |
|
100 | - * @method string section(string $innertext, array $attributes) creates a section in a document |
|
101 | - * @method string select(string $innertext, array $attributes) creates a drop-down list |
|
102 | - * @method string small(string $innertext, array $attributes) creates smaller text |
|
103 | - * @method string source(string $innertext, array $attributes) creates multiple media resources for media elements (<video> and <audio>) |
|
104 | - * @method string span(string $innertext, array $attributes) creates a section in a document |
|
105 | - * @method string strike(string $innertext, array $attributes) defines strikethrough text not supported in HTML5. use del() or s() instead. |
|
106 | - * @method string strong(string $innertext, array $attributes) creates important text |
|
107 | - * @method string style(string $innertext, array $attributes) creates style information for a document |
|
108 | - * @method string sub(string $innertext, array $attributes) creates subscripted text |
|
109 | - * @method string summary(string $innertext, array $attributes) creates a visible heading for a <details> element |
|
110 | - * @method string sup(string $innertext, array $attributes) creates superscripted text |
|
111 | - * @method string svg(string $innertext, array $attributes) creates a container for svg graphics |
|
112 | - * @method string table(string $innertext, array $attributes) creates a table |
|
113 | - * @method string tbody(string $innertext, array $attributes) groups the body content in a table |
|
114 | - * @method string td(string $innertext, array $attributes) creates a cell in a table |
|
115 | - * @method string template(string $innertext, array $attributes) creates a container for content that should be hidden when the page loads |
|
116 | - * @method string textarea(string $innertext, array $attributes) creates a multiline input control (text area) |
|
117 | - * @method string tfoot(string $innertext, array $attributes) groups the footer content in a table |
|
118 | - * @method string th(string $innertext, array $attributes) creates a header cell in a table |
|
119 | - * @method string thead(string $innertext, array $attributes) groups the header content in a table |
|
120 | - * @method string time(string $innertext, array $attributes) creates a specific time (or datetime) |
|
121 | - * @method string title(string $innertext, array $attributes) creates a title for the document |
|
122 | - * @method string tr(string $innertext, array $attributes) creates a row in a table |
|
123 | - * @method string track(string $innertext, array $attributes) creates text tracks for media elements (<video> and <audio>) |
|
124 | - * @method string tt(string $innertext, array $attributes) creates an element that defines teletype text (not supported in HTML5. use CSS instead) |
|
125 | - * @method string u(string $innertext, array $attributes) creates some text that is unarticulated and styled differently from normal text |
|
126 | - * @method string ul(string $innertext, array $attributes) creates an unordered list |
|
127 | - * @method string var(string $innertext, array $attributes) creates a variable |
|
128 | - * @method string video(string $innertext, array $attributes) creates embedded video content |
|
129 | - * @method string wbr(string $innertext, array $attributes) creates a possible line-break |
|
130 | - */ |
|
7 | + /** |
|
8 | + * show off @method |
|
9 | + * |
|
10 | + * @method string abbr(string $innertext, array $attributes) creates an abbreviation or an acronym |
|
11 | + * @method string acronym(string $innertext, array $attributes) creates an acronym (not supported in HTML5. use abbr() instead) |
|
12 | + * @method string address(string $innertext, array $attributes) creates contact information for the author/owner of a document |
|
13 | + * @method string applet(string $innertext, array $attributes) creates an embedded applet (not supported in HTML5. use embed() or <object> instead) |
|
14 | + * @method string area(string $innertext, array $attributes) creates an area inside an image map |
|
15 | + * @method string article(string $innertext, array $attributes) creates an article |
|
16 | + * @method string aside(string $innertext, array $attributes) creates content aside from the page content |
|
17 | + * @method string audio(string $innertext, array $attributes) creates embedded sound content |
|
18 | + * @method string b(string $innertext, array $attributes) creates bold text |
|
19 | + * @method string base(string $innertext, array $attributes) creates an element that specifies the base url/target for all relative urls in a document |
|
20 | + * @method string basefont(string $innertext, array $attributes) creates an element that specifies a default color, size, and font for all text in a document (not supported in HTML5. use CSS instead) |
|
21 | + * @method string bdi(string $innertext, array $attributes) creates an element that isolates a part of text that might be formatted in a different direction from other text outside it |
|
22 | + * @method string bdo(string $innertext, array $attributes) creates an element that overrides the current text direction |
|
23 | + * @method string big(string $innertext, array $attributes) creates an element that defines big text (not supported in HTML5. use CSS instead) |
|
24 | + * @method string blockquote(string $innertext, array $attributes) creates a section that is quoted from another source |
|
25 | + * @method string body(string $innertext, array $attributes) creates the document's body |
|
26 | + * @method string br(string $innertext, array $attributes) creates a single line break |
|
27 | + * @method string button(string $innertext, array $attributes) creates a clickable button |
|
28 | + * @method string canvas(string $innertext, array $attributes) used to draw graphics, on the fly, via scripting (usually javascript) |
|
29 | + * @method string caption(string $innertext, array $attributes) creates a table caption |
|
30 | + * @method string center(string $innertext, array $attributes) defines centered text (not supported in HTML5. use CSS instead) |
|
31 | + * @method string cite(string $innertext, array $attributes) creates the title of a work |
|
32 | + * @method string code(string $innertext, array $attributes) creates a piece of computer code |
|
33 | + * @method string col(string $innertext, array $attributes) specifies column properties for each column within a <colgroup> element |
|
34 | + * @method string colgroup(string $innertext, array $attributes) specifies a group of one or more columns in a table for formatting |
|
35 | + * @method string data(string $innertext, array $attributes) adds a machine-readable translation of a given content |
|
36 | + * @method string datalist(string $innertext, array $attributes) specifies a list of pre-defined options for input controls |
|
37 | + * @method string dd(string $innertext, array $attributes) creates a description/value of a term in a description list |
|
38 | + * @method string del(string $innertext, array $attributes) creates text that has been deleted from a document |
|
39 | + * @method string details(string $innertext, array $attributes) creates additional details that the user can view or hide |
|
40 | + * @method string dfn(string $innertext, array $attributes) specifies a term that is going to be defined within the content |
|
41 | + * @method string dialog(string $innertext, array $attributes) creates a dialog box or window |
|
42 | + * @method string dir(string $innertext, array $attributes) defines a directory list (not supported in HTML5. use ul() instead) |
|
43 | + * @method string div(string $innertext, array $attributes) creates a section in a document |
|
44 | + * @method string dl(string $innertext, array $attributes) creates a description list |
|
45 | + * @method string dt(string $innertext, array $attributes) creates a term/name in a description list |
|
46 | + * @method string em(string $innertext, array $attributes) creates emphasized text |
|
47 | + * @method string embed(string $innertext, array $attributes) creates a container for an external application |
|
48 | + * @method string fieldset(string $innertext, array $attributes) groups related elements in a form |
|
49 | + * @method string figcaption(string $innertext, array $attributes) creates a caption for a <figure> element |
|
50 | + * @method string figure(string $innertext, array $attributes) specifies self-contained content |
|
51 | + * @method string font(string $innertext, array $attributes) defines font, color, and size for text (not supported in HTML5. use CSS instead) |
|
52 | + * @method string footer(string $innertext, array $attributes) creates a footer for a document or section |
|
53 | + * @method string form(string $innertext, array $attributes) creates an HTML form for user input |
|
54 | + * @method string frame(string $innertext, array $attributes) defines a window (a frame) in a frameset (not supported in HTML5) |
|
55 | + * @method string frameset(string $innertext, array $attributes) defines a set of frames (not supported in HTML5) |
|
56 | + * @method string h1(string $innertext, array $attributes) creates HTML headings 1 |
|
57 | + * @method string h2(string $innertext, array $attributes) creates HTML headings 2 |
|
58 | + * @method string h3(string $innertext, array $attributes) creates HTML headings 3 |
|
59 | + * @method string h4(string $innertext, array $attributes) creates HTML headings 4 |
|
60 | + * @method string h5(string $innertext, array $attributes) creates HTML headings 5 |
|
61 | + * @method string h6(string $innertext, array $attributes) creates HTML headings 6 |
|
62 | + * @method string head(string $innertext, array $attributes) contains metadata/information for the document |
|
63 | + * @method string header(string $innertext, array $attributes) creates a header for a document or section |
|
64 | + * @method string hr(string $innertext, array $attributes) creates a thematic change in the content |
|
65 | + * @method string html(string $innertext, array $attributes) creates the root of an HTML document |
|
66 | + * @method string i(string $innertext, array $attributes) creates a part of text in an alternate voice or mood |
|
67 | + * @method string iframe(string $innertext, array $attributes) creates an inline frame |
|
68 | + * @method string input(string $innertext, array $attributes) creates an input control |
|
69 | + * @method string ins(string $innertext, array $attributes) creates a text that has been inserted into a document |
|
70 | + * @method string kbd(string $innertext, array $attributes) creates keyboard input |
|
71 | + * @method string label(string $innertext, array $attributes) creates a label for an <input> element |
|
72 | + * @method string legend(string $innertext, array $attributes) creates a caption for a <fieldset> element |
|
73 | + * @method string li(string $innertext, array $attributes) creates a list item |
|
74 | + * @method string link(string $innertext, array $attributes) creates the relationship between a document and an external resource (most used to link to style sheets) |
|
75 | + * @method string main(string $innertext, array $attributes) specifies the main content of a document |
|
76 | + * @method string map(string $innertext, array $attributes) creates an image map |
|
77 | + * @method string mark(string $innertext, array $attributes) creates marked/highlighted text |
|
78 | + * @method string meta(string $innertext, array $attributes) creates metadata about an HTML document |
|
79 | + * @method string meter(string $innertext, array $attributes) creates a scalar measurement within a known range (a gauge) |
|
80 | + * @method string nav(string $innertext, array $attributes) creates navigation links |
|
81 | + * @method string noframes(string $innertext, array $attributes) defines an alternate content for users that do not support frames (not supported in HTML5) |
|
82 | + * @method string noscript(string $innertext, array $attributes) creates an alternate content for users that do not support client-side scripts |
|
83 | + * @method string object(string $innertext, array $attributes) creates a container for an external application |
|
84 | + * @method string ol(string $innertext, array $attributes) creates an ordered list |
|
85 | + * @method string optgroup(string $innertext, array $attributes) creates a group of related options in a drop-down list |
|
86 | + * @method string option(string $innertext, array $attributes) creates an option in a drop-down list |
|
87 | + * @method string output(string $innertext, array $attributes) creates the result of a calculation |
|
88 | + * @method string p(string $innertext, array $attributes) creates a paragraph |
|
89 | + * @method string param(string $innertext, array $attributes) creates a parameter for an object |
|
90 | + * @method string picture(string $innertext, array $attributes) creates a container for multiple image resources |
|
91 | + * @method string pre(string $innertext, array $attributes) creates preformatted text |
|
92 | + * @method string progress(string $innertext, array $attributes) represents the progress of a task |
|
93 | + * @method string q(string $innertext, array $attributes) creates a short quotation |
|
94 | + * @method string rp(string $innertext, array $attributes) creates what to show in browsers that do not support ruby annotations |
|
95 | + * @method string rt(string $innertext, array $attributes) creates an explanation/pronunciation of characters (for east asian typography) |
|
96 | + * @method string ruby(string $innertext, array $attributes) creates a ruby annotation (for east asian typography) |
|
97 | + * @method string s(string $innertext, array $attributes) creates text that is no longer correct |
|
98 | + * @method string samp(string $innertext, array $attributes) creates sample output from a computer program |
|
99 | + * @method string script(string $innertext, array $attributes) creates a client-side script |
|
100 | + * @method string section(string $innertext, array $attributes) creates a section in a document |
|
101 | + * @method string select(string $innertext, array $attributes) creates a drop-down list |
|
102 | + * @method string small(string $innertext, array $attributes) creates smaller text |
|
103 | + * @method string source(string $innertext, array $attributes) creates multiple media resources for media elements (<video> and <audio>) |
|
104 | + * @method string span(string $innertext, array $attributes) creates a section in a document |
|
105 | + * @method string strike(string $innertext, array $attributes) defines strikethrough text not supported in HTML5. use del() or s() instead. |
|
106 | + * @method string strong(string $innertext, array $attributes) creates important text |
|
107 | + * @method string style(string $innertext, array $attributes) creates style information for a document |
|
108 | + * @method string sub(string $innertext, array $attributes) creates subscripted text |
|
109 | + * @method string summary(string $innertext, array $attributes) creates a visible heading for a <details> element |
|
110 | + * @method string sup(string $innertext, array $attributes) creates superscripted text |
|
111 | + * @method string svg(string $innertext, array $attributes) creates a container for svg graphics |
|
112 | + * @method string table(string $innertext, array $attributes) creates a table |
|
113 | + * @method string tbody(string $innertext, array $attributes) groups the body content in a table |
|
114 | + * @method string td(string $innertext, array $attributes) creates a cell in a table |
|
115 | + * @method string template(string $innertext, array $attributes) creates a container for content that should be hidden when the page loads |
|
116 | + * @method string textarea(string $innertext, array $attributes) creates a multiline input control (text area) |
|
117 | + * @method string tfoot(string $innertext, array $attributes) groups the footer content in a table |
|
118 | + * @method string th(string $innertext, array $attributes) creates a header cell in a table |
|
119 | + * @method string thead(string $innertext, array $attributes) groups the header content in a table |
|
120 | + * @method string time(string $innertext, array $attributes) creates a specific time (or datetime) |
|
121 | + * @method string title(string $innertext, array $attributes) creates a title for the document |
|
122 | + * @method string tr(string $innertext, array $attributes) creates a row in a table |
|
123 | + * @method string track(string $innertext, array $attributes) creates text tracks for media elements (<video> and <audio>) |
|
124 | + * @method string tt(string $innertext, array $attributes) creates an element that defines teletype text (not supported in HTML5. use CSS instead) |
|
125 | + * @method string u(string $innertext, array $attributes) creates some text that is unarticulated and styled differently from normal text |
|
126 | + * @method string ul(string $innertext, array $attributes) creates an unordered list |
|
127 | + * @method string var(string $innertext, array $attributes) creates a variable |
|
128 | + * @method string video(string $innertext, array $attributes) creates embedded video content |
|
129 | + * @method string wbr(string $innertext, array $attributes) creates a possible line-break |
|
130 | + */ |
|
131 | 131 | namespace HexMakina\Marker; |
132 | 132 | |
133 | 133 | class Marker |
@@ -135,31 +135,31 @@ discard block |
||
135 | 135 | //::span('inner text', $attributes) |
136 | 136 | public static function __callStatic($element_type, $arguments) |
137 | 137 | { |
138 | - $i=0; |
|
139 | - $element_inner =$arguments[$i++]??null; |
|
140 | - $attributes=$arguments[$i++]??[]; |
|
138 | + $i = 0; |
|
139 | + $element_inner = $arguments[$i++] ?? null; |
|
140 | + $attributes = $arguments[$i++] ?? []; |
|
141 | 141 | |
142 | 142 | return new Element($element_type, $element_inner, $attributes); |
143 | 143 | } |
144 | 144 | |
145 | 145 | // TODO labels should mandatory, accessibility |
146 | 146 | // TODO implement all options of font-awesome |
147 | - public static function fas($icon, $title=null, $attributes=[]) |
|
147 | + public static function fas($icon, $title = null, $attributes = []) |
|
148 | 148 | { |
149 | 149 | $attributes['title'] = $attributes['title'] ?? $title; // attributes take precedence |
150 | 150 | $attributes['class'] = sprintf('fas fa-%s %s', $icon, $attributes['class'] ?? ''); |
151 | - return new Element('i','', $attributes); |
|
151 | + return new Element('i', '', $attributes); |
|
152 | 152 | } |
153 | 153 | |
154 | - public static function checkbutton($field_name, $field_value, $field_label, $attributes=[]) |
|
154 | + public static function checkbutton($field_name, $field_value, $field_label, $attributes = []) |
|
155 | 155 | { |
156 | - if(!isset($attributes['id'])) |
|
157 | - $attributes['id']=$field_name; |
|
156 | + if (!isset($attributes['id'])) |
|
157 | + $attributes['id'] = $field_name; |
|
158 | 158 | |
159 | - if(!isset($attributes['type'])) |
|
160 | - $attributes['type']='checkbox'; // default |
|
159 | + if (!isset($attributes['type'])) |
|
160 | + $attributes['type'] = 'checkbox'; // default |
|
161 | 161 | |
162 | - if(isset($attributes['is_checked']) && $attributes['is_checked'] === true) // for boolean checkbuttons |
|
162 | + if (isset($attributes['is_checked']) && $attributes['is_checked'] === true) // for boolean checkbuttons |
|
163 | 163 | { |
164 | 164 | $attributes['checked'] = 'checked'; |
165 | 165 | unset($attributes['is_checked']); |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | ['class'=>'checkbutton']); |
173 | 173 | } |
174 | 174 | |
175 | - public static function img($src, $title, $attributes=[]) |
|
175 | + public static function img($src, $title, $attributes = []) |
|
176 | 176 | { |
177 | 177 | $attributes['src'] = $attributes['src'] ?? $src; |
178 | 178 | $attributes['title'] = $attributes['title'] ?? $title; |
179 | 179 | return new Element('img', null, $attributes); |
180 | 180 | } |
181 | 181 | |
182 | - public static function a($href, $label, $attributes=[]) |
|
182 | + public static function a($href, $label, $attributes = []) |
|
183 | 183 | { |
184 | 184 | $attributes['href'] = $attributes['href'] ?? $href; |
185 | 185 | return new Element('a', $label, $attributes); |
@@ -153,15 +153,20 @@ |
||
153 | 153 | |
154 | 154 | public static function checkbutton($field_name, $field_value, $field_label, $attributes=[]) |
155 | 155 | { |
156 | - if(!isset($attributes['id'])) |
|
157 | - $attributes['id']=$field_name; |
|
156 | + if(!isset($attributes['id'])) { |
|
157 | + $attributes['id']=$field_name; |
|
158 | + } |
|
158 | 159 | |
159 | - if(!isset($attributes['type'])) |
|
160 | - $attributes['type']='checkbox'; // default |
|
160 | + if(!isset($attributes['type'])) { |
|
161 | + $attributes['type']='checkbox'; |
|
162 | + } |
|
163 | + // default |
|
161 | 164 | |
162 | - if(isset($attributes['is_checked']) && $attributes['is_checked'] === true) // for boolean checkbuttons |
|
165 | + if(isset($attributes['is_checked']) && $attributes['is_checked'] === true) { |
|
166 | + // for boolean checkbuttons |
|
163 | 167 | { |
164 | 168 | $attributes['checked'] = 'checked'; |
169 | + } |
|
165 | 170 | unset($attributes['is_checked']); |
166 | 171 | } |
167 | 172 |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | public static function __callStatic($element_type, $arguments) |
11 | 11 | { |
12 | 12 | // arguments [name, value, [attributes], [errors]] |
13 | - $i=0; |
|
14 | - $field_name= $arguments[$i++] ?? null; |
|
15 | - $field_value= $arguments[$i++] ?? null; |
|
16 | - $attributes= $arguments[$i++] ?? []; |
|
17 | - $errors= $arguments[$i++] ?? []; |
|
13 | + $i = 0; |
|
14 | + $field_name = $arguments[$i++] ?? null; |
|
15 | + $field_value = $arguments[$i++] ?? null; |
|
16 | + $attributes = $arguments[$i++] ?? []; |
|
17 | + $errors = $arguments[$i++] ?? []; |
|
18 | 18 | |
19 | 19 | |
20 | 20 | $attributes['type'] = $element_type; |
21 | 21 | $attributes['name'] = $attributes['name'] ?? $field_name; |
22 | 22 | $attributes['value'] = $attributes['value'] ?? $field_value; |
23 | 23 | |
24 | - switch($attributes['type']) |
|
24 | + switch ($attributes['type']) |
|
25 | 25 | { |
26 | 26 | case 'datetime': |
27 | 27 | $attributes['type'] = 'datetime-local'; |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | - public static function input($field_name, $field_value=null, $attributes=[], $errors=[]) |
|
38 | + public static function input($field_name, $field_value = null, $attributes = [], $errors = []) |
|
39 | 39 | { |
40 | 40 | |
41 | - if(isset($attributes['disabled']) || !isset($attributes['type']) || in_array('disabled', $attributes, true)) |
|
41 | + if (isset($attributes['disabled']) || !isset($attributes['type']) || in_array('disabled', $attributes, true)) |
|
42 | 42 | $attributes['type'] = 'text'; |
43 | 43 | else |
44 | 44 | $attributes['type'] = $attributes['type'] ?? 'text'; |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | return self::element_with_errors('input', null, $attributes, isset($errors[$field_name])); |
50 | 50 | } |
51 | 51 | |
52 | - public static function textarea($field_name, $field_value=null, $attributes=[], $errors=[]) |
|
52 | + public static function textarea($field_name, $field_value = null, $attributes = [], $errors = []) |
|
53 | 53 | { |
54 | 54 | $attributes['name'] = $attributes['name'] ?? $field_name; |
55 | 55 | return self::element_with_errors('textarea', $field_value, $attributes, isset($errors[$field_name])); |
56 | 56 | } |
57 | 57 | |
58 | - public static function select($field_name, $option_list, $selected = null, $attributes=[], $errors=[]) |
|
58 | + public static function select($field_name, $option_list, $selected = null, $attributes = [], $errors = []) |
|
59 | 59 | { |
60 | 60 | $attributes['name'] = $attributes['name'] ?? $field_name; |
61 | 61 | |
62 | 62 | $options = ''; |
63 | - foreach($option_list as $value => $label) |
|
63 | + foreach ($option_list as $value => $label) |
|
64 | 64 | { |
65 | 65 | $option_attributes = ['value' => $value]; |
66 | - if($selected == $value) |
|
67 | - $option_attributes['selected'] = 'selected'; |
|
66 | + if ($selected == $value) |
|
67 | + $option_attributes['selected'] = 'selected'; |
|
68 | 68 | |
69 | 69 | $options .= new Element('option', $label, $option_attributes); |
70 | 70 | } |
71 | 71 | return self::element_with_errors('select', $options, $attributes, isset($errors[$field_name])); |
72 | 72 | } |
73 | 73 | |
74 | - public static function legend($label, $attributes=[]) |
|
74 | + public static function legend($label, $attributes = []) |
|
75 | 75 | { |
76 | 76 | return new Element('legend', $label, $attributes); |
77 | 77 | } |
78 | 78 | |
79 | - public static function label($field_for, $field_label, $attributes=[], $errors=[]) |
|
79 | + public static function label($field_for, $field_label, $attributes = [], $errors = []) |
|
80 | 80 | { |
81 | 81 | $attributes['for'] = $field_for; |
82 | 82 | return self::element_with_errors('label', $field_label, $attributes, isset($errors[$field_for])); |
83 | 83 | } |
84 | 84 | |
85 | - public static function submit($field_id, $field_label, $attributes=[]) |
|
85 | + public static function submit($field_id, $field_label, $attributes = []) |
|
86 | 86 | { |
87 | 87 | $attributes['id'] = $attributes['id'] ?? $field_id; |
88 | 88 | unset($attributes['name']); |
89 | 89 | $attributes['type'] = 'submit'; |
90 | - if(isset($attributes['tag']) && $attributes['tag'] === 'input') |
|
90 | + if (isset($attributes['tag']) && $attributes['tag'] === 'input') |
|
91 | 91 | return new Element('input', '', $attributes); |
92 | 92 | else |
93 | 93 | { |
@@ -97,19 +97,19 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | - private static function element_with_errors($tag, $content, $attributes=[], $errors=false) |
|
100 | + private static function element_with_errors($tag, $content, $attributes = [], $errors = false) |
|
101 | 101 | { |
102 | 102 | |
103 | 103 | $attributes['id'] = $attributes['id'] ?? $attributes['name'] ?? ''; |
104 | 104 | |
105 | - if($errors === true) |
|
105 | + if ($errors === true) |
|
106 | 106 | { |
107 | 107 | $attributes['class'] = $attributes['class'] ?? ''; |
108 | 108 | $attributes['class'] .= ' error'; |
109 | 109 | } |
110 | 110 | |
111 | 111 | $label = ''; |
112 | - if(isset($attributes['label'])) |
|
112 | + if (isset($attributes['label'])) |
|
113 | 113 | { |
114 | 114 | $label = self::label($attributes['id'], $attributes['label'], [], $errors); |
115 | 115 | unset($attributes['label']); |
@@ -38,10 +38,11 @@ discard block |
||
38 | 38 | public static function input($field_name, $field_value=null, $attributes=[], $errors=[]) |
39 | 39 | { |
40 | 40 | |
41 | - if(isset($attributes['disabled']) || !isset($attributes['type']) || in_array('disabled', $attributes, true)) |
|
42 | - $attributes['type'] = 'text'; |
|
43 | - else |
|
44 | - $attributes['type'] = $attributes['type'] ?? 'text'; |
|
41 | + if(isset($attributes['disabled']) || !isset($attributes['type']) || in_array('disabled', $attributes, true)) { |
|
42 | + $attributes['type'] = 'text'; |
|
43 | + } else { |
|
44 | + $attributes['type'] = $attributes['type'] ?? 'text'; |
|
45 | + } |
|
45 | 46 | |
46 | 47 | $attributes['name'] = $attributes['name'] ?? $field_name; |
47 | 48 | $attributes['value'] = $attributes['value'] ?? $field_value; |
@@ -63,8 +64,9 @@ discard block |
||
63 | 64 | foreach($option_list as $value => $label) |
64 | 65 | { |
65 | 66 | $option_attributes = ['value' => $value]; |
66 | - if($selected == $value) |
|
67 | - $option_attributes['selected'] = 'selected'; |
|
67 | + if($selected == $value) { |
|
68 | + $option_attributes['selected'] = 'selected'; |
|
69 | + } |
|
68 | 70 | |
69 | 71 | $options .= new Element('option', $label, $option_attributes); |
70 | 72 | } |
@@ -87,9 +89,9 @@ discard block |
||
87 | 89 | $attributes['id'] = $attributes['id'] ?? $field_id; |
88 | 90 | unset($attributes['name']); |
89 | 91 | $attributes['type'] = 'submit'; |
90 | - if(isset($attributes['tag']) && $attributes['tag'] === 'input') |
|
91 | - return new Element('input', '', $attributes); |
|
92 | - else |
|
92 | + if(isset($attributes['tag']) && $attributes['tag'] === 'input') { |
|
93 | + return new Element('input', '', $attributes); |
|
94 | + } else |
|
93 | 95 | { |
94 | 96 | unset($attributes['tag']); |
95 | 97 | unset($attributes['value']); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | return in_array($this->tagName, self::VOID_ELEMENTS); |
17 | 17 | } |
18 | 18 | |
19 | - public function __construct($tagName, $innerContent=null, $attributeList = []) |
|
19 | + public function __construct($tagName, $innerContent = null, $attributeList = []) |
|
20 | 20 | { |
21 | 21 | $this->tagName = $tagName; |
22 | 22 | $this->attributeList = $attributeList; |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | { |
28 | 28 | $ret = ''; |
29 | 29 | |
30 | - foreach($this->attributeList as $k => $v) |
|
31 | - if(!is_null($v) && $v !== '' && !is_array($v)) |
|
32 | - $ret .= is_int($k) ? " $v" : sprintf(' %s="%s"', $k, $v); |
|
30 | + foreach ($this->attributeList as $k => $v) |
|
31 | + if (!is_null($v) && $v !== '' && !is_array($v)) |
|
32 | + $ret .= is_int($k) ? " $v" : sprintf(' %s="%s"', $k, $v); |
|
33 | 33 | |
34 | 34 | return $ret; |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $flattributes = $this->format_attributes(); |
40 | 40 | |
41 | 41 | $ret = ''; |
42 | - if($this->is_void()) |
|
42 | + if ($this->is_void()) |
|
43 | 43 | $ret = sprintf('<%s%s/>', $this->tagName, $flattributes); |
44 | 44 | else |
45 | 45 | { |
@@ -27,9 +27,10 @@ discard block |
||
27 | 27 | { |
28 | 28 | $ret = ''; |
29 | 29 | |
30 | - foreach($this->attributeList as $k => $v) |
|
31 | - if(!is_null($v) && $v !== '' && !is_array($v)) |
|
30 | + foreach($this->attributeList as $k => $v) { |
|
31 | + if(!is_null($v) && $v !== '' && !is_array($v)) |
|
32 | 32 | $ret .= is_int($k) ? " $v" : sprintf(' %s="%s"', $k, $v); |
33 | + } |
|
33 | 34 | |
34 | 35 | return $ret; |
35 | 36 | } |
@@ -39,9 +40,9 @@ discard block |
||
39 | 40 | $flattributes = $this->format_attributes(); |
40 | 41 | |
41 | 42 | $ret = ''; |
42 | - if($this->is_void()) |
|
43 | - $ret = sprintf('<%s%s/>', $this->tagName, $flattributes); |
|
44 | - else |
|
43 | + if($this->is_void()) { |
|
44 | + $ret = sprintf('<%s%s/>', $this->tagName, $flattributes); |
|
45 | + } else |
|
45 | 46 | { |
46 | 47 | $ret = sprintf('<%s%s>%s</%s>', |
47 | 48 | $this->tagName, |