コード例 #1
0
ファイル: themes.php プロジェクト: nerdling/gregarius
/**
 * Returns the theme's "media" component, e.g. 'web', 
 * 'rss' or 'mobile'.
 */
function getThemeMedia()
{
    static $media;
    if ($media) {
        return $media;
    }
    // Default to "web".
    $media = 'web';
    // Has the user specified anything?
    if (isset($_GET['rss'])) {
        $media = 'rss';
    } elseif (isset($_SESSION['mobile']) || isset($_REQUEST['mobile']) || isMobileDevice()) {
        $media = 'mobile';
    }
    // This is here so that auto-detected (e.g. mobile) medias
    // can be overridden.
    if (isset($_REQUEST['media'])) {
        $media = sanitize($_REQUEST['media'], RSS_SANITIZER_WORDS);
    }
    // Finally: let plugins voice their opinion
    $media = rss_plugin_hook('rss.plugins.thememedia', $media);
    return $media;
}
コード例 #2
0
?>
<html>
<body>
<h1>Example #3</h1>
<h3 style="color: red">This is a basic MobileStrategy() PageCache page that is going to be cached, uses optional
    Mobile_Detect package</h3>
<p style="border:1px solid #ccc;">
    Visit this page with a desktop browser on your computer, and then using a mobile phone.<br/>
    You will notice 2 files inside cache/ directory, one regular cache file and the other same file but with "-mob"
    added to it.
</p>
<?php 
/**
 *  Cache for Mobile Phones only
 */
if (isMobileDevice()) {
    ?>
    <h3>This section will be displayed on mobile phones only</h3>
    <?php 
} else {
    /**
     * Cache the desktop version
     */
    ?>
    <h3>This section will be displayed on desktop devices, but not on mobile phones</h3>

    <?php 
}
?>

<h3>This is a dynamic PHP <i>date('H:i:s')</i>
コード例 #3
0
ファイル: index.php プロジェクト: leamiko/58bitao
    }
    return true;
}
function isMobileDevice()
{
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $type = '';
    $keyword = array('iphone', 'ipad', 'ipod', 'android');
    foreach ($keyword as $k) {
        if (strpos($agent, $k) !== false) {
            return true;
        }
    }
    return false;
}
if (isMobileDevice() && !isMobileUrl()) {
    header('Location: index.php/m/index/index');
    exit;
}
$host = strtolower($_SERVER['HTTP_HOST']);
if (substr($host, 0, 4) != 'www.') {
    $host = 'www.' . $host;
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://' . $host);
    exit;
}
define('FTX_VERSION', '5.0');
define('FTX_RELEASE', '20131210');
define('APP_NAME', 'app');
define('APP_PATH', './app/');
define('FTX_DATA_PATH', './data/');
コード例 #4
0
function __stickyflag_AddButtons()
{
    $usemodrewrite = getConfig('rss.output.usemodrewrite');
    $options = rss_plugins_get_option(STICKYFLAG_CONFIG_OPTIONS);
    if (null == $options) {
        return;
    }
    if ($options & STICKYFLAG_ENABLE_STICKY_MENU || isMobileDevice() && $options & STICKYFLAG_ENABLE_STICKY_SHORTCUT) {
        if (true == $usemodrewrite) {
            $url = getPath() . "state/" . RSS_STATE_STICKY . "";
        } else {
            $url = getPath() . "state.php?state=" . RSS_STATE_STICKY . "";
        }
        $GLOBALS['rss']->nav->addNavItem($url, 'Stick<span>y</span>');
    }
    if ($options & STICKYFLAG_ENABLE_FLAG_MENU || isMobileDevice() && $options & STICKYFLAG_ENABLE_FLAG_SHORTCUT) {
        if (true == $usemodrewrite) {
            $url = getPath() . "state/" . RSS_STATE_FLAG . "";
        } else {
            $url = getPath() . "state.php?state=" . RSS_STATE_FLAG . "";
        }
        $GLOBALS['rss']->nav->addNavItem($url, '<span>F</span>lag');
    }
}
コード例 #5
0
ファイル: itemlist.php プロジェクト: jphpsf/gregarius
<h2><?php 
    echo $title;
    ?>
</h2>
<?php 
    if (hidePrivate()) {
        ?>
	<p>(<a href="<?php 
        echo getPath();
        ?>
?mobilelogin&amp;media=mobile">Login</a> to mark items read)</p>
<?php 
    }
    ?>
<form method="post" action="<?php 
    print getPath();
    ?>
">
<?php 
}
rss_itemlist_feeds();
if (!isMobileDevice()) {
    ?>
<input type='hidden' name='mobile' />
<?php 
}
?>
<p id="nextitems"><input type='submit' value='Next  &raquo;&raquo;' /></p>
</form>
<?php 
rss_plugin_hook('rss.plugins.bodyend.media', getThemeMedia());