| @@ -43,9 +43,16 @@ | ||
| 43 | 43 | * @return string A DOCTYPE tag along with the HEAD section and title tag, configured by parameters. |
| 44 | 44 | */ |
| 45 | 45 | public static function doctype_html_head ($doctype_html_head_title = FALSE, $doctype_html_head_action = FALSE) |
| 46 | 46 | { |
| 47 | - $s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"]; // Loads s2Member only. | |
| 47 | + $static_css = (!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['static_css'])) ? c_ws_plugin__s2member_utils_assets::ensure_static_assets('css') : array(); | |
| 48 | + $static_js = (!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['static_js']) && function_exists('wp_add_inline_script')) ? c_ws_plugin__s2member_utils_assets::ensure_static_assets('js') : array(); | |
| 49 | + $static_inline_js = (!empty($static_js['ok']) && !empty($static_js['assets']) && c_ws_plugin__s2member_utils_assets::static_js_text_delivery() === 'page') ? c_ws_plugin__s2member_utils_assets::static_js_inline_data($static_js['assets']) : ''; | |
| 50 | + if(!empty($static_js['ok']) && !empty($static_js['assets']) && c_ws_plugin__s2member_utils_assets::static_js_text_delivery() === 'page' && $static_inline_js === '') | |
| 51 | + $static_js = array(); //260906.2049 Do not emit slot-based static JavaScript in standalone documents without its page-loaded text values. | |
| 52 | + //260906.2219 Static disabled keeps the selected s2Member-Only Dynamic Loader (s2member-o.php); requested static delivery that fails uses full WordPress so compatibility hooks are not skipped. | |
| 53 | + $dynamic_css_url = c_ws_plugin__s2member_utils_assets::dynamic_asset_url(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['static_css']) && (empty($static_css['ok']) || empty($static_css['assets']))); | |
| 54 | + $dynamic_js_url = c_ws_plugin__s2member_utils_assets::dynamic_asset_url(!empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['static_js']) && (empty($static_js['ok']) || empty($static_js['assets']))); | |
| 48 | 55 | |
| 49 | 56 | ob_start (); // Start output buffering here so we can "return" the output from this utility. |
| 50 | 57 | |
| 51 | 58 | echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; |
| @@ -54,12 +61,27 @@ | ||
| 54 | 61 | echo '<head>' . "\n"; |
| 55 | 62 | |
| 56 | 63 | echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' . "\n"; |
| 57 | 64 | |
| 58 | - echo '<link href="' . esc_attr ($s2o . "?ws_plugin__s2member_css=1&qcABC=1&ver=" . urlencode (c_ws_plugin__s2member_utilities::ver_checksum ())) . '" type="text/css" rel="stylesheet" media="all" />' . "\n"; | |
| 65 | + if(!empty($static_css['ok']) && !empty($static_css['assets'])) | |
| 66 | + { | |
| 67 | + foreach($static_css['assets'] as $asset) | |
| 68 | + echo '<link href="'.esc_attr($asset['url']).'" type="text/css" rel="stylesheet" media="all" />'."\n"; | |
| 69 | + } | |
| 70 | + else | |
| 71 | + echo '<link href="' . esc_attr ($dynamic_css_url . "?ws_plugin__s2member_css=1&qcABC=1&ver=" . urlencode (c_ws_plugin__s2member_utilities::ver_checksum ())) . '" type="text/css" rel="stylesheet" media="all" />' . "\n"; | |
| 59 | 72 | |
| 60 | 73 | echo '<script type="text/javascript" src="' . esc_attr (site_url ("/wp-includes/js/jquery/jquery.js?ver=" . urlencode (c_ws_plugin__s2member_utilities::ver_checksum ()))) . '"></script>' . "\n"; |
| 61 | - echo '<script type="text/javascript" src="' . esc_attr ($s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode (WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5) . "&qcABC=1&ver=" . urlencode (c_ws_plugin__s2member_utilities::ver_checksum ())) . '"></script>' . "\n"; | |
| 74 | + | |
| 75 | + if(!empty($static_js['ok']) && !empty($static_js['assets'])) | |
| 76 | + { | |
| 77 | + //260903.0453 This standalone frontend document cannot use WordPress's enqueue printer; emit the same page-specific globals immediately before the generated scripts. | |
| 78 | + echo '<script type="text/javascript">'.c_ws_plugin__s2member_css_js_in::current_user_js_globals(TRUE).(($static_inline_js !== '') ? "\n".$static_inline_js : '').'</script>'."\n"; | |
| 79 | + foreach($static_js['assets'] as $asset) | |
| 80 | + echo '<script type="text/javascript" src="'.esc_attr($asset['url']).'"></script>'."\n"; | |
| 81 | + } | |
| 82 | + else | |
| 83 | + echo '<script type="text/javascript" src="' . esc_attr ($dynamic_js_url . "?ws_plugin__s2member_js_w_globals=" . urlencode (WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5) . "&qcABC=1&ver=" . urlencode (c_ws_plugin__s2member_utilities::ver_checksum ())) . '"></script>' . "\n"; | |
| 62 | 84 | |
| 63 | 85 | if ($doctype_html_head_title) // Add <title></title> tag? |
| 64 | 86 | echo '<title>' . $doctype_html_head_title . '</title>' . "\n"; |
| 65 | 87 | |