[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The MIME_Viewer_report class is a wrapper used to load the appropriate 4 * MIME_Viewer for multipart/report data (RFC 3462). 5 * 6 * $Horde: framework/MIME/MIME/Viewer/report.php,v 1.6.10.6 2006/01/01 21:28:25 jan Exp $ 7 * 8 * Copyright 2003-2006 Michael Slusarz <slusarz@bigworm.colorado.edu> 9 * 10 * See the enclosed file COPYING for license information (LGPL). If you 11 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 12 * 13 * @author Michael Slusarz <slusarz@bigworm.colorado.edu> 14 * @since Horde 3.0 15 * @package Horde_MIME_Viewer 16 */ 17 class MIME_Viewer_report extends MIME_Viewer { 18 19 /** 20 * Stores the MIME_Viewer of the specified protocol. 21 * 22 * @var MIME_Viewer 23 */ 24 var $_viewer; 25 26 /** 27 * Render the multipart/report data. 28 * 29 * @param array $params An array of parameters needed. 30 * 31 * @return string The rendered data. 32 */ 33 function render($params = array()) 34 { 35 /* Get the appropriate MIME_Viewer for the protocol specified. */ 36 if (!($this->_resolveViewer())) { 37 return; 38 } 39 40 /* Render using the loaded MIME_Viewer object. */ 41 return $this->_viewer->render($params); 42 } 43 44 /** 45 * Returns the content-type of the Viewer used to view the part. 46 * 47 * @return string A content-type string. 48 */ 49 function getType() 50 { 51 /* Get the appropriate MIME_Viewer for the protocol specified. */ 52 if (!($this->_resolveViewer())) { 53 return 'application/octet-stream'; 54 } else { 55 return $this->_viewer->getType(); 56 } 57 } 58 59 /** 60 * Load a MIME_Viewer according to the report-type parameter stored 61 * in the MIME_Part to render. If unsuccessful, try to load a generic 62 * multipart MIME_Viewer. 63 * 64 * @access private 65 * 66 * @return boolean True on success, false on failure. 67 */ 68 function _resolveViewer() 69 { 70 $viewer = null; 71 72 if (empty($this->_viewer)) { 73 if (!($type = $this->mime_part->getContentTypeParameter('report-type'))) { 74 return false; 75 } 76 77 $viewer = &MIME_Viewer::factory($this->mime_part, 'message/' . String::lower($type)); 78 if (empty($viewer) || 79 (String::lower(get_class($viewer)) == 'mime_viewer_default')) { 80 if (!($viewer = &MIME_Viewer::factory($this->mime_part, $this->mime_part->getPrimaryType() . '/*'))) { 81 return false; 82 } 83 } 84 $this->_viewer = $viewer; 85 } 86 87 return true; 88 } 89 90 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |