/** * Adds Javascript for buttons above. */ function mce_button_scripts($plugin_array) { $plugin_array['apply_class'] = \Pressbooks\Utility\asset_path('scripts/applyclass.js'); $plugin_array['textboxes'] = \Pressbooks\Utility\asset_path('scripts/textboxes.js'); $plugin_array['anchor'] = \Pressbooks\Utility\asset_path('scripts/anchor.js'); $plugin_array['table'] = \Pressbooks\Utility\asset_path('scripts/table.js'); return $plugin_array; }
function search_head() { include PB_PLUGIN_DIR . 'includes/modules/searchandreplace/class-pb-search.php'; include PB_PLUGIN_DIR . 'includes/modules/searchandreplace/class-pb-result.php'; wp_enqueue_style('search-and-replace', \Pressbooks\Utility\asset_path('styles/search-and-replace.css')); wp_register_script('search-and-replace', \Pressbooks\Utility\asset_path('scripts/search-and-replace.js')); wp_localize_script('search-and-replace', 'pb_sr', $this->get_l10n()); wp_enqueue_script('search-and-replace'); }
function pressbooks_book_info_page() { if (is_front_page()) { wp_enqueue_style('pressbooks-book-info', get_template_directory_uri() . '/css/book-info.css', array(), '20130713', 'all'); wp_enqueue_style('book-info-fonts', 'https://fonts.googleapis.com/css?family=Droid+Serif:400,700|Oswald:300,400,700'); // Book info page Table of Content columns wp_enqueue_script('columnizer', \Pressbooks\Utility\asset_path('scripts/columnizer.js'), ['jquery']); wp_enqueue_script('columnizer-load', get_template_directory_uri() . '/js/columnizer-load.js', array('jquery', 'columnizer'), '20130819', false); // Sharer.js wp_enqueue_script('sharer', \Pressbooks\Utility\asset_path('scripts/sharer.js')); } }
/** * Add Custom Login Graphic. * To customize this, add a filter to the 'pressbooks_login_logo' hook that * returns a string containing a style tag comparable to the one below. */ function custom_login_logo() { $html = '<style type="text/css"> .login h1 a { background-image: url(' . \Pressbooks\Utility\asset_path('images/PB-logo.svg') . '); background-size: 276px 40px; width: 276px; height: 40px; } .login .message { border-left: 4px solid #0077cc; } .login #backtoblog a:hover, .login #backtoblog a:active, .login #backtoblog a:focus, .login #nav a:hover, .login #nav a:active, .login #nav a:focus { color: #d4002d; } .no-svg .login h1 a { background-image: url(' . \Pressbooks\Utility\asset_path('images/PB-logo.png') . '; } </style>'; $html = apply_filters('pressbooks_login_logo', $html); echo $html; }
/** * Init event called at admin_init * Instantiates various sub-classes, remove meta boxes from post pages & registers custom post status. */ function init_css_js() { // This is to work around JavaScript dependency errors global $concatenate_scripts; // @codingStandardsIgnoreLine $concatenate_scripts = false; // Note: Will auto-register a dependency $handle named 'colors' wp_admin_css_color('pb_colors', 'Pressbooks', \Pressbooks\Utility\asset_path('styles/colors-pb.css'), apply_filters('pressbooks_admin_colors', array('#b40026', '#d4002d', '#e9e9e9', '#dfdfdf'))); wp_deregister_style('pressbooks-book'); // Theme's CSS wp_enqueue_style('pressbooks-admin', \Pressbooks\Utility\asset_path('styles/pressbooks.css')); if ('pb_catalog' == esc_attr(@$_REQUEST['page'])) { wp_enqueue_style('wp-color-picker'); wp_enqueue_style('pressbooks-catalog', \Pressbooks\Utility\asset_path('styles/catalog.css')); wp_enqueue_script('color-picker', \Pressbooks\Utility\asset_path('scripts/color-picker.js'), ['wp-color-picker']); wp_enqueue_script('select2-js', \Pressbooks\Utility\asset_path('scripts/select2.js'), ['jquery']); } if ('pressbooks_theme_options' == esc_attr(@$_REQUEST['page'])) { wp_enqueue_style('select2', \Pressbooks\Utility\asset_path('styles/select2.css')); wp_enqueue_style('theme-options', \Pressbooks\Utility\asset_path('styles/theme-options.css')); wp_enqueue_script('select2-js', \Pressbooks\Utility\asset_path('scripts/select2.js'), ['jquery']); wp_enqueue_script('theme-options-js', \Pressbooks\Utility\asset_path('scripts/theme-options.js'), ['jquery']); } if ('pb_custom_css' == esc_attr(@$_REQUEST['page'])) { wp_enqueue_style('pb-custom-css', \Pressbooks\Utility\asset_path('styles/custom-css.css')); } // Don't let other plugins override our scripts $badScripts = array('jquery-blockui', 'jquery-bootstrap', 'pb-organize', 'pb-feedback', 'pb-export', 'pb-metadata', 'pb-import'); array_walk($badScripts, function ($value, $key) { wp_deregister_script($value); }); // Enqueue later, on-the-fly, using action: admin_print_scripts- wp_register_script('jquery-blockui', \Pressbooks\Utility\asset_path('scripts/blockui.js'), ['jquery', 'jquery-ui-core']); wp_register_script('js-cookie', \Pressbooks\Utility\asset_path('scripts/js-cookie.js'), ['jquery']); wp_register_script('pb-export', \Pressbooks\Utility\asset_path('scripts/export.js'), ['jquery', 'js-cookie']); wp_register_script('pb-organize', \Pressbooks\Utility\asset_path('scripts/organize.js'), ['jquery', 'jquery-ui-core', 'jquery-blockui']); wp_register_script('pb-metadata', \Pressbooks\Utility\asset_path('scripts/book-information.js'), ['jquery']); wp_register_script('pb-import', \Pressbooks\Utility\asset_path('scripts/import.js'), ['jquery']); wp_register_style('pb-export', \Pressbooks\Utility\asset_path('styles/export.css')); wp_register_style('pb-organize', \Pressbooks\Utility\asset_path('styles/organize.css')); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-sortable'); }
?> "></script> <script src="<?php echo \Pressbooks\Utility\asset_path('scripts/matchheight.js'); ?> " type="text/javascript"></script> <script src="<?php echo \Pressbooks\Utility\asset_path('scripts/isotope.js'); ?> " type="text/javascript"></script> <script src="<?php echo \Pressbooks\Utility\asset_path('scripts/small-menu.js'); ?> " type="text/javascript"></script> <script src="<?php echo \Pressbooks\Utility\asset_path('scripts/catalog.js'); ?> " type="text/javascript"></script> <?php // @codingStandardsIgnoreEnd ?> <?php \Pressbooks\analytics\print_analytics(); ?> </head> <body> <div class="catalog-wrap"> <div class="log-wrap"> <!-- Login/Logout --> <?php if (!is_user_logged_in()) {
/** * Enqueue css and javascript for the network manager administration page */ function admin_enqueues() { wp_enqueue_style('pb-network-managers', \Pressbooks\Utility\asset_path('styles/network-managers.css')); wp_enqueue_script('pb-network-managers', \Pressbooks\Utility\asset_path('scripts/network-managers.js'), ['jquery']); wp_localize_script('pb-network-managers', 'PB_NetworkManagerToken', array('networkManagerNonce' => wp_create_nonce('pb-network-managers'))); }
/** * Force a stylesheet onto our Book Information edit page * * @param string $hook */ function add_metadata_styles($hook) { if ('post-new.php' == $hook || 'post.php' == $hook) { $post_type = get_post_type(); if ('metadata' == $post_type) { wp_enqueue_style('metadata', \Pressbooks\Utility\asset_path('styles/metadata.css')); } elseif ('part' == $post_type) { wp_enqueue_style('part', \Pressbooks\Utility\asset_path('styles/part.css')); add_filter('page_attributes_dropdown_pages_args', function () { return array('post_type' => '__GARBAGE__'); }); // Hide this dropdown by querying for garbage } } }