You are here

function sweaver_show_editor in Sweaver 6

Same name and namespace in other branches
  1. 7 sweaver.module \sweaver_show_editor()

Function to check if we are going to show the editor.

2 calls to sweaver_show_editor()
sweaver_footer in ./sweaver.module
Implementation of hook_footer().
sweaver_init in ./sweaver.module
Implementation of hook_init().

File

./sweaver.module, line 466
Sweaver functions.

Code

function sweaver_show_editor() {
  static $run = FALSE;
  static $return = FALSE;
  if (!$run) {
    $run = TRUE;

    // Let's do the check for the editor early.
    if (variable_get('sweaver_enabled', TRUE)) {

      // Path visibility.
      $path = drupal_get_path_alias($_GET['q']);
      $page_match = drupal_match_path($path, variable_get('sweaver_paths', SWEAVER_PATHS_EXCLUDE));
      if ($path != $_GET['q']) {
        $page_match = $page_match || drupal_match_path($_GET['q'], variable_get('sweaver_paths', SWEAVER_PATHS_EXCLUDE));
      }
      $page_match = !(0 xor $page_match);

      // Compare all variables.
      if (user_access('use editor') && $page_match) {
        $return = TRUE;
      }
    }
  }
  return $return;
}