[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/panels/includes/ -> legacy.inc (source)

   1  <?php
   2  // $Id: legacy.inc,v 1.1.2.1 2010/06/07 20:25:04 sdboyer Exp $
   3  
   4  /**
   5   * Legacy state manager for Panels.
   6   *
   7   * Checks all possible ways (using discovery of patterned method names) in which
   8   * Panels may need to operate in legacy mode,
   9   * sets variables as appropriate, and returns an informational
  10   *
  11   */
  12  class PanelsLegacyState {
  13    var $legacy = NULL;
  14  
  15    function t() {
  16      $func = get_t();
  17      $args = func_get_args();
  18      return call_user_func_array($func, $args);
  19    }
  20  
  21    function getStatus() {
  22      if (!isset($this->legacy)) {
  23        $this->determineStatus();
  24      }
  25      return $this->legacy;
  26    }
  27  
  28    /**
  29     * Run all compatibility checks.
  30     */
  31    function determineStatus() {
  32      $this->legacy = array();
  33      foreach(get_class_methods($this) as $method) {
  34        if (strtolower(substr($method, 0, 5)) == 'check') {
  35          $this->legacy[$method] = $this->$method();
  36        }
  37      }
  38      $this->legacy = array_filter($this->legacy);
  39    }
  40  
  41    /**
  42     * Compatibility checker that ensures modules that implement Panels styles
  43     * list their api as being at least 2.0; this corresponds to the change with
  44     * the initial IPE commit that made region styles take a fully rendered pane
  45     * HTML string instead of a pane object that still needed rendering.
  46     */
  47    function checkStylesIPE1() {
  48      $legacy_info = array(
  49        'explanation' => $this->t('Panels 3.6 made changes to the rendering order in a way that affects certain style plugins. The above modules implement style plugins, but have not indicated their compatibility with this new system. See !link for information on how to update style plugins to the new system.', array('!link' => url('http://drupal.org/node/###FIXME', array('external' => TRUE)))),
  50        'modules' => array(),
  51      );
  52  
  53  
  54      $naughties = &$legacy_info['modules'];
  55      $legacy = FALSE;
  56  
  57      ctools_include('plugins', 'panels');
  58      // TODO given that the plugin cache is also clearing at this time, should
  59      // check this to ensure this isn't causing some kind of weird race condition
  60      $styles = panels_get_styles();
  61  
  62      foreach ($styles as $style) {
  63        if (version_compare($style['version'], 2.0, '<') && empty($naughties[$style['module']])) {
  64          $legacy = TRUE;
  65          $naughties[$style['module']] = $this->t('Style plugins');
  66        }
  67      }
  68      variable_set('panels_legacy_rendering_mode', $legacy);
  69      return $legacy ? $legacy_info : array();
  70    }
  71  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7