Source for file Stylesheet.class.php
Documentation is available at Stylesheet.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
include_once( CLASSPATH. "core/PlainTextFormatter.class.php" );
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2005 Daniel Plücken <daniel@debakel.net>
* This library 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 2.1 of the License.
* This library 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 this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* Stores the type of media ...
* The constructor can be used to set the first stylesheet-class.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $classname
function Stylesheet( $classname = "", $content = "" )
if ( !empty( $classname ) )
$this->addClass( $classname, $content );
* Sets the type of media to the stylesheet.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $str_type The type of media can be comma seperated!
* Adds a stylesheet-class to this object.
* @author Daniel Plücken <daniel@debakel.net>
$this->cls_arr[$cnt][1] = $content;
* Adds a stylesheet of a html-tag to this object.
* @author Daniel Plücken <daniel@debakel.net>
function addTag( $name, $content )
$this->tag_arr[$cnt][1] = $content;
* Adds a stylesheet-id to this object.
* @author Daniel Plücken <daniel@debakel.net>
* @param string $classname*
* @param string $content*
function addId( $name, $content )
$this->id_arr[$cnt][0] = $name;
$this->id_arr[$cnt][1] = $content;
* Returns a generated string based on the attributes of this HTML-Object.
* @author Daniel Plücken <daniel@debakel.net>
$out = "<style type=\"text/css\"". (
for( $i = 0; $i < count( $this->cls_arr ); $i++ )
$out .= "\r\n.".$this->cls_arr[$i][0]. "\r\n";
$out .= PlainTextFormatter::indentText( $this->cls_arr[$i][1], 2 ). "\r\n";
for( $i = 0; $i < count( $this->id_arr ); $i++ )
$out .= "\r\n#".$this->id_arr[$i][0]. "\r\n";
$out .= PlainTextFormatter::indentText( $this->id_arr[$i][1], 2 ). "\r\n";
for( $i = 0; $i < count( $this->tag_arr ); $i++ )
$out .= "\r\n".$this->tag_arr[$i][0]. "\r\n";
$out .= PlainTextFormatter::indentText( $this->tag_arr[$i][1], 2 )
|