diff options
author | Matt Friedman <maf675@gmail.com> | 2011-09-26 20:26:32 -0700 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2011-09-27 11:12:11 -0700 |
commit | 2dca3c3c278e99cfd6cdbea7149063d160e4cc11 (patch) | |
tree | 0e561f4bdeb04085115a70bb4d33d32322ecfcfa /phpBB/includes/functions.php | |
parent | 2a28b6fc401e4481a3a4eb6085b45b9bd7746f43 (diff) | |
download | forums-2dca3c3c278e99cfd6cdbea7149063d160e4cc11.tar forums-2dca3c3c278e99cfd6cdbea7149063d160e4cc11.tar.gz forums-2dca3c3c278e99cfd6cdbea7149063d160e4cc11.tar.bz2 forums-2dca3c3c278e99cfd6cdbea7149063d160e4cc11.tar.xz forums-2dca3c3c278e99cfd6cdbea7149063d160e4cc11.zip |
[ticket/10390] Serve jQuery from Google CDN Yes/No button in ACP
jQuery will now be available via remote CDN from Google. Microsoft and
jQuery CDNs have been removed, so we can simplify this option for the user.
Default mode is NO so the copy of jQuery included with phpBB is served by
default.
PHPBB3-10390
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8cdafbd95e..d769ce0374 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4569,8 +4569,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_STYLESHEET_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css', 'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css', 'T_STYLESHEET_NAME' => $user->theme['theme_name'], - 'T_JQUERY_LINK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? remote_jquery_url($config['load_jquery_host']) : "{$web_path}assets/javascript/jquery.js", - 'S_JQUERY_FALLBACK' => (!empty($config['load_jquery_host']) && $config['load_jquery_host'] != 'localhost') ? true : false, + 'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js", + 'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false, 'T_THEME_NAME' => $user->theme['theme_path'], 'T_THEME_LANG_NAME' => $user->data['user_lang'], @@ -4769,34 +4769,3 @@ function phpbb_pcre_utf8_support() } return $utf8_pcre_properties; } - -/** -* Build jQuery URL for remote CDNs -* Reference: http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery -* HTTP protocols intentionally omitted for Google and Microsoft - its the best -* way to reference third party content that is available via both HTTP and HTTPS -* -* @return string Returns url to a jQuery library -*/ -function remote_jquery_url($host) -{ - switch($host) - { - case 'google': - // Google uses a 1.5.0, 1.5.1 format (we need to add a .0 to new 1.X releases) - $version = (substr_count(JQUERY_VERSION, '.') == 1) ? JQUERY_VERSION . '.0' : JQUERY_VERSION; - $url = '//ajax.googleapis.com/ajax/libs/jquery/' . $version . '/jquery.min.js'; - break; - - case 'microsoft': - // Microsoft uses a 1.5, 1.5.1 format - $url = '//ajax.aspnetcdn.com/ajax/jQuery/jquery-' . JQUERY_VERSION . '.min.js'; - break; - - case 'jquery': - // jQuery uses a 1.5, 1.5.1 format - $url = 'http://code.jquery.com/jquery-' . JQUERY_VERSION . '.min.js'; - break; - } - return $url; -} |