You are here

function patterns_get_pattern in Patterns 6

Same name and namespace in other branches
  1. 5 patterns.module \patterns_get_pattern()
  2. 6.2 patterns.module \patterns_get_pattern()
  3. 7.2 includes/db.inc \patterns_get_pattern()
  4. 7 includes/db.inc \patterns_get_pattern()
7 calls to patterns_get_pattern()
patterns_edit in ./patterns.module
Menu callback to edit a patterns data
patterns_enable_pattern in ./patterns.module
patterns_enable_pattern_submit in ./patterns.module
patterns_execute_pattern_batch in ./patterns.module
patterns_get_pattern_details in ./patterns.module
Return an array with detailed information about the pattern

... See full list

File

./patterns.module, line 1068
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_get_pattern($id) {
  if (is_numeric($id)) {
    $pattern = db_fetch_object(db_query("SELECT * FROM {patterns} WHERE pid = '%d'", $id));
  }
  else {
    if (is_string($id)) {
      $pattern = db_fetch_object(db_query("SELECT * FROM {patterns} WHERE name = '%s'", $id));
    }
  }
  if (!$pattern) {
    return FALSE;
  }

  // Get the actual data. Data is stored in serialized form in the db.
  $pattern->pattern = unserialize($pattern->pattern);
  return $pattern;
}