PHPExcel_Writer_Excel2007
[ class tree: PHPExcel_Writer_Excel2007 ] [ index: PHPExcel_Writer_Excel2007 ] [ all elements ]

Source for file Excel2007.php

Documentation is available at Excel2007.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2010 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Writer_Excel2007
  23.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.2, 2010-01-11
  26.  */
  27.  
  28.  
  29. /** PHPExcel root directory */
  30. if (!defined('PHPEXCEL_ROOT')) {
  31.     /**
  32.      * @ignore
  33.      */
  34.     define('PHPEXCEL_ROOT'dirname(__FILE__'/../../');
  35. }
  36.  
  37. /** PHPExcel */
  38. require_once PHPEXCEL_ROOT 'PHPExcel.php';
  39.  
  40. /** PHPExcel_HashTable */
  41. require_once PHPEXCEL_ROOT 'PHPExcel/HashTable.php';
  42.  
  43. /** PHPExcel_IComparable */
  44. require_once PHPEXCEL_ROOT 'PHPExcel/IComparable.php';
  45.  
  46. /** PHPExcel_Worksheet */
  47. require_once PHPEXCEL_ROOT 'PHPExcel/Worksheet.php';
  48.  
  49. /** PHPExcel_Cell */
  50. require_once PHPEXCEL_ROOT 'PHPExcel/Cell.php';
  51.  
  52. /** PHPExcel_IWriter */
  53. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/IWriter.php';
  54.  
  55. /** PHPExcel_Shared_XMLWriter */
  56. require_once PHPEXCEL_ROOT 'PHPExcel/Shared/XMLWriter.php';
  57.  
  58. /** PHPExcel_Writer_Excel2007_WriterPart */
  59. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/WriterPart.php';
  60.  
  61. /** PHPExcel_Writer_Excel2007_StringTable */
  62. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/StringTable.php';
  63.  
  64. /** PHPExcel_Writer_Excel2007_ContentTypes */
  65. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/ContentTypes.php';
  66.  
  67. /** PHPExcel_Writer_Excel2007_DocProps */
  68. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/DocProps.php';
  69.  
  70. /** PHPExcel_Writer_Excel2007_Rels */
  71. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Rels.php';
  72.  
  73. /** PHPExcel_Writer_Excel2007_Theme */
  74. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Theme.php';
  75.  
  76. /** PHPExcel_Writer_Excel2007_Style */
  77. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Style.php';
  78.  
  79. /** PHPExcel_Writer_Excel2007_Workbook */
  80. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Workbook.php';
  81.  
  82. /** PHPExcel_Writer_Excel2007_Worksheet */
  83. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Worksheet.php';
  84.  
  85. /** PHPExcel_Writer_Excel2007_Drawing */
  86. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Drawing.php';
  87.  
  88. /** PHPExcel_Writer_Excel2007_Comments */
  89. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/Excel2007/Comments.php';
  90.  
  91.  
  92. /**
  93.  * PHPExcel_Writer_Excel2007
  94.  *
  95.  * @category   PHPExcel
  96.  * @package    PHPExcel_Writer_Excel2007
  97.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  98.  */
  99. class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
  100. {
  101.     /**
  102.      * Pre-calculate formulas
  103.      *
  104.      * @var boolean 
  105.      */
  106.     private $_preCalculateFormulas = true;
  107.  
  108.     /**
  109.      * Office2003 compatibility
  110.      *
  111.      * @var boolean 
  112.      */
  113.     private $_office2003compatibility = false;
  114.  
  115.     /**
  116.      * Private writer parts
  117.      *
  118.      * @var PHPExcel_Writer_Excel2007_WriterPart[] 
  119.      */
  120.     private $_writerParts;
  121.  
  122.     /**
  123.      * Private PHPExcel
  124.      *
  125.      * @var PHPExcel 
  126.      */
  127.     private $_spreadSheet;
  128.  
  129.     /**
  130.      * Private string table
  131.      *
  132.      * @var string[] 
  133.      */
  134.     private $_stringTable;
  135.  
  136.     /**
  137.      * Private unique PHPExcel_Style_Conditional HashTable
  138.      *
  139.      * @var PHPExcel_HashTable 
  140.      */
  141.  
  142.     /**
  143.      * Private unique PHPExcel_Style_Fill HashTable
  144.      *
  145.      * @var PHPExcel_HashTable 
  146.      */
  147.     private $_fillHashTable;
  148.  
  149.     /**
  150.      * Private unique PHPExcel_Style_Font HashTable
  151.      *
  152.      * @var PHPExcel_HashTable 
  153.      */
  154.     private $_fontHashTable;
  155.  
  156.     /**
  157.      * Private unique PHPExcel_Style_Borders HashTable
  158.      *
  159.      * @var PHPExcel_HashTable 
  160.      */
  161.     private $_bordersHashTable ;
  162.  
  163.     /**
  164.      * Private unique PHPExcel_Style_NumberFormat HashTable
  165.      *
  166.      * @var PHPExcel_HashTable 
  167.      */
  168.     private $_numFmtHashTable;
  169.  
  170.     /**
  171.      * Private unique PHPExcel_Worksheet_BaseDrawing HashTable
  172.      *
  173.      * @var PHPExcel_HashTable 
  174.      */
  175.     private $_drawingHashTable;
  176.  
  177.     /**
  178.      * Use disk caching where possible?
  179.      *
  180.      * @var boolean 
  181.      */
  182.     private $_useDiskCaching = false;
  183.     
  184.     /**
  185.      * Disk caching directory
  186.      *
  187.      * @var string 
  188.      */
  189.     private $_diskCachingDirectory;
  190.  
  191.     /**
  192.      * Create a new PHPExcel_Writer_Excel2007
  193.      *
  194.      * @param     PHPExcel    $pPHPExcel 
  195.      */
  196.     public function __construct(PHPExcel $pPHPExcel null)
  197.     {
  198.         // Assign PHPExcel
  199.         $this->setPHPExcel($pPHPExcel);
  200.         
  201.         // Set up disk caching location
  202.         $this->_diskCachingDirectory = './';
  203.  
  204.         // Initialise writer parts
  205.         $this->_writerParts['stringtable']        new PHPExcel_Writer_Excel2007_StringTable();
  206.         $this->_writerParts['contenttypes']     new PHPExcel_Writer_Excel2007_ContentTypes();
  207.         $this->_writerParts['docprops']         new PHPExcel_Writer_Excel2007_DocProps();
  208.         $this->_writerParts['rels']             new PHPExcel_Writer_Excel2007_Rels();
  209.         $this->_writerParts['theme']             new PHPExcel_Writer_Excel2007_Theme();
  210.         $this->_writerParts['style']             new PHPExcel_Writer_Excel2007_Style();
  211.         $this->_writerParts['workbook']         new PHPExcel_Writer_Excel2007_Workbook();
  212.         $this->_writerParts['worksheet']         new PHPExcel_Writer_Excel2007_Worksheet();
  213.         $this->_writerParts['drawing']             new PHPExcel_Writer_Excel2007_Drawing();
  214.         $this->_writerParts['comments']         new PHPExcel_Writer_Excel2007_Comments();
  215.  
  216.         // Assign parent IWriter
  217.         foreach ($this->_writerParts as $writer{
  218.             $writer->setParentWriter($this);
  219.         }
  220.  
  221.         // Set HashTable variables
  222.         $this->_stringTable                    = array();
  223.         $this->_stylesConditionalHashTable     = new PHPExcel_HashTable();
  224.         $this->_fillHashTable                 = new PHPExcel_HashTable();
  225.         $this->_fontHashTable                 = new PHPExcel_HashTable();
  226.         $this->_bordersHashTable             = new PHPExcel_HashTable();
  227.         $this->_numFmtHashTable             = new PHPExcel_HashTable();
  228.         $this->_drawingHashTable             = new PHPExcel_HashTable();
  229.     }
  230.  
  231.     /**
  232.      * Get writer part
  233.      *
  234.      * @param     string     $pPartName        Writer part name
  235.      * @return     PHPExcel_Writer_Excel2007_WriterPart 
  236.      */
  237.     function getWriterPart($pPartName ''{
  238.         if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
  239.             return $this->_writerParts[strtolower($pPartName)];
  240.         else {
  241.             return null;
  242.         }
  243.     }
  244.  
  245.     /**
  246.      * Save PHPExcel to file
  247.      *
  248.      * @param     string         $pFileName 
  249.      * @throws     Exception
  250.      */
  251.     public function save($pFilename null)
  252.     {
  253.         if (!is_null($this->_spreadSheet)) {
  254.             // garbage collect
  255.             $this->_spreadSheet->garbageCollect();
  256.  
  257.             // If $pFilename is php://output or php://stdout, make it a temporary file...
  258.             $originalFilename $pFilename;
  259.             if (strtolower($pFilename== 'php://output' || strtolower($pFilename== 'php://stdout'{
  260.                 $pFilename @tempnam('./''phpxltmp');
  261.                 if ($pFilename == ''{
  262.                     $pFilename $originalFilename;
  263.                 }
  264.             }
  265.  
  266.             $saveDateReturnType PHPExcel_Calculation_Functions::getReturnDateType();
  267.  
  268.             // Create string lookup table
  269.             $this->_stringTable = array();
  270.             for ($i 0$i $this->_spreadSheet->getSheetCount()++$i{
  271.                 $this->_stringTable = $this->getWriterPart('StringTable')->createStringTable($this->_spreadSheet->getSheet($i)$this->_stringTable);
  272.             }
  273.  
  274.             // Create styles dictionaries
  275.             $this->_stylesConditionalHashTable->addFromSource(     $this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet)             );
  276.             $this->_fillHashTable->addFromSource(                 $this->getWriterPart('Style')->allFills($this->_spreadSheet)             );
  277.             $this->_fontHashTable->addFromSource(                 $this->getWriterPart('Style')->allFonts($this->_spreadSheet)             );
  278.             $this->_bordersHashTable->addFromSource(             $this->getWriterPart('Style')->allBorders($this->_spreadSheet)             );
  279.             $this->_numFmtHashTable->addFromSource(             $this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet)     );
  280.  
  281.             // Create drawing dictionary
  282.             $this->_drawingHashTable->addFromSource(             $this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet)         );
  283.  
  284.             // Create new ZIP file and open it for writing
  285.             $objZip new ZipArchive();
  286.  
  287.             // Try opening the ZIP file
  288.             if ($objZip->open($pFilenameZIPARCHIVE::OVERWRITE!== true{
  289.                 if ($objZip->open($pFilenameZIPARCHIVE::CREATE!== true{
  290.                     throw new Exception("Could not open " $pFilename " for writing.");
  291.                 }
  292.             }
  293.  
  294.             // Add [Content_Types].xml to ZIP file
  295.             $objZip->addFromString('[Content_Types].xml',             $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet));
  296.  
  297.             // Add relationships to ZIP file
  298.             $objZip->addFromString('_rels/.rels',                     $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet));
  299.             $objZip->addFromString('xl/_rels/workbook.xml.rels',     $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet));
  300.  
  301.             // Add document properties to ZIP file
  302.             $objZip->addFromString('docProps/app.xml',                 $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
  303.             $objZip->addFromString('docProps/core.xml',             $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
  304.  
  305.             // Add theme to ZIP file
  306.             $objZip->addFromString('xl/theme/theme1.xml',             $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet));
  307.  
  308.             // Add string table to ZIP file
  309.             $objZip->addFromString('xl/sharedStrings.xml',             $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable));
  310.  
  311.             // Add styles to ZIP file
  312.             $objZip->addFromString('xl/styles.xml',                 $this->getWriterPart('Style')->writeStyles($this->_spreadSheet));
  313.  
  314.             // Add workbook to ZIP file
  315.             $objZip->addFromString('xl/workbook.xml',                 $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet));
  316.  
  317.             // Add worksheets
  318.             for ($i 0$i $this->_spreadSheet->getSheetCount()++$i{
  319.                 $objZip->addFromString('xl/worksheets/sheet' ($i 1'.xml'$this->getWriterPart('Worksheet')->writeWorksheet($this->_spreadSheet->getSheet($i)$this->_stringTable));
  320.             }
  321.  
  322.             // Add worksheet relationships (drawings, ...)
  323.             for ($i 0$i $this->_spreadSheet->getSheetCount()++$i{
  324.  
  325.                 // Add relationships
  326.                 $objZip->addFromString('xl/worksheets/_rels/sheet' ($i 1'.xml.rels',     $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i)($i 1)));
  327.  
  328.                 // Add drawing relationship parts
  329.                 if ($this->_spreadSheet->getSheet($i)->getDrawingCollection()->count(0{
  330.                     // Drawing relationships
  331.                     $objZip->addFromString('xl/drawings/_rels/drawing' ($i 1'.xml.rels'$this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i)));
  332.  
  333.                     // Drawings
  334.                     $objZip->addFromString('xl/drawings/drawing' ($i 1'.xml'$this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i)));
  335.                 }
  336.  
  337.                 // Add comment relationship parts
  338.                 if (count($this->_spreadSheet->getSheet($i)->getComments()) 0{
  339.                     // VML Comments
  340.                     $objZip->addFromString('xl/drawings/vmlDrawing' ($i 1'.vml'$this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i)));
  341.  
  342.                     // Comments
  343.                     $objZip->addFromString('xl/comments' ($i 1'.xml'$this->getWriterPart('Comments')->writeComments($this->_spreadSheet->getSheet($i)));
  344.                 }
  345.  
  346.                 // Add header/footer relationship parts
  347.                 if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) 0{
  348.                     // VML Drawings
  349.                     $objZip->addFromString('xl/drawings/vmlDrawingHF' ($i 1'.vml'$this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i)));
  350.  
  351.                     // VML Drawing relationships
  352.                     $objZip->addFromString('xl/drawings/_rels/vmlDrawingHF' ($i 1'.vml.rels'$this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->_spreadSheet->getSheet($i)));
  353.  
  354.                     // Media
  355.                     foreach ($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages(as $image{
  356.                         $objZip->addFromString('xl/media/' $image->getIndexedFilename()file_get_contents($image->getPath()));
  357.                     }
  358.                 }
  359.             }
  360.  
  361.             // Add media
  362.             for ($i 0$i $this->getDrawingHashTable()->count()++$i{
  363.                 if ($this->getDrawingHashTable()->getByIndex($iinstanceof PHPExcel_Worksheet_Drawing{
  364.                     $imageContents null;
  365.                     $imagePath $this->getDrawingHashTable()->getByIndex($i)->getPath();
  366.  
  367.                     if (strpos($imagePath'zip://'!== false{
  368.                         $imagePath substr($imagePath6);
  369.                         $imagePathSplitted explode('#'$imagePath);
  370.  
  371.                         $imageZip new ZipArchive();
  372.                         $imageZip->open($imagePathSplitted[0]);
  373.                         $imageContents $imageZip->getFromName($imagePathSplitted[1]);
  374.                         $imageZip->close();
  375.                         unset($imageZip);
  376.                     else {
  377.                         $imageContents file_get_contents($imagePath);
  378.                     }
  379.  
  380.                     $objZip->addFromString('xl/media/' str_replace(' ''_'$this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename())$imageContents);
  381.                 else if ($this->getDrawingHashTable()->getByIndex($iinstanceof PHPExcel_Worksheet_MemoryDrawing{
  382.                     ob_start();
  383.                     call_user_func(
  384.                         $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),
  385.                         $this->getDrawingHashTable()->getByIndex($i)->getImageResource()
  386.                     );
  387.                     $imageContents ob_get_contents();
  388.                     ob_end_clean();
  389.  
  390.                     $objZip->addFromString('xl/media/' str_replace(' ''_'$this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename())$imageContents);
  391.                 }
  392.             }
  393.  
  394.             PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
  395.  
  396.             // Close file
  397.             if ($objZip->close(=== false{
  398.                 throw new Exception("Could not close zip file $pFilename.");
  399.             }
  400.  
  401.             // If a temporary file was used, copy it to the correct file stream
  402.             if ($originalFilename != $pFilename{
  403.                 if (copy($pFilename$originalFilename=== false{
  404.                     throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
  405.                 }
  406.                 @unlink($pFilename);
  407.             }
  408.         else {
  409.             throw new Exception("PHPExcel object unassigned.");
  410.         }
  411.     }
  412.  
  413.     /**
  414.      * Get PHPExcel object
  415.      *
  416.      * @return PHPExcel 
  417.      * @throws Exception
  418.      */
  419.     public function getPHPExcel({
  420.         if (!is_null($this->_spreadSheet)) {
  421.             return $this->_spreadSheet;
  422.         else {
  423.             throw new Exception("No PHPExcel assigned.");
  424.         }
  425.     }
  426.  
  427.     /**
  428.      * Set PHPExcel object
  429.      *
  430.      * @param     PHPExcel     $pPHPExcel    PHPExcel object
  431.      * @throws    Exception
  432.      * @return PHPExcel_Writer_Excel2007 
  433.      */
  434.     public function setPHPExcel(PHPExcel $pPHPExcel null{
  435.         $this->_spreadSheet = $pPHPExcel;
  436.         return $this;
  437.     }
  438.  
  439.     /**
  440.      * Get string table
  441.      *
  442.      * @return string[] 
  443.      */
  444.     public function getStringTable({
  445.         return $this->_stringTable;
  446.     }
  447.  
  448.     /**
  449.      * Get PHPExcel_Style_Conditional HashTable
  450.      *
  451.      * @return PHPExcel_HashTable 
  452.      */
  453.     public function getStylesConditionalHashTable({
  454.         return $this->_stylesConditionalHashTable;
  455.     }
  456.  
  457.     /**
  458.      * Get PHPExcel_Style_Fill HashTable
  459.      *
  460.      * @return PHPExcel_HashTable 
  461.      */
  462.     public function getFillHashTable({
  463.         return $this->_fillHashTable;
  464.     }
  465.  
  466.     /**
  467.      * Get PHPExcel_Style_Font HashTable
  468.      *
  469.      * @return PHPExcel_HashTable 
  470.      */
  471.     public function getFontHashTable({
  472.         return $this->_fontHashTable;
  473.     }
  474.  
  475.     /**
  476.      * Get PHPExcel_Style_Borders HashTable
  477.      *
  478.      * @return PHPExcel_HashTable 
  479.      */
  480.     public function getBordersHashTable({
  481.         return $this->_bordersHashTable;
  482.     }
  483.  
  484.     /**
  485.      * Get PHPExcel_Style_NumberFormat HashTable
  486.      *
  487.      * @return PHPExcel_HashTable 
  488.      */
  489.     public function getNumFmtHashTable({
  490.         return $this->_numFmtHashTable;
  491.     }
  492.  
  493.     /**
  494.      * Get PHPExcel_Worksheet_BaseDrawing HashTable
  495.      *
  496.      * @return PHPExcel_HashTable 
  497.      */
  498.     public function getDrawingHashTable({
  499.         return $this->_drawingHashTable;
  500.     }
  501.  
  502.     /**
  503.      * Get Pre-Calculate Formulas
  504.      *
  505.      * @return boolean 
  506.      */
  507.     public function getPreCalculateFormulas({
  508.         return $this->_preCalculateFormulas;
  509.     }
  510.  
  511.     /**
  512.      * Set Pre-Calculate Formulas
  513.      *
  514.      * @param boolean $pValue    Pre-Calculate Formulas?
  515.      */
  516.     public function setPreCalculateFormulas($pValue true{
  517.         $this->_preCalculateFormulas = $pValue;
  518.     }
  519.  
  520.     /**
  521.      * Get Office2003 compatibility
  522.      *
  523.      * @return boolean 
  524.      */
  525.     public function getOffice2003Compatibility({
  526.         return $this->_office2003compatibility;
  527.     }
  528.  
  529.     /**
  530.      * Set Pre-Calculate Formulas
  531.      *
  532.      * @param boolean $pValue    Office2003 compatibility?
  533.      * @return PHPExcel_Writer_Excel2007 
  534.      */
  535.     public function setOffice2003Compatibility($pValue false{
  536.         $this->_office2003compatibility = $pValue;
  537.         return $this;
  538.     }
  539.  
  540.     /**
  541.      * Get use disk caching where possible?
  542.      *
  543.      * @return boolean 
  544.      */
  545.     public function getUseDiskCaching({
  546.         return $this->_useDiskCaching;
  547.     }
  548.  
  549.     /**
  550.      * Set use disk caching where possible?
  551.      *
  552.      * @param     boolean     $pValue 
  553.      * @param    string        $pDirectory        Disk caching directory
  554.      * @throws    Exception    Exception when directory does not exist
  555.      * @return PHPExcel_Writer_Excel2007 
  556.      */
  557.     public function setUseDiskCaching($pValue false$pDirectory null{
  558.         $this->_useDiskCaching = $pValue;
  559.         
  560.         if (!is_null($pDirectory)) {
  561.             if (is_dir($pDirectory)) {
  562.                 $this->_diskCachingDirectory = $pDirectory;
  563.             else {
  564.                 throw new Exception("Directory does not exist: $pDirectory");
  565.             }
  566.         }
  567.         return $this;
  568.     }
  569.         
  570.     /**
  571.      * Get disk caching directory
  572.      *
  573.      * @return string 
  574.      */
  575.     public function getDiskCachingDirectory({
  576.         return $this->_diskCachingDirectory;
  577.     }
  578. }

Documentation generated on Mon, 11 Jan 2010 08:09:03 +0100 by phpDocumentor 1.4.1