/** * Prepare and output any inline Javascript for the current page * @static */ static function GetHead_InlineJS() { global $page, $linkPrefix, $GP_INLINE_VARS; ob_start(); if (gpdebugjs) { if (is_string(gpdebugjs)) { $GP_INLINE_VARS['debugjs'] = 'send'; } else { $GP_INLINE_VARS['debugjs'] = true; } } if (common::LoggedIn()) { $GP_INLINE_VARS += array('isadmin' => true, 'gpBLink' => common::HrefEncode($linkPrefix, false), 'post_nonce' => common::new_nonce('post', true)); gpsession::GPUIVars(); } if (count($GP_INLINE_VARS) > 0) { echo 'var '; $comma = ''; foreach ($GP_INLINE_VARS as $key => $value) { echo $comma . $key . '=' . json_encode($value); $comma = ','; } echo ';'; } $inline = ob_get_clean(); if (!empty($inline)) { echo "\n<script>\n" . $inline . "\n</script>"; } ob_start(); echo $page->head_script; if (!empty($page->jQueryCode)) { echo '$(function(){'; echo $page->jQueryCode; echo '});'; } $inline = ob_get_clean(); $inline = ltrim($inline); if (!empty($inline)) { echo "\n<script>\n" . $inline . "\n</script>\n"; } }
/** * Prepare and output any inline Javascript for the current page * @static */ function GetHead_InlineJS() { global $page, $linkPrefix; ob_start(); if (gpdebugjs) { echo 'var debugjs=true;'; } if (common::LoggedIn()) { echo 'var isadmin=true'; echo ',gpBLink="' . common::HrefEncode($linkPrefix) . '"'; //here because of index.php gpsession::GPUIVars(); if (!admin_tools::CanRemoteInstall()) { echo ',gpRem=false'; } echo ',post_nonce="' . common::new_nonce('post', true) . '"'; echo ';'; gpOutput::GP_STYLES(); } echo $page->head_script; if (!empty($page->jQueryCode)) { echo '$(function(){'; echo $page->jQueryCode; echo '});'; } $inline = ob_get_clean(); if (!empty($inline)) { echo "\n<script type=\"text/javascript\">/* <![CDATA[ */\n"; echo $inline; echo "\n/* ]]> */</script>"; } }