You are here

function styleguide_word in Style Guide 6

Same name and namespace in other branches
  1. 7 styleguide.module \styleguide_word()

Return a random word or words.

Parameters

$size: The number of words to return.

$case: A string indicating the case to return. This is the name of a PHP function. options are 'ucfirst', 'ucwords', 'strtoupper', and 'strtolower'. Defaults to return strtolower().

4 calls to styleguide_word()
hook_styleguide in ./styleguide.api.php
Register a style guide element for display.
styleguide_form in ./styleguide.module
Sample form, showing all elements.
styleguide_list in ./styleguide.module
Return a simple array of words.
styleguide_styleguide in ./styleguide.styleguide.inc
Implements hook_styleguide().

File

./styleguide.module, line 189

Code

function styleguide_word($size = 1, $case = 'strtolower') {
  $words = styleguide_lorem(1, $size, 'lower', FALSE, FALSE);
  $functions = array(
    'ucfirst',
    'ucwords',
    'strtoupper',
    'strtolower',
  );
  if (!is_null($case) && function_exists($case) && in_array($case, $functions)) {
    $words = $case($words);
  }
  return $words;
}