[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/views_slideshow_imageflow/includes/ -> views_slideshow_imageflow.variables.inc (source)

   1  <?php
   2  
   3  /**
   4   * @file Contains the variables and defaults used by Views Slideshow: ImageFlow.
   5   */
   6  
   7  /**
   8   * The variable namespace for Views Slideshow: ImageFlow.
   9   */
  10  define('VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE', 'views_slideshow_imageflow__');
  11  
  12  /**
  13   * Wrapper for variable_get() that uses the Views Slideshow: ImageFlow variable
  14   * registry.
  15   *
  16   * @param string $name
  17   *  The variable name to retrieve. Note that it will be namespaced by
  18   *  pre-pending VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE, as to avoid variable
  19   *  collisions with other modules.
  20   * @param unknown $default
  21   *  An optional default variable to return if the variable hasn't been set
  22   *  yet. Note that within this module, all variables should already be set
  23   *  in the views_slideshow_imageflow_variable_default() function.
  24   * @return unknown
  25   *  Returns the stored variable or its default.
  26   *
  27   * @see views_slideshow_imageflow_variable_set()
  28   * @see views_slideshow_imageflow_variable_del()
  29   * @see views_slideshow_imageflow_variable_default()
  30   */
  31  function views_slideshow_imageflow_variable_get($name, $default = NULL) {
  32    // Allow for an override of the default.
  33    // Useful when a variable is required (like $path), but namespacing still desired.
  34    if (!isset($default)) {
  35      $default = views_slideshow_imageflow_variable_default($name);
  36    }
  37    // Namespace all variables
  38    $variable_name = VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE . $name;
  39    return variable_get($variable_name, $default);
  40  }
  41  
  42  /**
  43   * Wrapper for variable_set() for Views Slideshow: ImageFlow variable registry.
  44   *
  45   * @param string $name
  46   *  The variable name to set. Note that it will be namespaced by
  47   *  pre-pending VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE, as to avoid variable
  48   *  collisions with other modules.
  49   * @param unknown $value
  50   *  The value for which to set the variable.
  51   * @return unknown
  52   *  Returns the stored variable after setting.
  53   *
  54   * @see views_slideshow_imageflow_variable_get()
  55   * @see views_slideshow_imageflow_variable_del()
  56   * @see views_slideshow_imageflow_variable_default()
  57   */
  58  function views_slideshow_imageflow_variable_set($name, $value) {
  59    $variable_name = VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE . $name;
  60    return variable_set($variable_name, $value);
  61  }
  62  
  63  /**
  64   * Wrapper for variable_del() for Views Slideshow: ImageFlow variable registry.
  65   *
  66   * @param string $name
  67   *  The variable name to delete. Note that it will be namespaced by
  68   *  pre-pending VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE, as to avoid variable
  69   *  collisions with other modules.
  70   *
  71   * @see views_slideshow_imageflow_variable_get()
  72   * @see views_slideshow_imageflow_variable_set()
  73   * @see views_slideshow_imageflow_variable_default()
  74   */
  75  function views_slideshow_imageflow_variable_del($name) {
  76    $variable_name = VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE . $name;
  77    variable_del($variable_name);
  78  }
  79  
  80  /**
  81   * The default variables within the Views Slideshow: ImageFlow namespace.
  82   *
  83   * @param string $name
  84   *  Optional variable name to retrieve the default. Note that it has not yet
  85   *  been pre-pended with the VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE namespace at
  86   *  this time.
  87   * @return unknown
  88   *  The default value of this variable, if it's been set, or NULL, unless
  89   *  $name is NULL, in which case we return an array of all default values.
  90   *
  91   * @see views_slideshow_imageflow_variable_get()
  92   * @see views_slideshow_imageflow_variable_set()
  93   * @see views_slideshow_imageflow_variable_del()
  94   */
  95  function views_slideshow_imageflow_variable_default($name = NULL) {
  96    static $defaults;
  97  
  98    if (!isset($defaults)) {
  99      $defaults = array(
 100        // Path to ImageFlow plugin.
 101        'plugin_path' => '',
 102        // Whether to use the packed versions of the script.
 103        'packed' => TRUE,
 104        // Whether to include the CSS file.
 105        'include_css' => TRUE,
 106  
 107        // Default view settings.
 108        'aspect_ratio' => '1.964',
 109        'images_height' => '0.67',
 110        'image_cursor' => 'pointer',
 111        'slider_cursor' => 'pointer',
 112        'slider' => TRUE,
 113        'start' => 'middle',
 114        'captions' => TRUE,
 115        'imageFocusM' => '1.0',
 116        'scrollbarP' => '0.6',
 117        'imageFocusMax' => '4',
 118        'onClick' => 'function() { document.location = this.url; }',
 119      );
 120    }
 121  
 122    if (!isset($name)) {
 123      return $defaults;
 124    }
 125  
 126    if (isset($defaults[$name])) {
 127      return $defaults[$name];
 128    }
 129  }
 130  
 131  /**
 132   * Return the fully namespace variable name.
 133   *
 134   * @param string $name
 135   *  The variable name to retrieve the namespaced name.
 136   * @return string
 137   *  The fully namespace variable name, prepended with
 138   *  VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE.
 139   */
 140  function views_slideshow_imageflow_variable_name($name) {
 141    return VIEWS_SLIDESHOW_IMAGEFLOW_NAMESPACE . $name;
 142  }


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