示例#1
0
 /**
  * Function to detect if a mobile device is being used.
  *
  * @return bool
  */
 public static function detect()
 {
     // Do the most exhaustive device detection possible; other method calls
     // may be used instead of DetectMobileLong if you want to target a narrower
     // class of devices.
     $mobile = new \uagent_info();
     return $mobile->DetectMobileLong();
 }
function mobile_device_detect()
{
    // @codingStandardsIgnoreEnd
    // Do the most exhaustive device detection possible; other method calls
    // may be used instead of DetectMobileLong if you want to target a narrower
    // class of devices.
    $mobile = new uagent_info();
    return $mobile->DetectMobileLong();
}
示例#3
0
 /**
  * Loads MDetect library
  */
 public static function mdetect()
 {
     if (!class_exists('uagent_info')) {
         require_once dirname(__FILE__) . '/lib/mdetect/mdetect.php';
         $agent = new uagent_info();
         $is_mobile = $agent->DetectMobileQuick();
         $is_tablet = $agent->DetectTierTablet();
         if (true == $is_mobile) {
             PhotoSwipe::$device = 'mobile';
         } elseif (true == $is_tablet) {
             PhotoSwipe::$device = 'tablet';
         } else {
             PhotoSwipe::$device = 'desktop';
         }
         add_action('wp_head', array('PhotoSwipe', 'wp_head'));
     }
 }
示例#4
0
 function modal_dialog_plugin()
 {
     $this->mdpluginpath = WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/';
     load_plugin_textdomain('modal-dialog', $this->mdpluginpath . '/languages', 'modal-dialog/languages');
     $options = get_option('MD_PP');
     $genoptions = get_option('MD_General');
     if ($genoptions == false) {
         $this->md_install();
     }
     //add filter for WordPress 2.8 changed backend box system !
     add_filter('screen_layout_columns', array($this, 'on_screen_layout_columns'), 10, 2);
     //register callback for admin menu  setup
     add_action('admin_menu', array($this, 'on_admin_menu'));
     //register the callback been used if options of page been submitted and needs to be processed
     add_action('admin_post_save_modal_dialog_general', array($this, 'on_save_changes_general'));
     add_action('admin_post_save_modal_dialog_configurations', array($this, 'on_save_changes_configurations'));
     // Add addition section to Post/Page Edition page
     add_meta_box('modaldialog_meta_box', __('Modal Dialog', 'modal-dialog'), array($this, 'md_post_edit_extra'), 'post', 'normal', 'high');
     add_meta_box('modaldialog_meta_box', __('Modal Dialog', 'modal-dialog'), array($this, 'md_post_edit_extra'), 'page', 'normal', 'high');
     add_action('edit_post', array($this, 'md_editsave_post_field'));
     add_action('save_post', array($this, 'md_editsave_post_field'));
     add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     $genoptions = get_option('MD_General');
     for ($counter = 1; $counter <= $genoptions['numberofmodaldialogs']; $counter++) {
         $optionsname = "MD_PP" . $counter;
         $options = get_option($optionsname);
         if ($genoptions['disableonmobilebrowsers'] == true) {
             require_once ABSPATH . '/wp-content/plugins/modal-dialog/mdetect.php';
             $browserchecker = new uagent_info();
             $mobilebrowser = $browserchecker->DetectMobileQuick();
         }
         if ($options['active'] == true) {
             if ($genoptions['disableonmobilebrowsers'] == false || $genoptions['disableonmobilebrowsers'] == true && $mobilebrowser == false) {
                 add_action('wp_footer', array($this, 'modal_dialog_footer'));
                 add_action('wp_head', array($this, 'modal_dialog_header'));
                 break;
             }
         }
     }
     add_action('admin_head', array($this, 'modal_dialog_admin_header'));
     add_action('comment_post_redirect', array($this, 'comment_redirect_filter'), 10, 2);
     register_activation_hook(__FILE__, array($this, 'md_install'));
     register_deactivation_hook(__FILE__, array($this, 'md_uninstall'));
     return $this;
 }
