Example #1
0
    /**
     * Function called by the Pressbooks plugin when user is on [ Appearance → Theme Options ] page
     */
    function pressbooks_theme_options_display()
    {
        ?>
	<div class="wrap">
		<div id="icon-themes" class="icon32"></div>
		<h2><?php 
        echo wp_get_theme();
        ?>
 Theme Options</h2>
		<?php 
        settings_errors();
        ?>
		<?php 
        $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'global_options';
        ?>
		<h2 class="nav-tab-wrapper">
		<a href="?page=pressbooks_theme_options&tab=global_options" class="nav-tab <?php 
        echo $active_tab == 'global_options' ? 'nav-tab-active' : '';
        ?>
">Global Options</a>
		<a href="?page=pressbooks_theme_options&tab=web_options" class="nav-tab <?php 
        echo $active_tab == 'web_options' ? 'nav-tab-active' : '';
        ?>
">Web Options</a>
		<?php 
        if (true == \PressBooks\Utility\check_prince_install()) {
            ?>
		<a href="?page=pressbooks_theme_options&tab=pdf_options" class="nav-tab <?php 
            echo $active_tab == 'pdf_options' ? 'nav-tab-active' : '';
            ?>
">PDF Options</a>
		<?php 
        }
        ?>
		<?php 
        if (true == \PressBooks\Modules\Export\Mpdf\Pdf::isInstalled()) {
            ?>
		<a href="?page=pressbooks_theme_options&tab=mpdf_options" class="nav-tab <?php 
            echo $active_tab == 'mpdf_options' ? 'nav-tab-active' : '';
            ?>
">mPDF Options</a>
		<?php 
        }
        ?>
		<a href="?page=pressbooks_theme_options&tab=ebook_options" class="nav-tab <?php 
        echo $active_tab == 'ebook_options' ? 'nav-tab-active' : '';
        ?>
">Ebook Options</a>
		</h2>
		<!-- Create the form that will be used to render our options -->
		<form method="post" action="options.php">
			<?php 
        if ($active_tab == 'global_options') {
            settings_fields('pressbooks_theme_options_global');
            do_settings_sections('pressbooks_theme_options_global');
        } elseif ($active_tab == 'web_options') {
            settings_fields('pressbooks_theme_options_web');
            do_settings_sections('pressbooks_theme_options_web');
        } elseif ($active_tab == 'pdf_options') {
            settings_fields('pressbooks_theme_options_pdf');
            do_settings_sections('pressbooks_theme_options_pdf');
        } elseif ($active_tab == 'mpdf_options') {
            settings_fields('pressbooks_theme_options_mpdf');
            do_settings_sections('pressbooks_theme_options_mpdf');
        } elseif ($active_tab == 'ebook_options') {
            settings_fields('pressbooks_theme_options_ebook');
            do_settings_sections('pressbooks_theme_options_ebook');
        }
        ?>
			<?php 
        submit_button();
        ?>
		</form>
	</div>
<?php 
    }
Example #2
0
}
if (!isset($options['odt'])) {
    $options['odt'] = 0;
}
?>
    <form id="pb-export-form" action="<?php 
echo $export_form_url;
?>
" method="POST">
	    <fieldset>
	       <legend><?php 
_e('Standard book formats', 'pressbooks');
?>
:</legend>
	       <?php 
if (true == \PressBooks\Utility\check_prince_install()) {
    ?>
	    	<input type="checkbox" id="pdf" name="export_formats[pdf]" value="1" <?php 
    checked(1, $options['pdf'], true);
    ?>
/><label for="pdf"> <?php 
    _e('PDF (for printing)', 'pressbooks');
    ?>
</label><br />
	       <?php 
}
?>
		<?php 
if (true == \PressBooks\Utility\show_experimental_features()) {
    ?>
		<input type="checkbox" id="mpdf" name="export_formats[mpdf]" value="1" <?php 
 /**
  * @covers \PressBooks\Utility\check_prince_install
  */
 public function test_check_prince_install()
 {
     $this->assertInternalType('bool', \PressBooks\Utility\check_prince_install());
     $this->assertTrue(defined('PB_PRINCE_COMMAND'));
 }