public static function is_mobile() { $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $accept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : ''; if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { return true; } elseif (strpos($accept, 'text/vnd.wap.wml') > 0 || strpos($accept, 'application/vnd.wap.xhtml+xml') > 0) { return true; } else { foreach (self::$devices as $device => $regexp) { //echo $device . ' - ' . $regexp; if ((bool) preg_match("/" . $regexp . "/i", $user_agent)) { self::$device = $device; // if ( $device === 'ipad' ) { // self::$is_ipad = true; // } return true; } } } return false; }
/** * */ /** * Try to determine whether we operate on a mobile device */ $is_mobile = false; if (class_exists('PBO_User_Device')) { $is_mobile = PBO_User_Device::is_mobile(); if ($is_mobile && !in_array(PBO_User_Device::$device, ['iphone'])) { //echo 'MOBILE: ' . PBO_User_Device::$device . ' -> '; //echo $_SERVER['HTTP_USER_AGENT']; if (PBO_User_Device::$device === 'ipad') { $is_mobile = false; } else { $doc_width = PBO_User_Device::try_to_get_document_width(); //echo $doc_width; if (isset($doc_width) && $doc_width >= 768) { $is_mobile = false; } } } } /** * Default values for all theme options */ function pbosfc_get_option_def($name) { $pbosfc_option = []; // Top menu(s) $pbosfc_option['left_top_menu_width'] = 70;
* Text Domain: pbo-tools * Domain Path: /languages/ */ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly define('PBO_TOOLS_VERSION', "1.0.0"); define('PBO_TOOLS', 1); define('PBO_TOOLS_DIR', plugin_dir_path(__FILE__)); /** * Pre-initialization */ require_once PBO_TOOLS_DIR . 'user-device.php'; if (defined('DOING_AJAX') && DOING_AJAX) { PBO_User_Device::set_user_device_info($_POST, true); } if (!function_exists('is_woocommerce_activated')) { function is_woocommerce_activated() { return class_exists('woocommerce') ? true : false; } } /** * Plugin initialization */ function pbo_tools_initialize() { load_plugin_textdomain('pbo-tools', false, dirname(plugin_basename(__FILE__)) . '/languages/'); require_once PBO_TOOLS_DIR . 'query-ex.php'; $SE = new SearchEverything();