Pressbooks\CustomCss::isCustomCss PHP Метод

isCustomCss() статический публичный Метод

Is the current theme the custom css theme?
static public isCustomCss ( ) : boolean
Результат boolean
    static function isCustomCss()
    {
        return 'pressbooks-custom-css' == get_stylesheet();
    }

Usage Example

Пример #1
0
 /**
  * Configure the PDF options tab using the settings API.
  */
 function init()
 {
     $_page = $_option = 'pressbooks_theme_options_' . $this->getSlug();
     $_section = $this->getSlug() . '_options_section';
     if (false == get_option($_option)) {
         add_option($_option, $this->defaults);
     }
     add_settings_section($_section, $this->getTitle(), array($this, 'display'), $_page);
     if (\Pressbooks\Container::get('Sass')->isCurrentThemeCompatible(2)) {
         add_settings_field('pdf_body_font_size', __('Body Font Size', 'pressbooks'), array($this, 'renderBodyFontSizeField'), $_page, $_section, array(__('Heading sizes are proportional to the body font size and will also be affected by this setting.', 'pressbooks'), 'pt'));
         add_settings_field('pdf_body_line_height', __('Body Line Height', 'pressbooks'), array($this, 'renderBodyLineHightField'), $_page, $_section, array('', 'em'));
     }
     add_settings_field('pdf_page_size', __('Page Size', 'pressbooks'), array($this, 'renderPageSizeField'), $_page, $_section, array(__('Digest (5.5" × 8.5")', 'pressbooks'), __('US Trade (6" × 9")', 'pressbooks'), __('US Letter (8.5" × 11")', 'pressbooks'), __('Custom (8.5" × 9.25")', 'pressbooks'), __('Duodecimo (5" × 7.75")', 'pressbooks'), __('Pocket (4.25" × 7")', 'pressbooks'), __('A4 (21cm × 29.7cm)', 'pressbooks'), __('A5 (14.8cm × 21cm)', 'pressbooks'), __('5" × 8"', 'pressbooks'), __('Custom…', 'pressbooks')));
     add_settings_field('pdf_page_width', __('Page Width', 'pressbooks'), array($this, 'renderPageWidthField'), $_page, $_section, array(__('Page width must be expressed in CSS-compatible units, e.g. ‘5.5in’ or ‘10cm’.')));
     add_settings_field('pdf_page_height', __('Page Height', 'pressbooks'), array($this, 'renderPageHeightField'), $_page, $_section, array(__('Page height must be expressed in CSS-compatible units, e.g. ‘8.5in’ or ‘10cm’.')));
     if (\Pressbooks\Container::get('Sass')->isCurrentThemeCompatible(2)) {
         add_settings_field('pdf_page_margins', __('Margins', 'pressbooks'), array($this, 'renderMarginsField'), $_page, $_section, array(__('Customize your book’s margins using the fields below.', 'pressbooks')));
         add_settings_field('pdf_page_margin_outside', __('Outside Margin', 'pressbooks'), array($this, 'renderOutsideMarginField'), $_page, $_section, array(__('Margins must be expressed in CSS-compatible units, e.g. ‘8.5in’ or ‘10cm’.', 'pressbooks')));
         add_settings_field('pdf_page_margin_inside', __('Inside Margin', 'pressbooks'), array($this, 'renderInsideMarginField'), $_page, $_section, array(__('Margins must be expressed in CSS-compatible units, e.g. ‘8.5in’ or ‘10cm’.', 'pressbooks')));
         add_settings_field('pdf_page_margin_top', __('Top Margin', 'pressbooks'), array($this, 'renderTopMarginField'), $_page, $_section, array(__('Margins must be expressed in CSS-compatible units, e.g. ‘8.5in’ or ‘10cm’.', 'pressbooks')));
         add_settings_field('pdf_page_margin_bottom', __('Bottom Margin', 'pressbooks'), array($this, 'renderBottomMarginField'), $_page, $_section, array(__('Margins must be expressed in CSS-compatible units, e.g. ‘8.5in’ or ‘10cm’.', 'pressbooks')));
     }
     add_settings_field('pdf_hyphens', __('Hyphens', 'pressbooks'), array($this, 'renderHyphenationField'), $_page, $_section, array(__('Enable hyphenation', 'pressbooks')));
     add_settings_field('pdf_paragraph_separation', __('Paragraph Separation', 'pressbooks'), array($this, 'renderParagraphSeparationField'), $_page, $_section, array('indent' => __('Indent paragraphs', 'pressbooks'), 'skiplines' => __('Skip lines between paragraphs', 'pressbooks')));
     add_settings_field('pdf_blankpages', __('Blank Pages', 'pressbooks'), array($this, 'renderBlankPagesField'), $_page, $_section, array('include' => __('Include blank pages (for print PDF)', 'pressbooks'), 'remove' => __('Remove all blank pages (for web PDF)', 'pressbooks')));
     add_settings_field('pdf_toc', __('Table of Contents', 'pressbooks'), array($this, 'renderTOCField'), $_page, $_section, array(__('Display table of contents', 'pressbooks')));
     add_settings_field('pdf_image_resolution', __('Image resolution', 'pressbooks'), array($this, 'renderImageResolutionField'), $_page, $_section, array('300dpi' => __('High (300 DPI)', 'pressbooks'), '72dpi' => __('Low (72 DPI)', 'pressbooks')));
     add_settings_field('pdf_crop_marks', __('Crop Marks', 'pressbooks'), array($this, 'renderCropMarksField'), $_page, $_section, array(__('Display crop marks', 'pressbooks')));
     if (CustomCss::isCustomCss()) {
         add_settings_field('pdf_romanize_parts', __('Romanize Part Numbers', 'pressbooks'), array($this, 'renderRomanizePartsField'), $_page, $_section, array(__('Convert part numbers into Roman numerals', 'pressbooks')));
     }
     add_settings_field('pdf_footnotes_style', __('Footnote Style', 'pressbooks'), array($this, 'renderFootnoteStyleField'), $_page, $_section, array('footnotes' => __('Regular footnotes', 'pressbooks'), 'endnotes' => __('Display as chapter endnotes', 'pressbooks')));
     add_settings_field('widows', __('Widows', 'pressbooks'), array($this, 'renderWidowsField'), $_page, $_section);
     add_settings_field('orphans', __('Orphans', 'pressbooks'), array($this, 'renderOrphansField'), $_page, $_section);
     if (\Pressbooks\Container::get('Sass')->isCurrentThemeCompatible(2)) {
         add_settings_field('running_content', __('Running Heads & Feet', 'pressbooks'), array($this, 'renderRunningContentField'), $_page, $_section, array(__('Running content appears in either running heads or running feet (at the top or bottom of the page) depending on your theme.', 'pressbooks')));
         add_settings_field('running_content_front_matter_left', __('Front Matter Left Page Running Content', 'pressbooks'), array($this, 'renderRunningContentFrontMatterLeftField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%section_title%' => __('Front Matter Title', 'pressbooks'), '%section_author%' => __('Front Matter Author', 'pressbooks'), '%section_subtitle%' => __('Front Matter Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_front_matter_right', __('Front Matter Right Page Running Content', 'pressbooks'), array($this, 'renderRunningContentFrontMatterRightField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%section_title%' => __('Front Matter Title', 'pressbooks'), '%section_author%' => __('Front Matter Author', 'pressbooks'), '%section_subtitle%' => __('Front Matter Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_introduction_left', __('Introduction Left Page Running Content', 'pressbooks'), array($this, 'renderRunningContentIntroductionLeftField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%section_title%' => __('Introduction Title', 'pressbooks'), '%section_author%' => __('Introduction Author', 'pressbooks'), '%section_subtitle%' => __('Introduction Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_introduction_right', __('Introduction Right Page Running Content', 'pressbooks'), array($this, 'renderRunningContentIntroductionRightField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%section_title%' => __('Introduction Title', 'pressbooks'), '%section_author%' => __('Introduction Author', 'pressbooks'), '%section_subtitle%' => __('Introduction Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_part_left', __('Part Left Page Running Content', 'pressbooks'), array($this, 'renderRunningContentPartLeftField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%part_number%' => __('Part Number', 'pressbooks'), '%part_title%' => __('Part Title', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_part_right', __('Part Right Page Running Content', 'pressbooks'), array($this, 'renderRunningContentPartRightField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%part_number%' => __('Part Number', 'pressbooks'), '%part_title%' => __('Part Title', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_chapter_left', __('Chapter Left Page Running Content', 'pressbooks'), array($this, 'renderRunningContentChapterLeftField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%part_number%' => __('Part Number', 'pressbooks'), '%part_title%' => __('Part Title', 'pressbooks'), '%section_title%' => __('Chapter Title', 'pressbooks'), '%section_author%' => __('Chapter Author', 'pressbooks'), '%section_subtitle%' => __('Chapter Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_chapter_right', __('Chapter Right Page Running Content', 'pressbooks'), array($this, 'renderRunningContentChapterRightField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%part_number%' => __('Part Number', 'pressbooks'), '%part_title%' => __('Part Title', 'pressbooks'), '%section_title%' => __('Chapter Title', 'pressbooks'), '%section_author%' => __('Chapter Author', 'pressbooks'), '%section_subtitle%' => __('Chapter Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_back_matter_left', __('Back Matter Left Page Running Content', 'pressbooks'), array($this, 'renderRunningContentBackMatterLeftField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%section_title%' => __('Back Matter Title', 'pressbooks'), '%section_author%' => __('Back Matter Author', 'pressbooks'), '%section_subtitle%' => __('Back Matter Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
         add_settings_field('running_content_back_matter_right', __('Back Matter Right Page Running Content', 'pressbooks'), array($this, 'renderRunningContentBackMatterRightField'), $_page, $_section, array('%book_title%' => __('Book Title', 'pressbooks'), '%book_subtitle%' => __('Book Subtitle', 'pressbooks'), '%book_author%' => __('Book Author', 'pressbooks'), '%section_title%' => __('Back Matter Title', 'pressbooks'), '%section_author%' => __('Back Matter Author', 'pressbooks'), '%section_subtitle%' => __('Back Matter Subtitle', 'pressbooks'), '%blank%' => __('Blank', 'pressbooks'), '' => __('Custom…', 'pressbooks')));
     }
     if (!\Pressbooks\Container::get('Sass')->isCurrentThemeCompatible(2)) {
         add_settings_field('pdf_fontsize', __('Increase Font Size', 'pressbooks'), array($this, 'renderFontSizeField'), $_page, $_section, array(__('Increases font size and line height for greater accessibility', 'pressbooks')));
     }
     register_setting($_option, $_option, array($this, 'sanitize'));
 }
All Usage Examples Of Pressbooks\CustomCss::isCustomCss