File indexing completed on 2025-01-12 05:22:34
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_View 0017 * @subpackage Helper 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * @see Zend_View_Helper_HtmlElement 0025 */ 0026 // require_once 'Zend/View/Helper/HtmlElement.php'; 0027 0028 /** 0029 * @category Zend 0030 * @package Zend_View 0031 * @subpackage Helper 0032 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0033 * @license http://framework.zend.com/license/new-bsd New BSD License 0034 */ 0035 class Zend_View_Helper_HtmlObject extends Zend_View_Helper_HtmlElement 0036 { 0037 /** 0038 * Output an object set 0039 * 0040 * @param string $data The data file 0041 * @param string $type Data file type 0042 * @param array $attribs Attribs for the object tag 0043 * @param array $params Params for in the object tag 0044 * @param string $content Alternative content for object 0045 * @return string 0046 */ 0047 public function htmlObject($data, $type, array $attribs = array(), array $params = array(), $content = null) 0048 { 0049 // Merge data and type 0050 $attribs = array_merge(array('data' => $data, 0051 'type' => $type), $attribs); 0052 0053 // Params 0054 $paramHtml = array(); 0055 $closingBracket = $this->getClosingBracket(); 0056 0057 foreach ($params as $param => $options) { 0058 if (is_string($options)) { 0059 $options = array('value' => $options); 0060 } 0061 0062 $options = array_merge(array('name' => $param), $options); 0063 0064 $paramHtml[] = '<param' . $this->_htmlAttribs($options) . $closingBracket; 0065 } 0066 0067 // Content 0068 if (is_array($content)) { 0069 $content = implode(self::EOL, $content); 0070 } 0071 0072 // Object header 0073 $xhtml = '<object' . $this->_htmlAttribs($attribs) . '>' . self::EOL 0074 . implode(self::EOL, $paramHtml) . self::EOL 0075 . ($content ? $content . self::EOL : '') 0076 . '</object>'; 0077 0078 return $xhtml; 0079 } 0080 }