[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Document; 11 12 use Joomla\CMS\Uri\Uri; 13 14 // phpcs:disable PSR1.Files.SideEffects 15 \defined('JPATH_PLATFORM') or die; 16 // phpcs:enable PSR1.Files.SideEffects 17 18 /** 19 * Abstract class for a renderer 20 * 21 * @since 1.7.0 22 */ 23 abstract class DocumentRenderer implements RendererInterface 24 { 25 /** 26 * Reference to the Document object that instantiated the renderer 27 * 28 * @var Document 29 * @since 1.7.0 30 */ 31 protected $_doc = null; 32 33 /** 34 * Renderer mime type 35 * 36 * @var string 37 * @since 1.7.0 38 */ 39 protected $_mime = 'text/html'; 40 41 /** 42 * Class constructor 43 * 44 * @param Document $doc A reference to the Document object that instantiated the renderer 45 * 46 * @since 1.7.0 47 */ 48 public function __construct(Document $doc) 49 { 50 $this->_doc = $doc; 51 } 52 53 /** 54 * Return the content type of the renderer 55 * 56 * @return string The contentType 57 * 58 * @since 1.7.0 59 */ 60 public function getContentType() 61 { 62 return $this->_mime; 63 } 64 65 /** 66 * Convert links in a text from relative to absolute 67 * 68 * @param string $text The text processed 69 * 70 * @return string Text with converted links 71 * 72 * @since 1.7.0 73 */ 74 protected function _relToAbs($text) 75 { 76 $base = Uri::base(); 77 $text = preg_replace("/(href|src)=\"(?!http|ftp|https|mailto|data|\/\/)([^\"]*)\"/", "$1=\"$base\$2\"", $text); 78 79 return $text; 80 } 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |