You are here

function wysiwyg_profile_load in Wysiwyg 6.2

Same name and namespace in other branches
  1. 5.2 wysiwyg.module \wysiwyg_profile_load()
  2. 7.2 wysiwyg.module \wysiwyg_profile_load()

Load profile for a given input format.

Parameters

$reset: If true, resets the load cache.

Return value

A profile if found, else FALSE.

5 calls to wysiwyg_profile_load()
wysiwyg_get_profile in ./wysiwyg.module
Determine the profile to use for a given input format id.
wysiwyg_profile_break_lock_confirm_submit in ./wysiwyg.admin.inc
Submit handler to break_lock a profile.
wysiwyg_profile_cache_clear in ./wysiwyg.module
Clear all Wysiwyg profile caches.
wysiwyg_profile_overview_validate in ./wysiwyg.admin.inc
Validate callback for Wysiwyg profile overview form.
wysiwyg_ui_profile_cache_load in ./wysiwyg.module
Specialized menu callback to load a profile and check its locked status.

File

./wysiwyg.module, line 715
Integrates client-side editors with Drupal.

Code

function wysiwyg_profile_load($format, $reset = FALSE) {
  static $profiles;
  if ($reset) {
    $profiles = NULL;
  }
  if (!isset($profiles) || !array_key_exists($format, $profiles)) {
    $result = db_query('SELECT format, editor, settings FROM {wysiwyg} WHERE format = %d', $format);
    while ($profile = db_fetch_object($result)) {
      $profile->settings = unserialize($profile->settings);
      $profile->preferences = $profile->settings['_profile_preferences'];
      unset($profile->settings['_profile_preferences']);
      $profile->name = 'format' . $profile->format;
      $profiles[$profile->format] = $profile;
    }
  }
  return isset($profiles[$format]) ? $profiles[$format] : FALSE;
}