added comments to html class.

This commit is contained in:
Taylor Otwell 2011-09-21 23:03:58 -05:00
parent 122dff974f
commit efed3b6eaf
1 changed files with 47 additions and 4 deletions

View File

@ -16,7 +16,15 @@ public static function entities($value)
}
/**
* Generate a JavaScript reference.
* Generate a link to a JavaScript file.
*
* <code>
* // Generate a link to a JavaScript file
* echo HTML::script('js/jquery.js');
*
* // Generate a link to a JavaScript file and add some attributes
* echo HTML::script('js/jquery.js', array('defer'));
* </code>
*
* @param string $url
* @param array $attributes
@ -30,10 +38,18 @@ public static function script($url, $attributes = array())
}
/**
* Generate a CSS reference.
* Generate a link to a CSS file.
*
* If no media type is selected, "all" will be used.
*
* <code>
* // Generate a link to a CSS file
* echo HTML::style('css/common.css');
*
* // Generate a link to a CSS file and add some attributes
* echo HTML::style('css/common.css', array('media' => 'print'));
* </code>
*
* @param string $url
* @param array $attributes
* @return string
@ -62,6 +78,14 @@ public static function span($value, $attributes = array())
/**
* Generate a HTML link.
*
* <code>
* // Generate a link to a location within the application
* echo HTML::link('user/profile', 'User Profile');
*
* // Generate a link to a location outside of the application
* echo HTML::link('http://google.com', 'Google');
* </code>
*
* @param string $url
* @param string $title
* @param array $attributes
@ -122,6 +146,14 @@ public static function link_to_secure_asset($url, $title, $attributes = array())
*
* An array of parameters may be specified to fill in URI segment wildcards.
*
* <code>
* // Generate a link to the "profile" named route
* echo HTML::link_to_route('profile', 'Profile');
*
* // Generate a link to the "profile" route and add some parameters
* echo HTML::link_to_route('profile', 'Profile', array('taylor'));
* </code>
*
* @param string $name
* @param string $title
* @param array $parameters
@ -248,7 +280,7 @@ public static function attributes($attributes)
{
$html = array();
foreach ($attributes as $key => $value)
foreach ((array) $attributes as $key => $value)
{
// Assume numeric-keyed attributes to have the same key and value.
// Example: required="required", autofocus="autofocus", etc.
@ -269,7 +301,7 @@ public static function attributes($attributes)
* @param string $value
* @return string
*/
public static function obfuscate($value)
protected static function obfuscate($value)
{
$safe = '';
@ -300,6 +332,17 @@ public static function obfuscate($value)
* Magic Method for handling dynamic static methods.
*
* This method primarily handles dynamic calls to create links to named routes.
*
* <code>
* // Generate a link to the "profile" named route
* echo HTML::link_to_profile('Profile');
*
* // Generate a link to the "profile" route and add some parameters
* echo HTML::link_to_profile('Profile', array('taylor'));
*
* // Generate a link to the "profile" named route using HTTPS
* echo HTML::link_to_secure_profile('Profile');
* </code>
*/
public static function __callStatic($method, $parameters)
{