Source for file styles.inc.php
Documentation is available at styles.inc.php
* This file is part of the VCL for PHP project
* Copyright (c) 2004-2007 qadram software <support@qadram.com>
* Checkout AUTHORS file for more information on the developers
* 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, or (at your option) any later version.
* 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
* A class to allow import and use stylesheets
* Builds and returs back an array of Style names based on specified
function BuildStyleList($FileName, $InclStandard, $InclID, $InclSubStyle)
if (($FileName === "") || (!file_exists($FileName))) return $array;
if (($file = fopen($FileName, "r")) == false) return $array;
// Preload File, Parse out comments
$line = fgets($file, 4096);
if ($pos === false) $line = "";
if (!$temp=== "") $lines[] = $temp;
if ((!isset ($lines)) || (count($lines) == 0)) return $array;
// Parse lines, remove CSS Definitions
while (list ($index, $line) = each($lines))
if ($pos === false) $line = "";
if (($line!== "") && (!in_array($line, $lines2)))
if ((!isset ($lines2)) || (!in_array($temp, $lines2)))
if ((!isset ($lines2)) || (count($lines2) == 0)) return $array;
while (list (, $line) = each($lines2))
while (list (, $word) = each($words))
if ($word == "") continue;
if (($pos1 === 0) || ($pos2 === 0))
$parts = split('[ .#]', $word);
$parts = split('[ .#]', $word);
if (trim($part) == "") continue;
if ((isset ($array)) && (in_array($part, $array))) continue;
if ((($InclStandard == 1) && ($pos1 === false) && ($pos2 === false))
|| (($InclID == 1) && ($pos2 === 0))
echo ("<link rel=\"stylesheet\" href=\"" . $this->_filename . "\" type=\"text/css\" />\n");
* Specifies CSS File Name
protected function readFileName() { return $this->_filename; }
protected function writeFileName($value) { $this->_filename= $value; }
function defaultFileName() { return ""; }
* Specifies if Styles array should include style names for HTML tags
protected function readIncludeStandard() { return $this->_inclstandard; }
protected function writeIncludeStandard($value) { $this->_inclstandard = $value; }
function defaultIncludeStandard() { return 0; }
* Specifies if Styles array should include class IDs
* If set to True, then to work properly IncludeSubStyle should be set to True also
protected function readIncludeID() { return $this->_inclid; }
protected function writeIncludeID($value) { $this->_inclid = $value; }
function defaultIncludeID() { return 0; }
* Specifies if Styles array should include Class Names only or
* full class definitions including tag elements
protected function readIncludeSubStyle() { return $this->_incsubstyle; }
protected function writeIncludeSubStyle($value) { $this->_incsubstyle = $value; }
function defaultIncludeSubStyle() { return 0; }
* Array of Style Names from specified CSS File
function writeStyles($value) { $this->_stylelist = $value; }
* A class to allow import and use stylesheets
function getFileName() { return $this->readFileName(); }
function setFileName($value) { $this->writeFileName($value); }
function getIncludeStandard() { return $this->readIncludeStandard(); }
function setIncludeStandard($value) { $this->writeIncludeStandard($value); }
function getIncludeID() { return $this->readIncludeID(); }
function setIncludeID($value) { $this->writeIncludeID($value); }
function getIncludeSubStyle() { return $this->readIncludeSubStyle(); }
function setIncludeSubStyle($value) { $this->writeIncludeSubStyle($value); }
|