Exemple #1
0
<?php 
/**
 * Core Javascript libraries always included.
 */
$core_filenames = array('vars.php', 'base.js', 'modernizr.js', 'capability.js', 'browser.js', 'useragent.js', 'screen.js', 'classification.js', 'util.js', 'override.js', 'server.js', 'telemetry.js');
/**
 * Include each core Javascript library.
 */
foreach ($core_filenames as $filename) {
    JS::load('core/' . $filename);
}
/**
 * End JS definitions early if Device is not initialized, as server.js is going
 * to cause a redirect to return to this page after passing device info.
 */
if (!Classification::init()) {
    die;
}
JS::load('core/user_agent.js');
/**
 * Include utility libraries.
 */
if (!isset($_GET['no_ga'])) {
    JS::load('utility/analytics.js');
}
if (!isset($_GET['no_favicon']) && !isset($_GET['no_icon'])) {
    JS::load('utility/favicon.js');
}
/**
 * Writes apple-touch-icon[-precomposed] to the DOM.
 */
        switch ($classification) {
            case 'full':
                return self::is_full();
            case 'standard':
                return self::is_standard() && (!$absolute_only || !self::is_full());
            case 'basic':
                return self::is_basic() && (!$absolute_only || !self::is_standard());
        }
        /**
         * Return false if not a valid classification, as all valid 
         * classifications have been checked and then returned by switch.
         */
        return false;
    }
    /**
     * Determine if the device is in preview mode, as in it is not itself
     * mobile (when not considering override) but that it has indeed been
     * overridden.
     * 
     * @return bool
     */
    public static function is_preview()
    {
        return self::is_override() && !self::is_mobile(false);
    }
}
/**
 * Initialize the Device static object.
 */
Classification::init();