コード例 #1
0
ファイル: functions-html.php プロジェクト: yourls/yourls
/**
 * Display HTML head and <body> tag
 *
 * @param string $context Context of the page (stats, index, infos, ...)
 * @param string $title HTML title of the page
 */
function yourls_html_head($context = 'index', $title = '')
{
    yourls_do_action('pre_html_head', $context, $title);
    // All components to false, except when specified true
    $share = $insert = $tablesorter = $tabs = $cal = $charts = false;
    // Load components as needed
    switch ($context) {
        case 'infos':
            $share = $tabs = $charts = true;
            break;
        case 'bookmark':
            $share = $insert = $tablesorter = true;
            break;
        case 'index':
            $insert = $tablesorter = $cal = $share = true;
            break;
        case 'plugins':
        case 'tools':
            $tablesorter = true;
            break;
        case 'install':
        case 'login':
        case 'new':
        case 'upgrade':
            break;
    }
    // Force no cache for all admin pages
    if (yourls_is_admin() && !headers_sent()) {
        header('Expires: Thu, 23 Mar 1972 07:00:00 GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Cache-Control: no-cache, must-revalidate, max-age=0');
        header('Pragma: no-cache');
        yourls_content_type_header(yourls_apply_filter('html_head_content-type', 'text/html'));
        yourls_do_action('admin_headers', $context, $title);
    }
    // Store page context in global object
    global $ydb;
    $ydb->context = $context;
    // Body class
    $bodyclass = yourls_apply_filter('bodyclass', '');
    $bodyclass .= yourls_is_mobile_device() ? 'mobile' : 'desktop';
    // Page title
    $_title = 'YOURLS &mdash; Your Own URL Shortener | ' . yourls_link();
    $title = $title ? $title . " &laquo; " . $_title : $_title;
    $title = yourls_apply_filter('html_title', $title, $context);
    ?>
<!DOCTYPE html>
<html <?php 
    yourls_html_language_attributes();
    ?>
>
<head>
	<title><?php 
    echo $title;
    ?>
</title>
	<link rel="shortcut icon" href="<?php 
    yourls_favicon();
    ?>
" />
	<meta http-equiv="Content-Type" content="<?php 
    echo yourls_apply_filter('html_head_meta_content-type', 'text/html; charset=utf-8');
    ?>
" />
	<meta name="generator" content="YOURLS <?php 
    echo YOURLS_VERSION;
    ?>
" />
	<meta name="description" content="YOURLS &raquo; Your Own URL Shortener' | <?php 
    yourls_site_url();
    ?>
" />
    <meta name="referrer" content="always" />
	<script src="<?php 
    yourls_site_url();
    ?>
/js/jquery-1.9.1.min.js?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/javascript"></script>
	<script src="<?php 
    yourls_site_url();
    ?>
/js/common.js?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/javascript"></script>
	<script src="<?php 
    yourls_site_url();
    ?>
/js/jquery.notifybar.js?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/javascript"></script>
	<link rel="stylesheet" href="<?php 
    yourls_site_url();
    ?>
/css/style.css?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/css" media="screen" />
	<?php 
    if ($tabs) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/infos.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/infos.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($tablesorter) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/tablesorter.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/jquery.tablesorter.min.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($insert) {
        ?>
		<script src="<?php 
        yourls_site_url();
        ?>
/js/insert.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($share) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/share.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/share.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        yourls_site_url();
        ?>
/js/clipboard.min.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($cal) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/cal.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<?php 
        yourls_l10n_calendar_strings();
        ?>
		<script src="<?php 
        yourls_site_url();
        ?>
/js/jquery.cal.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($charts) {
        ?>
			<script type="text/javascript" src="https://www.google.com/jsapi"></script>
			<script type="text/javascript">
					 google.load('visualization', '1.0', {'packages':['corechart', 'geochart']});
			</script>
	<?php 
    }
    ?>
	<script type="text/javascript">
	//<![CDATA[
		var ajaxurl  = '<?php 
    echo yourls_admin_url('admin-ajax.php');
    ?>
';
	//]]>
	</script>
	<?php 
    yourls_do_action('html_head', $context);
    ?>
</head>
<body class="<?php 
    echo $context;
    ?>
 <?php 
    echo $bodyclass;
    ?>
">
<div id="wrap">
	<?php 
}
コード例 #2
0
function yourls_html_head($context = 'index', $title = '')
{
    // All components to false, except when specified true
    $share = $insert = $tablesorter = $tabs = $cal = false;
    // Load components as needed
    switch ($context) {
        case 'infos':
            $share = $tabs = true;
            break;
        case 'bookmark':
            $share = $insert = $tablesorter = true;
            break;
        case 'index':
            $insert = $tablesorter = $cal = $share = true;
            break;
        case 'plugins':
        case 'tools':
            $tablesorter = true;
            break;
        case 'install':
        case 'login':
        case 'new':
        case 'upgrade':
            break;
    }
    // Force no cache for all admin pages
    if (yourls_is_admin() && !headers_sent()) {
        header('Expires: Thu, 23 Mar 1972 07:00:00 GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Cache-Control: no-cache, must-revalidate, max-age=0');
        header('Pragma: no-cache');
        yourls_do_action('admin_headers');
    }
    // Body class
    $bodyclass = '';
    $bodyclass .= yourls_is_mobile_device() ? 'mobile' : 'desktop';
    // Page title
    $_title = 'YOURLS &mdash; Your Own URL Shortener | ' . YOURLS_SITE;
    $title = $title ? $title . " &laquo; " . $_title : $_title;
    $title = yourls_apply_filter('html_title', $title);
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title><?php 
    echo $title;
    ?>
</title>
	<link rel="icon" type="image/gif" href="<?php 
    yourls_site_url();
    ?>
/images/favicon.gif" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="chrome=1" />
	<meta name="author" content="Ozh RICHARD & Lester CHAN for http://yourls.org/" />
	<meta name="generator" content="YOURLS <?php 
    echo YOURLS_VERSION;
    ?>
" />
	<meta name="description" content="Insert URL &laquo; YOURLS &raquo; Your Own URL Shortener' | <?php 
    yourls_site_url();
    ?>
" />
	<script src="<?php 
    yourls_site_url();
    ?>
/js/jquery-1.4.3.min.js?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/javascript"></script>
	<script src="<?php 
    yourls_site_url();
    ?>
/js/common.js?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/javascript"></script>
	<script src="<?php 
    yourls_site_url();
    ?>
/js/jquery.notifybar.js?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/javascript"></script>
	<link rel="stylesheet" href="<?php 
    yourls_site_url();
    ?>
/css/style.css?v=<?php 
    echo YOURLS_VERSION;
    ?>
" type="text/css" media="screen" />
	<?php 
    if ($tabs) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/infos.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/infos.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($tablesorter) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/tablesorter.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/jquery.tablesorter.min.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($insert) {
        ?>
		<script src="<?php 
        yourls_site_url();
        ?>
/js/insert.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<?php 
    if ($share) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/share.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/share.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        yourls_site_url();
        ?>
/js/ZeroClipboard.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
		<script type="text/javascript">ZeroClipboard.setMoviePath( '<?php 
        yourls_site_url();
        ?>
/js/ZeroClipboard.swf' );</script>
	<?php 
    }
    ?>
	<?php 
    if ($cal) {
        ?>
		<link rel="stylesheet" href="<?php 
        yourls_site_url();
        ?>
/css/cal.css?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/css" media="screen" />
		<script src="<?php 
        yourls_site_url();
        ?>
/js/jquery.cal.js?v=<?php 
        echo YOURLS_VERSION;
        ?>
" type="text/javascript"></script>
	<?php 
    }
    ?>
	<script type="text/javascript">
	//<![CDATA[
		var ajaxurl = '<?php 
    echo yourls_admin_url('admin-ajax.php');
    ?>
';
	//]]>
	</script>
	<?php 
    yourls_do_action('html_head', $context);
    ?>
</head>
<body class="<?php 
    echo $context;
    ?>
 <?php 
    echo $bodyclass;
    ?>
">
<div id="wrap">
	<?php 
}