source: sipes/modules_contrib/panels/includes/legacy.inc @ de78188

stableversion-3.0
Last change on this file since de78188 was 4f375e3, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el modulo panels

  • Propiedad mode establecida a 100644
File size: 2.3 KB
Línea 
1<?php
2
3/**
4 * Legacy state manager for Panels.
5 *
6 * Checks all possible ways (using discovery of patterned method names) in which
7 * Panels may need to operate in legacy mode,
8 * sets variables as appropriate, and returns an informational
9 *
10 */
11class PanelsLegacyState {
12  var $legacy = NULL;
13
14  function t() {
15    $func = get_t();
16    $args = func_get_args();
17    return call_user_func_array($func, $args);
18  }
19
20  function getStatus() {
21    if (!isset($this->legacy)) {
22      $this->determineStatus();
23    }
24    return $this->legacy;
25  }
26
27  /**
28   * Run all compatibility checks.
29   */
30  function determineStatus() {
31    $this->legacy = array();
32    foreach(get_class_methods($this) as $method) {
33      if (strtolower(substr($method, 0, 5)) == 'check') {
34        $this->legacy[$method] = $this->$method();
35      }
36    }
37    $this->legacy = array_filter($this->legacy);
38  }
39
40  /**
41   * Compatibility checker that ensures modules that implement Panels styles
42   * list their api as being at least 2.0; this corresponds to the change with
43   * the initial IPE commit that made region styles take a fully rendered pane
44   * HTML string instead of a pane object that still needed rendering.
45   */
46  function checkStylesIPE1() {
47    $legacy_info = array(
48      '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/865840', array('external' => TRUE)))),
49      'modules' => array(),
50    );
51
52
53    $naughties = &$legacy_info['modules'];
54    $legacy = FALSE;
55
56    ctools_include('plugins', 'panels');
57    // TODO given that the plugin cache is also clearing at this time, should
58    // check this to ensure this isn't causing some kind of weird race condition
59    $styles = panels_get_styles();
60
61    foreach ($styles as $style) {
62      if (version_compare($style['version'], 2.0, '<') && empty($naughties[$style['module']])) {
63        $legacy = TRUE;
64        $naughties[$style['module']] = $this->t('Style plugins');
65      }
66    }
67    variable_set('panels_legacy_rendering_mode', $legacy);
68    return $legacy ? $legacy_info : array();
69  }
70}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.