diff --git a/lib/front/front.class.php b/lib/front/front.class.php
index 558ffedc31..12faaaca0c 100644
--- a/lib/front/front.class.php
+++ b/lib/front/front.class.php
@@ -9,15 +9,74 @@
* @version $Id$
* @link http://www.zentao.net
*/
+/**
+ * The html class, to build html tags.
+ *
+ * @package framework
+ */
class html
{
/**
- * create tags like text
+ * Create the title tag.
+ *
+ * @param mixed $title
+ * @access public
+ * @return string.
+ */
+ public static function title($title)
+ {
+ return "
$title\n";
+ }
+
+ /**
+ * Create a meta.
+ *
+ * @param mixed $name the meta name
+ * @param mixed $value the meta value
+ * @access public
+ * @return string
+ */
+ public static function meta($name, $value)
+ {
+ return "\n";
+ }
+
+ /**
+ * Create icon tag
+ *
+ * @param mixed $url the url of the icon.
+ * @access public
+ * @return string
+ */
+ public static function icon($url)
+ {
+ return "\n" .
+ "\n";
+
+ }
+
+ /**
+ * Create the rss tag.
+ *
+ * @param string $url
+ * @param string $title
+ * @static
+ * @access public
+ * @return string
+ */
+ public static function rss($url, $title = '')
+ {
+ return "";
+ }
+
+ /**
+ * Create tags like text
*
- * @param string $href the link url.
- * @param string $title the link title.
- * @param string $target the target window
- * @param string $misc other params.
+ * @param string $href the link url.
+ * @param string $title the link title.
+ * @param string $target the target window
+ * @param string $misc other params.
+ * @return string
*/
static public function a($href = '', $title = '', $target = "_self", $misc = '')
{
@@ -27,10 +86,11 @@ class html
}
/**
- * create tags like text
+ * Create tags like text
*
- * @param string $mail the email address
- * @param string $title the email title.
+ * @param string $mail the email address
+ * @param string $title the email title.
+ * @return string
*/
static public function mailto($mail = '', $title = '')
{
@@ -39,12 +99,13 @@ class html
}
/**
- * create tags like ""
+ * Create tags like ""
*
- * @param string $name the name of the select tag.
- * @param array $options the array to create select tag from.
- * @param string $selectedItems the item(s) to be selected, can like item1,item2.
- * @param string $attrib other params such as multiple, size and style.
+ * @param string $name the name of the select tag.
+ * @param array $options the array to create select tag from.
+ * @param string $selectedItems the item(s) to be selected, can like item1,item2.
+ * @param string $attrib other params such as multiple, size and style.
+ * @return string
*/
static public function select($name = '', $options = array(), $selectedItems = "", $attrib = "")
{
@@ -60,7 +121,7 @@ class html
$selectedItems = ",$selectedItems,";
foreach($options as $key => $value)
{
- $key = str_replace('item', '', $key); // 因为对象的元素不能为数字,所以需要在配置里面会在数字前面添加item,这个地方将item去掉。
+ $key = str_replace('item', '', $key);
$selected = strpos($selectedItems, ",$key,") !== false ? " selected='selected'" : '';
$string .= "\n";
}
@@ -70,12 +131,13 @@ class html
}
/**
- * create select with optgroup.
+ * Create select with optgroup.
*
- * @param string $name the name of the select tag.
- * @param array $groups the option groups.
- * @param string $selectedItems the item(s) to be selected, can like item1,item2.
- * @param string $attrib other params such as multiple, size and style.
+ * @param string $name the name of the select tag.
+ * @param array $groups the option groups.
+ * @param string $selectedItems the item(s) to be selected, can like item1,item2.
+ * @param string $attrib other params such as multiple, size and style.
+ * @return string
*/
static public function selectGroup($name = '', $groups = array(), $selectedItems = "", $attrib = "")
{
@@ -107,10 +169,11 @@ class html
/**
* Create tags like ""
*
- * @param string $name the name of the radio tag.
- * @param array $options the array to create radio tag from.
- * @param string $checked the value to checked by default.
- * @param string $attrib other attribs.
+ * @param string $name the name of the radio tag.
+ * @param array $options the array to create radio tag from.
+ * @param string $checked the value to checked by default.
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function radio($name = '', $options = array(), $checked = '', $attrib = '')
{
@@ -129,12 +192,13 @@ class html
}
/**
- * create tags like ""
+ * Create tags like ""
*
- * @param string $name the name of the checkbox tag.
- * @param array $options the array to create checkbox tag from.
- * @param string $checked the value to checked by default, can be item1,item2
- * @param string $attrib other attribs.
+ * @param string $name the name of the checkbox tag.
+ * @param array $options the array to create checkbox tag from.
+ * @param string $checked the value to checked by default, can be item1,item2
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function checkbox($name, $options, $checked = "", $attrib = "")
{
@@ -145,7 +209,7 @@ class html
foreach($options as $key => $value)
{
- $key = str_replace('item', '', $key); // 因为对象的元素不能为数字,所以需要在配置里面会在数字前面添加item,这个地方将item去掉。
+ $key = str_replace('item', '', $key);
$string .= ""
+ * Create tags like ""
*
- * @param string $name the name of the text input tag.
- * @param string $value the default value.
- * @param string $attrib other attribs.
+ * @param string $name the name of the text input tag.
+ * @param string $value the default value.
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function input($name, $value = "", $attrib = "")
{
@@ -167,11 +232,12 @@ class html
}
/**
- * create tags like ""
+ * Create tags like ""
*
- * @param string $name the name of the text input tag.
- * @param string $value the default value.
- * @param string $attrib other attribs.
+ * @param string $name the name of the text input tag.
+ * @param string $value the default value.
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function hidden($name, $value = "", $attrib = "")
{
@@ -179,11 +245,12 @@ class html
}
/**
- * create tags like ""
+ * Create tags like ""
*
- * @param string $name the name of the text input tag.
- * @param string $value the default value.
- * @param string $attrib other attribs.
+ * @param string $name the name of the text input tag.
+ * @param string $value the default value.
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function password($name, $value = "", $attrib = "")
{
@@ -191,11 +258,12 @@ class html
}
/**
- * create tags like ""
+ * Create tags like ""
*
- * @param string $name the name of the textarea tag.
- * @param string $value the default value of the textarea tag.
- * @param string $attrib other attribs.
+ * @param string $name the name of the textarea tag.
+ * @param string $value the default value of the textarea tag.
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function textarea($name, $value = "", $attrib = "")
{
@@ -203,10 +271,11 @@ class html
}
/**
- * create tags like "".
+ * Create tags like "".
*
- * @param string $name the name of the file name.
- * @param string $attrib other attribs.
+ * @param string $name the name of the file name.
+ * @param string $attrib other attribs.
+ * @return string
*/
static public function file($name, $attrib = "")
{
@@ -214,11 +283,13 @@ class html
}
/**
- * create submit button.
- *
+ * Create submit button.
+ *
+ * @param string $label the label of the button
+ * @param string $misc other params
* @static
* @access public
- * @return string the submit button tag.
+ * @return string the submit button tag.
*/
public static function submitButton($label = '', $misc = '')
{
@@ -231,11 +302,11 @@ class html
}
/**
- * create reset button.
- *
+ * Create reset button.
+ *
* @static
* @access public
- * @return string the reset button tag.
+ * @return string the reset button tag.
*/
public static function resetButton()
{
@@ -244,11 +315,13 @@ class html
}
/**
- * create common button.
- *
+ * Create common button.
+ *
+ * @param string $label the label of the button
+ * @param string $misc other params
* @static
* @access public
- * @return string the reset button tag.
+ * @return string the common button tag.
*/
public static function commonButton($label = '', $misc = '')
{
@@ -256,11 +329,14 @@ class html
}
/**
- * create a button with a link.
- *
+ * create a button, when click, go to a link.
+ *
+ * @param string $label the link title
+ * @param string $link the link url
+ * @param string $misc other params
* @static
* @access public
- * @return string the reset button tag.
+ * @return string
*/
public static function linkButton($label = '', $link = '', $misc = '')
{
@@ -269,198 +345,85 @@ class html
/**
* create a export link.
- *
+ *
+ * @param string $label
+ * @param string $pluginTitle
+ * @param string $misc
* @static
* @access public
- * @return string the reset button tag.
+ * @return void
*/
public static function export2csv($label = '', $pluginTitle, $misc = '')
{
return "$label\n\n";
}
-
- /*!
- * ubb2html support for php
- * @requires xhEditor
- *
- * @author Yanis.Wang
- * @site http://xheditor.com/
- * @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php)
- *
- * @Version: 0.9.8 (build 100505)
- */
-
- public static function parseUBB($sUBB)
- {
- $sHtml=$sUBB;
-
- global $emotPath,$cnum,$arrcode,$bUbb2htmlFunctionInit;$cnum=0;$arrcode=array();
- $emotPath='../xheditor_emot/';//表情根路径
-
- if(!$bUbb2htmlFunctionInit)
- {
- function saveCodeArea($match)
- {
- global $cnum,$arrcode;
- $cnum++;$arrcode[$cnum]=$match[0];
- return "[\tubbcodeplace_".$cnum."\t]";
- }
- }
-
- $sHtml=preg_replace_callback('/\[code\s*(?:=\s*((?:(?!")[\s\S])+?)(?:"[\s\S]*?)?)?\]([\s\S]*?)\[\/code\]/i','saveCodeArea',$sHtml);
-
- //$sHtml=preg_replace("/&/",'&',$sHtml);
- //$sHtml=preg_replace("/",'<',$sHtml);
- //$sHtml=preg_replace("/>/",'>',$sHtml);
- $sHtml=preg_replace("/\r?\n/",' ',$sHtml);
-
- $sHtml=preg_replace("/\[(\/?)(b|u|i|s|sup|sub)\]/i",'<$1$2>',$sHtml);
- $sHtml=preg_replace('/\[color\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','',$sHtml);
- if(!$bUbb2htmlFunctionInit)
- {
- function getSizeName($match)
- {
- $arrSize=array('8pt','10pt','12pt','14pt','18pt','24pt','36pt');
- return '';
- }
- }
- $sHtml=preg_replace_callback("/\[size\s*=\s*(\d+?)\s*\]/i",'getSizeName',$sHtml);
- $sHtml=preg_replace('/\[font\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','',$sHtml);
- $sHtml=preg_replace('/\[back\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/i','',$sHtml);
- $sHtml=preg_replace("/\[\/(color|size|font|back)\]/i",'',$sHtml);
-
- for($i=0;$i<3;$i++)$sHtml=preg_replace('/\[align\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\](((?!\[align(?:\s+[^\]]+)?\])[\s\S])*?)\[\/align\]/','