/mod/wiki/weblib.php

https://github.com/jarednipper/HSU-common-code · PHP · 1363 lines · 615 code · 322 blank · 426 comment · 439 complexity · fd99ac27f66ce738d9aeef76f8205c01 MD5 · raw file

  1. <?php
  2. /**
  3. * This library contains functions to generate XHTML strict output
  4. *
  5. * @author DFWiki LABS
  6. * @author Marc Alier i Forment
  7. * @author David Castro, Ferran Recio, Jordi Piguillem, UPC,
  8. * and members of DFWikiteam listed at http://morfeo.upc.edu/crom
  9. * @version $Id: weblib.php,v 1.26 2007/08/21 13:57:11 tusefomal Exp $
  10. * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  11. * @package Output_API
  12. */
  13. /**
  14. * Defines the start of a table.
  15. *
  16. * @param integer num number of lines break.
  17. * @param bool $return whether to return an output string or echo now.
  18. */
  19. function wiki_br($num=1, $return=false){
  20. $output = "<br />\n";
  21. while ($num > 1){
  22. $output .= "<br />\n";
  23. $num--;
  24. }
  25. if ($return) {
  26. return $output;
  27. } else {
  28. echo $output;
  29. }
  30. }
  31. /**
  32. * Defines the start of a table.
  33. *
  34. * @param array $propert is an object with several properties.
  35. * <ul>
  36. * <li>$propert->border, specifies the border width. Set border="0" to display tables with no borders!
  37. * <li>$propert->width, specifies the width of the table.
  38. * <li>$propert->padding, specifies the space between the cell walls and contents.
  39. * <li>$propert->spacing, specifies the space between cells.
  40. * <li>$propert->class, the class of the element.
  41. * <li>$propert->id, the id of the element.
  42. * <li>$propert->style, an inline style definition.
  43. * <li>$propert->classtr, the class of the element.
  44. * <li>$propert->aligntd, specifies the horizontal alignment of cell content.
  45. * <li>$propert->valigntd, specifies the vertical alignment of cell content.
  46. * <li>$propert->colspantd, indicates the number of columns this cell should span.
  47. * <li>$propert->rowspantd, indicates the number of rows this cell should span.
  48. * <li>$propert->classtd, the class of the element.
  49. * <li>$propert->idtd, the class of the element.
  50. * <li>$propert->styletd, an inline style definition.
  51. * <li>$propert->header, specifies if the table has a header.
  52. * <li>$propert->alignth, specifies the horizontal alignment of cell content.
  53. * <li>$propert->valignth, specifies the vertical alignment of cell content.
  54. * <li>$propert->colspanth, indicates the number of columns this cell should span.
  55. * <li>$propert->rowspanth, indicates the number of rows this cell should span.
  56. * <li>$propert->idth, the class of the element.
  57. * <li>$propert->classth, the class of the element.
  58. * <li>$propert->styleth, an inline style definition.
  59. * <li>$propert->events, event attributes.
  60. * </ul>
  61. * @param bool $return whether to return an output string or echo now.
  62. */
  63. function wiki_table_start($propert=null, $return=false) {
  64. if (isset($propert->border)) { $propert->border = ' border="'.$propert->border.'"'; }
  65. else { $propert->border = ''; }
  66. if (isset($propert->width)) { $propert->width = ' width="'.$propert->width.'"'; }
  67. else { $propert->width = ''; }
  68. if (isset($propert->padding)) { $propert->padding = ' cellpadding="'.$propert->padding.'"'; }
  69. else { $propert->padding = ''; }
  70. if (isset($propert->spacing)) { $propert->spacing = ' cellspacing="'.$propert->spacing.'"'; }
  71. else { $propert->spacing = ''; }
  72. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  73. else { $propert->id = ''; }
  74. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  75. else { $propert->class = ''; }
  76. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  77. else { $propert->style = ''; }
  78. if (isset($propert->classtr)) { $propert->classtr = ' class="'.$propert->classtr.'"'; }
  79. else { $propert->classtr = ''; }
  80. if (isset($propert->header)){
  81. if (isset($propert->alignth)) { $propert->alignth = ' align="'.$propert->alignth.'"'; }
  82. else { $propert->alignth = ''; }
  83. if (isset($propert->valignth)) { $propert->valignth = ' valign="'.$propert->valignth.'"'; }
  84. else { $propert->valignth = ''; }
  85. if (isset($propert->colspanth)) { $propert->colspanth = ' colspan="'.$propert->colspanth.'"'; }
  86. else { $propert->colspanth = ''; }
  87. if (isset($propert->rowspanth)) { $propert->rowspanth = ' rowspan="'.$propert->rowspanth.'"'; }
  88. else { $propert->rowspanth = ''; }
  89. if (isset($propert->idth)) { $propert->idth = ' id="'.$propert->idth.'"'; }
  90. else { $propert->idth = ''; }
  91. if (isset($propert->classth)) { $propert->classth = ' class="'.$propert->classth.'"'; }
  92. else { $propert->classth = ''; }
  93. if (isset($propert->styleth)) { $propert->styleth = ' style="'.$propert->styleth.'"'; }
  94. else { $propert->styleth = ''; }
  95. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  96. else { $propert->events = ''; }
  97. $output = "<table".$propert->border.$propert->spacing.$propert->padding.$propert->width.$propert->id.$propert->id.$propert->class.$propert->style.">\n".
  98. "<tr".$propert->classtr."><th".$propert->alignth.$propert->valignth.$propert->colspanth.$propert->rowspanth.$propert->idth.$propert->classth.$propert->styleth.$propert->events.">\n";
  99. } else {
  100. if (isset($propert->aligntd)) { $propert->aligntd = ' align="'.$propert->aligntd.'"'; }
  101. else { $propert->aligntd = ''; }
  102. if (isset($propert->valigntd)) { $propert->valigntd = ' valign="'.$propert->valigntd.'"'; }
  103. else { $propert->valigntd = ''; }
  104. if (isset($propert->colspantd)) { $propert->colspantd = ' colspan="'.$propert->colspantd.'"'; }
  105. else { $propert->colspantd = ''; }
  106. if (isset($propert->rowspantd)) { $propert->rowspantd = ' rowspan="'.$propert->rowspantd.'"'; }
  107. else { $propert->rowspantd = ''; }
  108. if (isset($propert->idtd)) { $propert->idtd = ' id="'.$propert->idtd.'"'; }
  109. else { $propert->idtd = ''; }
  110. if (isset($propert->classtd)) { $propert->classtd = ' class="'.$propert->classtd.'"'; }
  111. else { $propert->classtd = ''; }
  112. if (isset($propert->styletd)) { $propert->styletd = ' style="'.$propert->styletd.'"'; }
  113. else { $propert->styletd = ''; }
  114. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  115. else { $propert->events = ''; }
  116. $output = "<table".$propert->border.$propert->spacing.$propert->padding.$propert->width.$propert->id.$propert->class.$propert->style.">\n".
  117. "<tr".$propert->classtr."><td".$propert->aligntd.$propert->valigntd.$propert->colspantd.$propert->rowspantd.$propert->idtd.$propert->classtd.$propert->styletd.$propert->events.">\n";
  118. }
  119. if ($return) {
  120. return $output;
  121. } else {
  122. echo $output;
  123. }
  124. }
  125. /**
  126. * Print the end of a table.
  127. *
  128. * @param array $propert is an object with several properties.
  129. * <ul>
  130. * <li>$propert->header, specifies if the table has a header.
  131. * </ul>
  132. * @param bool $return whether to return an output string or echo now.
  133. */
  134. function wiki_table_end($propert=null, $return=false) {
  135. if (isset($propert->header)){
  136. $output = "</th></tr>\n</table>\n";
  137. } else {
  138. $output = "</td></tr>\n</table>\n";
  139. }
  140. if ($return) {
  141. return $output;
  142. } else {
  143. echo $output;
  144. }
  145. }
  146. /**
  147. * Change column.
  148. *
  149. * @param array $propert is an object with several properties.
  150. * <ul>
  151. * <li>$propert->header, specifies if the table has a header.
  152. * <li>$propert->align, specifies the horizontal alignment of cell content.
  153. * <li>$propert->valign, specifies the vertical alignment of cell content.
  154. * <li>$propert->colspan, indicates the number of columns this cell should span.
  155. * <li>$propert->rowspan, indicates the number of rows this cell should span.
  156. * <li>$propert->id, the id of the element.
  157. * <li>$propert->class, the class of the element.
  158. * <li>$propert->style, an inline style definition.
  159. * <li>$propert->events, event attributes.
  160. * </ul>
  161. * @param bool $return whether to return an output string or echo now.
  162. */
  163. function wiki_change_column($propert=null, $return=false){
  164. if (isset($propert->align)) { $propert->align = ' align="'.$propert->align.'"'; }
  165. else { $propert->align = ''; }
  166. if (isset($propert->valign)) { $propert->valign = ' valign="'.$propert->valign.'"'; }
  167. else { $propert->valign = ''; }
  168. if (isset($propert->colspan)) { $propert->colspan = ' colspan="'.$propert->colspan.'"'; }
  169. else { $propert->colspan = ''; }
  170. if (isset($propert->rowspan)) { $propert->rowspan = ' rowspan="'.$propert->rowspan.'"'; }
  171. else { $propert->rowspan = ''; }
  172. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  173. else { $propert->id = ''; }
  174. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  175. else { $propert->class = ''; }
  176. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  177. else { $propert->style = ''; }
  178. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  179. else { $propert->events = ''; }
  180. if (isset($propert->header)){
  181. $output = "</th><th".$propert->align.$propert->valign.$propert->colspan.$propert->rowspan.$propert->id.$propert->class.$propert->style.$propert->events.">\n";
  182. } else {
  183. $output = "</td><td".$propert->align.$propert->valign.$propert->colspan.$propert->rowspan.$propert->id.$propert->class.$propert->style.$propert->events.">\n";
  184. }
  185. if ($return) {
  186. return $output;
  187. } else {
  188. echo $output;
  189. }
  190. }
  191. /**
  192. * Change row.
  193. *
  194. * @param array $propert is an object with several properties.
  195. * <ul>
  196. * <li>$propert->header, specifies if the table has a header.
  197. * <li>$propert->align, specifies the horizontal alignment of cell content.
  198. * <li>$propert->valign, specifies the vertical alignment of cell content.
  199. * <li>$propert->colspan, indicates the number of columns this cell should span.
  200. * <li>$propert->rowspan, indicates the number of rows this cell should span.
  201. * <li>$propert->id, the class of the element.
  202. * <li>$propert->class, the class of the element.
  203. * <li>$propert->classtr, the class of the element.
  204. * <li>$propert->style, an inline style definition.
  205. * <li>$propert->events, event attributes.
  206. * </ul>
  207. * @param bool $return whether to return an output string or echo now.
  208. */
  209. function wiki_change_row($propert=null, $return=false){
  210. if (isset($propert->align)) { $propert->align = ' align="'.$propert->align.'"'; }
  211. else { $propert->align = ''; }
  212. if (isset($propert->valign)) { $propert->valign = ' valign="'.$propert->valign.'"'; }
  213. else { $propert->valign = ''; }
  214. if (isset($propert->colspan)) { $propert->colspan = ' colspan="'.$propert->colspan.'"'; }
  215. else { $propert->colspan = ''; }
  216. if (isset($propert->rowspan)) { $propert->rowspan = ' rowspan="'.$propert->rowspan.'"'; }
  217. else { $propert->rowspan = ''; }
  218. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  219. else { $propert->id = ''; }
  220. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  221. else { $propert->class = ''; }
  222. if (isset($propert->classtr)) { $propert->classtr = ' class="'.$propert->classtr.'"'; }
  223. else { $propert->classtr = ''; }
  224. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  225. else { $propert->style = ''; }
  226. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  227. else { $propert->events = ''; }
  228. if (isset($propert->header)){
  229. $output = "</th></tr>\n<tr".$propert->classtr."><td".$propert->align.$propert->valign.$propert->colspan.$propert->rowspan.$propert->id.$propert->class.$propert->style.$propert->events.">\n";
  230. } else {
  231. $output = "</td></tr>\n<tr".$propert->classtr."><td".$propert->align.$propert->valign.$propert->colspan.$propert->rowspan.$propert->id.$propert->class.$propert->style.$propert->events.">\n";
  232. }
  233. if ($return) {
  234. return $output;
  235. } else {
  236. echo $output;
  237. }
  238. }
  239. /**
  240. * Creates a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL.
  241. *
  242. * @param string $info defines input info.
  243. * @param array $propert is an object with several properties.
  244. * <ul>
  245. * <li>$propert->action, defines where to send the data when the submit button is pushed.
  246. * <li>$propert->method, the HTTP method for sending data to the action URL.
  247. * <li>$propert->enctype, defines where to send the data when the submit button is pushed.
  248. * <li>$propert->id, the id of the element.
  249. * <li>$propert->class, the class of the element.
  250. * <li>$propert->style, an inline style definition.
  251. * <li>$propert->events, event attributes.
  252. * </ul>
  253. * @param bool $return whether to return an output string or echo now.
  254. */
  255. function wiki_form($info='', $propert=null, $return=false){
  256. if (isset($propert->action)) { $propert->action = ' action="'.$propert->action.'"'; }
  257. else { $propert->action = ''; }
  258. if (isset($propert->method)) { $propert->method = ' method="'.$propert->method.'"'; }
  259. else { $propert->method = ''; }
  260. if (isset($propert->enctype)) { $propert->enctype = ' enctype="'.$propert->enctype.'"'; }
  261. else { $propert->enctype = ''; }
  262. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  263. else { $propert->id = ''; }
  264. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  265. else { $propert->class = ''; }
  266. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  267. else { $propert->style = ''; }
  268. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  269. else { $propert->events = ''; }
  270. $output = "<form".$propert->action.$propert->method.$propert->enctype.$propert->id.$propert->class.$propert->style.$propert->events.">\n".$info."</form>\n";
  271. if ($return) {
  272. return $output;
  273. } else {
  274. echo $output;
  275. }
  276. }
  277. /**
  278. * Creates a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL.
  279. *
  280. * @param array $propert is an object with several properties.
  281. * <ul>
  282. * <li>$propert->action, defines where to send the data when the submit button is pushed.
  283. * <li>$propert->method, the HTTP method for sending data to the action URL.
  284. * <li>$propert->enctype, defines where to send the data when the submit button is pushed.
  285. * <li>$propert->id, the id of the element.
  286. * <li>$propert->class, the class of the element.
  287. * <li>$propert->style, an inline style definition.
  288. * <li>$propert->events, event attributes.
  289. * </ul>
  290. * @param bool $return whether to return an output string or echo now.
  291. */
  292. function wiki_form_start($propert=null, $return=false){
  293. if (isset($propert->action)) { $propert->action = ' action="'.$propert->action.'"'; }
  294. else { $propert->action = ''; }
  295. if (isset($propert->method)) { $propert->method = ' method="'.$propert->method.'"'; }
  296. else { $propert->method = ''; }
  297. if (isset($propert->enctype)) { $propert->enctype = ' enctype="'.$propert->enctype.'"'; }
  298. else { $propert->enctype = ''; }
  299. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  300. else { $propert->id = ''; }
  301. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  302. else { $propert->class = ''; }
  303. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  304. else { $propert->style = ''; }
  305. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  306. else { $propert->events = ''; }
  307. $output = "<form".$propert->action.$propert->method.$propert->enctype.$propert->id.$propert->class.$propert->style.$propert->events.">\n";
  308. if ($return) {
  309. return $output;
  310. } else {
  311. echo $output;
  312. }
  313. }
  314. /**
  315. * Print the end of a form.
  316. *
  317. * @param bool $return whether to return an output string or echo now.
  318. */
  319. function wiki_form_end($return=false){
  320. $output = "</form>\n";
  321. if ($return) {
  322. return $output;
  323. } else {
  324. echo $output;
  325. }
  326. }
  327. /**
  328. * Defines the relationship between two linked documents.
  329. *
  330. * @param array $propert is an object with several properties.
  331. * <ul>
  332. * <li>$propert->rel, defines the relationship between the current document and the targeted document.
  333. * <li>$propert->type, specifies the MIME type of the target URL.
  334. * <li>$propert->href, the target URL of the resource.
  335. * <li>$propert->class, the class of the element.
  336. * <li>$propert->style, an inline style definition.
  337. * <li>$propert->events, event attributes.
  338. * </ul>
  339. * @param bool $return whether to return an output string or echo now.
  340. */
  341. function wiki_link($propert=null, $return=false){
  342. if (isset($propert->rel)) { $propert->rel = ' rel="'.$propert->rel.'"'; }
  343. else { $propert->rel = ''; }
  344. if (isset($propert->type)) { $propert->type = ' type="'.$propert->type.'"'; }
  345. else { $propert->type = ''; }
  346. if (isset($propert->href)) { $propert->href = ' href="'.$propert->href.'"'; }
  347. else { $propert->href = ''; }
  348. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  349. else { $propert->class = ''; }
  350. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  351. else { $propert->style = ''; }
  352. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  353. else { $propert->events = ''; }
  354. $output = "<link".$propert->rel.$propert->type.$propert->href.$propert->class.$propert->style.$propert->events." />\n";
  355. if ($return) {
  356. return $output;
  357. } else {
  358. echo $output;
  359. }
  360. }
  361. /**
  362. * Defines an anchor. An anchor can be used in two ways:
  363. * <ol>
  364. * <li>To create a link to another document by using the href attribute.</li>
  365. * <li>To create a bookmark inside a document, by using the name or id attribute.</li>
  366. * </ol>
  367. *
  368. * @param string $info defines the text.
  369. * @param array $propert is an object with several properties.
  370. * <ul>
  371. * <li>$propert->href, The target URL of the link.
  372. * <li>$propert->name, Names an anchor. Use this attribute to create a bookmark in a document.
  373. * <li>$propert->rel, Specifies the relationship between the current document and the target URL.
  374. * <li>$propert->type, Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL.
  375. * <li>$propert->class, class of this anchor.
  376. * <li>$propert->style, style of this anchor.
  377. * <li>$propert->events, event attributes.
  378. * </ul>
  379. * @param bool $return whether to return an output string or echo now.
  380. */
  381. function wiki_a($info='', $propert=null, $return=false){
  382. if (isset($propert->href)) { $propert->href = ' href="'.$propert->href.'"'; }
  383. else { $propert->href = ''; }
  384. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  385. else { $propert->name = ''; }
  386. if (isset($propert->rel)) { $propert->rel = ' rel="'.$propert->rel.'"'; }
  387. else { $propert->rel = ''; }
  388. if (isset($propert->type)) { $propert->type = ' type="'.$propert->type.'"'; }
  389. else { $propert->type = ''; }
  390. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  391. else { $propert->class = ''; }
  392. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  393. else { $propert->style = ''; }
  394. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  395. else { $propert->events = ''; }
  396. $output = "<a".$propert->href.$propert->name.$propert->rel.$propert->type.$propert->class.$propert->style.$propert->events.">".$info."</a>\n";
  397. if ($return) {
  398. return $output;
  399. } else {
  400. echo $output;
  401. }
  402. }
  403. /**
  404. * Defines the start of an input field where the user can enter data.
  405. *
  406. * @param array $propert is an object with several properties.
  407. * <ul>
  408. * <li>$propert->name, defines a unique name for the input element.
  409. * <li>$propert->value, defines the text on the button.
  410. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  411. * <li>$propert->size, defines the size of the input element.
  412. * <li>$propert->id, a unique id for the element.
  413. * <li>$propert->class, the class of the element.
  414. * <li>$propert->style, an inline style definition.
  415. * <li>$propert->events, event attributes.
  416. * </ul>
  417. * @param bool $return whether to return an output string or echo now.
  418. */
  419. function wiki_input_button($propert=null, $return=false){
  420. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  421. else { $propert->name = ''; }
  422. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  423. else { $propert->value = ''; }
  424. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  425. else { $propert->disabled = ''; }
  426. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  427. else { $propert->size = ''; }
  428. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  429. else { $propert->id = ''; }
  430. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  431. else { $propert->class = ''; }
  432. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  433. else { $propert->style = ''; }
  434. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  435. else { $propert->events = ''; }
  436. $output = "<input type=\"button\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  437. if ($return) {
  438. return $output;
  439. } else {
  440. echo $output;
  441. }
  442. }
  443. /**
  444. * Defines the start of an input field where the user can enter data.
  445. *
  446. * @param array $propert is an object with several properties.
  447. * <ul>
  448. * <li>$propert->name, defines a unique name for the input element.
  449. * <li>$propert->value, value for the input element.
  450. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  451. * <li>$propert->size, defines the size of the input element.
  452. * <li>$propert->checked, indicates that the input element should be checked when it first loads.
  453. * <li>$propert->id, a unique id for the element.
  454. * <li>$propert->class, the class of the element.
  455. * <li>$propert->style, an inline style definition.
  456. * <li>$propert->events, event attributes.
  457. * </ul>
  458. * @param bool $return whether to return an output string or echo now.
  459. */
  460. function wiki_input_checkbox($propert=null, $return=false){
  461. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  462. else { $propert->name = ''; }
  463. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  464. else { $propert->value = ''; }
  465. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  466. else { $propert->disabled = ''; }
  467. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  468. else { $propert->size = ''; }
  469. if (isset($propert->checked)) { $propert->checked = ' checked="checked"'; }
  470. else { $propert->checked = ''; }
  471. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  472. else { $propert->id = ''; }
  473. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  474. else { $propert->class = ''; }
  475. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  476. else { $propert->style = ''; }
  477. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  478. else { $propert->events = ''; }
  479. $output = "<input type=\"checkbox\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->checked.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  480. if ($return) {
  481. return $output;
  482. } else {
  483. echo $output;
  484. }
  485. }
  486. /**
  487. * Defines the start of an input field where the user can enter data.
  488. *
  489. * @param array $propert is an object with several properties.
  490. * <ul>
  491. * <li>$propert->name, defines a unique name for the input element.
  492. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  493. * <li>$propert->size, defines the size of the input element.
  494. * <li>$propert->accept, a comma-separated list of MIME types that indicates the MIME type of the file transfer.
  495. * <li>$propert->id, a unique id for the element.
  496. * <li>$propert->class, the class of the element.
  497. * <li>$propert->style, an inline style definition.
  498. * <li>$propert->events, event attributes.
  499. * </ul>
  500. * @param bool $return whether to return an output string or echo now.
  501. */
  502. function wiki_input_file($propert=null, $return=false){
  503. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  504. else { $propert->name = ''; }
  505. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  506. else { $propert->disabled = ''; }
  507. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  508. else { $propert->size = ''; }
  509. if (isset($propert->accept)) { $propert->accept = ' accept="'.$propert->accept.'"'; }
  510. else { $propert->accept = ''; }
  511. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  512. else { $propert->id = ''; }
  513. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  514. else { $propert->class = ''; }
  515. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  516. else { $propert->style = ''; }
  517. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  518. else { $propert->events = ''; }
  519. $output = "<input type=\"file\"".$propert->name.$propert->disabled.$propert->size.$propert->accept.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  520. if ($return) {
  521. return $output;
  522. } else {
  523. echo $output;
  524. }
  525. }
  526. /**
  527. * Defines the start of an input field where the user can enter data.
  528. *
  529. * @param array $propert is an object with several properties.
  530. * <ul>
  531. * <li>$propert->name, defines a unique name for the input element.
  532. * <li>$propert->value, value for the input element.
  533. * <li>$propert->id, a unique id for the element.
  534. * <li>$propert->class, the class of the element.
  535. * <li>$propert->style, an inline style definition.
  536. * <li>$propert->events, event attributes.
  537. * </ul>
  538. * @param bool $return whether to return an output string or echo now.
  539. */
  540. function wiki_input_hidden($propert=null, $return=false){
  541. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  542. else { $propert->name = ''; }
  543. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  544. else { $propert->value = ''; }
  545. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  546. else { $propert->id = ''; }
  547. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  548. else { $propert->class = ''; }
  549. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  550. else { $propert->style = ''; }
  551. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  552. else { $propert->events = ''; }
  553. $output = "<input type=\"hidden\"".$propert->name.$propert->value.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  554. if ($return) {
  555. return $output;
  556. } else {
  557. echo $output;
  558. }
  559. }
  560. /**
  561. * Defines the start of an input field where the user can enter data.
  562. *
  563. * @param array $propert is an object with several properties.
  564. * <ul>
  565. * <li>$propert->name, defines a unique name for the input element.
  566. * <li>$propert->value, value for the input element.
  567. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  568. * <li>$propert->size, defines the size of the input element.
  569. * <li>$propert->alt, defines an alternate text for the image.
  570. * <li>$propert->src, defines the URL of the image to display.
  571. * <li>$propert->id, a unique id for the element.
  572. * <li>$propert->class, the class of the element.
  573. * <li>$propert->style, an inline style definition.
  574. * <li>$propert->events, event attributes.
  575. * </ul>
  576. * @param bool $return whether to return an output string or echo now.
  577. */
  578. function wiki_input_image($propert=null, $return=false){
  579. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  580. else { $propert->name = ''; }
  581. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  582. else { $propert->value = ''; }
  583. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  584. else { $propert->disabled = ''; }
  585. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  586. else { $propert->size = ''; }
  587. if (isset($propert->alt)) { $propert->alt = ' alt="'.$propert->alt.'"'; }
  588. else { $propert->alt = ''; }
  589. if (isset($propert->src)) { $propert->src = ' src="'.$propert->src.'"'; }
  590. else { $propert->src = ''; }
  591. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  592. else { $propert->id = ''; }
  593. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  594. else { $propert->class = ''; }
  595. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  596. else { $propert->style = ''; }
  597. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  598. else { $propert->events = ''; }
  599. $output = "<input type=\"image\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->alt.$propert->src.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  600. if ($return) {
  601. return $output;
  602. } else {
  603. echo $output;
  604. }
  605. }
  606. /**
  607. * Defines the start of an input field where the user can enter data.
  608. *
  609. * @param array $propert is an object with several properties.
  610. * <ul>
  611. * <li>$propert->name, defines a unique name for the input element.
  612. * <li>$propert->value, value for the input element.
  613. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  614. * <li>$propert->size, defines the size of the input element.
  615. * <li>$propert->id, a unique id for the element.
  616. * <li>$propert->class, the class of the element.
  617. * <li>$propert->style, an inline style definition.
  618. * <li>$propert->events, event attributes.
  619. * </ul>
  620. * @param bool $return whether to return an output string or echo now.
  621. */
  622. function wiki_input_password($propert=null, $return=false){
  623. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  624. else { $propert->name = ''; }
  625. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  626. else { $propert->value = ''; }
  627. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  628. else { $propert->disabled = ''; }
  629. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  630. else { $propert->size = ''; }
  631. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  632. else { $propert->id = ''; }
  633. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  634. else { $propert->class = ''; }
  635. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  636. else { $propert->style = ''; }
  637. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  638. else { $propert->events = ''; }
  639. $output = "<input type=\"password\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  640. if ($return) {
  641. return $output;
  642. } else {
  643. echo $output;
  644. }
  645. }
  646. /**
  647. * Defines the start of an input field where the user can enter data.
  648. *
  649. * @param array $propert is an object with several properties.
  650. * <ul>
  651. * <li>$propert->name, defines a unique name for the input element.
  652. * <li>$propert->value, value for the input element.
  653. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  654. * <li>$propert->size, defines the size of the input element.
  655. * <li>$propert->checked, indicates that the input element should be checked when it first loads.
  656. * <li>$propert->id, a unique id for the element.
  657. * <li>$propert->class, the class of the element.
  658. * <li>$propert->style, an inline style definition.
  659. * <li>$propert->events, event attributes.
  660. * </ul>
  661. * @param bool $return whether to return an output string or echo now.
  662. */
  663. function wiki_input_radio($propert=null, $return=false){
  664. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  665. else { $propert->name = ''; }
  666. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  667. else { $propert->value = ''; }
  668. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  669. else { $propert->disabled = ''; }
  670. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  671. else { $propert->size = ''; }
  672. if (isset($propert->checked)) { $propert->checked = ' checked="checked"'; }
  673. else { $propert->checked = ''; }
  674. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  675. else { $propert->id = ''; }
  676. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  677. else { $propert->class = ''; }
  678. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  679. else { $propert->style = ''; }
  680. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  681. else { $propert->events = ''; }
  682. $output = "<input type=\"radio\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->checked.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  683. if ($return) {
  684. return $output;
  685. } else {
  686. echo $output;
  687. }
  688. }
  689. /**
  690. * Defines the start of an input field where the user can enter data.
  691. *
  692. * @param array $propert is an object with several properties.
  693. * <ul>
  694. * <li>$propert->name, defines a unique name for the input element.
  695. * <li>$propert->value, value for the input element.
  696. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  697. * <li>$propert->size, defines the size of the input element.
  698. * <li>$propert->id, a unique id for the element.
  699. * <li>$propert->class, the class of the element.
  700. * <li>$propert->style, an inline style definition.
  701. * <li>$propert->events, event attributes.
  702. * </ul>
  703. * @param bool $return whether to return an output string or echo now.
  704. */
  705. function wiki_input_reset($propert=null, $return=false){
  706. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  707. else { $propert->name = ''; }
  708. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  709. else { $propert->value = ''; }
  710. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  711. else { $propert->disabled = ''; }
  712. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  713. else { $propert->size = ''; }
  714. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  715. else { $propert->id = ''; }
  716. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  717. else { $propert->class = ''; }
  718. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  719. else { $propert->style = ''; }
  720. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  721. else { $propert->events = ''; }
  722. $output = "<input type=\"reset\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  723. if ($return) {
  724. return $output;
  725. } else {
  726. echo $output;
  727. }
  728. }
  729. /**
  730. * Defines the start of an input field where the user can enter data.
  731. *
  732. * @param array $propert is an object with several properties.
  733. * <ul>
  734. * <li>$propert->name, defines a unique name for the input element.
  735. * <li>$propert->value, value for the input element.
  736. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  737. * <li>$propert->size, defines the size of the input element.
  738. * <li>$propert->id, a unique id for the element.
  739. * <li>$propert->class, the class of the element.
  740. * <li>$propert->style, an inline style definition.
  741. * <li>$propert->events, event attributes.
  742. * </ul>
  743. * @param bool $return whether to return an output string or echo now.
  744. */
  745. function wiki_input_submit($propert=null, $return=false){
  746. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  747. else { $propert->name = ''; }
  748. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  749. else { $propert->value = ''; }
  750. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  751. else { $propert->disabled = ''; }
  752. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  753. else { $propert->size = ''; }
  754. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  755. else { $propert->id = ''; }
  756. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  757. else { $propert->class = ''; }
  758. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  759. else { $propert->style = ''; }
  760. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  761. else { $propert->events = ''; }
  762. $output = "<input type=\"submit\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  763. if ($return) {
  764. return $output;
  765. } else {
  766. echo $output;
  767. }
  768. }
  769. /**
  770. * Defines the start of an input field where the user can enter data.
  771. *
  772. * @param array $propert is an object with several properties.
  773. * <ul>
  774. * <li>$propert->name, defines a unique name for the input element.
  775. * <li>$propert->value, value for the input element.
  776. * <li>$propert->disabled, disables the input element when it first loads so that the user can not write text in it, or select it.
  777. * <li>$propert->size, defines the size of the input element.
  778. * <li>$propert->maxlength, defines the maximum number of characters allowed in a text field.
  779. * <li>$propert->readonly, indicates that the value of this field cannot be modified.
  780. * <li>$propert->id, a unique id for the element.
  781. * <li>$propert->class, the class of the element.
  782. * <li>$propert->style, an inline style definition.
  783. * <li>$propert->events, event attributes.
  784. * </ul>
  785. * @param bool $return whether to return an output string or echo now.
  786. */
  787. function wiki_input_text($propert=null, $return=false){
  788. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  789. else { $propert->name = ''; }
  790. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  791. else { $propert->value = ''; }
  792. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  793. else { $propert->disabled = ''; }
  794. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  795. else { $propert->size = ''; }
  796. if (isset($propert->maxlength)) { $propert->maxlength = ' maxlength="'.$propert->maxlength.'"'; }
  797. else { $propert->maxlength = ''; }
  798. if (isset($propert->readonly)) { $propert->readonly = ' readonly="readonly"'; }
  799. else { $propert->readonly = ''; }
  800. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  801. else { $propert->id = ''; }
  802. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  803. else { $propert->class = ''; }
  804. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  805. else { $propert->style = ''; }
  806. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  807. else { $propert->events = ''; }
  808. $output = "<input type=\"text\"".$propert->name.$propert->value.$propert->disabled.$propert->size.$propert->maxlength.$propert->readonly.$propert->id.$propert->class.$propert->style.$propert->events." />\n";
  809. if ($return) {
  810. return $output;
  811. } else {
  812. echo $output;
  813. }
  814. }
  815. /**
  816. * Defines a label to a control. If you click the text within the label element, it is supposed to toggle the control.
  817. *
  818. * @param string $info defines the text.
  819. * @param array $propert is an object with several properties.
  820. * <ul>
  821. * <li>$propert->for, defines which form element the label is for, Set to an ID of a form element.
  822. * <li>$propert->id, a unique id for the element.
  823. * <li>$propert->class, the class of the element.
  824. * <li>$propert->style, an inline style definition.
  825. * <li>$propert->events, event attributes.
  826. * </ul>
  827. * @param bool $return whether to return an output string or echo now.
  828. */
  829. function wiki_label($info='', $propert=null, $return=false){
  830. if (isset($propert->for)) { $propert->for = ' for="'.$propert->for.'"'; }
  831. else { $propert->for = ''; }
  832. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  833. else { $propert->id = ''; }
  834. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  835. else { $propert->class = ''; }
  836. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  837. else { $propert->style = ''; }
  838. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  839. else { $propert->events = ''; }
  840. $output = "<label".$propert->for.$propert->id.$propert->class.$propert->style.$propert->events.">".$info."</label>\n";
  841. if ($return) {
  842. return $output;
  843. } else {
  844. echo $output;
  845. }
  846. }
  847. /**
  848. * Creates a drop-down list.
  849. *
  850. * @param string $options defines an option in the drop-down list.
  851. * @param array $propert is an object with several properties.
  852. * <ul>
  853. * <li>$propert->disabled, disables the drop-down list.
  854. * <li>$propert->name, defines a unique name for the drop-down list.
  855. * <li>$propert->multiple, specifies that multiple items can be selected at a time.
  856. * <li>$propert->size, defines the number of visible items in the drop-down list.
  857. * <li>$propert->id, the id of the element.
  858. * <li>$propert->class, the class of the element.
  859. * <li>$propert->style, an inline style definition.
  860. * <li>$propert->events, event attributes.
  861. * </ul>
  862. * @param bool $return whether to return an output string or echo now.
  863. */
  864. function wiki_select($options, $propert=null, $return=false){
  865. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  866. else { $propert->disabled = ''; }
  867. if (isset($propert->name)) { $propert->name = ' name="'.$propert->name.'"'; }
  868. else { $propert->name = ''; }
  869. if (isset($propert->multiple)) { $propert->multiple = ' multiple="multiple"'; }
  870. else { $propert->multiple = ''; }
  871. if (isset($propert->size)) { $propert->size = ' size="'.$propert->size.'"'; }
  872. else { $propert->size = ''; }
  873. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  874. else { $propert->id = ''; }
  875. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  876. else { $propert->class = ''; }
  877. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  878. else { $propert->style = ''; }
  879. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  880. else { $propert->events = ''; }
  881. $output = "<select".$propert->disabled.$propert->name.$propert->multiple.$propert->size.$propert->id.$propert->class.$propert->style.$propert->events.">\n".$options."</select>\n";
  882. if ($return) {
  883. return $output;
  884. } else {
  885. echo $output;
  886. }
  887. }
  888. /**
  889. * This element allows you to group choices. When you have a long list of options, groups of related choices are easier to handle.
  890. *
  891. * @param string $options defines an option in the drop-down list.
  892. * @param array $propert is an object with several properties.
  893. * <ul>
  894. * <li>$propert->label, defines the label for the option group.
  895. * <li>$propert->disabled, disables the option-group when it first loads.
  896. * <li>$propert->id, the id of the element.
  897. * <li>$propert->class, the class of the element.
  898. * <li>$propert->style, an inline style definition.
  899. * <li>$propert->events, event attributes.
  900. * </ul>
  901. * @param bool $return whether to return an output string or echo now.
  902. */
  903. function wiki_optgroup($options, $propert=null, $return=false){
  904. if (isset($propert->label)) { $propert->label = ' label="'.$propert->label.'"'; }
  905. else { $propert->label = ''; }
  906. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  907. else { $propert->disabled = ''; }
  908. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  909. else { $propert->id = ''; }
  910. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  911. else { $propert->class = ''; }
  912. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  913. else { $propert->style = ''; }
  914. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  915. else { $propert->events = ''; }
  916. $output = "<optgroup".$propert->label.$propert->disabled.$propert->id.$propert->class.$propert->style.$propert->events.">\n".$options."</optgroup>\n";
  917. if ($return) {
  918. return $output;
  919. } else {
  920. echo $output;
  921. }
  922. }
  923. /**
  924. * Defines an option in the drop-down list.
  925. *
  926. * @param string $info defines the text.
  927. * @param array $propert is an object with several properties.
  928. * <ul>
  929. * <li>$propert->disabled, specifies that the option should be disabled when it first loads.
  930. * <li>$propert->selected, specifies that the option should appear selected (will be displayed first in the list).
  931. * <li>$propert->label, defines a label to use when using <optgroup>.
  932. * <li>$propert->value, defines the value of the option to be sent to the server.
  933. * <li>$propert->class, the class of the element.
  934. * <li>$propert->style, an inline style definition.
  935. * <li>$propert->events, event attributes.
  936. * </ul>
  937. * @param bool $return whether to return an output string or echo now.
  938. */
  939. function wiki_option($info='', $propert=null, $return=false){
  940. if (isset($propert->disabled)) { $propert->disabled = ' disabled="disabled"'; }
  941. else { $propert->disabled = ''; }
  942. if (isset($propert->selected)) { $propert->selected = ' selected="selected"'; }
  943. else { $propert->selected = ''; }
  944. if (isset($propert->label)) { $propert->label = ' label="'.$propert->label.'"'; }
  945. else { $propert->label = ''; }
  946. if (isset($propert->value)) { $propert->value = ' value="'.$propert->value.'"'; }
  947. else { $propert->value = ''; }
  948. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  949. else { $propert->class = ''; }
  950. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  951. else { $propert->style = ''; }
  952. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  953. else { $propert->events = ''; }
  954. $output = "<option".$propert->disabled.$propert->selected.$propert->label.$propert->value.$propert->class.$propert->style.$propert->events.">".$info."</option>\n";
  955. if ($return) {
  956. return $output;
  957. } else {
  958. echo $output;
  959. }
  960. }
  961. /**
  962. * Inserts a horizontal rule.
  963. *
  964. * @param array $propert is an object with several properties.
  965. * <ul>
  966. * <li>$propert->class, class of this style horizontal rule.
  967. * <li>$propert->style, style of this style horizontal rule.
  968. * <li>$propert->events, event attributes.
  969. * </ul>
  970. * @param bool $return whether to return an output string or echo now.
  971. */
  972. function wiki_hr($propert=null, $return=false){
  973. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  974. else { $propert->class = ''; }
  975. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  976. else { $propert->style = ''; }
  977. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  978. else { $propert->events = ''; }
  979. $output = "<hr".$propert->class.$propert->style.$propert->events." />\n";
  980. if ($return) {
  981. return $output;
  982. } else {
  983. echo $output;
  984. }
  985. }
  986. /**
  987. * Defines a division/section in a document.
  988. *
  989. * @param string $info defines the text.
  990. * @param array $propert is an object with several properties.
  991. * <ul>
  992. * <li>$propert->class, class of this division/section.
  993. * <li>$propert->style, style of this division/section.
  994. * <li>$propert->events, event attributes.
  995. * </ul>
  996. * @param bool $return whether to return an output string or echo now.
  997. */
  998. function wiki_div($info='', $propert=null, $return=false){
  999. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  1000. else { $propert->class = ''; }
  1001. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  1002. else { $propert->style = ''; }
  1003. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  1004. else { $propert->events = ''; }
  1005. $output = "<div".$propert->class.$propert->style.$propert->events.">\n".$info."</div>";
  1006. if ($return) {
  1007. return $output;
  1008. } else {
  1009. echo $output;
  1010. }
  1011. }
  1012. /**
  1013. * Defines a division/section in a document.
  1014. *
  1015. * @param array $propert is an object with several properties.
  1016. * <ul>
  1017. * <li>$propert->id, id of this division/section.
  1018. * <li>$propert->class, class of this division/section.
  1019. * <li>$propert->style, style of this division/section.
  1020. * <li>$propert->events, event attributes.
  1021. * </ul>
  1022. * @param bool $return whether to return an output string or echo now.
  1023. */
  1024. function wiki_div_start($propert=null, $return=false){
  1025. if (isset($propert->id)) { $propert->id = ' id="'.$propert->id.'"'; }
  1026. else { $propert->id = ''; }
  1027. if (isset($propert->class)) { $propert->class = ' class="'.$propert->class.'"'; }
  1028. else { $propert->class = ''; }
  1029. if (isset($propert->style)) { $propert->style = ' style="'.$propert->style.'"'; }
  1030. else { $propert->style = ''; }
  1031. if (isset($propert->events)) { $propert->events = ' '.$propert->events; }
  1032. else { $propert->events = ''; }
  1033. $output = "<div".$propert->id.$propert->class.$propert->style.$propert->events.">\n";
  1034. if ($return) {
  1035. return $output;
  1036. } else {
  1037. echo $output;
  1038. }
  1039. }
  1040. /**
  1041. * Print the end of a division/section