Phpfox_Parse_Css

Description

CSS Code Parser Parses CSS code passed on by end-users and make sure the data being passed is valid.

Class is connected with the profile designer, which allows end-users the ability to create custom profiles based on CSS we allow within this class.

  • author: Raymond Benc
  • version: $Id: css.class.php 1687 2010-07-22 03:13:27Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]

Located in /include/library/phpfox/parse/css.class.php (line 19)


	
			
Method Summary
 Phpfox_Parse_Css __construct ()
 void addCss (string $sKey, string $sCodeStr)
 string cleanCss (string $sCss)
 array getBorders ()
 array getBorderStyles ()
 array getBorderWidths ()
 string getCss ()
 array getFonts ()
 array getFontSizes ()
 array getFontStyles ()
 array getFontWeights ()
 string getJavaScript ()
 array getPaddings ()
 array getPaddingSizes ()
 array getPositions ()
 array getTextAlign ()
 bool isHex (string $sHex)
 bool isImageLink (string $sHex)
 void parseCss (string $sCss)
 bool process (string $sProperty, string $sValue)
 string _build (array $aBuild)
Variables
array $_aAttachment = array(
'scroll',
'fixed'
)
(line 72)

Background Attachment (background-attachment)

  • access: private
array $_aBorderStyles = array(
'none',
'dotted',
'dashed',
'solid',
'double',
'groove',
'ridge',
'inset',
'outset',
'inherit'
)
(line 114)

Border Styles (border-style)

  • access: private
array $_aBorderWidths = array(
'0px',
'1px',
'2px',
'3px',
'4px',
'5px',
'6px',
'7px',
'8px'
)
(line 97)

Border Widths (border-width)

  • access: private
array $_aCss = '' (line 206)

ARRAY of CSS code to parse.

  • access: private
array $_aFonts = array(
'Microsoft Sans Serif',
'Verdana',
'Arial Black',
'Arial',
'Courier New',
'Palatino Linotype',
'Tahoma',
'Franklin Gothic Medium',
'Lucida Console'
)
(line 26)

Fonts (font-family)

  • access: private
array $_aFontSizes = array(
'8px',
'9px',
'10px',
'11px',
'12px',
'14px',
'16px'
)
(line 82)

Font Sizes (font-size)

  • access: private
array $_aFontStyles = array(
'normal',
'italic',
'oblique'
)
(line 149)

Font Styles (font-style)

  • access: private
array $_aFontWeights = array(
'normal',
'bold',
'bolder',
'lighter'
)
(line 160)

Font Weight (font-weight)

  • access: private
array $_aPaddingSizes = array(
'0px',
'1px',
'2px',
'3px',
'4px',
'5px',
'6px',
'7px',
'8px'
)
(line 132)

Padding (padding)

  • access: private
array $_aPositions = array(
'top left',
'top center',
'top right',
'center left',
'center center',
'center right',
'bottom left',
'bottom center',
'bottom right'
)
(line 43)

Positions (position)

  • access: private
array $_aRegex = array(
'hex' => '/^#([a-fA-F0-9]){6}$/',
'link' => '/^(?:(ftp|http|https):)?(?:\/\/(?:((?:%[0-9a-f]{2}|[\-a-z0-9_.!~*\'\(\);:&=\+\$,])+)@)?(?:((?:[a-z0-9](?:[\-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[\-a-z0-9]*[a-z0-9])?)|([0-9]{1,3}(?:\.[0-9]{1,3}){3}))(?::([0-9]*))?)?((?:\/(?:%[0-9a-f]{2}|[\-a-z0-9_.!~*\'\(\):@&=\+\$,;])+)+)?\/?(?:\?.*)?$/i'
)
(line 196)

Regex for CSS hex and image links.

  • access: private
array $_aRemoveProperties = array(
'-moz-binding'
)
(line 213)

Evil CSS properties we need to remove.

  • access: private
array $_aRepeat = array(
'no-repeat',
'repeat-x',
'repeat-y',
'repeat'
)
(line 60)

