Skip to content

Commit

Permalink
Merge branch 'syncguru-bug13285-move-js-to-footer'
Browse files Browse the repository at this point in the history
This is Rafik's original branch rebased on master.
Pull request #605
  • Loading branch information
dregad committed Aug 20, 2015
2 parents aa9b4f8 + 98a91f8 commit 2dbc86b
Showing 1 changed file with 32 additions and 41 deletions.
73 changes: 32 additions & 41 deletions core/html_api.php
Expand Up @@ -31,7 +31,6 @@
* html_title
* html_css
* html_rss_link
* html_head_javascript
* (html_meta_redirect)
* html_page_top2
* html_page_top2a
Expand Down Expand Up @@ -207,8 +206,6 @@ function html_page_top1( $p_page_title = null ) {
# Advertise the availability of the browser search plug-ins.
echo "\t", '<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Text Search" href="' . string_sanitize_url( 'browser_search_plugin.php?type=text', true ) . '" />' . "\n";
echo "\t", '<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Issue Id" href="' . string_sanitize_url( 'browser_search_plugin.php?type=id', true ) . '" />' . "\n";

html_head_javascript();
}

/**
Expand Down Expand Up @@ -303,7 +300,7 @@ function html_page_bottom1a( $p_file = null ) {
}

/**
* (1) Print the document type and the opening <html> tag
* Print the document type and the opening <html> tag
* @return void
*/
function html_begin() {
Expand All @@ -312,23 +309,23 @@ function html_begin() {
}

/**
* (2) Begin the <head> section
* Begin the <head> section
* @return void
*/
function html_head_begin() {
echo '<head>', "\n";
}

/**
* (3) Print the content-type
* Print the content-type
* @return void
*/
function html_content_type() {
echo "\t", '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />', "\n";
}

/**
* (4) Print the window title
* Print the window title
* @param string $p_page_title Window title.
* @return void
*/
Expand Down Expand Up @@ -359,7 +356,7 @@ function require_css( $p_stylesheet_path ) {
}

/**
* (5) Print the link to include the CSS file
* Print the link to include the CSS file
* @return void
*/
function html_css() {
Expand Down Expand Up @@ -393,7 +390,7 @@ function html_css_link( $p_filename ) {


/**
* (6) Print an HTML meta tag to redirect to another page
* Print an HTML meta tag to redirect to another page
* This function is optional and may be called by pages that need a redirect.
* $p_time is the number of seconds to wait before redirecting.
* If we have handled any errors on this page return false and don't redirect.
Expand Down Expand Up @@ -437,31 +434,7 @@ function require_js( $p_script_path ) {
}

/**
* (6a) Javascript...
* @return void
*/
function html_head_javascript() {
global $g_scripts_included;

echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";

if ( config_get_global( 'cdn_enabled' ) == ON ) {
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jquery/' . JQUERY_VERSION . '/jquery.min.js"></script>' . "\n";
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/' . JQUERY_UI_VERSION . '/jquery-ui.min.js"></script>' . "\n";
} else {
html_javascript_link( 'jquery-' . JQUERY_VERSION . '.min.js' );
html_javascript_link( 'jquery-ui-' . JQUERY_UI_VERSION . '.min.js' );
}

html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}
}

/**
* (7) End the <head> section
* End the <head> section
* @return void
*/
function html_head_end() {
Expand All @@ -471,7 +444,7 @@ function html_head_end() {
}

/**
* (8) Begin the <body> section
* Begin the <body> section
* @return void
*/
function html_body_begin() {
Expand All @@ -489,7 +462,7 @@ function html_body_begin() {
}

/**
* (9) Print a user-defined banner at the top of the page if there is one.
* Print a user-defined banner at the top of the page if there is one.
* @return void
*/
function html_top_banner() {
Expand Down Expand Up @@ -527,7 +500,7 @@ function html_top_banner() {
}

/**
* (10) Print the user's account information
* Print the user's account information
* Also print the select box where users can switch projects
* @return void
*/
Expand Down Expand Up @@ -622,7 +595,7 @@ function html_login_info() {
}

/**
* (11) Print a user-defined banner at the bottom of the page if there is one.
* Print a user-defined banner at the bottom of the page if there is one.
* @return void
*/
function html_bottom_banner() {
Expand Down Expand Up @@ -660,7 +633,7 @@ function html_is_auto_refresh() {
}

/**
* (13) Print the page footer information
* Print the page footer information
* @return void
*/
function html_footer() {
Expand Down Expand Up @@ -778,19 +751,37 @@ function html_footer() {
}

/**
* (14) End the <body> section
* End the <body> section
* @return void
*/
function html_body_end() {
global $g_scripts_included;

event_signal( 'EVENT_LAYOUT_BODY_END' );

echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";

if ( config_get_global( 'cdn_enabled' ) == ON ) {
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jquery/' . JQUERY_VERSION . '/jquery.min.js"></script>' . "\n";
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/' . JQUERY_UI_VERSION . '/jquery-ui.min.js"></script>' . "\n";
} else {
html_javascript_link( 'jquery-' . JQUERY_VERSION . '.min.js' );
html_javascript_link( 'jquery-ui-' . JQUERY_UI_VERSION . '.min.js' );
}

html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}

echo '</div>', "\n";

echo '</body>', "\n";
}

/**
* (15) Print the closing <html> tag
* Print the closing <html> tag
* @return void
*/
function html_end() {
Expand Down

0 comments on commit 2dbc86b

Please sign in to comment.