get() static public method

static public get ( string $var ) : mixed
$var string
return mixed
 /**
  * Override based on Theme Options
  */
 protected function themeOptionsOverrides()
 {
     $sass = \Pressbooks\Container::get('Sass');
     if ($sass->isCurrentThemeCompatible(2)) {
         $extra = "/* Print Overrides */\n\$prince-image-resolution: 300dpi; \n";
     } else {
         $extra = "/* Print Overrides */\nimg { prince-image-resolution: 300dpi; } \n";
     }
     $scss = '';
     $scss = apply_filters('pb_pdf_css_override', $scss) . "\n";
     $scss = $sass->applyOverrides($scss, $extra);
     // Copyright
     // Please be kind, help Pressbooks grow by leaving this on!
     if (empty($GLOBALS['PB_SECRET_SAUCE']['TURN_OFF_FREEBIE_NOTICES_PDF'])) {
         $freebie_notice = __('This book was produced using Pressbooks.com, and PDF rendering was done by PrinceXML.', 'pressbooks');
         $scss .= '#copyright-page .ugc > p:last-of-type::after { display:block; margin-top: 1em; content: "' . $freebie_notice . '" }' . "\n";
     }
     $this->cssOverrides = $scss;
     // --------------------------------------------------------------------
     // Hacks
     $hacks = array();
     $hacks = apply_filters('pb_pdf_hacks', $hacks);
     // Append endnotes to URL?
     if ('endnotes' == $hacks['pdf_footnotes_style']) {
         $this->url .= '&endnotes=true';
     }
 }
 /**
  * @covers \PressBooks\GlobalTypography::updateWebBookStyleSheet
  */
 public function test_updateWebBookStyleSheet()
 {
     $this->_book();
     $this->gt->updateWebBookStyleSheet();
     $file = \Pressbooks\Container::get('Sass')->pathToUserGeneratedCss() . '/style.css';
     $this->assertFileExists($file);
     $this->assertNotEmpty(file_get_contents($file));
 }
 /**
  * @covers \Pressbooks\GlobalTypography::updateWebBookStyleSheet
  */
 public function test_updateWebBookStyleSheet()
 {
     $this->_book('donham');
     // Pick a theme with some built-in $supported_languages
     $this->gt->updateWebBookStyleSheet();
     $file = \Pressbooks\Container::get('Sass')->pathToUserGeneratedCss() . '/style.css';
     $this->assertFileExists($file);
     $this->assertNotEmpty(file_get_contents($file));
 }
Beispiel #4
0
/**
 * Fix Sass for everything that has to do with dynamically generated font stacks
 */
function fix_missing_font_stacks()
{
    $sass = Container::get('Sass');
    if (!is_file($sass->pathToUserGeneratedSass() . '/_font-stack-web.scss')) {
        Container::get('GlobalTypography')->updateGlobalTypographyMixin();
    }
    if (realpath(get_stylesheet_directory() . '/style.scss') && !is_file($sass->pathToUserGeneratedCss() . '/style.css')) {
        Container::get('GlobalTypography')->updateWebBookStyleSheet();
    }
    if (!is_file($sass->pathToUserGeneratedCss() . '/editor.css')) {
        \PressBooks\Editor\update_editor_style();
    }
}
<?php

/**
 * @see http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
 */
namespace PHPSTORM_META;