function buildSubnav($skel, $section, $subsections)
{
    $result = "\t<div class=\"subnavbar\">\n";
    $uagent_obj = new uagent_info();
    if ($uagent_obj->DetectSmartphone()) {
        //$result .= "\t<h2>" . $skel['sectionname'] . "</h2>\n";
        $result .= "\t\t<ul>\n";
        for ($i = 0; $i < count($subsections); $i++) {
            if ('' != trim($subsections[$i])) {
                $pagekey = getKey($subsections[$i]);
                $page = getValue($subsections[$i]);
                if ('#' != $pagekey[0] && '' != trim($page)) {
                    if (isset($skel['page']) && $pagekey == $skel['page']) {
                        $active = ' class="highlight"';
                    } else {
                        $active = '';
                    }
                    $result .= "\t\t\t<li><a href=\"" . $skel['base_uri'] . 'page/' . $section . '/' . $pagekey . '/"' . $active . '>' . trim($page) . "</a></li>\n";
                }
            }
        }
        $result .= "\t\t</ul>\n";
        /*
        		$result .= "\t\t<ul class=\"info\">\n";
        		$result .= "\t\t\t<li><form action=\"http://www.google.com/search\" method=\"get\"><input type=\"hidden\" name=\"q\" value=\"site:aquariusoft.org\" /><input type=\"text\" class=\"searchfield\" name=\"q\" size=\"20\" /><input type=\"submit\" value=\"find\" /></form></li>\n";
        		$result .= "\t\t</ul>\n"; 
        		$uagent_obj = new uagent_info();
        		if (!$uagent_obj->DetectSmartphone())
        		{
        			$result .= "\t\t<ul class=\"info\">\n";
        			$result .= "\t\t\t<li><a href=\"http://www.mozilla.com/firefox/\" title=\"Get Firefox - Web Browsing Redefined [and take back the web]\"><img src=\"images/firefox_pixel.png\" alt=\"Get Firefox\"/></a></li>\n";
        			$result .= "\t\t\t<li><a href=\"http://www.mozilla.com/thunderbird/\" title=\"Get Thunderbird and reclaim your inbox!\"><img src=\"images/thunderbird_pixel.png\" alt=\"Get Thunderbird\"/></a></li>\n";
        			$result .= "\t\t</ul>\n";
        		}
        		$result .= "\t\t<ul class=\"info\">\n";
        		$result .= "\t\t\t<li><a href=\"http://aquariusoft.org/page/html/qik/\">build with qik</a></li>\n";
        		$result .= "\t\t</ul>\n";
        */
    } else {
        /* regular site */
        for ($i = 0; $i < count($subsections); $i++) {
            if ('' != trim($subsections[$i])) {
                $pagekey = getKey($subsections[$i]);
                $page = getValue($subsections[$i]);
                if ('#' != $pagekey[0] && '' != trim($page)) {
                    if (isset($skel['page']) && $pagekey == $skel['page']) {
                        $active = ' class="highlight"';
                    } else {
                        $active = '';
                    }
                    $result .= "<a href=\"" . $skel['base_uri'] . 'page/' . $section . '/' . $pagekey . '/"' . $active . '>' . trim($page) . " </a>";
                }
            }
        }
    }
    return $result . "</div>\n";
}
 /**
  * Device Detection
  *
  * Detect the user's device by using the MobileESP library written by Anthony Hand [http://blog.mobileesp.com/].
  * Return the string name of their device.
  *
  * @internal         Called during object instantiation
  * @uses             get_option, uagent_info
  * @param    void
  * @return   string  The current user's device in one of four options:
  *                      active, handheld, tablet, low_support
  */
 public function detect_users_device()
 {
     //Default is active (default computer theme set by the admin) until it's overridden
     $device = 'active';
     $low_support_device = 'handheld';
     $low_support_theme = get_option('dts_low_support_theme');
     // Give the handheld theme to any low_support device
     // UNLESS one has been set in the admin already
     if (!empty($low_support_theme) && is_array($low_support_theme)) {
         if (isset($low_support_theme['name'])) {
             if (!empty($low_support_theme['name'])) {
                 //Detect if the device is a low support device (poor css and javascript rendering / older devices)
                 $low_support_device = 'low_support';
             }
             // end if
         }
         // end if
     }
     // end if
     // Check for Varnish Device Detect: https://github.com/varnish/varnish-devicedetect/
     // Thanks to Tim Broder for this addition! https://github.com/broderboy | http://timbroder.com/
     $http_xua_handheld_devices = array('mobile-iphone', 'mobile-android', 'mobile-firefoxos', 'mobile-smartphone', 'mobile-generic');
     $http_xua_tablet_devices = array('tablet-ipad', 'tablet-android');
     // Determine if the HTTP X UA server variable is present
     if (isset($_SERVER['HTTP_X_UA_DEVICE'])) {
         // if it is, determine which device type is being used
         if (in_array($_SERVER['HTTP_X_UA_DEVICE'], $http_xua_handheld_devices)) {
             $device = 'handheld';
         } elseif (in_array($_SERVER['HTTP_X_UA_DEVICE'], $http_xua_tablet_devices)) {
             $device = 'tablet';
         }
     } else {
         // DEFAULT ACTION - Use MobileESP to sniff the UserAgent string
         // Include the MobileESP code library for acertaining device user agents
         include_once 'mobile-esp.php';
         // Setup the MobileESP Class
         $ua = new uagent_info();
         // Detect if the device is a handheld
         if ($ua->DetectSmartphone() || $ua->DetectTierRichCss()) {
             $device = 'handheld';
         }
         // Detect if the device is a tablet
         if ($ua->DetectTierTablet() || $ua->DetectKindle() || $ua->DetectAmazonSilk()) {
             $device = 'tablet';
         }
         // Detect if the device is a low_support device (poor javascript and css support / text-only)
         if ($ua->DetectBlackBerryLow() || $ua->DetectTierOtherPhones()) {
             $device = $low_support_device;
         }
     }
     // end if
     // Return the user's device
     return $device;
 }
