<?php

/**
 * Detect plugin for Fansoro CMS
 *
 * @package    Fansoro
 * @subpackage Plugins
 * @author     Pavel Belousov / pafnuty
 * @author     Romanenko Sergey / Awilum
 * @version    1.1.0
 * @license    https://github.com/pafnuty-fansoro-plugins/fansoro-plugin-detect/blob/master/LICENSE MIT
 *
 */
require_once 'classes/Mobile_Detect.php';
Action::add('before_page_rendered', function () {
    Detect::init();
});
class Detect
{
    protected static $detect;
    public static function init()
    {
        static::$detect = new Mobile_Detect();
    }
    public static function isMobile($userAgent = null, $httpHeaders = null)
    {
        return static::$detect->isMobile($userAgent, $httpHeaders);
    }
    public static function isTablet($userAgent = null, $httpHeaders = null)
    {
        return static::$detect->isTablet($userAgent, $httpHeaders);
 /**
  * Constructor, load parent constructor
  */
 protected function __construct()
 {
     parent::__construct();
 }
Exemple #3
0
    //echo $lang;
    if ($lang == 'localhost') {
        ?>
                <script type="text/javascript">
                    swal('<?php 
        __("Country Language");
        ?>
', "<?php 
        __('Cant Detect your Country Language in localhost');
        ?>
", 'error');
                </script>
                <?php 
    } else {
        ?>
                <script type="text/javascript">
                    swal("<?php 
        __('Country Language', $lang);
        ?>
", "<?php 
        echo _x('Detected Your Country Language is :', $lang) . languageNameIntongue(Detect::country());
        ?>
", "success");
                </script>
                <?php 
    }
}
?>
    </body>

</html>