/** @noinspection PhpUnusedLocalVariableInspection */
/** @noinspection PhpIllegalArrayKeyTypeInspection */
$STATIC_METHOD_TYPES = [\Pressbooks\Container::get('') => ['Sass' instanceof \Pressbooks\Sass, 'GlobalTypography' instanceof \Pressbooks\GlobalTypography]];
Beispiel #6
0
 /**
  * Parse CSS, copy assets, rewrite copy.
  *
  * @param string $path_to_original_stylesheet *
  * @param string $path_to_copy_of_stylesheet
  */
 protected function scrapeKneadAndSaveCss($path_to_original_stylesheet, $path_to_copy_of_stylesheet)
 {
     $sass = Container::get('Sass');
     $scss_dir = pathinfo($path_to_original_stylesheet, PATHINFO_DIRNAME);
     $path_to_epub_assets = $this->tmpDir . '/OEBPS/assets';
     $scss = file_get_contents($path_to_copy_of_stylesheet);
     if ($this->extraCss) {
         $scss .= "\n" . $this->loadTemplate($this->extraCss);
     }
     // Append overrides
     $scss .= "\n" . $this->cssOverrides;
     if ($sass->isCurrentThemeCompatible()) {
         $css = $sass->compile($scss);
     } else {
         $css = static::injectHouseStyles($scss);
     }
     // Search for url("*"), url('*'), and url(*)
     $url_regex = '/url\\(([\\s])?([\\"|\'])?(.*?)([\\"|\'])?([\\s])?\\)/i';
     $css = preg_replace_callback($url_regex, function ($matches) use($scss_dir, $path_to_epub_assets) {
         $url = $matches[3];
         $filename = sanitize_file_name(basename($url));
         if (preg_match('#^images/#', $url) && substr_count($url, '/') == 1) {
             // Look for "^images/"
             // Count 1 slash so that we don't touch stuff like "^images/out/of/bounds/"	or "^images/../../denied/"
             $my_image = realpath("{$scss_dir}/{$url}");
             if ($my_image) {
                 copy($my_image, "{$path_to_epub_assets}/{$filename}");
                 return "url(assets/{$filename})";
             }
         } elseif (preg_match('#^https?://#i', $url) && preg_match('/(' . $this->supportedImageExtensions . ')$/i', $url)) {
             // Look for images via http(s), pull them in locally
             if ($new_filename = $this->fetchAndSaveUniqueImage($url, $path_to_epub_assets)) {
                 return "url(assets/{$new_filename})";
             }
         } elseif (preg_match('#^themes-book/pressbooks-book/fonts/[a-zA-Z0-9_-]+(' . $this->supportedFontExtensions . ')$#i', $url)) {
             // Look for themes-book/pressbooks-book/fonts/*.ttf (or .otf), copy into our Epub
             $my_font = realpath(PB_PLUGIN_DIR . $url);
             if ($my_font) {
                 copy($my_font, "{$path_to_epub_assets}/{$filename}");
                 return "url(assets/{$filename})";
             }
         } elseif (preg_match('#^https?://#i', $url) && preg_match('/(' . $this->supportedFontExtensions . ')$/i', $url)) {
             // Look for fonts via http(s), pull them in locally
             if ($new_filename = $this->fetchAndSaveUniqueFont($url, $path_to_epub_assets)) {
                 return "url(assets/{$new_filename})";
             }
         }
         return $matches[0];
         // No change
     }, $css);
     // Overwrite the new file with new info
     file_put_contents($path_to_copy_of_stylesheet, $css);
     if (WP_DEBUG) {
         Container::get('Sass')->debug($css, $scss, 'epub');
     }
 }
Beispiel #7
0
/**
 * WP_Ajax hook. Copy book style from an existing template.
 */
function load_css_from()
{
    check_ajax_referer('pb-load-css-from');
    if (false == current_user_can('edit_theme_options')) {
        die(-1);
    }
    $css = '';
    $themes = wp_get_themes(array('allowed' => true));
    list($theme, $slug) = explode('__', @$_POST['slug']);
    if (isset($themes[$theme])) {
        $theme = $themes[$theme];
        // Get theme object
        /** @var $theme \WP_Theme */
        // TODO: SCSS is optional, what if the user wants to copy from an old theme that has not yet been covnerted? This file won't exist?
        if ('web' == $slug) {
            $path_to_style = realpath($theme->get_stylesheet_directory() . '/style.scss');
            $uri_to_style = $theme->get_stylesheet_directory_uri();
        } else {
            $path_to_style = realpath($theme->get_stylesheet_directory() . "/export/{$slug}/style.scss");
            $uri_to_style = false;
            // We don't want a URI for EPUB or Prince exports
        }
        if ($path_to_style) {
            $scss = file_get_contents($path_to_style);
            $sass = Container::get('Sass');
            $includes = [$sass->pathToUserGeneratedSass(), $sass->pathToPartials(), $sass->pathToFonts(), $theme->get_stylesheet_directory()];
            $css = $sass->compile($scss, $includes);
            $css = fix_url_paths($css, $uri_to_style);
        }
    }
    // Send back JSON
    header('Content-Type: application/json');
    $json = json_encode(array('content' => $css));
    echo $json;
    // @see http://codex.wordpress.org/AJAX_in_Plugins#Error_Return_Values
    // Will append 0 to returned json string if we don't die()
    die;
}
Beispiel #8
0
function pressbooks_theme_global_typography_callback($args)
{
    $foreign_languages = get_option('pressbooks_global_typography');
    if (!$foreign_languages) {
        $foreign_languages = array();
    }
    $languages = \PressBooks\Container::get('GlobalTypography')->getSupportedLanguages();
    $already_supported_languages = \PressBooks\Container::get('GlobalTypography')->getThemeSupportedLanguages();
    $already_supported_languages_string = '';
    $i = 1;
    $c = count($already_supported_languages);
    foreach ($already_supported_languages as $lang) {
        $already_supported_languages_string .= $languages[$lang];
        if ($i < $c && $i == $c - 1) {
            $already_supported_languages_string .= ' ' . __('and', 'pressbooks') . ' ';
        } elseif ($i < $c) {
            $already_supported_languages_string .= ', ';
        }
        unset($languages[$lang]);
        $i++;
    }
    $html = '<label for="global_typography"> ' . $args[0] . '</label><br /><br />';
    $html .= '<select id="global_typography" class="select2" data-placeholder="' . __('Select languages…', 'pressbooks') . '" name="pressbooks_global_typography[]" multiple>';
    foreach ($languages as $key => $value) {
        $selected = in_array($key, $foreign_languages) || in_array($key, $already_supported_languages) ? ' selected' : '';
        $html .= '<option value="' . $key . '" ' . $selected . '>' . $value . '</option>';
    }
    $html .= '</select>';
    if ($already_supported_languages_string) {
        $html .= '<br /><br />' . sprintf(__('This theme includes built-in support for %s.', 'pressbooks'), $already_supported_languages_string);
    }
    echo $html;
}
Beispiel #9
0
/**
 * Shortcut to \PressBooks\Modules\Export::isScss();
 *
 * @return bool
 */
