/** * Get Scripts * * Echo and load scripts * * @since 3.1 * @uses $GS_scripts * * @param boolean $footer Load only script with footer flag set */ function get_scripts_backend($footer = FALSE) { global $GS_scripts; if (!$footer) { get_styles_backend(); } # debugLog($GS_scripts); foreach ($GS_scripts as $script) { if ($script['where'] & GSBACK) { if (!$footer) { if ($script['load'] == TRUE && $script['in_footer'] == FALSE) { echo "\t<script src=\"" . $script['src'] . '?v=' . $script['ver'] . "\"></script>\n"; cdn_fallback($script); } } else { if ($script['load'] == TRUE && $script['in_footer'] == TRUE) { echo "\t<script src=\"" . $script['src'] . '?v=' . $script['ver'] . "\"></script>\n"; cdn_fallback($script); } } } } }
/** * Get Scripts * * Echo and load scripts via queue depending on if in footer and on front or back * * @since 3.4 * @uses $GS_scripts * * @param int $facing GSBACK or GSFRONT constant * @param boolean $footer Load only script with footer flag set */ function getScripts($facing = GSBACK, $footer = false) { global $GS_scripts; if (!$footer) { $facing === GSBACK ? get_styles_backend() : get_styles_frontend(); } // debugLog($GS_scripts); foreach ($GS_scripts as $script) { if ($script['load'] == true && $script['where'] & $facing) { if ($footer !== $script['in_footer']) { continue; } echo '<script src="' . $script['src'] . (!empty($script['ver']) ? '?v=' . $script['ver'] : '') . '"></script>' . "\n"; cdn_fallback($script); } } }
/** * Get Scripts * * Echo and load scripts * * @since 3.1 * @uses $GS_scripts * * @param boolean $footer Load only script with footer flag set */ function get_scripts_backend($footer = FALSE) { global $GS_scripts; if (!$footer) { get_styles_backend(); } foreach ($GS_scripts as $script) { if ($script['where'] & GSBACK) { if (!$footer) { if ($script['load'] == TRUE && $script['in_footer'] == FALSE) { echo '<script src="' . $script['src'] . '?v=' . $script['ver'] . '"></script>'; } } else { if ($script['load'] == TRUE && $script['in_footer'] == TRUE) { echo '<script src="' . $script['src'] . '?v=' . $script['ver'] . '"></script>'; } } } } }