You are here

function advanced_forum_path_to_images in Advanced Forum 6

Same name and namespace in other branches
  1. 5 advanced_forum.module \advanced_forum_path_to_images()

Returns the path to the advanced forum image directory

2 calls to advanced_forum_path_to_images()
advanced_forum_preprocess_forum_icon in ./advanced_forum.module
Preprocesses template variables for the forum icon template.
advanced_forum_theme_image in ./advanced_forum.module
Wrapper around theme_image that automatically includes the path.

File

./advanced_forum.module, line 1248
Enables the look and feel of other popular forum software.

Code

function advanced_forum_path_to_images() {
  static $image_path;
  global $language;
  if (!$image_path) {

    // If there is an override in settings, use it
    $image_path = variable_get('advanced_forum_image_directory', '');
    if (empty($image_path)) {

      // Otherwise assume it's in the style's directory
      $image_path = advanced_forum_path_to_style() . '/images';
    }
    if (!file_exists($image_path)) {

      // If the style doesn't have an images directory, fall back to naked.
      $image_path = drupal_get_path('module', 'advanced_forum') . '/styles/naked/images';
    }
  }

  //Add language prefix to path if exist
  $language_prefix = $language->language;
  $image_path_language_prefix = $image_path . '/' . $language_prefix;
  if (file_exists($image_path_language_prefix)) {
    $image_path = $image_path_language_prefix;
  }
  return $image_path;
}