function pb_is_scss()
{
    return \PressBooks\Container::get('Sass')->isCurrentThemeCompatible();
}
Beispiel #10
0
 /**
  * Return kneaded CSS string
  *
  * @return string
  */
 protected function kneadCss()
 {
     $sass = Container::get('Sass');
     $scss_dir = pathinfo($this->exportStylePath, PATHINFO_DIRNAME);
     $scss = $sass->applyOverrides(file_get_contents($this->exportStylePath), $this->cssOverrides);
     if ($sass->isCurrentThemeCompatible(1)) {
         $css = $sass->compile($scss, [$sass->pathToUserGeneratedSass(), $sass->pathToPartials(), $sass->pathToFonts(), get_stylesheet_directory()]);
     } elseif ($sass->isCurrentThemeCompatible(2)) {
         $css = $sass->compile($scss, $sass->defaultIncludePaths('prince'));
     } else {
         $css = static::injectHouseStyles($scss);
     }
     // Search for url("*"), url('*'), and url(*)
     $url_regex = '/url\\(([\\s])?([\\"|\'])?(.*?)([\\"|\'])?([\\s])?\\)/i';
     $css = preg_replace_callback($url_regex, function ($matches) use($scss_dir) {
         $url = $matches[3];
         if (preg_match('#^themes-book/pressbooks-book/fonts/[a-zA-Z0-9_-]+(\\.woff|\\.otf|\\.ttf)$#i', $url)) {
             $my_asset = realpath(PB_PLUGIN_DIR . $url);
             if ($my_asset) {
                 return 'url(' . PB_PLUGIN_DIR . $url . ')';
             }
         } elseif (preg_match('#^uploads/assets/fonts/[a-zA-Z0-9_-]+(\\.woff|\\.otf|\\.ttf)$#i', $url)) {
             $my_asset = realpath(WP_CONTENT_DIR . '/' . $url);
             if ($my_asset) {
                 return 'url(' . WP_CONTENT_DIR . '/' . $url . ')';
             }
         } elseif (!preg_match('#^https?://#i', $url)) {
             $my_asset = realpath("{$scss_dir}/{$url}");
             if ($my_asset) {
                 return "url({$scss_dir}/{$url})";
             }
         }
         return $matches[0];
         // No change
     }, $css);
     if (WP_DEBUG) {
         Container::get('Sass')->debug($css, $scss, 'prince');
     }
     return $css;
 }
 /**
  * @covers \Pressbooks\Container::get
  */
 public function test_getException()
 {
     $this->setExpectedException('\\LogicException');
     $var = Container::get('foo');
 }
Beispiel #12
0
/**
 * Adds stylesheet for MCE previewing.
 */
