You are here

function _img_assist_page_match in Image Assist 6

Same name and namespace in other branches
  1. 5.3 img_assist.module \_img_assist_page_match()
  2. 5 img_assist.module \_img_assist_page_match()
  3. 5.2 img_assist.module \_img_assist_page_match()
  4. 6.2 img_assist.module \_img_assist_page_match()

Determine if img_assist can render the current page.

Return value

TRUE if can render, FALSE if not allowed.

See also

block_list().

Related topics

1 call to _img_assist_page_match()
img_assist_textarea in ./img_assist.module
Add image link underneath textareas.

File

./img_assist.module, line 1556
Image Assist module

Code

function _img_assist_page_match() {
  $must_match = variable_get('img_assist_paths_type', 2);
  if ($must_match == 2) {
    return TRUE;
  }
  else {
    $paths = variable_get('img_assist_paths', "node/*\ncomment/*");
    $path = drupal_get_path_alias($_GET['q']);
    $regexp = '/^(' . preg_replace(array(
      '/(\\r\\n?|\\n)/',
      '/\\\\\\*/',
      '/(^|\\|)\\\\<front\\\\>($|\\|)/',
    ), array(
      '|',
      '.*',
      '\\1' . variable_get('site_frontpage', 'node') . '\\2',
    ), preg_quote($paths, '/')) . ')$/';
    $match = preg_match($regexp, $path);
    return $match != $must_match;
  }
}