You are here

function wysiwyg_ui_profile_cache_get in Wysiwyg 7.2

Same name and namespace in other branches
  1. 6.2 wysiwyg.module \wysiwyg_ui_profile_cache_get()

Specialized cache function to load a profile from the editing cache.

Parameters

$name: The name of a profile to load. Currently the format name prefixed by 'format'.

Return value

The profile object, with a "locked" property indicating whether or not someone else is already editing the profile, or FALSE if not cached.

1 call to wysiwyg_ui_profile_cache_get()
wysiwyg_ui_profile_cache_load in ./wysiwyg.module
Specialized menu callback to load a profile and check its locked status.

File

./wysiwyg.module, line 925

Code

function wysiwyg_ui_profile_cache_get($name) {
  $profile = FALSE;
  if (module_exists('ctools')) {
    ctools_include('object-cache');
    $profile = ctools_object_cache_get('wysiwyg_profile', $name);
    if ($profile) {
      $profile->locked = ctools_object_cache_test('wysiwyg_profile', $name);
    }
  }
  else {

    // Fall back on simple caching in its own bin without locking.
    $cached = cache_get('wysiwyg_profile:' . $name);
    if ($cached) {
      $profile = $cached->data;
      $profile->locked = FALSE;
    }
  }
  return $profile;
}