You are here

function styleguide_word in Style Guide 7

Same name and namespace in other branches
  1. 6 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().

10 calls to styleguide_word()
aggregator_styleguide in modules/aggregator.inc
Implements hook_styleguide().
book_styleguide in modules/book.inc
Implements hook_styleguide().
comment_styleguide in modules/comment.inc
Implements hook_styleguide().
hook_styleguide in ./styleguide.api.php
Register a style guide element for display.
search_styleguide in modules/search.inc
Implements hook_styleguide().

... See full list

File

./styleguide.module, line 251

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;
}