created with PHPDoc 1.0alpha (modified)  

dynamic_CSS

dynamic_CSS

private class dynamic_CSS

This class provides functions for parsing, storing and returning CSS style sheets.
It stores the CSS styles in a MySql database with an owner id and a theme id.
The main purpose for this class is to provide different CSS styles for different user and themes.
The constructor expects an MySQL link identifier and the name of the MySql-Database as arguments. (See example)


Copyright (C) 2004 Nico de Haen <mail@ndh-websolutions.de>

Version 0.9 alpha

$Id: dynamic_CSS.class.php,v 0.9 2004/04/04
 
 

Public Method Summary

void

dynamic_CSS()

Constructor
array

parse_css(string $str)

parses a string, for style sheet informations and stores all the styles in a multi leveled array
void

print_css( $id, $owner)

prints a complete style sheet tag
array

get_style_arr( $id, $owner)

gets a style array from database
string

debug()

returns a string with all warnings that occured

Private Method Summary

boolean

mysql_check()

checks, weither the MySQL server is reachable
void

save_to_db(string $id, $owner, $str, $db)

stores the styles in the database
void

print_style_arr( $style_arr)

Public Field Summary

string

$mysql_host

MySql host
string

$mysql_user

MySql user
string

$mysql_pass

MySql pass
string

$mysql_db

MySql database
array

$style_arr

style_arr. Multi leveled array to store all the CSS styles
string

$warnings

for debugging

Public Method Details

dynamic_CSS

public void dynamic_CSS( )

  Constructor
defines public connection parameters and call the connect method

optional parameter (if not connected to database):
$host, $user, $password, $database

Returns void

 

parse_css

public array parse_css( string $str )

Parameter
string $str
  parses a string, for style sheet informations and stores all the styles in a multi leveled array
key of the 1st level array is the style name, key of the 2nd level arrays is the style property name
(i.e. color, font-size etc.)

Returns array $style_arr

 

print_css

public void print_css( $id, $owner )

Parameter
$id
$owner
  prints a complete style sheet tag

Gets the style info from the database and transforms it into appropriate form

Returns void

 

get_style_arr

public array get_style_arr( $id, $owner )

Parameter
$id
$owner
  gets a style array from database

Gets the style info from the database and transforms it into appropriate form

Returns array

style_arr

 

debug

public string debug( )

  returns a string with all warnings that occured

Returns string

warnings

 

Private Method Details

mysql_check

private boolean mysql_check( )

  checks, weither the MySQL server is reachable
tries to connect with the parameters set by the constructor
returns false if it fails

Returns boolean

if mysql_ping or connect successfull

 

save_to_db

private void save_to_db( string $id, $owner, $str, $db )

Parameter
string $id
CSS style sheet data
$owner
$str
$db
  stores the styles in the database
primary keys are the theme id and the owner id.
both can be chosen freely

Returns void

 

print_style_arr

private void print_style_arr( $style_arr )

Parameter
$style_arr
 

Returns void

 

Public Field Details

$mysql_host

public string $mysql_host

 

$mysql_user

public string $mysql_user

 

$mysql_pass

public string $mysql_pass

 

$mysql_db

public string $mysql_db

 

$style_arr

public array $style_arr

 

$warnings

public string $warnings

back to top