コード例 #1
0
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.1
  */
 function __construct()
 {
     parent::get_instance();
     // Add the options page and menu item.
     add_action('admin_menu', array(&$this, 'adminMenuAdjuster'));
     add_action('admin_init', array(&$this, 'adminSettings'));
     add_action('init', '\\PBT\\Search\\ApiSearch::formSubmit', 50);
     add_action('admin_enqueue_scripts', array(&$this, 'enqueueAdminStyles'));
     add_filter('tiny_mce_before_init', array(&$this, 'modForSchemaOrg'));
     // needs to be delayed to come after PB
     add_action('wp_dashboard_setup', array(&$this, 'addOtbNewsFeed'), 11);
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_slug . '.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'addActionLinks'));
     // include other functions
     require PBT_PLUGIN_DIR . 'includes/pbt-settings.php';
     require PBT_PLUGIN_DIR . 'includes/modules/search/class-pbt-apisearch.php';
 }
コード例 #2
0
//		};

		// send validation logs
		update_option( 'pressbooks_email_validation_logs', 1 );
		
		// set display copyright information to on
		update_option( 'pressbooks_theme_options_global', $display_copyright );

		// choose 'US Letter size' for PDF exports
		update_option( 'pressbooks_theme_options_pdf', $pdf_options );

		// EPUB export - reduce image size and quality 
		update_option( 'pressbooks_theme_options_ebook', $epub_compress_images );
		
		// modify the book description
		update_option( 'blogdescription', __( 'Open Textbook', $this->plugin_slug ) );
	}
	
}

// Prohibit installation if PB is not installed
if ( get_site_option( 'pressbooks-activated' ) ) {
	if ( is_admin() ) {		
		require (dirname( __FILE__ ) . '/admin/class-pbt-textbook-admin.php');
		$pbt = new Admin\TextbookAdmin;		
	} else {
		$pbt = \PBT\Textbook::get_instance();
	}
}

コード例 #3
0
?>
">Redistribute</a>
		<a href="?page=pressbooks-textbook-settings&tab=retain" class="nav-tab <?php 
echo $active_tab == 'retain' ? 'nav-tab-active' : '';
?>
">Retain</a>
		<a href="?page=pressbooks-textbook-settings&tab=other" class="nav-tab <?php 
echo $active_tab == 'other' ? 'nav-tab-active' : '';
?>
">Other</a>
	</h2>
	<!-- Create the form that will be used to modify display options -->
	<form method="post" action="options.php" name="pbt_settings">
		<?php 
$current_theme = wp_get_theme()->Name;
$pbt_theme = \PBT\Textbook::isTextbookTheme();
switch ($active_tab) {
    case 'reuse':
        settings_fields('pbt_reuse_settings');
        do_settings_sections('pbt_reuse_settings');
        break;
    case 'revise':
        echo '<h3>Adapt, Adjust, Modify</h3>' . "<p><b>Good News!</b> We've added some functionality to the TinyMCE editor</p>" . "<ol><li><b>MCE Textbook Buttons</b> by Brad Payne adds the following textbook specific buttons: Learning Objectives (LO), Key Takeaways (KT), Excercies (EX).</li>" . "<li><b>MCE Table Buttons</b> by jakemgold, 10up, thinkoomph adds table buttons to the editor.</li>" . "<li><b><a href='options-general.php?page=pb-latex'>PB LaTeX</a></b> by Brad Payne adds the ability to include math equations using LaTeX markup.</li>" . "<li>Anchor tags!</li></ol>";
        break;
    case 'remix':
        echo "<h3>Search, Import</h3>";
        if (class_exists('\\Pressbooks\\Modules\\Api_v1\\Api')) {
            echo "<p>Remixing starts with finding the right content. <a href='admin.php?page=api_search_import'>Search this instance of Pressbooks for relevant content and import it into your book</a>.</p>";
            settings_fields('pbt_remix_settings');
            do_settings_sections('pbt_remix_settings');
        } else {