Documentation is available at Html.php
- <?php
- /*
- * This file is part of Sylar.
- *
- * Sylar is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Sylar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Sylar. If not, see <http://www.gnu.org/licenses/>.
- *
- * @copyright Copyright Sylar Development Team
- * @license http://www.gnu.org/licenses/ GNU Public License V2.0
- * @see https://launchpad.net/sylar/
- * @see http://www.giano-solutions.com
- */
- import('sylar.presentation.Format');
- /**
- * Main Html Format Class
- *
- * This class is extended from various Html Sylar Classes and collect
- * common method uses to formato HTML source
- *
- * @package Sylar
- * @version 1.0
- * @since 03/apr/08
- * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
- * @copyright Sylar Development Team
- */
- class Sylar_Html extends Sylar_Format{
- function __construct(){
- // nothing to do at the moment
- }
- function __destruct(){
- // nothing to do at the moment
- }
- // Public Methods
- /**
- * Fill Html Attributes in Tag
- * It generate the HTML tag $sTagStart with all attributes secified in the array $aAttributes
- * The array is formatted like Key=>Value, Key is the attribute name and Value is the value of attribute.
- * It ignores all null data contained in the attributes array.
- *
- * For example:
- * $sTagStart = "div";
- * $aAttributes = array("id"=>"My_ID", "class"=>"My_CSS_Class");
- *
- * calling the method:
- * fillTagAttributes($sTagStart, $aAttributes)
- * it returns a string thath contain: <div id="My_ID" class="My_CSS_Class">
- *
- * @return string
- * @param string $sTagStart The begin of the tag for example: <script or <div
- * @param array $aAttributes An array Key=>Value to insert as attributes in the Tag.
- */
- public static function fillTagAttributes($sTagStart, $aAttributes){
- if(is_null($sTagStart) || strlen(str_replace(" ", "",$sTagStart))==0){
- throw new ExceptionInSylar("HTML TAG is not declared. [Sylar_Html::fillTagAttributes]");
- return null;
- }
- $sTagStart = "<".$sTagStart;
- if(!is_null($aAttributes) && is_array($aAttributes)){
- foreach ($aAttributes as $k => $v) {
- if(!is_null($v)){
- $sTagStart .= " ".$k."=\"".$v."\"";
- }
- }
- }
- $sTagStart .= ">";
- return $sTagStart;
- }
- }
- ?>
Documentation generated on Thu, 24 Apr 2008 16:14:14 +0200 by phpDocumentor 1.3.0RC3