PHP Class Pressbooks\CustomCss

Mostra file Open project: pressbooks/pressbooks Class Usage Examples

Public Properties

Property Type Description
$supported array All keys must match an *existing* WP post where post_name = __key__ and post_type = 'custom-css' If the key is not 'web' then it must map to: themes-book/__SOME_THEME__/export/__key__/style.css

Public Methods

Method Description
__construct ( )
formSubmit ( ) Save custom CSS to database (and filesystem)
getBaseTheme ( $slug ) : string Determine base theme that was used for the selected Custom CSS.
getCss ( $slug ) : string Get CSS from database
getCustomCssFolder ( ) : string Get the fullpath to the Custom CSS folder Create if not there.
getPost ( string $slug ) : WP_Post | boolean Returns the latest "custom-css" post
isCustomCss ( ) : boolean Is the current theme the custom css theme?
isFormSubmission ( ) : boolean Check if a user submitted something to themes.php?page=pb_custom_css
isRomanized ( ) : boolean Is the romanize parts option true?

Protected Methods

Method Description
cleanupCss ( $css ) : string Clean up CSS.

Method Details

__construct() public method

public __construct ( )

cleanupCss() protected static method

Minimal intervention, but prevent users from injecting garbage.
protected static cleanupCss ( $css ) : string
$css
return string

formSubmit() static public method

Save custom CSS to database (and filesystem)
static public formSubmit ( )

getBaseTheme() static public method

Determine base theme that was used for the selected Custom CSS.
static public getBaseTheme ( $slug ) : string
$slug string
return string

getCss() public method

Get CSS from database
public getCss ( $slug ) : string
$slug
return string

getCustomCssFolder() static public method

Get the fullpath to the Custom CSS folder Create if not there.
static public getCustomCssFolder ( ) : string
return string fullpath

getPost() public method

Returns the latest "custom-css" post
See also: Pressbooks\Activation::wpmuActivate
See also: Pressbooks\Metadata::upgradeCustomCss
public getPost ( string $slug ) : WP_Post | boolean
$slug string post_name
return WP_Post | boolean

isCustomCss() static public method

Is the current theme the custom css theme?
static public isCustomCss ( ) : boolean
return boolean

isFormSubmission() static public method

Check if a user submitted something to themes.php?page=pb_custom_css
static public isFormSubmission ( ) : boolean
return boolean

isRomanized() static public method

Is the romanize parts option true?
static public isRomanized ( ) : boolean
return boolean

Property Details

$supported public_oe property

All keys must match an *existing* WP post where post_name = __key__ and post_type = 'custom-css' If the key is not 'web' then it must map to: themes-book/__SOME_THEME__/export/__key__/style.css
public array $supported
return array