本文整理汇总了PHP中Browser::isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::isMobile方法的具体用法?PHP Browser::isMobile怎么用?PHP Browser::isMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::isMobile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStreamUrl
/**
* Returns the stream URL for the media. A direct link will be returned if
* the user is on a mobile device or if the "singleFilePlaylist" setting
* is enabled, otherwise the media playlist URL will be returned
* @return string the stream URL
*/
protected function getStreamUrl()
{
if (count($this->_links) === 1 && (Setting::getBoolean('singleFilePlaylist') || (Browser::isMobile() || Browser::isTablet()))) {
return $this->_links[0]->url;
} else {
return $this->getPlayListAction();
}
}
示例2: initCanvas
private function initCanvas($data)
{
$data = json_decode($data);
$this->ip = $this->validateInput($_SERVER['REMOTE_ADDR']);
$this->message = filter_var($data->note, FILTER_SANITIZE_STRING);
$browser = new Browser();
$this->browser = "Name of browser " . $browser->getBrowser() . " Version " . $browser->getVersion();
$this->isBrowserMobile = $browser->isMobile();
$this->url = is_null($data->url) ? null : $data->url;
if (!is_null($data->img)) {
$this->img = $data->img;
}
}
示例3: YtTemplate
function YtTemplate($template = null)
{
$this->_tpl = $template;
$this->template = $template->template;
$this->type = $this->getType();
$this->browser = $this->browser();
$_params_cookie = array('direction', 'fontsize', 'font_name', 'sitestyle', 'bgcolor', 'linkcolor', 'textcolor', 'header-bgimage', 'header-bgcolor', 'footer-bgcolor', 'footer-bgimage', 'default_main_layout', 'menustyle', 'googleWebFont');
foreach ($_params_cookie as $k) {
$this->_params_cookie[$k] = $this->_tpl->params->get($k);
}
$this->getUserSetting();
//print_r($this->_params_cookie); die();
$browser = new Browser();
$this->is_mobile = $browser->isMobile();
$this->float1 = $this->getParam('direction') == 'rtl' ? 'float:right' : 'float:left';
$this->float2 = $this->getParam('direction') == 'rtl' ? 'float:left' : 'float:right';
}
示例4: generateAuthResponse
public function generateAuthResponse(Application $app, \Browser $browser, $redirect)
{
if ($browser->isMobile()) {
$response = $app->redirectPath('lightbox');
} elseif ($redirect) {
$response = new RedirectResponse('../' . ltrim($redirect, '/'));
} elseif (true !== $browser->isNewGeneration()) {
$response = $app->redirectPath('get_client');
} else {
$response = $app->redirectPath('prod');
}
$response->headers->clearCookie('postlog');
$response->headers->clearCookie('last_act');
return $response;
}
示例5: layoutValid
}
if (function_exists('ult_ms_getter')) {
$prel = ult_ms_getter();
}
if ($layout) {
// Get The Layout Info
// Responsiveness check
$ttable = $wpdb->prefix . 'ultimatum_themes';
$sql = "SELECT * FROM {$ttable} WHERE id='" . $layout["theme"] . "'";
$tfetch = $wpdb->get_row($sql, ARRAY_A);
$ultimateresponsive = false;
if ($tfetch['type'] == 1) {
$ultimateresponsive = 'responsive';
}
// Check for mobility feature
if ($browser->isMobile() && $tfetch['type'] != 2) {
$browsing = $browser->getPlatform();
// Get the Template for device
$mtable = $wpdb->prefix . 'ultimatum_mobile';
$mobilethemeq = "SELECT * FROM {$mtable} WHERE `device`='{$browsing}'";
$mfetch = $wpdb->get_row($mobilethemeq, ARRAY_A);
if ($mfetch) {
$defql = "SELECT * FROM {$table} WHERE `default`=1 AND `theme`='" . $mfetch["theme"] . "'";
$dfetch = $wpdb->get_row($defql, ARRAY_A);
if ($dfetch) {
$mobileapp = true;
$layout = layoutValid($dfetch["id"]);
}
}
}
if (strlen($layout['before']) >= 1) {
示例6: loadView
public function loadView()
{
$sql = 'SELECT
V.idview,
V.name as shopname,
V.namespace,
C.idcurrency,
C.currencysymbol,
C.decimalseparator,
C.decimalcount,
C.thousandseparator,
C.positivepreffix,
C.positivesuffix,
C.negativepreffix,
C.negativesuffix,
S.countryid,
V.taxes,
V.showtax,
V.offline,
cartredirect,
terms,
photoid,
favicon,
forcelogin,
apikey,
watermark,
confirmregistration,
enableregistration,
invoicenumerationkind,
V.pageschemeid,
V.contactid,
PS.templatefolder
FROM view V
LEFT JOIN viewcategory VC ON VC.viewid = V.idview
LEFT JOIN store S ON V.storeid = S.idstore
LEFT JOIN pagescheme PS ON PS.idpagescheme = V.pageschemeid
LEFT JOIN currency C ON C.idcurrency = IF(:currencyid > 0, :currencyid, V.currencyid)
WHERE V.idview = :viewid';
$stmt = Db::getInstance()->prepare($sql);
$stmt->bindValue('viewid', $this->determineViewId());
$stmt->bindValue('currencyid', Session::getActiveCurrencyId());
$stmt->execute();
$rs = $stmt->fetch();
if ($rs) {
$this->layer = array('terms' => $rs['terms'], 'idview' => $rs['idview'], 'namespace' => $rs['namespace'], 'cartredirect' => $rs['cartredirect'], 'offline' => $rs['offline'], 'taxes' => $rs['taxes'], 'showtax' => $rs['showtax'], 'shopname' => $rs['shopname'], 'photoid' => $rs['photoid'], 'favicon' => $rs['favicon'], 'watermark' => $rs['watermark'], 'idcurrency' => $rs['idcurrency'], 'currencysymbol' => $rs['currencysymbol'], 'decimalseparator' => $rs['decimalseparator'], 'decimalcount' => $rs['decimalcount'], 'thousandseparator' => $rs['thousandseparator'], 'positivepreffix' => $rs['positivepreffix'], 'positivesuffix' => $rs['positivesuffix'], 'negativepreffix' => $rs['negativepreffix'], 'negativesuffix' => $rs['negativesuffix'], 'countryid' => $rs['countryid'], 'forcelogin' => $rs['forcelogin'], 'confirmregistration' => $rs['confirmregistration'], 'enableregistration' => $rs['enableregistration'], 'apikey' => $rs['apikey'], 'invoicenumerationkind' => $rs['invoicenumerationkind'], 'pageschemeid' => $rs['pageschemeid'], 'theme' => $rs['templatefolder'], 'pageschemeid' => $rs['pageschemeid'], 'contactid' => $rs['contactid']);
Session::setActiveShopName($this->layer['shopname']);
if (is_null($this->layer['photoid'])) {
$this->layer['photoid'] = 'logo.png';
}
if (is_null($this->layer['favicon'])) {
$this->layer['favicon'] = 'favicon.ico';
}
Session::setActiveShopCurrencyId($this->layer['idcurrency']);
Session::setActiveForceLogin($this->layer['forcelogin']);
if (Session::getActiveBrowserData() == NULL) {
$browser = new Browser();
$Data = array('browser' => $browser->getBrowser(), 'platform' => $browser->getPlatform(), 'ismobile' => $browser->isMobile(), 'isbot' => $browser->isRobot());
Session::setActiveBrowserData($Data);
}
}
}
示例7: processattendanceAction
function processattendanceAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$session = SessionWrapper::getInstance();
$config = Zend_Registry::get("config");
$this->_translate = Zend_Registry::get("translate");
$validshift = false;
$formvalues = $this->_getAllParams();
/* $formvalues = array(
"id" => "",
"successmessage" => "Check-In Successfull",
"datein" => "Apr 24, 2015",
"timein" => "8:40 PM",
"inremarks" => "",
"status" => "",
"userid" => "93"
); */
// debugMessage($formvalues); // exit;
$id = decode($formvalues['id']);
$formvalues['id'] = $id;
$timesheet = new Timesheet();
$user = new UserAccount();
$user->populate($formvalues['userid']);
# no shift available at all on profile
// validate that user is checking into right shift
if (isEmptyString($id)) {
$checkindate = date('Y-m-d', strtotime($formvalues['datein']));
$checkintime = date('H:i:s', strtotime($formvalues['timein']));
$checkinfulldate = $checkindate . ' ' . $checkintime;
debugMessage('checkin: ' . $checkinfulldate);
// if user is already checkin, throw exception
if (isCheckedIn($formvalues['userid'], $checkindate)) {
$message = "Check-In failed. Active session already exists";
$session->setVar(ERROR_MESSAGE, $message);
exit;
}
$hasshift = false;
$scheduleentry = getSessionEntry($user->getID());
// debugMessage($scheduleentry);
if (!isEmptyString($scheduleentry['id']) && !isEmptyString($user->getShift()) && $scheduleentry['status'] == 1) {
$hasshift = true;
}
if ($hasshift) {
$shift = new ShiftSchedule();
$shift->populate($scheduleentry['id']);
// debugMessage($shift->toArray());
$validstartdate = $checkindate;
$validstarttime = !isEmptyString($shift->getStartTime()) ? $shift->getStartTime() : $shift->getSession()->getStartTime();
$validfullstartdate = $validstartdate . ' ' . $validstarttime;
debugMessage('startin: ' . $validfullstartdate);
# compute end date and time
$endtime = !isEmptyString($shift->getEndTime()) ? $shift->getEndTime() : $shift->getSession()->getEndTime();
$endday = $checkindate;
$starthr = date('H', strtotime($validstarttime));
//debugMessage($starthr);
$endhr = date('H', strtotime($endtime));
//debugMessage($endhr);
if ($endhr < $starthr) {
$nxtday = date('Y-m-d', strtotime($checkindate . " + 1 day"));
$endday = $nxtday;
}
$validenddate = $endday;
$validendtime = $endtime;
$validfullenddate = $validenddate . ' ' . $validendtime;
debugMessage('ending: ' . $validfullenddate);
// validate start and end dates for each session
$rangevalid = false;
if (strtotime($checkinfulldate) >= strtotime($shift->getStartDate() . ' 00:00:00')) {
$rangevalid = true;
if (!isEmptyString($shift->getEndDate())) {
$rangevalid = false;
if (strtotime($checkinfulldate) <= strtotime($shift->getEndDate() . ' 23:00:00')) {
$rangevalid = true;
}
}
}
// also check if the days of the week are in the valid range
if ($rangevalid) {
$todaywkno = date('w', strtotime($checkinfulldate));
// debugMessage($todaywkno);
$wkdaysprofiled = $user->getDaysOfWeekArray();
// debugMessage($wkdaysprofiled);
if (!isEmptyString($scheduleentry['workingdays'])) {
$wkdaysprofiled = explode(',', preg_replace('!\\s+!', '', trim($scheduleentry['workingdays'])));
// debugMessage($wkdaysprofiled);
}
if (count($wkdaysprofiled) > 0) {
if (!in_array($todaywkno, $wkdaysprofiled)) {
$rangevalid = false;
}
}
}
// now validate the time within the session
if ($rangevalid) {
if (strtotime($checkinfulldate) >= strtotime($validfullstartdate) && strtotime($checkinfulldate) < strtotime($validfullenddate)) {
$validshift = true;
$browser = new Browser();
$audit_values = $browser_session = array("browserdetails" => $browser->getBrowserDetailsForAudit(), "browser" => $browser->getBrowser(), "version" => $browser->getVersion(), "useragent" => $browser->getUserAgent(), "os" => $browser->getPlatform(), "ismobile" => $browser->isMobile() ? '1' : 0, "ipaddress" => $browser->getIPAddress());
$formvalues['sessionid'] = $scheduleentry['sessionid'];
//.........这里部分代码省略.........
示例8: mobile_device_detect
/**
* Detect mobile device
*
* @return mixed Mobile device name or false
*/
public static function mobile_device_detect()
{
$ui = T3Parameter::_getParam('ui');
if ($ui == 'desktop') {
return false;
}
// Detect mobile
if (!class_exists('Browser')) {
t3import('core.libs.browser');
}
$browser = new Browser();
// Bypass
if ($browser->isRobot()) {
return false;
}
// Consider ipad as normal browser
if ($browser->getBrowser() == Browser::BROWSER_IPAD) {
return false;
}
// Mobile
if ($browser->isMobile()) {
if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) {
$device = 'iphone';
} elseif ($browser->getPlatform() == Browser::PLATFORM_ANDROID) {
$device = 'android';
} else {
//$device = strtolower($browser->getBrowser());
$device = 'handheld';
}
$layout = T3Parameter::_getParam($device . "_layout", '');
if ($layout == -1) {
return false;
}
//disable
return $device;
//return 'handheld';
}
// Not mobile
if ($ui == 'mobile') {
return 'iphone';
}
//default for mobile layout on desktop
return false;
}
示例9: die
<?php
/**
* @package Wright
* @subpackage Includes
*
* @copyright Copyright (C) 2005 - 2015 Joomlashack. Meritage Assets. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Restrict Access to within Joomla
defined('_JEXEC') or die('Restricted access');
$browser = new Browser();
$isMobile = $browser->isMobile();
?>
<!-- Modal -->
<div id="wrightBCW" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="wrightBCWLabel" aria-hidden="true" data-controls-modal="wrightBCW" data-backdrop="static" data-keyboard="false">
<div class="modal-header">
<h3 id="wrightBCWLabel">
<?php
echo JText::_('TPL_JS_WRIGHT_BROWSER_WARNING_TITLE');
?>
</h3>
</div>
<div class="modal-body">
<p>
<?php
echo JText::_('TPL_JS_WRIGHT_BROWSER_WARNING_CONTENT');
?>
</p>
<p>
示例10: die
if ($charset != '') {
$ops['charset'] = $charset;
}
$ops['autoescape'] = true;
$loader = new Twig_Loader_Filesystem($config['twig']['templates_folder']);
$twig = new Twig_Environment($loader, $ops);
$twig->getExtension('core')->setNumberFormat(2, ',', '.');
} else {
die("NO SE PUEDE ENCONTRAR EL MOTOR TWIG");
}
// ------------------------------------------------
// COMPROBAR DISPOSITIVO DE NAVEGACION
// ------------------------------------------------
if (!isset($_SESSION['browser'])) {
$browser = new Browser();
$_SESSION['browser'] = $browser->isMobile() ? "mobile" : "laptop";
unset($browser);
}
// -------------------------------------------------------------------
// CARGAR LO QUE VIENE EN EL REQUEST Y ACTIVAR EL FORMATO DE LA MONEDA
// -------------------------------------------------------------------
$rq = new Request();
setlocale(LC_MONETARY, $rq->getLanguage());
// ----------------------------------------------------------------
// DETERMINAR ENTORNO DE DESARROLLO O DE PRODUCCION
// ----------------------------------------------------------------
$_SESSION['EntornoDesarrollo'] = $rq->isDevelopment();
if ($rq->isOldBrowser()) {
$controller = 'OldBrowser';
$action = 'Index';
} else {
示例11: checkloginAction
function checkloginAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
// debugMessage($formvalues);
# check that an email has been provided
if (isEmptyString(trim($this->_getParam("email")))) {
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_email_error"));
$session->setVar(FORM_VALUES, $this->_getAllParams());
// return to the home page
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
if (isEmptyString(trim($this->_getParam("password")))) {
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_password_error"));
$session->setVar(FORM_VALUES, $this->_getAllParams());
// return to the home page
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
# check which field user is using to login. default is username
$credcolumn = "username";
$login = (string) trim($this->_getParam("email"));
// $password = encode(sha1(trim($this->_getParam("password"))));
# check if credcolumn is emai
$validator = new Zend_Validate_EmailAddress();
if ($validator->isValid($login)) {
$usertable = new UserAccount();
if ($usertable->findByEmail($login)) {
$credcolumn = 'email';
}
}
if (stringContains('!@#', $login)) {
$credcolumn = 'trx';
$loginarray = explode('.', $login);
// debugMessage($loginarray);
$id = $loginarray[0];
}
// debugMessage($credcolumn); exit;
$browser = new Browser();
$audit_values = $browser_session = array("browserdetails" => $browser->getBrowserDetailsForAudit(), "browser" => $browser->getBrowser(), "version" => $browser->getVersion(), "useragent" => $browser->getUserAgent(), "os" => $browser->getPlatform(), "ismobile" => $browser->isMobile() ? '1' : 0, "ipaddress" => $browser->getIPAddress());
// debugMessage($audit_values);
if ($credcolumn == 'email' || $credcolumn == 'username') {
$authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get("dbAdapter"));
// define the table, fields and additional rules to use for authentication
$authAdapter->setTableName('useraccount');
$authAdapter->setIdentityColumn($credcolumn);
$authAdapter->setCredentialColumn('password');
$authAdapter->setCredentialTreatment("sha1(?) AND status = '1' ");
// set the credentials from the login form
$authAdapter->setIdentity($login);
$authAdapter->setCredential($this->_getParam("password"));
// new class to audit the type of Browser and OS that the visitor is using
if (!$authAdapter->authenticate()->isValid()) {
// debugMessage('invalid'); exit;
// add failed login to audit trail
$audit_values['module'] = 1;
$audit_values['usecase'] = '1.1';
$audit_values['transactiontype'] = USER_LOGIN;
$audit_values['status'] = "N";
$audit_values['transactiondetails'] = "Login for user with id '" . $this->_getParam("email") . "' failed. Invalid username or password";
// exit();
$this->notify(new sfEvent($this, USER_LOGIN, $audit_values));
// return to the home page
if (!isArrayKeyAnEmptyString(URL_FAILURE, $formvalues)) {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
} else {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoSimple('login', "user");
}
return false;
}
// user is logged in sucessfully so add information to the session
$user = $authAdapter->getResultRowObject();
$useraccount = new UserAccount();
$useraccount->populate($user->id);
}
// exit;
# trx login
if ($credcolumn == 'trx') {
$useraccount = new UserAccount();
$useraccount->populate($id);
// debugMessage($result); exit();
if (isEmptyString($useraccount->getID())) {
// return to the home page
if (!isArrayKeyAnEmptyString(URL_FAILURE, $formvalues)) {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
} else {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoSimple('login', "user");
}
return false;
}
}
// debugMessage($useraccount->toArray()); exit();
$session->setVar("userid", $useraccount->getID());
$session->setVar("username", $useraccount->getUserName());
$session->setVar("type", $useraccount->getType());
//.........这里部分代码省略.........
示例12: function
return Response::error('500');
}
});
Route::filter('auth', function () {
if (Auth::guest()) {
return Redirect::to('/');
}
});
Route::filter('Sentry_auth', function () {
if (Sentry::guest()) {
return Redirect::to('/');
}
});
Route::filter('ip', function () {
// Create the Eloquent object Visit
$visit = new Track();
$browser = new Browser();
$visit->location = Locate::get('city') . ', ' . Locate::get('state') . ', ' . Locate::get('country');
$visit->ip_address = Request::ip();
$visit->request = URI::current();
if (Auth::check()) {
$visit->user_id = Auth::user()->id;
}
// Browser stats
$visit->browser = $browser->getBrowser();
$visit->browser_version = $browser->getVersion();
$visit->platform = $browser->getPlatform();
$visit->mobile = $browser->isMobile();
$visit->robot = $browser->isRobot();
$visit->save();
});
示例13: define
}
// xac dinh co phai User_Agent cua NukeViet hay khong
if (NV_USER_AGENT == 'NUKEVIET CMS ' . $global_config['version'] . '. Developed by VINADES. Url: http://nukeviet.vn. Code: ' . md5($global_config['sitekey'])) {
define('NV_IS_MY_USER_AGENT', true);
}
// Xac dinh borwser cua client
$browser = new Browser(NV_USER_AGENT);
$client_info['browser'] = array();
$client_info['browser']['key'] = $browser->getBrowserKey();
$client_info['browser']['name'] = $browser->getBrowser();
if (preg_match('/^([0-9]+)\\.(.*)$/', $browser->getVersion(), $matches)) {
$client_info['browser']['version'] = (int) $matches[1];
} else {
$client_info['browser']['version'] = 0;
}
$client_info['is_mobile'] = $browser->isMobile();
$client_info['is_tablet'] = $browser->isTablet();
$client_info['is_bot'] = $browser->isRobot();
$client_info['client_os'] = array('key' => $browser->getPlatformKey(), 'name' => $browser->getPlatform());
$is_mobile_tablet = $client_info['is_mobile'] . '-' . $client_info['is_tablet'];
if ($is_mobile_tablet != $nv_Request->get_string('is_mobile_tablet', 'session')) {
$nv_Request->set_Session('is_mobile_tablet', $is_mobile_tablet);
$nv_Request->unset_request('nv' . NV_LANG_DATA . 'themever', 'cookie');
}
// Ket noi voi class chong flood
if ($global_config['is_flood_blocker'] and !$nv_Request->isset_request('admin', 'session') and (!$nv_Request->isset_request('second', 'get') or $nv_Request->isset_request('second', 'get') and $client_info['is_myreferer'] != 1)) {
require NV_ROOTDIR . '/includes/core/flood_blocker.php';
}
// Captcha
if ($nv_Request->isset_request('scaptcha', 'get')) {
require NV_ROOTDIR . '/includes/core/captcha.php';
示例14: get_status
/**
* Get status
* Credits to @link(https://github.com/reduxframework/redux-framework/blob/master/ReduxCore/inc/class.redux_helpers.php#L367)
*
* @since 1.0.0
* @global $wpdb | WordPress database object
* @param boolean $output_as_json
* @param boolean $remote_checks
* @return array
*/
public static function get_status($output_as_json = false, $remote_checks = true)
{
global $wpdb;
$data = array();
// WordPress
$data['home_url'] = home_url();
$data['site_url'] = site_url();
$data['wp_content_url'] = WP_CONTENT_URL;
$data['wp_ver'] = get_bloginfo('version');
$data['wp_multisite'] = is_multisite();
$data['permalink_structure'] = get_option('permalink_structure') ? get_option('permalink_structure') : 'Default';
$data['front_page_display'] = get_option('show_on_front');
if ($data['front_page_display'] == 'page') {
$front_page_id = get_option('page_on_front');
$blog_page_id = get_option('page_for_posts');
$data['front_page'] = $front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset';
$data['posts_page'] = $blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset';
}
$data['wp_mem_limit_raw'] = self::let_to_num(WP_MEMORY_LIMIT);
$data['wp_mem_limit_size'] = size_format($data['wp_mem_limit_raw']);
$data['db_table_prefix'] = 'Length: ' . strlen($wpdb->prefix) . ' - Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable');
$data['wp_debug'] = 'false';
if (defined('WP_DEBUG') && WP_DEBUG) {
$data['wp_debug'] = 'true';
}
$data['wp_lang'] = get_locale();
// server
$data['server_info'] = esc_html($_SERVER['SERVER_SOFTWARE']);
$data['localhost'] = self::bool_to_string(self::is_local_host());
$data['php_ver'] = function_exists('phpversion') ? esc_html(phpversion()) : 'phpversion() function does not exist.';
$data['abspath'] = ABSPATH;
if (function_exists('ini_get')) {
$data['php_mem_limit'] = size_format(self::let_to_num(ini_get('memory_limit')));
$data['php_post_max_size'] = size_format(self::let_to_num(ini_get('post_max_size')));
$data['php_time_limit'] = ini_get('max_execution_time');
$data['php_max_input_var'] = ini_get('max_input_vars');
$data['php_display_errors'] = self::bool_to_string(ini_get('display_errors'));
}
$data['suhosin_installed'] = extension_loaded('suhosin');
$data['mysql_ver'] = $wpdb->db_version();
$data['max_upload_size'] = size_format(wp_max_upload_size());
$data['def_tz_is_utc'] = 'true';
if (date_default_timezone_get() !== 'UTC') {
$data['def_tz_is_utc'] = 'false';
}
$data['fsockopen_curl'] = 'false';
if (function_exists('fsockopen') || function_exists('curl_init')) {
$data['fsockopen_curl'] = 'true';
}
// remote
if ($remote_checks == true) {
$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', array('sslverify' => false, 'timeout' => 60, 'body' => array('cmd' => '_notify-validate')));
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$data['wp_remote_post'] = 'true';
$data['wp_remote_post_error'] = '';
} else {
$data['wp_remote_post'] = 'false';
$data['wp_remote_post_error'] = $response->get_error_message();
}
}
// custom
$custom_key = apply_filters('PWP_System_Status\\custom_key', 'custom');
$custom_array = apply_filters('PWP_System_Status\\custom_array', array());
$data[$custom_key] = $custom_array;
// $data['redux_ver'] = esc_html( ReduxFramework::$_version );
// $data['redux_data_dir'] = ReduxFramework::$_upload_dir;
// Only is a file-write check
// $f = 'fo' . 'pen';
// $data['redux_data_writeable'] = self::bool_to_string( @$f( ReduxFramework::$_upload_dir . 'test-log.log', 'a' ) );
// browser
if (!class_exists('Browser')) {
require_once __DIR__ . '/Browser.php';
// require_once __DIR__ . '/vendor/cbschuld/browser.php/lib/Browser.php'; // @@todo \\
}
$browser = new Browser();
$data['browser']['agent'] = $browser->getUserAgent();
$data['browser']['browser'] = $browser->getBrowser();
$data['browser']['version'] = $browser->getVersion();
$data['browser']['platform'] = $browser->getPlatform();
$data['browser']['mobile'] = $browser->isMobile() ? 'true' : 'false';
// theme
$active_theme = wp_get_theme();
$data['theme']['name'] = $active_theme->Name;
$data['theme']['version'] = $active_theme->Version;
$data['theme']['author_uri'] = $active_theme->{'Author URI'};
$data['theme']['is_child'] = self::bool_to_string(is_child_theme());
if (is_child_theme()) {
$parent_theme = wp_get_theme($active_theme->Template);
$data['theme']['parent_name'] = $parent_theme->Name;
$data['theme']['parent_version'] = $parent_theme->Version;
//.........这里部分代码省略.........
示例15: Browser
function mobile_device_detect()
{
$ui = T3Parameter::_getParam('ui');
if ($ui == 'desktop') {
return false;
}
//detect mobile
t3import('core.libs.Browser');
$browser = new Browser();
//bypass
if ($browser->isRobot()) {
return false;
}
//consider ipad as normal browser
if ($browser->getBrowser() == Browser::BROWSER_IPAD) {
return false;
}
//mobile
if ($browser->isMobile()) {
if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) {
$device = 'iphone';
} else {
$device = strtolower($browser->getBrowser());
}
//$device = 'handheld';
$layout = T3Parameter::get($device . "_layout", '');
if ($layout == -1) {
return false;
}
//disable
return $device;
//return 'handheld';
}
//Not mobile
if ($ui == 'mobile') {
return 'iphone';
}
//default for mobile layout on desktop
return false;
}