Changeset 1764
- Timestamp:
- 01/21/2008 05:33:31 AM (12 months ago)
- Location:
- trunk/system/helpers
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/helpers/html.php
r1710 r1764 3 3 * HTML helper class. 4 4 * 5 * $Id :$5 * $Id$ 6 6 * 7 7 * @package Core … … 13 13 14 14 /** 15 * Method: specialchars 16 * Convert special characters to HTML entities 17 * 18 * Parameters: 19 * str - string to convert 20 * double_encode - encode existing entities 21 * 22 * Returns: 23 * Entity-encoded string. 15 * Convert special characters to HTML entities 16 * 17 * @param string string to convert 18 * @param boolean encode existing entities 19 * @return string 24 20 */ 25 21 public static function specialchars($str, $double_encode = TRUE) … … 49 45 50 46 /** 51 * Method: query_string 52 * Creates an HTTP query string from an array. 53 * 54 * Parameters: 55 * array - array of data to convert to string 56 * 57 * Returns: 58 * An HTTP query string. 47 * Creates an HTTP query string from an array. 48 * 49 * @param array array of data to convert to string 50 * @return string 59 51 */ 60 52 public static function query_string($array) … … 74 66 75 67 /** 76 * Method: anchor 77 * Create HTML link anchors. 78 * 79 * Parameters: 80 * uri - URL or URI string 81 * title - link text 82 * attributes - HTML anchor attributes 83 * protocol - non-default protocol, eg: https 84 * 85 * Returns: 86 * An HTML link anchor. 68 * Create HTML link anchors. 69 * 70 * @param string URL or URI string 71 * @param string link text 72 * @param array HTML anchor attributes 73 * @param string non-default protocol, eg: https 74 * @return string 87 75 */ 88 76 public static function anchor($uri, $title = FALSE, $attributes = FALSE, $protocol = FALSE) … … 111 99 112 100 /** 113 * Method: file_anchor 114 * Creates an HTML anchor to a file. 115 * 116 * Parameters: 117 * file - name of file to link to 118 * title - link text 119 * attributes - HTML anchor attributes 120 * protocol - non-default protocol, eg: ftp 121 * 122 * Returns: 123 * An HTML link anchor. 101 * Creates an HTML anchor to a file. 102 * 103 * @param string name of file to link to 104 * @param string link text 105 * @param array HTML anchor attributes 106 * @param string non-default protocol, eg: ftp 107 * @return string 124 108 */ 125 109 public static function file_anchor($file, $title = FALSE, $attributes = FALSE, $protocol = FALSE) … … 135 119 136 120 /** 137 * Method: panchor 138 * Similar to anchor, but with the protocol parameter first. 139 * 140 * Parameters: 141 * protocol - link protocol 142 * uri - URI or URL to link to 143 * title - link text 144 * attributes - HTML anchor attributes 145 * 146 * Returns: 147 * An HTML link anchor. 121 * Similar to anchor, but with the protocol parameter first. 122 * 123 * @param string link protocol 124 * @param string URI or URL to link to 125 * @param string link text 126 * @param array HTML anchor attributes 127 * @return string 148 128 */ 149 129 public static function panchor($protocol, $uri, $title = FALSE, $attributes = FALSE) … … 153 133 154 134 /** 155 * Method: mailto 156 * Creates a email anchor. 157 * 158 * Parameters: 159 * email - email address to send to 160 * title - link text 161 * attributes - HTML anchor attributes 162 * 163 * Returns: 164 * An HTML link anchor. 135 * Creates a email anchor. 136 * 137 * @param string email address to send to 138 * @param string link text 139 * @param array HTML anchor attributes 140 * @return string 165 141 */ 166 142 public static function mailto($email, $title = FALSE, $attributes = FALSE) … … 203 179 * Generate a "breadcrumb" list of anchors representing the URI. 204 180 * 205 * @param 206 * @return string181 * @param array segments to use as breadcrumbs, defaults to using Router::$segments 182 * @return string 207 183 */ 208 184 public static function breadcrumb($segments = NULL) … … 227 203 228 204 /** 229 * Method: stylesheet 230 * Creates a stylesheet link. 231 * 232 * Parameters: 233 * style - filename 234 * media - media type of stylesheet 235 * index - include the index_page in the link 236 * 237 * Returns: 238 * An HTML stylesheet link. 205 * Creates a stylesheet link. 206 * 207 * @param string|array filename, or array of filenames to match to array of medias 208 * @param string|array media type of stylesheet, or array to match filenames 209 * @param boolean include the index_page in the link 210 * @return string 239 211 */ 240 212 public static function stylesheet($style, $media = FALSE, $index = TRUE) … … 244 216 245 217 /** 246 * Method: link 247 * Creates a link tag. 248 * 249 * Parameters: 250 * href - filename 251 * rel - relationship 252 * type - mimetype 253 * suffix - specifies suffix of the file 254 * media - specifies on what device the document will be displayed 255 * index - include the index_page in the link 256 * 257 * Returns: 258 * An HTML stylesheet link. 218 * Creates a link tag. 219 * 220 * @param string|array filename 221 * @param string|array relationship 222 * @param string|array mimetype 223 * @param string specifies suffix of the file 224 * @param string|array specifies on what device the document will be displayed 225 * @param boolean include the index_page in the link 226 * @return string 259 227 */ 260 228 public static function link($href, $rel, $type, $suffix = FALSE, $media = FALSE, $index = TRUE) … … 285 253 286 254 /** 287 * Method: script 288 * Creates a script link. 289 * 290 * Parameters: 291 * script - filename 292 * index - include the index_page in the link 293 * 294 * Returns: 295 * An HTML script link. 255 * Creates a script link. 256 * 257 * @param string|array filename 258 * @param boolean include the index_page in the link 259 * @return string 296 260 */ 297 261 public static function script($script, $index = TRUE) … … 317 281 318 282 /** 319 * Method: image 320 * Creates a image link. 321 * 322 * Parameters: 323 * attr - array of html attributes, or an image name 324 * index - include the index_page in the link 325 * 326 * Returns: 327 * An HTML image link. 283 * Creates a image link. 284 * 285 * @param string|array array of html attributes, or an image name 286 * @param boolean include the index_page in the link 287 * @return string 328 288 */ 329 289 public static function image($attr = NULL, $index = TRUE) … … 344 304 345 305 /** 346 * Method: attributes 347 * Compiles an array of HTML attributes into an attribute string. 348 * 349 * Parameters: 350 * attrs - array of attributes 351 * 352 * Returns: 353 * HTML attribute string. 306 * Compiles an array of HTML attributes into an attribute string. 307 * 308 * @param string|array array of attributes 309 * @return string 354 310 */ 355 311 public static function attributes($attrs) -
trunk/system/helpers/valid.php
r1710 r1764 3 3 * Validation helper class. 4 4 * 5 * $Id :$5 * $Id$ 6 6 * 7 7 * @package Validation … … 13 13 14 14 /** 15 * Method: email 16 * Validate email, commonly used characters only 17 * 18 * Parameters: 19 * email - email address 20 * 21 * Returns: 22 * TRUE if email is valid, FALSE if not. 15 * Validate email, commonly used characters only 16 * 17 * @param string email address 18 * @return boolean 23 19 */ 24 20 public static function email($email) … … 28 24 29 25 /** 30 * Method: email_rfc 31 * Validate email, RFC compliant version 32 * Note: This function is LESS strict than valid_email. Choose carefully. 33 * 34 * Originally by Cal Henderson, modified to fit Kohana syntax standards: 35 * - http://www.iamcal.com/publish/articles/php/parsing_email/ 36 * - http://www.w3.org/Protocols/rfc822/ 37 * 38 * Parameters: 39 * email - email address 40 * 41 * Returns: 42 * TRUE if email is valid, FALSE if not. 26 * Validate email, RFC compliant version 27 * Note: This function is LESS strict than valid_email. Choose carefully. 28 * 29 * @see Originally by Cal Henderson, modified to fit Kohana syntax standards: 30 * @see http://www.iamcal.com/publish/articles/php/parsing_email/ 31 * @see http://www.w3.org/Protocols/rfc822/ 32 * 33 * @param string email address 34 * @return boolean 43 35 */ 44 36 public static function email_rfc($email) … … 61 53 62 54 /** 63 * Method: url 64 * Validate URL 65 * 66 * Parameters: 67 * url - URL 68 * scheme - protocol 69 * 70 * Returns: 71 * TRUE if URL is valid, FALSE if not. 55 * Validate URL 56 * 57 * @param string URL 58 * @param string protocol 59 * @return boolean 72 60 */ 73 61 public static function url($url, $scheme = 'http') … … 84 72 85 73 /** 86 * Method: ip 87 * Validate IP 88 * 89 * Parameters: 90 * ip - IP address 91 * 92 * Returns: 93 * TRUE if IP address is valid, FALSE if not. 74 * Validate IP 75 * 76 * @param string IP address 77 * @return boolean 94 78 */ 95 79 public static function ip($ip) … … 205 189 206 190 /** 207 * Method: alpha 208 * Checks whether a string consists of alphabetical characters only 209 * 210 * Parameters: 211 * str - input string 212 * utf8 - trigger UTF-8 compatibility 213 * 214 * Returns: 215 * TRUE if string only contains alphabetical characters, FALSE if not. 191 * Checks whether a string consists of alphabetical characters only. 192 * 193 * @param string input string 194 * @param boolean trigger UTF-8 compatibility 195 * @return boolean 216 196 */ 217 197 public static function alpha($str, $utf8 = FALSE) … … 223 203 224 204 /** 225 * Method: alpha_numeric 226 * Checks whether a string consists of alphabetical characters and numbers only 227 * 228 * Parameters: 229 * str - input string 230 * utf8 - trigger UTF-8 compatibility 231 * 232 * Returns: 233 * TRUE if string only contains alphabetical characters and numbers, FALSE if not. 205 * Checks whether a string consists of alphabetical characters and numbers only. 206 * 207 * @param string input string 208 * @param boolean trigger UTF-8 compatibility 209 * @return boolean 234 210 */ 235 211 public static function alpha_numeric($str, $utf8 = FALSE) … … 241 217 242 218 /** 243 * Method: alpha_dash 244 * Checks whether a string consists of alphabetical characters, numbers, underscores and dashes only 245 * 246 * Parameters: 247 * str - input string 248 * utf8 - trigger UTF-8 compatibility 249 * 250 * Returns: 251 * TRUE if string only contains alphabetical characters, numbers, underscores and dashes; FALSE if not. 219 * Checks whether a string consists of alphabetical characters, numbers, underscores and dashes only. 220 * 221 * @param string input string 222 * @param boolean trigger UTF-8 compatibility 223 * @return boolean 252 224 */ 253 225 public static function alpha_dash($str, $utf8 = FALSE) … … 259 231 260 232 /** 261 * Method: digit 262 * Checks whether a string consists of digits only (no dots or dashes) 263 * 264 * Parameters: 265 * str - input string 266 * utf8 - trigger UTF-8 compatibility 267 * 268 * Returns: 269 * TRUE if string only contains digits, FALSE if not. 233 * Checks whether a string consists of digits only (no dots or dashes). 234 * 235 * @param string input string 236 * @param boolean trigger UTF-8 compatibility 237 * @return boolean 270 238 */ 271 239 public static function digit($str, $utf8 = FALSE) … … 277 245 278 246 /** 279 * Method: numeric 280 * Checks whether a string is a valid number (negative and decimal numbers allowed) 281 * 282 * Parameters: 283 * str - input string 284 * 285 * Returns: 286 * TRUE if string is a valid number, FALSE if not. 247 * Checks whether a string is a valid number (negative and decimal numbers allowed). 248 * 249 * @param string input string 250 * @return boolean 287 251 */ 288 252 public static function numeric($str) … … 292 256 293 257 /** 294 * Method: numeric 295 * Checks whether a string is a valid text 296 * 297 * Parameters: 298 * str - input string 299 * 300 * Returns: 301 * TRUE if string is a valid text, FALSE if not. 258 * Checks whether a string is a valid text. 259 * 260 * @param string $str 261 * @return boolean 302 262 */ 303 263 public static function standard_text($str)