Background Repaat (background-repeat)

  • access: private
array $_aTextDecorations = array(
'none',
'underline',
'overline',
'line-through'
)
(line 184)

Text Decoration (text-decoration)

  • access: private
array $_aTextTransforms = array(
'none',
'capitalize',
'uppercase',
'lowercase'
)
(line 172)

Text Transforms (text-transform)

  • access: private
Methods
Constructor __construct (line 221)

Class constructor.

  • access: public
Phpfox_Parse_Css __construct ()
addCss (line 304)

Adds a CSS property and value to the global CSS ARRAY that will later be converted into CSS code.

  • access: public
void addCss (string $sKey, string $sCodeStr)
  • string $sKey: CSS property.
  • string $sCodeStr: CSS value.
cleanCss (line 290)

Clean out the css by running the method parseCss().

  • return: Parsed CSS code that is valid and ready for output.
  • see: self::parseCSs()
  • access: public
string cleanCss (string $sCss)
  • string $sCss: CSS code to parse.
getBorders (line 624)

Get all borders.

  • access: public
array getBorders ()
getBorderStyles (line 655)

Get all border styles.

  • see: self::_aBorderStyles
  • access: public
array getBorderStyles ()
getBorderWidths (line 570)

Get all border widths.

  • see: self::_aBorderWidths
  • access: public
array getBorderWidths ()
getCss (line 230)

Convert the ARRAY of CSS into CSS code.

  • return: CSS code.
  • access: public
string getCss ()
getFonts (line 559)

Get all fonts.

  • see: self::_aFonts
  • access: public
array getFonts ()
getFontSizes (line 581)

Get all font sizes.

  • see: self::_aFontSizes
  • access: public
array getFontSizes ()
getFontStyles (line 603)

Get all font styles.

  • see: self::_aFontStyles
  • access: public
array getFontStyles ()
getFontWeights (line 592)

Get all font weights.

  • see: self::_aFontWeights
  • access: public
array getFontWeights ()
getJavaScript (line 702)

Get JavaScript code used to verify the validity of a CSS property value.

  • return: JavaScript code used to validate CSS property values.
  • access: public
string getJavaScript ()
getPaddings (line 639)

Get all paddings.

  • access: public
array getPaddings ()
getPaddingSizes (line 614)

Get all padding sizes.

  • see: self::_aPaddingSizes
  • access: public
array getPaddingSizes ()
getPositions (line 548)

Get all positions.

  • see: self::_aPositions
  • access: public
array getPositions ()
getTextAlign (line 665)

Get all text allignments.

  • access: public
array getTextAlign ()
getTextDecorations (line 692)

Get all text decorations.

  • see: self::_aTextDecorations
  • access: public
array getTextDecorations ()
getTextTransforms (line 681)

Get all text transformations.

  • see: self::_aTextTransforms
  • access: public
array getTextTransforms ()
isHex (line 267)

Check if a color is a valid HEX.

  • return: TRUE on success, FALSE on failure.
  • access: public
bool isHex (string $sHex)
  • string $sHex: HEX Color.
isImageLink (line 278)

Make sure images added to CSS are really images.

  • return: TRUE on success, FALSE on failure.
  • access: public
bool isImageLink (string $sHex)
  • string $sHex: Image path.
parseCss (line 338)

Parse CSS code and remove evil tags, comments.

  • access: public
void parseCss (string $sCss)
  • string $sCss: CSS Code we need to parse.
process (line 387)

Run sanity checks on a CSS property and value to make sure they are valid.

  • return: TRUE if value is valid, FALSE if value is invalid.
  • access: public
bool process (string $sProperty, string $sValue)
  • string $sProperty: CSS property to check.
  • string $sValue: CSS property value to check.
_build (line 756)

Build javascript code.

  • return: JavaScript code.
  • see: self::getJavaScript()
  • access: private
string _build (array $aBuild)
  • array $aBuild: ARRAY of CSS properties and values to build.

Documentation generated on Tue, 28 Sep 2010 10:36:38 +0200 by phpDocumentor 1.4.0a2