$title\n"; } /** * 生成meta标签。 * Create a meta. * * @param mixed $name the meta name * @param mixed $value the meta value * @static * @access public * @return string */ public static function meta($name, $value) { if($name == 'charset') return "\n"; return "\n"; } /** * 生成favicon标签。 * Create favicon tag * * @param mixed $url the url of the icon. * @static * @access public * @return string */ public static function favicon($url) { return "\n\n"; } /** * 创建图标。 * Create icon. * * @param name $name the name of the icon. * @param cssClass $class the extra css class of the icon. * @static * @access public * @return string */ public static function icon($name, $class = '') { $class = empty($class) ? ('icon-' . $name) : ('icon-' . $name . ' ' . $class); return ""; } /** * 生成rss标签。 * 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 $misc other params. * @param string $newline * @static * @access public * @return string */ static public function a($href = '', $title = '', $misc = '', $newline = true) { global $config; if(empty($title)) $title = $href; $newline = $newline ? "\n" : ''; $href = helper::processOnlyBodyParam($href); return "$title$newline"; } /** * 生成邮件链接。 * Create tags like text * * @param string $mail the email address * @param string $title the email title. * @static * @access public * @return string */ static public function mailto($mail = '', $title = '') { $html = ''; $mails = explode(',', $mail); $titles = explode(',', $title); foreach($mails as $key => $m) { if(empty($m)) continue; $t = empty($titles[$key]) ? $mail : $titles[$key]; $html .= " $t"; } return $html; } /** * 生成select标签。 * 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 $append adjust if add options[$selectedItems]. * @static * @access public * @return string */ static public function select($name = '', $options = array(), $selectedItems = "", $attrib = "", $append = false) { $options = (array)($options); if($append and !isset($options[$selectedItems])) $options[$selectedItems] = $selectedItems; if(!is_array($options) or empty($options)) return false; /* The begin. */ $id = $name; if(strpos($name, '[') !== false) $id = trim(str_replace(']', '', str_replace('[', '', $name))); $id = "id='{$id}'"; if(strpos($attrib, 'id=') !== false) $id = ''; $string = "\n"; } /** * 生成带optgroup标签的select标签。 * 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. * @static * @access public * @return string */ static public function selectGroup($name = '', $groups = array(), $selectedItems = "", $attrib = "") { if(!is_array($groups) or empty($groups)) return false; /* The begin. */ $id = $name; if(strpos($name, '[') !== false) $id = trim(str_replace(']', '', str_replace('[', '', $name))); $string = "\n"; } /** * 生成单选按钮。 * 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 $type inline or block * @static * @access public * @return string */ static public function radio($name = '', $options = array(), $checked = '', $attrib = '', $type = 'inline') { $options = (array)($options); if(!is_array($options) or empty($options)) return false; $isBlock = $type == 'block'; $string = ''; foreach($options as $key => $value) { if($isBlock) $string .= "