Joomla! Platform 12.1

Source code for file /libraries/joomla/document/document.php

Documentation is available at document.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Document
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. jimport('joomla.environment.response');
  13.  
  14. /**
  15.  * Document class, provides an easy interface to parse and display a document
  16.  *
  17.  * @package     Joomla.Platform
  18.  * @subpackage  Document
  19.  * @since       11.1
  20.  */
  21. class JDocument extends JObject
  22. {
  23.     /**
  24.      * Document title
  25.      *
  26.      * @var    string 
  27.      * @since  11.1
  28.      */
  29.     public $title = '';
  30.  
  31.     /**
  32.      * Document description
  33.      *
  34.      * @var    string 
  35.      * @since  11.1
  36.      */
  37.     public $description = '';
  38.  
  39.     /**
  40.      * Document full URL
  41.      *
  42.      * @var    string 
  43.      * @since  11.1
  44.      */
  45.     public $link = '';
  46.  
  47.     /**
  48.      * Document base URL
  49.      *
  50.      * @var    string 
  51.      * @since  11.1
  52.      */
  53.     public $base = '';
  54.  
  55.     /**
  56.      * Contains the document language setting
  57.      *
  58.      * @var    string 
  59.      * @since  11.1
  60.      */
  61.     public $language = 'en-gb';
  62.  
  63.     /**
  64.      * Contains the document direction setting
  65.      *
  66.      * @var    string 
  67.      * @since  11.1
  68.      */
  69.     public $direction = 'ltr';
  70.  
  71.     /**
  72.      * Document generator
  73.      *
  74.      * @var    string 
  75.      */
  76.     public $_generator = 'Joomla! - Open Source Content Management';
  77.  
  78.     /**
  79.      * Document modified date
  80.      *
  81.      * @var    string 
  82.      * @since  11.1
  83.      */
  84.     public $_mdate = '';
  85.  
  86.     /**
  87.      * Tab string
  88.      *
  89.      * @var    string 
  90.      * @since  11.1
  91.      */
  92.     public $_tab = "\11";
  93.  
  94.     /**
  95.      * Contains the line end string
  96.      *
  97.      * @var    string 
  98.      * @since  11.1
  99.      */
  100.     public $_lineEnd = "\12";
  101.  
  102.     /**
  103.      * Contains the character encoding string
  104.      *
  105.      * @var    string 
  106.      * @since  11.1
  107.      */
  108.     public $_charset = 'utf-8';
  109.  
  110.     /**
  111.      * Document mime type
  112.      *
  113.      * @var    string 
  114.      * @since  11.1
  115.      */
  116.     public $_mime = '';
  117.  
  118.     /**
  119.      * Document namespace
  120.      *
  121.      * @var    string 
  122.      * @since  11.1
  123.      */
  124.     public $_namespace = '';
  125.  
  126.     /**
  127.      * Document profile
  128.      *
  129.      * @var    string 
  130.      * @since  11.1
  131.      */
  132.     public $_profile = '';
  133.  
  134.     /**
  135.      * Array of linked scripts
  136.      *
  137.      * @var    array 
  138.      * @since  11.1
  139.      */
  140.     public $_scripts = array();
  141.  
  142.     /**
  143.      * Array of scripts placed in the header
  144.      *
  145.      * @var    array 
  146.      * @since  11.1
  147.      */
  148.     public $_script = array();
  149.  
  150.     /**
  151.      * Array of linked style sheets
  152.      *
  153.      * @var    array 
  154.      * @since  11.1
  155.      */
  156.     public $_styleSheets = array();
  157.  
  158.     /**
  159.      * Array of included style declarations
  160.      *
  161.      * @var    array 
  162.      * @since  11.1
  163.      */
  164.     public $_style = array();
  165.  
  166.     /**
  167.      * Array of meta tags
  168.      *
  169.      * @var    array 
  170.      * @since  11.1
  171.      */
  172.     public $_metaTags = array();
  173.  
  174.     /**
  175.      * The rendering engine
  176.      *
  177.      * @var    object 
  178.      * @since  11.1
  179.      */
  180.     public $_engine = null;
  181.  
  182.     /**
  183.      * The document type
  184.      *
  185.      * @var    string 
  186.      * @since  11.1
  187.      */
  188.     public $_type = null;
  189.  
  190.     /**
  191.      * Array of buffered output
  192.      *
  193.      * @var    mixed (depends on the renderer)
  194.      * @since  11.1
  195.      */
  196.     public static $_buffer null;
  197.  
  198.     /**
  199.      * @var    array  JDocument instances container.
  200.      * @since  11.3
  201.      */
  202.     protected static $instances array();
  203.  
  204.     /**
  205.      * Class constructor.
  206.      *
  207.      * @param   array  $options  Associative array of options
  208.      *
  209.      * @since   11.1
  210.      */
  211.     public function __construct($options array())
  212.     {
  213.         parent::__construct();
  214.  
  215.         if (array_key_exists('lineend'$options))
  216.         {
  217.             $this->setLineEnd($options['lineend']);
  218.         }
  219.  
  220.         if (array_key_exists('charset'$options))
  221.         {
  222.             $this->setCharset($options['charset']);
  223.         }
  224.  
  225.         if (array_key_exists('language'$options))
  226.         {
  227.             $this->setLanguage($options['language']);
  228.         }
  229.  
  230.         if (array_key_exists('direction'$options))
  231.         {
  232.             $this->setDirection($options['direction']);
  233.         }
  234.  
  235.         if (array_key_exists('tab'$options))
  236.         {
  237.             $this->setTab($options['tab']);
  238.         }
  239.  
  240.         if (array_key_exists('link'$options))
  241.         {
  242.             $this->setLink($options['link']);
  243.         }
  244.  
  245.         if (array_key_exists('base'$options))
  246.         {
  247.             $this->setBase($options['base']);
  248.         }
  249.     }
  250.  
  251.     /**
  252.      * Returns the global JDocument object, only creating it
  253.      * if it doesn't already exist.
  254.      *
  255.      * @param   string  $type        The document type to instantiate
  256.      * @param   array   $attributes  Array of attributes
  257.      *
  258.      * @return  object  The document object.
  259.      *
  260.      * @since   11.1
  261.      * @throws  RuntimeException
  262.      */
  263.     public static function getInstance($type 'html'$attributes array())
  264.     {
  265.         $signature serialize(array($type$attributes));
  266.  
  267.         if (empty(self::$instances[$signature]))
  268.         {
  269.             $type preg_replace('/[^A-Z0-9_\.-]/i'''$type);
  270.             $path = __DIR__ . '/' $type '/' $type '.php';
  271.             $ntype null;
  272.  
  273.             // Check if the document type exists
  274.             if (!file_exists($path))
  275.             {
  276.                 // Default to the raw format
  277.                 $ntype $type;
  278.                 $type 'raw';
  279.             }
  280.  
  281.             // Determine the path and class
  282.             $class 'JDocument' $type;
  283.             if (!class_exists($class))
  284.             {
  285.                 $path = __DIR__ . '/' $type '/' $type '.php';
  286.                 if (file_exists($path))
  287.                 {
  288.                     require_once $path;
  289.                 }
  290.                 else
  291.                 {
  292.                     throw new RuntimeException('Invalid JDocument Class'500);
  293.                 }
  294.             }
  295.  
  296.             $instance new $class($attributes);
  297.             self::$instances[$signature$instance;
  298.  
  299.             if (!is_null($ntype))
  300.             {
  301.                 // Set the type to the Document type originally requested
  302.                 $instance->setType($ntype);
  303.             }
  304.         }
  305.  
  306.         return self::$instances[$signature];
  307.     }
  308.  
  309.     /**
  310.      * Set the document type
  311.      *
  312.      * @param   string  $type  Type document is to set to
  313.      *
  314.      * @return  JDocument instance of $this to allow chaining
  315.      *
  316.      * @since   11.1
  317.      */
  318.     public function setType($type)
  319.     {
  320.         $this->_type = $type;
  321.  
  322.         return $this;
  323.     }
  324.  
  325.     /**
  326.      * Returns the document type
  327.      *
  328.      * @return  string 
  329.      *
  330.      * @since   11.1
  331.      */
  332.     public function getType()
  333.     {
  334.         return $this->_type;
  335.     }
  336.  
  337.     /**
  338.      * Get the contents of the document buffer
  339.      *
  340.      * @return  The contents of the document buffer
  341.      *
  342.      * @since   11.1
  343.      */
  344.     public function getBuffer()
  345.     {
  346.         return self::$_buffer;
  347.     }
  348.  
  349.     /**
  350.      * Set the contents of the document buffer
  351.      *
  352.      * @param   string  $content  The content to be set in the buffer.
  353.      * @param   array   $options  Array of optional elements.
  354.      *
  355.      * @return  JDocument instance of $this to allow chaining
  356.      *
  357.      * @since   11.1
  358.      */
  359.     public function setBuffer($content$options array())
  360.     {
  361.         self::$_buffer $content;
  362.  
  363.         return $this;
  364.     }
  365.  
  366.     /**
  367.      * Gets a meta tag.
  368.      *
  369.      * @param   string   $name       Value of name or http-equiv tag
  370.      * @param   boolean  $httpEquiv  META type "http-equiv" defaults to null
  371.      *
  372.      * @return  string 
  373.      *
  374.      * @since   11.1
  375.      */
  376.     public function getMetaData($name$httpEquiv false)
  377.     {
  378.         $result '';
  379.         $name strtolower($name);
  380.         if ($name == 'generator')
  381.         {
  382.             $result $this->getGenerator();
  383.         }
  384.         elseif ($name == 'description')
  385.         {
  386.             $result $this->getDescription();
  387.         }
  388.         else
  389.         {
  390.             if ($httpEquiv == true)
  391.             {
  392.                 $result @$this->_metaTags['http-equiv'][$name];
  393.             }
  394.             else
  395.             {
  396.                 $result @$this->_metaTags['standard'][$name];
  397.             }
  398.         }
  399.  
  400.         return $result;
  401.     }
  402.  
  403.     /**
  404.      * Sets or alters a meta tag.
  405.      *
  406.      * @param   string   $name        Value of name or http-equiv tag
  407.      * @param   string   $content     Value of the content tag
  408.      * @param   boolean  $http_equiv  META type "http-equiv" defaults to null
  409.      *
  410.      * @return  JDocument instance of $this to allow chaining
  411.      *
  412.      * @since   11.1
  413.      */
  414.     public function setMetaData($name$content$http_equiv false)
  415.     {
  416.         $name strtolower($name);
  417.  
  418.         if ($name == 'generator')
  419.         {
  420.             $this->setGenerator($content);
  421.         }
  422.         elseif ($name == 'description')
  423.         {
  424.             $this->setDescription($content);
  425.         }
  426.         else
  427.         {
  428.             if ($http_equiv == true)
  429.             {
  430.                 $this->_metaTags['http-equiv'][$name$content;
  431.             }
  432.             else
  433.             {
  434.                 $this->_metaTags['standard'][$name$content;
  435.             }
  436.         }
  437.  
  438.         return $this;
  439.     }
  440.  
  441.     /**
  442.      * Adds a linked script to the page
  443.      *
  444.      * @param   string   $url    URL to the linked script
  445.      * @param   string   $type   Type of script. Defaults to 'text/javascript'
  446.      * @param   boolean  $defer  Adds the defer attribute.
  447.      * @param   boolean  $async  Adds the async attribute.
  448.      *
  449.      * @return  JDocument instance of $this to allow chaining
  450.      *
  451.      * @since   11.1
  452.      */
  453.     public function addScript($url$type "text/javascript"$defer false$async false)
  454.     {
  455.         $this->_scripts[$url]['mime'$type;
  456.         $this->_scripts[$url]['defer'$defer;
  457.         $this->_scripts[$url]['async'$async;
  458.  
  459.         return $this;
  460.     }
  461.  
  462.     /**
  463.      * Adds a script to the page
  464.      *
  465.      * @param   string  $content  Script
  466.      * @param   string  $type     Scripting mime (defaults to 'text/javascript')
  467.      *
  468.      * @return  JDocument instance of $this to allow chaining
  469.      *
  470.      * @since   11.1
  471.      */
  472.     public function addScriptDeclaration($content$type 'text/javascript')
  473.     {
  474.         if (!isset($this->_script[strtolower($type)]))
  475.         {
  476.             $this->_script[strtolower($type)$content;
  477.         }
  478.         else
  479.         {
  480.             $this->_script[strtolower($type).= chr(13$content;
  481.         }
  482.  
  483.         return $this;
  484.     }
  485.  
  486.     /**
  487.      * Adds a linked stylesheet to the page
  488.      *
  489.      * @param   string  $url      URL to the linked style sheet
  490.      * @param   string  $type     Mime encoding type
  491.      * @param   string  $media    Media type that this stylesheet applies to
  492.      * @param   array   $attribs  Array of attributes
  493.      *
  494.      * @return  JDocument instance of $this to allow chaining
  495.      *
  496.      * @since   11.1
  497.      */
  498.     public function addStyleSheet($url$type 'text/css'$media null$attribs array())
  499.     {
  500.         $this->_styleSheets[$url]['mime'$type;
  501.         $this->_styleSheets[$url]['media'$media;
  502.         $this->_styleSheets[$url]['attribs'$attribs;
  503.  
  504.         return $this;
  505.     }
  506.  
  507.     /**
  508.      * Adds a stylesheet declaration to the page
  509.      *
  510.      * @param   string  $content  Style declarations
  511.      * @param   string  $type     Type of stylesheet (defaults to 'text/css')
  512.      *
  513.      * @return  JDocument instance of $this to allow chaining
  514.      *
  515.      * @since   11.1
  516.      */
  517.     public function addStyleDeclaration($content$type 'text/css')
  518.     {
  519.         if (!isset($this->_style[strtolower($type)]))
  520.         {
  521.             $this->_style[strtolower($type)$content;
  522.         }
  523.         else
  524.         {
  525.             $this->_style[strtolower($type).= chr(13$content;
  526.         }
  527.  
  528.         return $this;
  529.     }
  530.  
  531.     /**
  532.      * Sets the document charset
  533.      *
  534.      * @param   string  $type  Charset encoding string
  535.      *
  536.      * @return  JDocument instance of $this to allow chaining
  537.      *
  538.      * @since   11.1
  539.      */
  540.     public function setCharset($type 'utf-8')
  541.     {
  542.         $this->_charset = $type;
  543.  
  544.         return $this;
  545.     }
  546.  
  547.     /**
  548.      * Returns the document charset encoding.
  549.      *
  550.      * @return  string 
  551.      *
  552.      * @since   11.1
  553.      */
  554.     public function getCharset()
  555.     {
  556.         return $this->_charset;
  557.     }
  558.  
  559.     /**
  560.      * Sets the global document language declaration. Default is English (en-gb).
  561.      *
  562.      * @param   string  $lang  The language to be set
  563.      *
  564.      * @return  JDocument instance of $this to allow chaining
  565.      *
  566.      * @since   11.1
  567.      */
  568.     public function setLanguage($lang "en-gb")
  569.     {
  570.         $this->language = strtolower($lang);
  571.  
  572.         return $this;
  573.     }
  574.  
  575.     /**
  576.      * Returns the document language.
  577.      *
  578.      * @return  string 
  579.      *
  580.      * @since   11.1
  581.      */
  582.     public function getLanguage()
  583.     {
  584.         return $this->language;
  585.     }
  586.  
  587.     /**
  588.      * Sets the global document direction declaration. Default is left-to-right (ltr).
  589.      *
  590.      * @param   string  $dir  The language direction to be set
  591.      *
  592.      * @return  JDocument instance of $this to allow chaining
  593.      *
  594.      * @since   11.1
  595.      */
  596.     public function setDirection($dir "ltr")
  597.     {
  598.         $this->direction = strtolower($dir);
  599.  
  600.         return $this;
  601.     }
  602.  
  603.     /**
  604.      * Returns the document direction declaration.
  605.      *
  606.      * @return  string 
  607.      *
  608.      * @since   11.1
  609.      */
  610.     public function getDirection()
  611.     {
  612.         return $this->direction;
  613.     }
  614.  
  615.     /**
  616.      * Sets the title of the document
  617.      *
  618.      * @param   string  $title  The title to be set
  619.      *
  620.      * @return  JDocument instance of $this to allow chaining
  621.      *
  622.      * @since   11.1
  623.      */
  624.     public function setTitle($title)
  625.     {
  626.         $this->title = $title;
  627.  
  628.         return $this;
  629.     }
  630.  
  631.     /**
  632.      * Return the title of the document.
  633.      *
  634.      * @return  string 
  635.      *
  636.      * @since   11.1
  637.      */
  638.     public function getTitle()
  639.     {
  640.         return $this->title;
  641.     }
  642.  
  643.     /**
  644.      * Sets the base URI of the document
  645.      *
  646.      * @param   string  $base  The base URI to be set
  647.      *
  648.      * @return  JDocument instance of $this to allow chaining
  649.      *
  650.      * @since   11.1
  651.      */
  652.     public function setBase($base)
  653.     {
  654.         $this->base = $base;
  655.  
  656.         return $this;
  657.     }
  658.  
  659.     /**
  660.      * Return the base URI of the document.
  661.      *
  662.      * @return  string 
  663.      *
  664.      * @since   11.1
  665.      */
  666.     public function getBase()
  667.     {
  668.         return $this->base;
  669.     }
  670.  
  671.     /**
  672.      * Sets the description of the document
  673.      *
  674.      * @param   string  $description  The description to set
  675.      *
  676.      * @return  JDocument instance of $this to allow chaining
  677.      *
  678.      * @since   11.1
  679.      */
  680.     public function setDescription($description)
  681.     {
  682.         $this->description = $description;
  683.  
  684.         return $this;
  685.     }
  686.  
  687.     /**
  688.      * Return the title of the page.
  689.      *
  690.      * @return  string 
  691.      *
  692.      * @since    11.1
  693.      */
  694.     public function getDescription()
  695.     {
  696.         return $this->description;
  697.     }
  698.  
  699.     /**
  700.      * Sets the document link
  701.      *
  702.      * @param   string  $url  A url
  703.      *
  704.      * @return  JDocument instance of $this to allow chaining
  705.      *
  706.      * @since   11.1
  707.      */
  708.     public function setLink($url)
  709.     {
  710.         $this->link = $url;
  711.  
  712.         return $this;
  713.     }
  714.  
  715.     /**
  716.      * Returns the document base url
  717.      *
  718.      * @return string 
  719.      *
  720.      * @since   11.1
  721.      */
  722.     public function getLink()
  723.     {
  724.         return $this->link;
  725.     }
  726.  
  727.     /**
  728.      * Sets the document generator
  729.      *
  730.      * @param   string  $generator  The generator to be set
  731.      *
  732.      * @return  JDocument instance of $this to allow chaining
  733.      *
  734.      * @since   11.1
  735.      */
  736.     public function setGenerator($generator)
  737.     {
  738.         $this->_generator = $generator;
  739.  
  740.         return $this;
  741.     }
  742.  
  743.     /**
  744.      * Returns the document generator
  745.      *
  746.      * @return  string 
  747.      *
  748.      * @since   11.1
  749.      */
  750.     public function getGenerator()
  751.     {
  752.         return $this->_generator;
  753.     }
  754.  
  755.     /**
  756.      * Sets the document modified date
  757.      *
  758.      * @param   string  $date  The date to be set
  759.      *
  760.      * @return  JDocument instance of $this to allow chaining
  761.      *
  762.      * @since   11.1
  763.      */
  764.     public function setModifiedDate($date)
  765.     {
  766.         $this->_mdate = $date;
  767.  
  768.         return $this;
  769.     }
  770.  
  771.     /**
  772.      * Returns the document modified date
  773.      *
  774.      * @return  string 
  775.      *
  776.      * @since   11.1
  777.      */
  778.     public function getModifiedDate()
  779.     {
  780.         return $this->_mdate;
  781.     }
  782.  
  783.     /**
  784.      * Sets the document MIME encoding that is sent to the browser.
  785.      *
  786.      * This usually will be text/html because most browsers cannot yet
  787.      * accept the proper mime settings for XHTML: application/xhtml+xml
  788.      * and to a lesser extent application/xml and text/xml. See the W3C note
  789.      * ({@link http://www.w3.org/TR/xhtml-media-types/}
  790.      * http://www.w3.org/TR/xhtml-media-types/}) for more details.
  791.      *
  792.      * @param   string   $type  The document type to be sent
  793.      * @param   boolean  $sync  Should the type be synced with HTML?
  794.      *
  795.      * @return  JDocument instance of $this to allow chaining
  796.      *
  797.      * @since   11.1
  798.      *
  799.      * @link    http://www.w3.org/TR/xhtml-media-types
  800.      */
  801.     public function setMimeEncoding($type 'text/html'$sync true)
  802.     {
  803.         $this->_mime = strtolower($type);
  804.  
  805.         // Syncing with meta-data
  806.         if ($sync)
  807.         {
  808.             $this->setMetaData('content-type'$type '; charset=' $this->_charsettrue);
  809.         }
  810.  
  811.         return $this;
  812.     }
  813.  
  814.     /**
  815.      * Return the document MIME encoding that is sent to the browser.
  816.      *
  817.      * @return  string 
  818.      *
  819.      * @since   11.1
  820.      */
  821.     public function getMimeEncoding()
  822.     {
  823.         return $this->_mime;
  824.     }
  825.  
  826.     /**
  827.      * Sets the line end style to Windows, Mac, Unix or a custom string.
  828.      *
  829.      * @param   string  $style  "win", "mac", "unix" or custom string.
  830.      *
  831.      * @return  JDocument instance of $this to allow chaining
  832.      *
  833.      * @since   11.1
  834.      */
  835.     public function setLineEnd($style)
  836.     {
  837.         switch ($style)
  838.         {
  839.             case 'win':
  840.                 $this->_lineEnd = "\15\12";
  841.                 break;
  842.             case 'unix':
  843.                 $this->_lineEnd = "\12";
  844.                 break;
  845.             case 'mac':
  846.                 $this->_lineEnd = "\15";
  847.                 break;
  848.             default:
  849.                 $this->_lineEnd = $style;
  850.         }
  851.  
  852.         return $this;
  853.     }
  854.  
  855.     /**
  856.      * Returns the lineEnd
  857.      *
  858.      * @return  string 
  859.      *
  860.      * @since   11.1
  861.      */
  862.     public function _getLineEnd()
  863.     {
  864.         return $this->_lineEnd;
  865.     }
  866.  
  867.     /**
  868.      * Sets the string used to indent HTML
  869.      *
  870.      * @param   string  $string  String used to indent ("\11", "\t", '  ', etc.).
  871.      *
  872.      * @return  JDocument instance of $this to allow chaining
  873.      *
  874.      * @since   11.1
  875.      */
  876.     public function setTab($string)
  877.     {
  878.         $this->_tab = $string;
  879.  
  880.         return $this;
  881.     }
  882.  
  883.     /**
  884.      * Returns a string containing the unit for indenting HTML
  885.      *
  886.      * @return  string 
  887.      *
  888.      * @since   11.1
  889.      */
  890.     public function _getTab()
  891.     {
  892.         return $this->_tab;
  893.     }
  894.  
  895.     /**
  896.      * Load a renderer
  897.      *
  898.      * @param   string  $type  The renderer type
  899.      *
  900.      * @return  JDocumentRenderer  Object or null if class does not exist
  901.      *
  902.      * @since   11.1
  903.      * @throws  RuntimeException
  904.      */
  905.     public function loadRenderer($type)
  906.     {
  907.         $class 'JDocumentRenderer' $type;
  908.  
  909.         if (!class_exists($class))
  910.         {
  911.             $path = __DIR__ . '/' $this->_type . '/renderer/' $type '.php';
  912.  
  913.             if (file_exists($path))
  914.             {
  915.                 require_once $path;
  916.             }
  917.             else
  918.             {
  919.                 throw new RuntimeException('Unable to load renderer class'500);
  920.             }
  921.         }
  922.  
  923.         if (!class_exists($class))
  924.         {
  925.             return null;
  926.         }
  927.  
  928.         $instance new $class($this);
  929.  
  930.         return $instance;
  931.     }
  932.  
  933.     /**
  934.      * Parses the document and prepares the buffers
  935.      *
  936.      * @param   array  $params  The array of parameters
  937.      *
  938.      * @return  JDocument instance of $this to allow chaining
  939.      *
  940.      * @since   11.1
  941.      */
  942.     public function parse($params array())
  943.     {
  944.         return $this;
  945.     }
  946.  
  947.     /**
  948.      * Outputs the document
  949.      *
  950.      * @param   boolean  $cache   If true, cache the output
  951.      * @param   array    $params  Associative array of attributes
  952.      *
  953.      * @return  The rendered data
  954.      *
  955.      * @since   11.1
  956.      */
  957.     public function render($cache false$params array())
  958.     {
  959.         if ($mdate $this->getModifiedDate())
  960.         {
  961.             JResponse::setHeader('Last-Modified'$mdate /* gmdate('D, d M Y H:i:s', time() + 900) . ' GMT' */);
  962.         }
  963.  
  964.         JResponse::setHeader('Content-Type'$this->_mime . ($this->_charset ? '; charset=' $this->_charset : ''));
  965.     }
  966. }
/html>