Development

Changeset 14576

You must first sign up to be able to contribute.

Changeset 14576

Show
Ignore:
Timestamp:
01/10/09 13:04:44 (4 years ago)
Author:
Aliaksei Shytkin
Message:

Add support for cache, fix tsTitleTest

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/tsTitlePlugin/lib/response/tsTitleWebResponse.class.php

    r14400 r14576  
    4949   */ 
    5050  public function setTitle($title, $escape = true) { 
    51      
    5251    if ($escape) { 
    5352       
     
    5756    $this->getTitle()->push($title); 
    5857  } 
     58   
     59   
     60  /** 
     61   * @see sfResponse 
     62   */ 
     63  public function serialize() 
     64  { 
     65    return serialize(array( 
     66       
     67      $this->content,  
     68      $this->statusCode,  
     69      $this->statusText,  
     70      $this->options,  
     71      $this->cookies,  
     72      $this->headerOnly,  
     73      $this->headers,  
     74      $this->metas,  
     75      $this->httpMetas,  
     76      $this->stylesheets,  
     77      $this->javascripts,  
     78      $this->slots, 
     79       
     80      $this->_title 
     81    )); 
     82  } 
     83   
     84  /** 
     85   * @see sfResponse 
     86   */ 
     87  public function unserialize($serialized) 
     88  { 
     89    list( 
     90       
     91      $this->content,  
     92      $this->statusCode,  
     93      $this->statusText,  
     94      $this->options,  
     95      $this->cookies,  
     96      $this->headerOnly,  
     97      $this->headers,  
     98      $this->metas,  
     99      $this->httpMetas,  
     100      $this->stylesheets,  
     101      $this->javascripts,  
     102      $this->slots, 
     103       
     104      $this->_title 
     105       
     106    ) = unserialize($serialized); 
     107  } 
     108   
     109  /** 
     110   * 
     111   * @see sfWebResponse  
     112   */ 
     113  public function copyProperties(sfWebResponse $response) 
     114  { 
     115    parent::copyProperties($response); 
     116    $this->_title = $response->_title; 
     117  } 
    59118} 
  • plugins/tsTitlePlugin/lib/util/tsTitle.class.php

    r14400 r14576  
    99 * @version     SVN: $Id$ 
    1010 */ 
    11 class tsTitle
     11class tsTitle implements Serializable
    1212   
    1313  /** 
     
    101101    return $this->generate(); 
    102102  } 
     103   
     104  public function serialize(){ 
     105     
     106    return serialize($this->_registry); 
     107  } 
     108   
     109  public function unserialize($serialized){ 
     110     
     111    $this->_registry = unserialize($serialized); 
     112  } 
    103113} 
  • plugins/tsTitlePlugin/test/tsTitleTest.php

    r14400 r14576  
    1212  public function testGenerateTitle() { 
    1313     
    14     $title = new myTitle(); 
     14    $title = new tsTitle(); 
    1515    $title->set(array('Preved', 'medved', 'Krossavcheg')); 
    1616     
     
    2323  public function testToString() { 
    2424     
    25     $title = new myTitle(array('alfa', 'beta', 'gamma')); 
     25    $title = new tsTitle(array('alfa', 'beta', 'gamma')); 
    2626    $this->assertEquals('alfa | beta | gamma', strval($title)); 
    2727  } 
     
    2929  public function testTitleUnshift() { 
    3030     
    31     $title = new myTitle(array('alfa', 'beta')); 
     31    $title = new tsTitle(array('alfa', 'beta')); 
    3232    $title->unshift('omikron'); 
    3333     
     
    3737  public function testTitleUnshift2() { 
    3838     
    39     $title = new myTitle(array('alfa', 'beta')); 
     39    $title = new tsTitle(array('alfa', 'beta')); 
    4040    $title->unshift('omikron'); 
    4141    $title->unshift('persey');