Methods

init()

init()

save()

save(array $args) : int

Save new custom CSS. This should be the entry point for any third-party code using Jetpack_Custom_CSS to save CSS.

Parameters

array $args

Array of arguments:

   string $css The CSS (or LESS or Sass)
   bool $is_preview Whether this CSS is preview or published
   string preprocessor Which CSS preprocessor to use
   bool $add_to_existing Whether this CSS replaces the theme's CSS or supplements it.
   int $content_width A custom $content_width to go along with this CSS.

Returns

int —

The post ID of the saved Custom CSS post.

get_post()

get_post() : array

Get the published custom CSS post.

Returns

array

post_id()

post_id() : int|bool

Get the post ID of the published custom CSS post.

Returns

int|bool —

The post ID if it exists; false otherwise.

get_current_revision()

get_current_revision() : object

Get the current revision of the original safecss record

Returns

object

save_revision()

save_revision(string $css, bool $is_preview,  $preprocessor) : bool|int

Save new revision of CSS Checks to see if content was modified before really saving

Parameters

string $css
bool $is_preview
$preprocessor

Returns

bool|int —

If nothing was saved, returns false. If a post

             or revision was saved, returns the post ID.

skip_stylesheet()

skip_stylesheet()

is_preview()

is_preview()

is_freetrial()

is_freetrial()

get_css()

get_css( $compressed)

Parameters

$compressed

print_css()

print_css()

link_tag()

link_tag()

style_filter()

style_filter( $current)

Parameters

$current

buffer()

buffer( $html)

Parameters

$html

preview_links()

preview_links( $matches)

Parameters

$matches

preview_flag()

preview_flag()

Places a black bar above every preview page

menu()

menu()

update_title()

update_title()

Adds a menu item in the appearance section for this plugin's administration page. Also adds hooks to enqueue the CSS and JS for the admin page.

prettify_post_revisions()

prettify_post_revisions()

post_title()

post_title( $title,  $post_id)

Parameters

$title
$post_id

enqueue_scripts()

enqueue_scripts( $hook)

Parameters

$hook

saved_message()

saved_message()

admin()

admin()

content_width_settings()

content_width_settings()

Content width setting callback

publish_box()

publish_box()

revisions_meta_box()

revisions_meta_box(array $safecss_post) : string

Render metabox listing CSS revisions and the themes that correspond to the revisions.

Called by safecss_admin

Parameters

array $safecss_post

Returns

string

disable()

disable()

Hook in init at priority 11 to disable custom CSS.

reset()

reset()

Reset all aspects of Custom CSS on a theme switch so that changing themes is a sure-fire way to get a clean start.

is_customizer_preview()

is_customizer_preview()

minify()

minify( $css,  $preprocessor)

Parameters

$css
$preprocessor

restore_revision()

restore_revision( $_post_id,  $_revision_id)

When restoring a SafeCSS post revision, also copy over the content_width and custom_css_add post metadata.

Parameters

$_post_id
$_revision_id

upgrade()

upgrade() : void

Migration routine for moving safecss from wp_options to wp_posts to support revisions

revision_redirect()

revision_redirect( $redirect)

Parameters

$redirect

revision_post_link()

revision_post_link( $post_link,  $post_id,  $context)

Parameters

$post_link
$post_id
$context

editor_max_image_size()

editor_max_image_size( $dims,  $size,  $context)

When on the edit screen, make sure the custom content width setting is applied to the large image size.

Parameters

$dims
$size
$context

jetpack_content_width()

jetpack_content_width( $content_width)

Override the content_width with a custom value if one is set.

Parameters

$content_width