[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/views_slideshow_imageflow/ -> views_slideshow_imageflow.module (source)

   1  <?php
   2  
   3  /**
   4   * @file
   5   * The Views Slideshow: ImageFlow creates ImageFlow rotators with Views Slideshows.
   6   *
   7   * You need to install Views and Views Slideshow from
   8   * http://drupal.org/project/views and http://drupal.org/project/views_slideshow
   9   * respectively.
  10   *
  11   * This module also requires the ImageFlow JavaScript plugin from
  12   * http://finnrudolph.de/ImageFlow. You will need to download and extract the
  13   * plugin and copy it to your site's library directory, at
  14   * /sites/all/libraries/imageflow.
  15   *
  16   * You can find a detailed installation tutorial at
  17   * http://www.advomatic.com/blogs/aaron-winborn/imageflow-slide-shows-part-i
  18   */
  19  
  20  /* ***************************************** */
  21  /* INCLUDES                                  */
  22  /* ***************************************** */
  23  
  24  // A registry of variable_get defaults.
  25  include_once ('includes/views_slideshow_imageflow.variables.inc');
  26  
  27  /**
  28   *  Implements hook_menu().
  29   */
  30  function views_slideshow_imageflow_menu() {
  31    $items['admin/build/views/views_slideshow_imageflow'] = array(
  32      'title' => 'Views Slideshow: ImageFlow',
  33      'description' => 'Configure Views Slideshow: ImageFlow options.',
  34      'page callback' => 'drupal_get_form',
  35      'page arguments' => array('views_slideshow_imageflow_settings'),
  36      'file' => 'includes/views_slideshow_imageflow.admin.inc',
  37      'access callback' => 'user_access',
  38      'access arguments' => array('administer views'),
  39    );
  40    return $items;
  41  }
  42  
  43  /**
  44   *  Implements hook_theme().
  45   */
  46  function views_slideshow_imageflow_theme($existing, $type, $theme, $path) {
  47    return array(
  48      'views_slideshow_imageflow' => array(
  49        'arguments' => array('view' => NULL, 'options' => array(), 'rows' => array(), 'title' => ''),
  50        'template' => 'views-slideshow-imageflow',
  51        'file' => 'views_slideshow_imageflow.theme.inc',
  52        'path' => $path .'/themes',
  53      ),
  54    );
  55  }
  56  
  57  /**
  58   * Return the path to the ImageFlow plugin.
  59   *
  60   * If variable_get('views_slideshow_imageflow_plugin') has not yet been set,
  61   * then this will attempt to autodiscover the path if the imageflow.js file
  62   * exists within sites/all/libraries/* or sites/example.com/libraries/*. It will
  63   * also set the path to variable_get('views_slideshow_imageflow_plugin').
  64   *
  65   * The library is available from http://finnrudolph.de/ImageFlow.
  66   *
  67   * @param boolean $reset
  68   *  (Optional) If TRUE, then reset the variable and attempt a new autodiscovery.
  69   * @return string
  70   *  The path to the imageflow.js file.
  71   */
  72  function views_slideshow_imageflow_path($reset = FALSE) {
  73    static $path;
  74  
  75    if (!isset($path) || $reset) {
  76      if (!($path = views_slideshow_imageflow_variable_get('plugin_path')) || $reset) {
  77        $files = drupal_system_listing('^imageflow\.js$', 'libraries', 'basename', 0);
  78        if (!$files) {
  79          $files = drupal_system_listing('^imageflow\.js$', 'plugins', 'basename', 0);
  80        }
  81        if (isset($files['imageflow.js'])) {
  82          $path = dirname($files['imageflow.js']->filename);
  83          views_slideshow_imageflow_variable_set('plugin_path', $path);
  84        }
  85      }
  86    }
  87  
  88    return $path;
  89  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7