示例#1
0
 /**
  * Prepare and output the Javascript for the current page
  * @static
  */
 public static function GetHead_JS($scripts)
 {
     global $page, $config;
     $combine = $config['combinejs'] && !\gp\tool::loggedIn() && $page->pagetype !== 'admin_display';
     $scripts = self::GetHead_CDN('js', $scripts);
     //just local jquery
     if (!count($page->head_js) && count($scripts) === 1 && isset($scripts['jquery'])) {
         echo '<!-- jquery_placeholder ' . gp_random . ' -->';
         return;
     }
     if (!$combine || $page->head_force_inline) {
         echo "\n<script type=\"text/javascript\">\n";
         \gp\tool::jsStart();
         echo "\n</script>";
     }
     if (is_array($page->head_js)) {
         $scripts += $page->head_js;
         //other js files
     } else {
         trigger_error('$page->head_js is not an array');
     }
     self::CombineFiles($scripts, 'js', $combine);
 }
示例#2
0
/**
 * Output the message buffer
 *
 */
function GetMessages($wrap = true)
{
    global $wbMessageBuffer, $gp_not_writable, $langmessage;
    if (\gp\tool::loggedIn() && count($gp_not_writable) > 0) {
        $files = '<ul><li>' . implode('</li><li>', $gp_not_writable) . '</li></ul>';
        $message = sprintf($langmessage['not_writable'], \gp\tool::GetUrl('Admin/Status')) . $files;
        message($message);
        $gp_not_writable = array();
    }
    $result = $wrap_end = '';
    if ($wrap) {
        $result = "\n<!-- message_start " . gp_random . " -->";
        $wrap_end = "<!-- message_end -->\n";
    }
    if (!empty($wbMessageBuffer)) {
        if (gpdebug === false) {
            $wbMessageBuffer = array_unique($wbMessageBuffer);
        }
        $result .= '<div class="messages gp-fixed-adjust"><div>';
        $result .= '<a style="" href="#" class="req_script close_message" data-cmd="close_message"></a>';
        $result .= '<ul>';
        $result .= implode('', $wbMessageBuffer);
        $result .= '</ul></div></div>';
    }
    return $result .= \gp\tool::ErrorBuffer() . $wrap_end;
}
示例#3
0
 /**
  * Return the beginning content of a data file
  *
  */
 public static function FileStart($file, $time = null, $file_stats = array())
 {
     global $gpAdmin;
     if (is_null($time)) {
         $time = time();
     }
     //file stats
     $file_stats = (array) $file_stats + self::GetFileStats($file);
     $file_stats['gpversion'] = gpversion;
     $file_stats['modified'] = $time;
     if (\gp\tool::loggedIn()) {
         $file_stats['username'] = $gpAdmin['username'];
     } else {
         $file_stats['username'] = false;
     }
     return '<' . '?' . 'php' . "\ndefined('is_running') or die('Not an entry point...');" . "\n" . '$fileVersion = \'' . gpversion . '\';' . "\n" . '$fileModTime = \'' . $time . '\';' . "\n" . self::ArrayToPHP('file_stats', $file_stats) . "\n\n";
 }