function sandbox_body_class($print = true)
{
    global $wp_query, $current_user;
    // It's surely a WordPress blog, right?
    $c = array('wordpress');
    // Applies the time- and date-based classes (below) to BODY element
    sandbox_date_classes(time(), $c);
    // Generic semantic classes for what type of content is displayed
    is_front_page() ? $c[] = 'home' : null;
    // For the front page, if set
    is_home() ? $c[] = 'blog' : null;
    // For the blog posts page, if set
    is_archive() ? $c[] = 'archive' : null;
    is_date() ? $c[] = 'date' : null;
    is_search() ? $c[] = 'search' : null;
    is_paged() ? $c[] = 'paged' : null;
    is_attachment() ? $c[] = 'attachment' : null;
    is_404() ? $c[] = 'four04' : null;
    // CSS does not allow a digit as first character
    // Special classes for BODY element when a single post
    if (is_single()) {
        $postID = $wp_query->post->ID;
        the_post();
        // Adds 'single' class and class with the post ID
        $c[] = 'single postid-' . $postID;
        // Adds classes for the month, day, and hour when the post was published
        if (isset($wp_query->post->post_date)) {
            sandbox_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-');
        }
        // Adds category classes for each category on single posts
        if ($cats = get_the_category()) {
            foreach ($cats as $cat) {
                $c[] = 's-category-' . $cat->slug;
            }
        }
        // Adds tag classes for each tags on single posts
        if ($tags = get_the_tags()) {
            foreach ($tags as $tag) {
                $c[] = 's-tag-' . $tag->slug;
            }
        }
        // Adds MIME-specific classes for attachments
        if (is_attachment()) {
            $mime_type = get_post_mime_type();
            $mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
            $c[] = 'attachmentid-' . $postID . ' attachment-' . str_replace($mime_prefix, "", "{$mime_type}");
        }
        // Adds author class for the post author
        $c[] = 's-author-' . sanitize_title_with_dashes(strtolower(get_the_author_login()));
        rewind_posts();
    } elseif (is_author()) {
        $author = $wp_query->get_queried_object();
        $c[] = 'author';
        $c[] = 'author-' . $author->user_nicename;
    } elseif (is_category()) {
        $cat = $wp_query->get_queried_object();
        $c[] = 'category';
        $c[] = 'category-' . $cat->slug;
    } elseif (is_tag()) {
        $tags = $wp_query->get_queried_object();
        $c[] = 'tag';
        $c[] = 'tag-' . $tags->slug;
    } elseif (is_page()) {
        $pageID = $wp_query->post->ID;
        $page_children = wp_list_pages("child_of={$pageID}&echo=0");
        the_post();
        $c[] = 'page pageid-' . $pageID;
        $c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));
        // Checks to see if the page has children and/or is a child page; props to Adam
        if ($page_children) {
            $c[] = 'page-parent';
        }
        if ($wp_query->post->post_parent) {
            $c[] = 'page-child parent-pageid-' . $wp_query->post->post_parent;
        }
        if (is_page_template()) {
            // Hat tip to Ian, themeshaper.com
            $c[] = 'page-template page-template-' . str_replace('.php', '-php', get_post_meta($pageID, '_wp_page_template', true));
        }
        rewind_posts();
    } elseif (is_search()) {
        the_post();
        if (have_posts()) {
            $c[] = 'search-results';
        } else {
            $c[] = 'search-no-results';
        }
        rewind_posts();
    }
    // Paged classes; for 'page X' classes of index, single, etc.
    if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
        $c[] = 'paged-' . $page;
        if (is_single()) {
            $c[] = 'single-paged-' . $page;
        } elseif (is_page()) {
            $c[] = 'page-paged-' . $page;
        } elseif (is_category()) {
            $c[] = 'category-paged-' . $page;
        } elseif (is_tag()) {
            $c[] = 'tag-paged-' . $page;
        } elseif (is_date()) {
            $c[] = 'date-paged-' . $page;
        } elseif (is_author()) {
            $c[] = 'author-paged-' . $page;
        } elseif (is_search()) {
            $c[] = 'search-paged-' . $page;
        }
    }
    $thePostID = $wp_query->post->ID;
    $hero_type = get_post_meta($thePostID, 'hero_type_value', true);
    $layout = get_post_meta($thePostID, 'page_layout_value', true);
    if ($layout) {
        $c[] = 'layout layout_' . $layout;
    }
    if ($hero_type) {
        $c[] = 'hero hero_' . $hero_type;
    }
    // start http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/
    global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
    if ($is_lynx) {
        $c[] = 'lynx';
    } elseif ($is_gecko) {
        $c[] = 'gecko';
    } elseif ($is_opera) {
        $c[] = 'opera';
    } elseif ($is_NS4) {
        $c[] = 'ns4';
    } elseif ($is_safari) {
        $c[] = 'safari';
    } elseif ($is_chrome) {
        $c[] = 'chrome';
    } elseif ($is_IE) {
        $c[] = 'ie';
    } else {
        $c[] = 'unknown';
    }
    //if($is_iphone) $c[] = 'iphone';
    // end http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
        $c[] = 'ie6';
    }
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') == false) {
        $c[] = 'not-ie6';
    }
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == false) {
        $c[] = 'not-ie';
    }
    $uagent_obj = new uagent_info();
    //Detect methods return 1 for true, 0 for false
    $isIphone = $uagent_obj->DetectIphone();
    $isIpod = $uagent_obj->DetectIpod();
    $isIpad = $uagent_obj->DetectIpad();
    $isAndroid = $uagent_obj->DetectAndroid();
    $isTierIphone = $uagent_obj->DetectTierIphone();
    if ($isIphone == 1) {
        $c[] = 'iphone';
    } else {
        if ($isIpod == 1) {
            $c[] = 'iphone ipod';
        } else {
            if ($isIpad == 1) {
                $c[] = 'iphone ipad';
            } else {
                if ($isAndroid == 1) {
                    $c[] = 'android';
                }
            }
        }
    }
    if ($isTierIphone == 1) {
        $c[] = 'tierIphone';
    }
    // For when a visitor is logged in while browsing
    if ($current_user->ID) {
        $c[] = 'loggedin';
    }
    if (function_exists('ashford_set_theme_style')) {
        if ($_GET["color"] != '') {
            $c[] = 'theme-style-' . $_GET["color"];
        } else {
            $c[] = ashford_set_theme_style();
        }
    }
    // Separates classes with a single space, collates classes for BODY
    $c = join(' ', apply_filters('body_class', $c));
    // Available filter: body_class
    // And tada!
    return $print ? print $c : $c;
}
    header("location: ../index.php?e=local");
    exit;
}
if (!isset($_SESSION['status']) || $_SESSION['status'] > 2) {
    header("location: ../index.php");
    exit;
}
if (!isset($_SESSION['token']['act'])) {
    $_SESSION['token']['act'] = random_token(7);
}
include_once '../php/config/database.php';
if (is_file('../php/config/setting.txt')) {
    $setting = file('../php/config/setting.txt', FILE_IGNORE_NEW_LINES);
}
include_once '../php/mobileESP.php';
$uagent_obj = new uagent_info();
$isMob = $uagent_obj->DetectMobileQuick();
try {
    $DBH = new PDO("mysql:host={$Hostname};dbname={$DatabaseName}", $Username, $Password);
    $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    if ($_SESSION['status'] == 2 || $_SESSION['status'] == 1) {
        $query = "SELECT \n\t\t\t\t\t\t\ta.id,\n\t\t\t\t\t\t\ta.enabled,\n\t\t\t\t\t\t\ta.ref_id,\n\t\t\t\t\t\t\ta.title,\n\t\t\t\t\t\t\ta.user_id,\n\t\t\t\t\t\t\ta.operator_id,\n\t\t\t\t\t\t\ta.ticket_status,\n\t\t\t\t\t\t\ta.department_id,\n\t\t\t\t\t\t\ta.website,\n\t\t\t\t\t\t\ta.contype,\n\t\t\t\t\t\t\ta.ftp_user,\n\t\t\t\t\t\t\ta.ftp_password,\n\t\t\t\t\t\t\ta.enc_key,\n\t\t\t\t\t\t\tb.rate,\n\t\t\t\t\t\t\tb.note,\n\t\t\t\t\t\t\tc.reason,\n\t\t\t\t\t\t\td.free,\n\t\t\t\t\t\t\tIF(d.free=0,a.support_time,NULL) AS support_time\n\t\t\t\t\t\tFROM " . $SupportTicketsTable . " a\n\t\t\t\t\t\tLEFT JOIN " . $SupportRateTable . " b\n\t\t\t\t\t\t\tON b.id=a.id\n\t\t\t\t\t\tLEFT JOIN " . $SupportFlagTable . " c\n\t\t\t\t\t\t\tON (c.tk_id=a.id AND c.usr_id='" . $_SESSION['id'] . "')\n\t\t\t\t\t\tLEFT JOIN " . $SupportDepaTable . " d\n\t\t\t\t\t\t\tON d.id=a.department_id\n\t\t\t\t\t\tWHERE a.id=?  LIMIT 1";
    } else {
        $query = "SELECT \n\t\t\t\t\t\t\ta.id,\n\t\t\t\t\t\t\ta.enabled,\n\t\t\t\t\t\t\ta.ref_id,\n\t\t\t\t\t\t\ta.title,\n\t\t\t\t\t\t\ta.user_id,\n\t\t\t\t\t\t\ta.operator_id,\n\t\t\t\t\t\t\ta.ticket_status,\n\t\t\t\t\t\t\ta.department_id,\n\t\t\t\t\t\t\ta.website,\n\t\t\t\t\t\t\ta.contype,\n\t\t\t\t\t\t\ta.ftp_user,\n\t\t\t\t\t\t\ta.ftp_password,\n\t\t\t\t\t\t\ta.enc_key,\n\t\t\t\t\t\t\tb.rate,\n\t\t\t\t\t\t\tb.note,\n\t\t\t\t\t\t\tc.reason,\n\t\t\t\t\t\t\td.free,\n\t\t\t\t\t\t\tIF(d.free=0,a.support_time,NULL) AS support_time\n\t\t\t\t\t\tFROM " . $SupportTicketsTable . " a\n\t\t\t\t\t\tLEFT JOIN " . $SupportRateTable . " b\n\t\t\t\t\t\t\tON b.id=a.id\n\t\t\t\t\t\tLEFT JOIN " . $SupportFlagTable . " c\n\t\t\t\t\t\t\tON (c.tk_id=a.id AND c.usr_id=" . $_SESSION['id'] . ")\n\t\t\t\t\t\tLEFT JOIN " . $SupportDepaTable . " d\n\t\t\t\t\t\t\tON d.id=a.department_id\n\t\t\t\t\t\tWHERE a.id=? AND a.user_id=" . $_SESSION['id'] . " LIMIT 1";
    }
    $STH = $DBH->prepare($query);
    $STH->bindParam(1, $_GET['id'], PDO::PARAM_INT);
    $STH->execute();
    $STH->setFetchMode(PDO::FETCH_ASSOC);
    $a = $STH->fetch();
    if (!empty($a)) {
示例#9
0
/**
 * return the device type: mobile, tablet or desktop
 *
 * @return string
 */
function get_device()
{
    $device = pwg_get_session_var('device');
    if (is_null($device)) {
        include_once PHPWG_ROOT_PATH . 'include/mdetect.php';
        $uagent_obj = new uagent_info();
        if ($uagent_obj->DetectSmartphone()) {
            $device = 'mobile';
        } elseif ($uagent_obj->DetectTierTablet()) {
            $device = 'tablet';
        } else {
            $device = 'desktop';
        }
        pwg_set_session_var('device', $device);
    }
    return $device;
}
示例#10
0
 * @author        Matt Thomas http://construct-framework.com | http://betweenbrain.com
 * @copyright    Copyright (C) 2009 - 2012 Matt Thomas. All rights reserved.
 * @license        GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 */
// Load Joomla filesystem package
jimport('joomla.filesystem.file');
// Load template logic
$logicFile = JPATH_THEMES . '/' . $this->template . '/elements/logic.php';
if (JFile::exists($logicFile)) {
    include $logicFile;
}
// Mobile device detection
if (JFile::exists($mdetectFile)) {
    include_once $mdetectFile;
    // Instantiate the mobile object class
    $uagent_obj = new uagent_info();
    $isMobile = $uagent_obj->DetectMobileLong();
    $isTablet = $uagent_obj->DetectTierTablet();
}
// Layout override
$results = $layoutOverride->getIncludeFile();
// Check if mobile device has opted for desktop version
if (isset($_GET['viewDesktop'])) {
    $_SESSION['viewDesktop'] = $_GET['viewDesktop'];
}
// Check if mobile device detection is turned on and, test if visitor is a mobile device, and if so, load mobile sub-template
if (($mdetect && $isMobile || $mdetect && $detectTablets && $isTablet) && !isset($_SESSION['viewDesktop'])) {
    if (JFile::exists($mTemplate)) {
        include_once $mTemplate;
    }
} elseif ($results) {
示例#11
0
文件: script.php 项目: nfreear/mQuiz
<?php

include_once "../config.php";
$uagent_obj = new uagent_info();
?>

function initPage(){
	mQ.initStore();
	<?php 
if (isLoggedIn()) {
    printf("mQ.store.set('username','%s');", $USER->username);
    printf("mQ.store.set('displayname','%s');", $USER->firstname . " " . $USER->lastname);
    printf("mQ.store.set('password','%s');", $USER->password);
}
if (!$uagent_obj->DetectIphone() && !$uagent_obj->DetectAndroidPhone()) {
    printf("mQ.store.set('source','%s');", $CONFIG->homeAddress);
}
?>
}


function addQuestion(){
	
	var qno = $('#questions > div').size()+1;
	
	var fb = $("<div class='formblock'></div>");
	var fl = $("<div class='formlabel'></div>").text("Question " +qno);
	fb.append(fl);
	var ff = $("<div class='formfield'></div>");
	ff.append("<textarea name='q"+qno+"' cols='80' rows='3' maxlength='300'></textarea>");
	ff.append("<div class='responses'>");
function smallbiz_setup_mobile()
{
    $GLOBALS["smartphone"] = false;
    $type = false;
    $urlmd5 = md5(get_bloginfo('siteurl'));
    if (!isset($_COOKIE[$urlmd5 . "device_type"])) {
        // DetectSmartphone() would restrict to, well, smartphones.
        // MobileLong will also show older devices the mobile layout, though they might not be able to see it well.
        $uagent_obj = new uagent_info();
        if ($uagent_obj->DetectMobileLong()) {
            $type = "Mobile";
        } else {
            $type = "Desktop";
        }
        setcookie($urlmd5 . "device_type", $type);
        $_COOKIE[$urlmd5 . "device_type"] = $type;
    } else {
        $type = $_COOKIE[$urlmd5 . "device_type"];
    }
    if (get_option('smallbiz_mobile-layout-enabled')) {
        if (isset($_REQUEST["ui"])) {
            if ($_REQUEST["ui"] == "m") {
                $GLOBALS["smartphone"] = true;
            }
        } else {
            if (isset($_COOKIE[$urlmd5 . "ui"])) {
                if ($_COOKIE[$urlmd5 . "ui"] == "m") {
                    $GLOBALS["smartphone"] = true;
                } else {
                    $GLOBALS["smartphone"] = false;
                }
            } else {
                if ($_COOKIE[$urlmd5 . "device_type"] == "Mobile") {
                    $GLOBALS["smartphone"] = true;
                }
            }
        }
        if (!headers_sent()) {
            if ($GLOBALS["smartphone"]) {
                setcookie($urlmd5 . "ui", "m");
            } else {
                setcookie($urlmd5 . "ui", "f");
            }
        }
    }
    return $GLOBALS["smartphone"];
}
示例#13
0
文件: header.php 项目: nfreear/mQuiz
<?php

header('Content-Type:text/html; charset=UTF-8');
//first detect if using mobile device and redirect accordingly
$uagent_obj = new uagent_info();
if ($uagent_obj->DetectTierTablet() || $uagent_obj->DetectTierIphone()) {
    header('Location: ' . $CONFIG->homeAddress . 'm/');
    die;
}
global $PAGE, $CONFIG, $MSG, $API, $HEADER;
$nologinpages = array("login", "index", "register", "faqs", "terms", "about", "phoneapps", "reset", "search", "browse", "contact");
if (!in_array($PAGE, $nologinpages)) {
    checkLogin();
}
$lang = optional_param("lang", "", PARAM_TEXT);
if ($lang != "") {
    setLang($lang, true);
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<META name="description" content="mQuiz: mobile quiz application"/> 
	<META name="keywords" content="mquiz,quiz,assessment,mobile,android"/> 
	<title><?php 
echo getstring("app.title");
?>
</title>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
	<script type="text/javascript" src="<?php 
function get_device_name()
{
    // Do the most exhaustive device detection possible; other method calls
    // may be used instead of DetectMobileLong if you want to target a narrower
    // class of devices.
    $mobile = new uagent_info();
    if ($mobile->DetectKindle()) {
        return 'Kindle';
    } elseif ($mobile->DetectKindleFire() || $mobile->DetectAmazonSilk()) {
        return 'Kindle Fire';
    } elseif ($mobile->DetectIpad()) {
        return 'iPad';
    } elseif ($mobile->DetectIphone()) {
        return 'iPhone';
    } elseif ($mobile->DetectMac()) {
        return 'Mac';
    } elseif ($mobile->DetectAndroidPhone()) {
        return 'Android Phone';
    } elseif ($mobile->DetectAndroidTablet()) {
        return 'Android Tablet';
    } elseif ($mobile->DetectBlackBerry()) {
        return 'BlackBerry';
    } elseif ($mobile->DetectGoogleTV()) {
        return 'Google TV';
    } elseif ($mobile->DetectIos()) {
        return 'iOS';
    } else {
        return 'PC';
    }
}
示例#15
0
文件: index.php 项目: kmschlagel/NCS
<?php

include "mdetect.php";
//Instantiate the object to do our testing with.
$uagent_obj = new uagent_info();
//Detect methods return 1 for true, 0 for false
$isIphoneIpod = $uagent_obj->DetectIphoneOrIpod();
//Check for both!
$isAndroid = $uagent_obj->DetectAndroid();
$isTierIphone = $uagent_obj->DetectTierIphone();
$isTierTablet = $uagent_obj->DetectTierTablet();
$isWebOS = $uagent_obj->DetectPalmWebOS();
$isTierRichCss = $uagent_obj->DetectTierRichCss();
$isTierGenericMobile = $uagent_obj->DetectTierOtherPhones();
if ($isIphoneIpod == 1) {
    header('Location: http://m.northfieldcabinetshop.com');
} else {
    if ($isAndroid == 1) {
        header('Location: http://m.northfieldcabinetshop.com');
    } else {
        if ($isTierIphone == 1) {
            header('Location: http://m.northfieldcabinetshop.com');
        } else {
            if ($isTierTablet == 1) {
                header('Location: http://m.northfieldcabinetshop.com');
            } else {
                if ($isWebOS == 1) {
                    header('Location: http://m.northfieldcabinetshop.com');
                } else {
                    if ($isTierRichCss == 1) {
                        header('Location: http://m.northfieldcabinetshop.com');
示例#16
0
 public static function detectMobile()
 {
     if (defined('OPC_DETECTED_DEVICE')) {
         if (OPC_DETECTED_DEVICE != 'DESKTOP') {
             return true;
         } else {
             return false;
         }
     }
     $isMobile = false;
     if (!class_exists('uagent_info')) {
         require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR . 'mdetect.php';
     }
     $ua = new uagent_info();
     if ($ua->DetectMobileQuick()) {
         define('OPC_DETECTED_DEVICE', 'MOBILE');
         $isMobile = true;
     }
     if ($ua->DetectTierTablet()) {
         define('OPC_DETECTED_DEVICE', 'TABLET');
         $isMobile = true;
     }
     if ($isMobile == false) {
         define('OPC_DETECTED_DEVICE', 'DESKTOP');
     }
     return $isMobile;
 }
示例#17
0
 public function __analyseExport($type, $retailer, $store, $region, $country, $course, $team, $sortBy, $fieldsval, $keyword, $isshowreport, $recordrow)
 {
     global $CFG, $DB, $SESSION;
     require_once $CFG->libdir . '/csvlib.class.php';
     $useragent = new uagent_info();
     if ($useragent->DetectIpad() || $useragent->DetectIphoneOrIpod() || $useragent->DetectAndroid() || $useragent->DetectIosNative()) {
         $csvexport = new csv_export_writer();
         $download_method = 'download_file';
     } else {
         $csvexport = new csv_export_writer('tab');
         $download_method = 'download_file_for_excel';
     }
     if ($recordrow != '') {
         $fields = array('Region' => 'Region', 'Country' => 'Country', 'Retailer' => 'Retailer', 'Store' => 'Store', 'Course' => 'Course', 'First Name' => 'First Name', 'Last Name' => 'Last Name', 'Job Title' => 'Job Title', 'Course Points' => 'Course Points', 'Total Points' => 'Total Points');
         $filename = time();
         $csvexport->set_filename($filename);
         $csvexport->add_data($fields);
         if (empty($sortBy)) {
             $sortBy = 'firstname';
             $sortMode = 'ASC';
         } else {
             list($sortBy, $sortMode) = explode(' ', $sortBy);
         }
         $recordrow = explode(',', $recordrow);
         $reportsDetails = $SESSION->reports_current_page;
         foreach ($reportsDetails as $id => &$reportsDetail) {
             if (!in_array($id, $recordrow)) {
                 unset($reportsDetails[$id]);
             }
         }
         unset($reportsDetail);
         foreach ($reportsDetails as $kReportsDetails => $vReportDetails) {
             $userprofiledata['Region'] = $vReportDetails->region;
             $userprofiledata['Country'] = $vReportDetails->country;
             $userprofiledata['Retailer'] = $vReportDetails->retailer;
             $userprofiledata['Store'] = $vReportDetails->store;
             $userprofiledata['Course'] = $vReportDetails->fullname;
             $userprofiledata['First Name'] = $vReportDetails->firstname;
             $userprofiledata['Last Name'] = $vReportDetails->lastname;
             $userprofiledata['Job Title'] = $vReportDetails->jobtitle;
             $userprofiledata['Course Points'] = $vReportDetails->points;
             $userprofiledata['Total Points'] = $vReportDetails->totalpoints;
             $csvexport->add_data($userprofiledata);
             $i++;
         }
         $csvexport->{$download_method}();
         exit;
     }
     if ($isshowreport == 'true') {
         if ($type == 'user' || $type == 'course') {
             $fields = array('Region' => 'Region', 'Country' => 'Country', 'Retailer' => 'Retailer', 'Store' => 'Store', 'Course' => 'Course', 'First Name' => 'First Name', 'Last Name' => 'Last Name', 'Job Title' => 'Job Title', 'Course Points' => 'Course Points', 'Total Points' => 'Total Points');
             //$filename = clean_filename(get_string('users'));
             $filename = time();
             $csvexport->set_filename($filename);
             $csvexport->add_data($fields);
             $region = explode(",", $region);
             $country = explode(",", $country);
             $retailer = explode(",", $retailer);
             $store = explode(",", $store);
             $course = explode(",", $course);
             if ($type == 'user' || $type == 'course') {
                 if (in_array("sel_all", $region) || in_array("null", $country)) {
                     $regionstr = '';
                 } else {
                     $regionstr = implode('~', $region);
                 }
                 if (in_array("sel_all", $country) || in_array("null", $country)) {
                     $countrystr = '';
                 } else {
                     $countrystr = implode('~', $country);
                 }
                 if (in_array("sel_all", $retailer) || in_array("null", $retailer)) {
                     $retailerstr = '';
                 } else {
                     $retailerstr = implode('~', $retailer);
                 }
                 if (in_array("sel_all", $store) || in_array("null", $store)) {
                     $storestr = '';
                 } else {
                     $storestr = implode('~', $store);
                 }
                 if (in_array("sel_all", $course) || in_array("null", $course)) {
                     $coursestr = '';
                 } else {
                     $coursestr = implode('~', $course);
                 }
                 if (empty($sortBy)) {
                     $sortBy = 'firstname';
                     $sortMode = 'ASC';
                 } else {
                     list($sortBy, $sortMode) = explode(' ', $sortBy);
                 }
                 /*
                 	CALL get_mdl_reports_dtl
                 	(
                 	@v_region := '',
                 	@v_country := '',
                 	@v_retailer	:= '',
                 	@v_store := '',
                 	@v_course := '',
                 	@v_username := '******',
                 	@v_email    := 'terasima.ibuki@rainbow.plala.or.jp~whyunwhaya@nate.com',
                 	@v_sortby := 'lastname',
                 	@v_sortmode     := 'desc',
                 	@v_offset := '0',
                 	@v_limit := '25'
                 	)
                 */
                 $reportsSPCall = "CALL get_mdl_reports_dtl ('{$regionstr}','{$countrystr}','{$retailerstr}','{$storestr}','{$coursestr}', " . "'{$sortBy}', '{$sortMode}', '', '')";
                 $reportsDetails = $DB->get_records_sql($reportsSPCall);
             }
             foreach ($reportsDetails as $kReportsDetails => $vReportDetails) {
                 $userprofiledata['Region'] = $vReportDetails->region;
                 $userprofiledata['Country'] = $vReportDetails->country;
                 $userprofiledata['Retailer'] = $vReportDetails->retailer;
                 $userprofiledata['Store'] = $vReportDetails->store;
                 $userprofiledata['Course'] = $vReportDetails->fullname;
                 $userprofiledata['First Name'] = $vReportDetails->firstname;
                 $userprofiledata['Last Name'] = $vReportDetails->lastname;
                 $userprofiledata['Job Title'] = $vReportDetails->jobtitle;
                 $userprofiledata['Course Points'] = $vReportDetails->points;
                 $userprofiledata['Total Points'] = $vReportDetails->totalpoints;
                 $csvexport->add_data($userprofiledata);
                 $i++;
             }
             $csvexport->{$download_method}();
             exit;
         }
     } else {
         $filename = time();
         $csvexport->set_filename($filename);
         $fields = array('Region' => 'Region', 'Country' => 'Country', 'Retailer' => 'Retailer', 'Store' => 'Store', 'Course' => 'Course', 'First Name' => 'First Name', 'Last Name' => 'Last Name', 'Job Title' => 'Job Title', 'Course Points' => 'Course Points', 'Total Points' => 'Total Points');
         $csvexport->add_data($fields);
         if (empty($sortBy)) {
             $sortBy = 'firstname';
             $sortMode = 'ASC';
         } else {
             list($sortBy, $sortMode) = explode(' ', $sortBy);
         }
         $fieldsArr = explode(',', $fieldsval);
         $coursekey = array_search('fullname', $fieldsArr);
         if (!is_bool($coursekey)) {
             $fieldsArr[$coursekey] = 'course';
         }
         $fieldstilde = implode('~', $fieldsArr);
         /*
         	CALL get_mdl_reports_dtl
         	(
         	@v_region := '',
         	@v_country := '',
         	@v_retailer	:= '',
         	@v_store := '',
         	@v_course := '',
         	@v_username := '******',
         	@v_email    := 'terasima.ibuki@rainbow.plala.or.jp~whyunwhaya@nate.com',
         	@v_sortby := 'lastname',
         	@v_sortmode     := 'desc',
         	@v_offset := '0',
         	@v_limit := '25'
         	)
         */
         $reportsSPCall = "CALL get_mdl_reports_search ('{$keyword}','{$fieldstilde}'," . "'{$sortBy}', '{$sortMode}', '', '')";
         $reportsDetails = $DB->get_records_sql($reportsSPCall);
         $i = 0;
         foreach ($reportsDetails as $kReportsDetails => $vReportDetails) {
             $userprofiledata['Region'] = $vReportDetails->region;
             $userprofiledata['Country'] = $vReportDetails->country;
             $userprofiledata['Retailer'] = $vReportDetails->retailer;
             $userprofiledata['Store'] = $vReportDetails->store;
             $userprofiledata['Course'] = $vReportDetails->fullname;
             $userprofiledata['First Name'] = $vReportDetails->firstname;
             $userprofiledata['Last Name'] = $vReportDetails->lastname;
             $userprofiledata['Job Title'] = $vReportDetails->jobtitle;
             $userprofiledata['Course Points'] = $vReportDetails->points;
             $userprofiledata['Total Points'] = $vReportDetails->totalpoints;
             $csvexport->add_data($userprofiledata);
             $i++;
         }
         $csvexport->{$download_method}();
         exit;
     }
 }
示例#18
0
function nbcu_page_alter($page)
{
    $typeKit = "<script src='https://use.typekit.net/duz4krn.js'></script>\n   <script>try{Typekit.load({ async: true });}catch(e){}</script>";
    $ie_js_files = "\n\t<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->\n    <!--[if lt IE 9]>\n      <script src='https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js'></script>\n      <script src='https://oss.maxcdn.com/respond/1.4.2/respond.min.js'></script>\n    <![endif]-->\n\t";
    include_once __DIR__ . '/mobile-detect/mdetect.php';
    $md = new uagent_info();
    $ua = $md->Get_Uagent();
    $isEdge = "false";
    if (strpos($ua, 'edge') !== false) {
        $isEdge = "true";
    }
    // dpm($ua);
    $mobileTest = $md->DetectMobileLong();
    $mobileDetect = "<script type='text/javascript'>\n    var useSkrollr = " . $mobileTest . ";\n    var isEdge = " . $isEdge . ";\n  </script>";
    $ie_scripts = array('#type' => 'markup', '#markup' => $ie_js_files, '#weight' => 10000);
    $typekit_scripts = array('#type' => 'markup', '#markup' => $typeKit, '#weight' => 0);
    $mobile_detect = array('#type' => 'markup', '#markup' => $mobileDetect, '#weight' => 0);
    drupal_add_html_head($ie_scripts, 'ie-helpers');
    drupal_add_html_head($typekit_scripts, 'typekit');
    drupal_add_html_head($mobile_detect, 'mobile-detect');
}
示例#19
0
<?php

require_once 'mdetect.php';
if (preg_match('@^/([0-9]+)/?$@', $_SERVER['REQUEST_URI'], $matches)) {
    $ui = new uagent_info();
    if ($ui->DetectMobileQuick() == $ui->true) {
        header("Location: http://m.flickr.com/#/photos/noboru/sets/{$matches['1']}/");
    } else {
        header("Location: http://www.flickr.com/photos/noboru/sets/{$matches['1']}/");
    }
} else {
    header("Location: http://www.flickr.com/photos/noboru/sets/");
}
示例#20
0
/**
 * Mobi check and set is child theme
 *
 * v2.0 - detect tierIphone and set define IS_MOBI
 * v2.2 - bullet proofing
 * 
 * @author Tim Bednar 
 * @version v2.0
 * @since v2.0
*/
$isMobi = 'false';
$isChildTheme = 'false';
$ashford_use_mobi = 'mobi_off';
// mdetect is Apache License, Version 2.0
require_once TEMPLATEPATH . '/library/ashford_mdetect.php';
$uagent_obj = new uagent_info();
//Detect methods return 1 for true, 0 for false
//$isIphone= $uagent_obj->DetectIphone();$isIpod= $uagent_obj->DetectIpod();$isIpad= $uagent_obj->DetectIpad();$isAndroid = $uagent_obj->DetectAndroid();
$isTierIphone = $uagent_obj->DetectTierIphone();
if ($isTierIphone == 1) {
    $isMobi = 'true';
}
global $ashfordtheme;
if (isset($ashfordtheme->option['ashford_use_mobi'])) {
    $ashford_use_mobi = $ashfordtheme->option['ashford_use_mobi'];
}
if ($ashford_use_mobi == 'mobi_off') {
    $isMobi = 'false';
}
if (ASHFORD_DIR == ASHFORD_CHILD_DIR) {
    $isMobi = 'false';
示例#21
0
 function __construct()
 {
     // init parent constructor
     parent::uagent_info();
     // translations
     load_plugin_textdomain(MOBILESMART_DOMAIN);
     if (isset($_COOKIE[MOBILESMART_SWITCHER_COOKIE])) {
         $this->switcher_cookie = $_COOKIE[MOBILESMART_SWITCHER_COOKIE];
         //echo "Construct cookie: $this->switcher_cookie<br/><br/>";
     }
 }
示例#22
0
<?php

// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: mobile.php 52907 2014-10-16 16:05:30Z jonnybradley $
//this script may only be included - so its better to die if called directly.
$access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));
if (!isset($_REQUEST['mobile_mode']) || $_REQUEST['mobile_mode'] === 'y') {
    require_once 'vendor_extra/mobileesp/mdetect.php';
    $uagent_info = new uagent_info();
    $supported_device = $uagent_info->DetectIphoneOrIpod() || $uagent_info->DetectIpad() || $uagent_info->DetectAndroid() || $uagent_info->DetectBlackBerry() || $uagent_info->DetectOperaMobile() || $uagent_info->DetectPalmWebOS();
    if (!getCookie('mobile_mode') && $supported_device || getCookie('mobile_mode') === 'y') {
        // supported by jquery.mobile
        if (!is_array($prefs['mobile_perspectives'])) {
            $prefs['mobile_perspectives'] = unserialize($prefs['mobile_perspectives']);
        }
        if (count($prefs['mobile_perspectives']) > 0) {
            $persp = $prefs['mobile_perspectives'][0];
            if (Perms::get(array('type' => 'perspective', 'object' => $persp))->perspective_view) {
                $prefs['mobile_mode'] = 'y';
                // hard-wire a few incompatible prefs shut to speed development
                $prefs['feature_jquery_ui'] = 'n';
                $prefs['feature_jquery_reflection'] = 'n';
                $prefs['feature_fullscreen'] = 'n';
                $prefs['feature_syntax_highlighter'] = 'n';
                $prefs['feature_layoutshadows'] = 'n';
                $prefs['feature_wysiwyg'] = 'n';
                $prefs['themegenerator_feature'] = 'n';
                $prefs['ajax_autosave'] = 'n';
示例#23
0
 public static function isSmartphone()
 {
     require_once OW_DIR_LIB . 'mobileesp' . DS . 'mdetect.php';
     $obj = new uagent_info();
     return (bool) $obj->DetectSmartphone();
 }