panels_cache_object Class Reference

List of all members.


Detailed Description

An object to hold caching information while it is happening.

Definition at line 624 of file plugins.inc.


Public Member Functions

 add_content ($content)
 cache ()
 panels_cache_object ()
 restore ()
 set_content ($content)

Public Attributes

 $content = ''
 $css = NULL
 $head = NULL
 $js = NULL
 $ready = FALSE

Member Function Documentation

panels_cache_object::add_content ( content  ) 

Add content to the cache. This assumes a pure stream; use set_content() if it's something else.

Definition at line 647 of file plugins.inc.

References $content.

00647                                  {
00648     $this->content .= $content;
00649   }

panels_cache_object::cache (  ) 

Set the object for storing. This overwrites.

Definition at line 658 of file plugins.inc.

References $css, and $js.

00658                    {
00659     if ($this->ready) {
00660       return;
00661     }
00662 
00663     $this->ready = TRUE;
00664 
00665     // Simple replacement for head
00666     $this->head = str_replace($this->head, '', drupal_set_html_head());
00667 
00668     // Slightly less simple for CSS:
00669     $css = drupal_add_css();
00670     $start = $this->css;
00671     $this->css = array();
00672 
00673     foreach ($css as $media => $medias) {
00674       foreach ($medias as $type => $types) {
00675         foreach ($types as $path => $preprocess) {
00676           if (!isset($start[$media][$type][$path])) {
00677             $this->css[] = array($path, $type, $media, $preprocess);
00678           }
00679         }
00680       }
00681     }
00682 
00683     $js = array();
00684     // A little less simple for js
00685     foreach (array('header', 'footer') as $scope) {
00686       $js[$scope] = drupal_add_js(NULL, NULL, $scope);
00687     }
00688 
00689     $start = $this->js;
00690     $this->js = array();
00691 
00692     foreach ($js as $scope => $scopes) {
00693       foreach ($scopes as $type => $types) {
00694         foreach ($types as $id => $info) {
00695           if (!isset($start[$scope][$type][$id])) {
00696             switch ($type) {
00697               case 'setting':
00698                 $this->js[] = array($info, $type, $scope);
00699                 break;
00700 
00701               case 'inline':
00702                 $this->js[] = array($info['code'], $type, $scope, $info['defer']);
00703                 break;
00704 
00705               default:
00706                 $this->js[] = array($id, $type, $scope, $info['defer'], $info['cache']);
00707             }
00708           }
00709         }
00710       }
00711     }
00712   }

panels_cache_object::panels_cache_object (  ) 

When constructed, take a snapshot of our existing out of band data.

Definition at line 634 of file plugins.inc.

00634                                  {
00635     $this->head = drupal_set_html_head();
00636     $this->css = drupal_add_css();
00637 
00638     foreach (array('header', 'footer') as $scope) {
00639       $this->js[$scope] = drupal_add_js(NULL, NULL, $scope);
00640     }
00641   }

panels_cache_object::restore (  ) 

Restore out of band data saved to cache.

Definition at line 717 of file plugins.inc.

00717                      {
00718     if (!empty($this->head)) {
00719       drupal_set_html_head($this->head);
00720     }
00721     if (!empty($this->css)) {
00722       foreach ($this->css as $args) {
00723         call_user_func_array('drupal_add_css', $args);
00724       }
00725     }
00726     if (!empty($this->js)) {
00727       foreach ($this->js as $args) {
00728         call_user_func_array('drupal_add_js', $args);
00729       }
00730     }
00731   }

panels_cache_object::set_content ( content  ) 

Definition at line 651 of file plugins.inc.

References $content.

00651                                  {
00652     $this->content = $content;
00653   }


Member Data Documentation

panels_cache_object::$content = ''

Definition at line 625 of file plugins.inc.

Referenced by add_content(), and set_content().

panels_cache_object::$css = NULL

Definition at line 627 of file plugins.inc.

Referenced by cache().

panels_cache_object::$head = NULL

Definition at line 626 of file plugins.inc.

panels_cache_object::$js = NULL

Definition at line 628 of file plugins.inc.

Referenced by cache().

panels_cache_object::$ready = FALSE

Definition at line 629 of file plugins.inc.


The documentation for this class was generated from the following file:

Generated on Thu Jul 29 05:00:19 2010 for Panels 2 by  doxygen 1.5.6