PHP Class Lime\Helper\Utils

Inheritance: extends Lime\Helper
Show file Open project: sjardim/Hugopit

Public Methods

Method Description
fixRelativeUrls ( $content, $base = '/' )
formatSize ( $size )
gravatar ( $email, $size = 40 )
resolveDependencies ( array $data ) : array resolves complicated dependencies to determine what order something can run in
safe_truncate ( string $string, integer $length, string $append = '...' ) : string Truncate a string to a specified length without cutting a word off.
sluggify ( $string, $replacement = '-', $tolower = true )
str_to_bool ( string $string, boolean $default = false ) : boolean Converts many english words that equate to true or false to boolean.

Method Details

fixRelativeUrls() public method

public fixRelativeUrls ( $content, $base = '/' )

formatSize() public method

public formatSize ( $size )

gravatar() public method

public gravatar ( $email, $size = 40 )

resolveDependencies() public method

start with an array like: array( 'a' => array('b', 'c'), 'b' => array(), 'c' => array('b') ) a depends on b and c, c depends on b, and b depends on nobody in this case we would return array('b', 'c', 'a')
public resolveDependencies ( array $data ) : array
$data array
return array

safe_truncate() public static method

Truncate a string to a specified length without cutting a word off.
public static safe_truncate ( string $string, integer $length, string $append = '...' ) : string
$string string The string to truncate
$length integer The length to truncate the string to
$append string Text to append to the string IF it gets truncated, defaults to '...'
return string

sluggify() public method

public sluggify ( $string, $replacement = '-', $tolower = true )

str_to_bool() public static method

Supports 'y', 'n', 'yes', 'no' and a few other variations.
public static str_to_bool ( string $string, boolean $default = false ) : boolean
$string string The string to convert to boolean
$default boolean The value to return if we can't match any yes/no words
return boolean