You are here

function _wysiwyg_install_get_formats in Wysiwyg 6.2

Same name and namespace in other branches
  1. 5.2 wysiwyg.install \_wysiwyg_install_get_formats()
  2. 5 wysiwyg.install \_wysiwyg_install_get_formats()
  3. 6 wysiwyg.install \_wysiwyg_install_get_formats()

Retrieve a list of input formats to associate profiles to.

1 call to _wysiwyg_install_get_formats()
wysiwyg_update_6001 in ./wysiwyg.install
Associate Wysiwyg profiles with input formats.

File

./wysiwyg.install, line 130

Code

function _wysiwyg_install_get_formats() {
  $formats = array();
  $result = db_query("SELECT format, name FROM {filter_formats}");
  while ($format = db_fetch_object($result)) {

    // Build a list of all formats.
    $formats[$format->format] = $format->name;

    // Fetch filters.
    $result2 = db_query("SELECT module, delta FROM {filters} WHERE format = %d", $format->format);
    while ($filter = db_fetch_object($result2)) {

      // If PHP filter is enabled, remove this format.
      if ($filter->module == 'php') {
        unset($formats[$format->format]);
        break;
      }
    }
  }
  return $formats;
}