function add_editor_style()
{
    $sass = Container::get('Sass');
    $uri = $sass->urlToUserGeneratedCss() . '/editor.css';
    \add_editor_style($uri);
}
Beispiel #13
0
 /**
  * Return the fullpath to an export module's style file.
  *
  * @param string $type
  *
  * @return string
  */
 function getExportStylePath($type)
 {
     $fullpath = false;
     if (CustomCss::isCustomCss()) {
         $fullpath = CustomCss::getCustomCssFolder() . "/{$type}.css";
         if (!is_file($fullpath)) {
             $fullpath = false;
         }
     }
     if (!$fullpath) {
         if (Container::get('Sass')->isCurrentThemeCompatible()) {
             $fullpath = realpath(get_stylesheet_directory() . "/export/{$type}/style.scss");
         } else {
             $fullpath = realpath(get_stylesheet_directory() . "/export/{$type}/style.css");
         }
     }
     return $fullpath;
 }
 /**
  * Return the fullpath to an export module's Javascript file.
  *
  * @param string $type
  *
  * @return string
  */
 function getExportScriptPath($type)
 {
     $fullpath = false;
     if (CustomCss::isCustomCss()) {
         $fullpath = CustomCss::getCustomCssFolder() . "/{$type}.js";
         if (!is_file($fullpath)) {
             $fullpath = false;
         }
     }
     if (!$fullpath) {
         if (Container::get('Sass')->isCurrentThemeCompatible(2)) {
             // Check for v2 themes
             $fullpath = realpath(get_stylesheet_directory() . "/assets/scripts/{$type}/script.js");
         } else {
             $fullpath = realpath(get_stylesheet_directory() . "/export/{$type}/script.js");
         }
         if (CustomCss::isCustomCss() && CustomCss::isRomanized() && 'prince' == $type) {
             $fullpath = realpath(get_stylesheet_directory() . "/export/{$type}/script-romanize.js");
         }
     }
     return $fullpath;
 }
Beispiel #15
0
function pressbooks_theme_ebook_css_override($scss)
{
    // --------------------------------------------------------------------
    // Global Options
    $sass = \Pressbooks\Container::get('Sass');
    $options = get_option('pressbooks_theme_options_global');
    if (!$options['chapter_numbers']) {
        if ($sass->isCurrentThemeCompatible(2)) {
            $scss .= "\$chapter-number-display: none; \n";
        } else {
            $scss .= "div.part-title-wrap > .part-number, div.chapter-title-wrap > .chapter-number { display: none !important; } \n";
        }
    }
    // --------------------------------------------------------------------
    // Ebook Options
    $options = get_option('pressbooks_theme_options_ebook');
    // Indent paragraphs?
    if ($options['ebook_paragraph_separation'] == 'indent') {
        // Default, no change needed
    } elseif ($options['ebook_paragraph_separation'] == 'skiplines') {
        if ($sass->isCurrentThemeCompatible(2)) {
            $scss .= "\$para-margin-top: 1em; \n";
            $scss .= "\$para-indent: 0; \n";
        } else {
            $scss .= "p + p, .indent, div.ugc p.indent { text-indent: 0; margin-top: 1em; } \n";
        }
    }
    return $scss;
}
 /**
  * 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&quot; &times; 8.5&quot;)', 'pressbooks'), __('US Trade (6&quot; &times; 9&quot;)', 'pressbooks'), __('US Letter (8.5&quot; &times; 11&quot;)', 'pressbooks'), __('Custom (8.5&quot; &times; 9.25&quot;)', 'pressbooks'), __('Duodecimo (5&quot; &times; 7.75&quot;)', 'pressbooks'), __('Pocket (4.25&quot; &times; 7&quot;)', 'pressbooks'), __('A4 (21cm &times; 29.7cm)', 'pressbooks'), __('A5 (14.8cm &times; 21cm)', 'pressbooks'), __('5&quot; &times; 8&quot;', 'pressbooks'), __('Custom&hellip;', '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. &lsquo;5.5in&rsquo; or &lsquo;10cm&rsquo;.')));
     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. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.')));
     if (\Pressbooks\Container::get('Sass')->isCurrentThemeCompatible(2)) {
         add_settings_field('pdf_page_margins', __('Margins', 'pressbooks'), array($this, 'renderMarginsField'), $_page, $_section, array(__('Customize your book&rsquo;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. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', '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. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', '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. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', '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. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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&hellip;', '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'));
 }
Beispiel #17
0
/**
 * Shortcut to \Pressbooks\Container::get('Sass')->isCurrentThemeCompatible( $version );
 *
 * @return bool
 */
function pb_is_scss($version = 1)
{
    if (\Pressbooks\Container::get('Sass')->isCurrentThemeCompatible($version)) {
        return true;
    }
    return false;
}