Beispiel #1
0
 /**
  * This function should init the templates - like adding Javascript through the {@link add_headline()} method.
  */
 function init_templates()
 {
     global $Messages, $debug, $Hit, $check_browser_version;
     // This is included before controller specifc require_css() calls:
     require_css('results.css', 'rsc_url');
     // Results/tables styles
     require_js('#jquery#', 'rsc_url');
     require_js('jquery/jquery.raty.min.js', 'rsc_url');
     require_js('#bootstrap#', 'rsc_url');
     require_css('#bootstrap_css#', 'rsc_url');
     // require_css( '#bootstrap_theme_css#', 'rsc_url' );
     require_js('#bootstrap_typeahead#', 'rsc_url');
     // JS to init Bootstrap tooltips (E.g. on badges with title "Admin"):
     add_js_headline('jQuery( function () { jQuery( \'[data-toggle="tooltip"]\' ).tooltip() } )');
     if ($debug) {
         // Use readable CSS:
         // rsc/less/bootstrap-basic_styles.less
         // rsc/less/bootstrap-basic.less
         // rsc/less/bootstrap-evoskins.less
         require_css('bootstrap-backoffice-b2evo_base.bundle.css', 'rsc_url');
         // Concatenation of the above
     } else {
         // Use minified CSS:
         require_css('bootstrap-backoffice-b2evo_base.bmin.css', 'rsc_url');
         // Concatenation + Minifaction of the above
     }
     // Make sure standard CSS is called ahead of custom CSS generated below:
     if ($debug) {
         // Use readable CSS:
         require_css('skins_adm/bootstrap/rsc/css/style.css', 'relative');
         // Relative to <base> tag (current skin folder)
     } else {
         // Use minified CSS:
         require_css('skins_adm/bootstrap/rsc/css/style.min.css', 'relative');
         // Relative to <base> tag (current skin folder)
     }
     // Set bootstrap css classes for messages
     $Messages->set_params(array('class_outerdiv' => 'action_messages container-fluid', 'class_success' => 'alert alert-dismissible alert-success fade in', 'class_warning' => 'alert alert-dismissible alert-warning fade in', 'class_error' => 'alert alert-dismissible alert-danger fade in', 'class_note' => 'alert alert-dismissible alert-info fade in', 'before_message' => '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>'));
     // Initialize font-awesome icons and use them as a priority over the glyphicons, @see get_icon()
     init_fontawesome_icons('fontawesome-glyphicons');
     if ($check_browser_version && $Hit->get_browser_version() > 0 && $Hit->is_IE(9, '<')) {
         // Display info message if browser IE < 9 version and it is allowed by config var:
         $Messages->add(T_('Your web browser is too old. For this site to work correctly, we recommend you use a more recent browser.'), 'note');
         if ($debug) {
             $Messages->add('User Agent: ' . $Hit->get_user_agent(), 'note');
         }
     }
 }
 *
 * This file is part of the evoCore framework - {@link http://evocore.net/}
 * See also {@link https://github.com/b2evolution/b2evolution}.
 *
 * @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license}
 *
 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}
 *
 * @package htsrv
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
load_funcs('skins/_skin.funcs.php');
// Initialize font-awesome icons and use them as a priority over the glyphicons, @see get_icon()
init_fontawesome_icons('fontawesome-glyphicons');
require_js('#jquery#', 'rsc_url');
// Bootstrap
require_js('#bootstrap#', 'rsc_url');
require_css('#bootstrap_css#', 'rsc_url');
// require_css( '#bootstrap_theme_css#', 'rsc_url' );
// rsc/less/bootstrap-basic_styles.less
// rsc/less/bootstrap-basic.less
// rsc/less/bootstrap-evoskins.less
// rsc/build/bootstrap-backoffice-b2evo_base.bundle.css // CSS concatenation of the above
require_css('bootstrap-backoffice-b2evo_base.bmin.css', 'rsc_url');
// Concatenation + Minifaction of the above
require_css('login.css', 'rsc_url');
// Set bootstrap classes for messages
$Messages->set_params(array('class_success' => 'alert alert-dismissible alert-success fade in', 'class_warning' => 'alert alert-dismissible alert-warning fade in', 'class_error' => 'alert alert-dismissible alert-danger fade in', 'class_note' => 'alert alert-dismissible alert-info fade in', 'before_message' => '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>'));
// Form template
Beispiel #3
0
 /**
  * Get ready for displaying the skin.
  *
  * This method may register some CSS or JS. 
  * The default implementation can register a few common things that you may request in the $features param.
  * This is where you'd specify you want to use BOOTSTRAP, etc.
  *
  * If this doesn't do what you need you may add functions like the following to your skin's display_init():
  * require_js() , require_css() , add_js_headline()
  *
  * @param array of possible features you want to include. If empty, will default to {'b2evo_base', 'style', 'colorbox'} for backwards compatibility.
  */
 function display_init($features = array())
 {
     global $debug, $Messages, $disp;
     if (empty($features)) {
         // Fall back to v5 default set of features:
         $features = array('b2evo_base_css', 'style_css', 'colorbox', 'disp_auto');
     }
     // "Temporary" patch to at least have disp_auto unless another disp_xxx was specified. Use 'disp_off' to NOT include anuthing.
     if (!preg_grep('/disp_.*/', $features)) {
         $features[] = 'disp_auto';
     }
     // We're NOT using foreach so that the array can continue to grow during parsing: (see 'disp_auto')
     for ($i = 0; isset($features[$i]); $i++) {
         // Get next feature to include:
         $feature = $features[$i];
         switch ($feature) {
             case 'jquery':
                 // Include jQuery:
                 require_js('#jquery#', 'blog');
                 break;
             case 'font_awesome':
                 // Initialize font-awesome icons and use them as a priority over the glyphicons, @see get_icon()
                 init_fontawesome_icons('fontawesome-glyphicons');
                 break;
             case 'bootstrap':
                 // Include Bootstrap:
                 require_js('#bootstrap#', 'blog');
                 require_css('#bootstrap_css#', 'blog');
                 break;
             case 'bootstrap_theme_css':
                 // Include the Bootstrap Theme CSS:
                 require_css('#bootstrap_theme_css#', 'blog');
                 break;
             case 'bootstrap_evo_css':
                 // Include the bootstrap-b2evo_base CSS (NEW / v6 style) - Use this when you use Bootstrap:
                 if ($debug) {
                     // Use readable CSS:
                     // rsc/less/bootstrap-basic_styles.less
                     // rsc/less/bootstrap-basic.less
                     // rsc/less/bootstrap-blog_base.less
                     // rsc/less/bootstrap-item_base.less
                     // rsc/less/bootstrap-evoskins.less
                     require_css('bootstrap-b2evo_base.bundle.css', 'blog');
                     // CSS concatenation of the above
                 } else {
                     // Use minified CSS:
                     require_css('bootstrap-b2evo_base.bmin.css', 'blog');
                     // Concatenation + Minifaction of the above
                 }
                 break;
             case 'bootstrap_init_tooltips':
                 // JS to init Bootstrap tooltips (E.g. on comment form for allowed file extensions):
                 add_js_headline('jQuery( function () { jQuery( \'[data-toggle="tooltip"]\' ).tooltip() } )');
                 break;
             case 'bootstrap_messages':
                 // Initialize $Messages Class to use Bootstrap styles:
                 $Messages->set_params(array('class_success' => 'alert alert-dismissible alert-success fade in', 'class_warning' => 'alert alert-dismissible alert-warning fade in', 'class_error' => 'alert alert-dismissible alert-danger fade in', 'class_note' => 'alert alert-dismissible alert-info fade in', 'before_message' => '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>'));
                 break;
             case 'b2evo_base_css':
                 // Include the b2evo_base CSS (OLD / v5 style) - Use this when you DON'T use Bootstrap:
                 if ($debug) {
                     // Use readable CSS:
                     // require_css( 'basic_styles.css', 'blog' ); // the REAL basic styles
                     // require_css( 'basic.css', 'blog' ); // Basic styles
                     // require_css( 'blog_base.css', 'blog' ); // Default styles for the blog navigation
                     // require_css( 'item_base.css', 'blog' ); // Default styles for the post CONTENT
                     // require_css( 'b2evo_base.bundle.css', 'blog' ); // Concatenation of the above
                     require_css('b2evo_base.bundle.css', 'blog');
                     // Concatenation + Minifaction of the above
                 } else {
                     // Use minified CSS:
                     require_css('b2evo_base.bmin.css', 'blog');
                     // Concatenation + Minifaction of the above
                 }
                 break;
             case 'style_css':
                 // Include the default skin style.css:
                 // You should make sure this is called ahead of any custom generated CSS.
                 if ($this->use_min_css == false || $debug || $this->use_min_css == 'check' && !file_exists(dirname(__FILE__) . '/style.min.css')) {
                     // Use readable CSS:
                     require_css('style.css', 'relative');
                     // Relative to <base> tag (current skin folder)
                 } else {
                     // Use minified CSS:
                     require_css('style.min.css', 'relative');
                     // Relative to <base> tag (current skin folder)
                 }
                 break;
             case 'colorbox':
                 // Colorbox (a lightweight Lightbox alternative) allows to zoom on images and do slideshows with groups of images:
                 if ($this->get_setting('colorbox')) {
                     // This can be enabled by a setting in skins where it may be relevant
                     require_js_helper('colorbox', 'blog');
                 }
                 break;
             case 'disp_auto':
                 // Automatically add a disp_xxx for current $disp:
                 $features[] = 'disp_' . $disp;
                 break;
             case 'disp_single':
                 // Specific features for disp=single:
             // Specific features for disp=single:
             case 'disp_page':
                 // Specific features for disp=page:
                 global $Blog;
                 // Used to init functions for AJAX forms to add a comment:
                 init_ajax_forms('blog');
                 // Used to set rating for a new comment:
                 init_ratings_js('blog');
                 // Used to vote on the comments:
                 init_voting_comment_js('blog');
                 // Used to display a tooltip to the right of plugin help icon:
                 init_plugins_js('blog', $this->get_template('tooltip_plugin'));
                 // Used to autocomplete usernames in textarea:
                 init_autocomplete_usernames_js('blog');
                 if ($Blog->get_setting('allow_rating_comment_helpfulness')) {
                     // Load jquery UI to animate background color on change comment status or on vote:
                     require_js('#jqueryUI#', 'blog');
                 }
                 break;
             case 'disp_users':
                 // Specific features for disp=users:
                 // Used to add new search field "Specific criteria":
                 require_js('#jqueryUI#', 'blog');
                 require_css('#jqueryUI_css#', 'blog');
                 // Require results.css to display thread query results in a table:
                 if (!in_array('bootstrap', $features)) {
                     // Only for NON-bootstrap skins
                     require_css('results.css', 'blog');
                     // Results/tables styles
                 }
                 // Require functions.js to show/hide a panel with filters:
                 require_js('functions.js', 'blog');
                 // Include this file to expand/collapse the filters panel when JavaScript is disabled
                 global $inc_path;
                 require_once $inc_path . '_filters.inc.php';
                 break;
             case 'disp_messages':
                 // Specific features for disp=messages:
                 // Used to display a tooltip to the right of plugin help icon:
                 init_plugins_js('blog', $this->get_template('tooltip_plugin'));
                 // Require results.css to display message query results in a table
                 if (!in_array('bootstrap', $features)) {
                     // Only for NON-bootstrap skins
                     require_css('results.css', 'blog');
                     // Results/tables styles
                 }
                 // Require functions.js to show/hide a panel with filters:
                 require_js('functions.js', 'blog');
                 // Include this file to expand/collapse the filters panel when JavaScript is disabled
                 global $inc_path;
                 require_once $inc_path . '_filters.inc.php';
                 break;
             case 'disp_contacts':
                 // Specific features for disp=contacts:
                 // Used for combo box "Add all selected contacts to this group":
                 require_js('form_extensions.js', 'blog');
                 // Require results.css to display contact query results in a table
                 if (!in_array('bootstrap', $features)) {
                     // Only for NON-bootstrap skins
                     require_css('results.css', 'blog');
                     // Results/tables styles
                 }
                 // Require functions.js to show/hide a panel with filters:
                 require_js('functions.js', 'blog');
                 // Include this file to expand/collapse the filters panel when JavaScript is disabled
                 global $inc_path;
                 require_once $inc_path . '_filters.inc.php';
                 break;
             case 'disp_threads':
                 // Specific features for disp=threads:
                 if (in_array(get_param('action'), array('new', 'create', 'preview'))) {
                     // Used to suggest usernames for the field "Recipients":
                     init_tokeninput_js('blog');
                 }
                 // Used to display a tooltip to the right of plugin help icon:
                 init_plugins_js('blog', $this->get_template('tooltip_plugin'));
                 // Require results.css to display thread query results in a table:
                 if (!in_array('bootstrap', $features)) {
                     // Only for NON-bootstrap skins
                     require_css('results.css', 'blog');
                     // Results/tables styles
                 }
                 // Require functions.js to show/hide a panel with filters:
                 require_js('functions.js', 'blog');
                 // Include this file to expand/collapse the filters panel when JavaScript is disabled
                 global $inc_path;
                 require_once $inc_path . '_filters.inc.php';
                 break;
             case 'disp_login':
                 // Specific features for disp=threads:
                 global $Settings, $Plugins;
                 $transmit_hashed_password = (bool) $Settings->get('js_passwd_hashing') && !(bool) $Plugins->trigger_event_first_true('LoginAttemptNeedsRawPassword');
                 if ($transmit_hashed_password) {
                     // Include JS for client-side password hashing:
                     require_js('build/sha1_md5.bmin.js', 'blog');
                 }
                 break;
             case 'disp_profile':
                 // Specific features for disp=profile:
                 // Used to add new user fields:
                 init_userfields_js('blog', $this->get_template('tooltip_plugin'));
                 // Used to crop profile pictures:
                 require_js('#jquery#', 'blog');
                 require_js('#jcrop#', 'blog');
                 require_css('#jcrop_css#', 'blog');
                 break;
             case 'disp_avatar':
                 // Specific features for disp=avatar:
                 // Used to crop profile pictures:
                 require_js('#jquery#', 'blog');
                 require_js('#jcrop#', 'blog');
                 require_css('#jcrop_css#', 'blog');
                 break;
             case 'disp_edit':
                 // Specific features for disp=edit:
                 // Require results.css to display attachments as a result table:
                 require_css('results.css');
                 init_tokeninput_js('blog');
                 // Used to display a date picker for date form fields:
                 init_datepicker_js('blog');
                 // Used to display a tooltip to the right of plugin help icon:
                 init_plugins_js('blog', $this->get_template('tooltip_plugin'));
                 // Used to switch to advanced editing:
                 require_js('backoffice.js', 'blog');
                 // Used to automatically checks the matching extracat when we select a new main cat:
                 require_js('extracats.js', 'blog');
                 // Used to autocomplete usernames in textarea:
                 init_autocomplete_usernames_js('blog');
                 break;
             case 'disp_edit_comment':
                 // Specific features for disp=edit_comment:
                 // Require results.css to display attachments as a result table:
                 require_css('results.css');
                 // Used to set rating for a new comment:
                 init_ratings_js('blog');
                 // Used to display a date picker for date form fields:
                 init_datepicker_js('blog');
                 // Used to display a tooltip to the right of plugin help icon:
                 init_plugins_js('blog', $this->get_template('tooltip_plugin'));
                 // Used to autocomplete usernames in textarea:
                 init_autocomplete_usernames_js('blog');
                 break;
             case 'disp_useritems':
                 // Specific features for disp=useritems:
             // Specific features for disp=useritems:
             case 'disp_usercomments':
                 // Specific features for disp=usercomments:
                 // Require results.css to display item/comment query results in a table
                 require_css('results.css');
                 // Results/tables styles
                 // Require functions.js to show/hide a panel with filters
                 require_js('functions.js', 'blog');
                 // Include this file to expand/collapse the filters panel when JavaScript is disabled
                 global $inc_path;
                 require_once $inc_path . '_filters.inc.php';
                 break;
             default:
                 // We no longer want to do this because of 'disp_auto':
                 // debug_die( 'This skin has requested an unknown feature: \''.$feature.'\'. Maybe this skin requires a more recent version of b2evolution.' );
         }
     }
 }