You are here

function ctools_css_retrieve in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/css.inc \ctools_css_retrieve()

Retrieve a filename associated with an id of previously cached CSS.

This will ensure the file still exists and, if not, create it.

1 call to ctools_css_retrieve()
ctools_stylizer_add_css in includes/stylizer.inc
Add the necessary CSS for a stylizer plugin to the page.

File

includes/css.inc, line 88

Code

function ctools_css_retrieve($id) {
  $cache = db_fetch_object(db_query("SELECT * FROM {ctools_css_cache} WHERE cid = '%s'", $id));
  if (!$cache) {
    return;
  }
  if (!file_exists($cache->filename)) {
    $filename = ctools_css_cache($cache->css, $cache->filter);
    if ($filename != $cache->filename) {
      db_query("UPDATE {ctools_css_cache} SET filename = '%s' WHERE cid = '%s'", $filename, $id);
      $cache->filename = $filename;
    }
  }
  return $cache->filename;
}