本文整理汇总了PHP中Mobile类的典型用法代码示例。如果您正苦于以下问题:PHP Mobile类的具体用法?PHP Mobile怎么用?PHP Mobile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mobile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(Mobile_API_Request $request)
{
$current_user = $this->getActiveUser();
$query = $request->get('query');
$nextPage = 0;
$queryResult = false;
if (preg_match("/(.*) LIMIT[^;]+;/i", $query)) {
$queryResult = vtws_query($query, $current_user);
} else {
// Implicit limit and paging
$query = rtrim($query, ";");
$currentPage = intval($request->get('page', 0));
$FETCH_LIMIT = Mobile::config('API_RECORD_FETCH_LIMIT');
$startLimit = $currentPage * $FETCH_LIMIT;
$queryWithLimit = sprintf("%s LIMIT %u,%u;", $query, $startLimit, $FETCH_LIMIT + 1);
$queryResult = vtws_query($queryWithLimit, $current_user);
// Determine paging
$hasNextPage = count($queryResult) > $FETCH_LIMIT;
if ($hasNextPage) {
array_pop($queryResult);
// Avoid sending next page record now
$nextPage = $currentPage + 1;
}
}
$records = array();
if (!empty($queryResult)) {
foreach ($queryResult as $recordValues) {
$records[] = $this->processQueryResultRecord($recordValues, $current_user);
}
}
$result = array('records' => $records, 'nextPage' => $nextPage);
$response = new Mobile_API_Response();
$response->setResult($result);
return $response;
}
示例2: getUserInfo
function getUserInfo()
{
$uid = intval($this->Get['uid']);
if ($uid < 1) {
$uid = MEMBER_ID;
}
$is_follow = false;
$is_blacklist = false;
if ($uid > 0) {
$member = Mobile::convert($this->TopicLogic->GetMember($uid));
if (empty($member)) {
$error_code = 400;
} else {
if ($member['uid'] != MEMBER_ID) {
$is_follow = chk_follow(MEMBER_ID, $member['uid']);
if (!$is_follow) {
Mobile::logic('friend');
$FriendLogic = new FriendLogic();
$is_blacklist = $FriendLogic->check($member['uid']);
}
}
}
} else {
Mobile::show_message(400);
}
include template('user_info');
}
示例3: ModuleObject
function ModuleObject($config)
{
$this->MasterObject($config);
$this->CacheConfig = jconf::get('cache');
Mobile::is_login();
$this->Execute();
}
示例4: init_flow_handle
public function init_flow_handle(Flow $flow)
{
if (Mobile::is_mobile()) {
$vars = $flow->vars();
mb_convert_variables('utf-8', 'utf-8,SJIS-win', $vars);
$flow->vars($vars);
}
}
示例5: isMobileDevice
/**
*
* @return boolean
*/
private static function isMobileDevice()
{
$res = false;
if (isset($_SESSION['ismobiledevice'])) {
$res = $_SESSION['ismobiledevice'];
} else {
$res = Mobile::isMobileDevice();
}
return $res;
}
示例6: viewController
function viewController()
{
$smarty = new vtigerCRM_Smarty();
foreach ($this->parameters as $k => $v) {
$smarty->assign($k, $v);
}
$smarty->assign("IS_SAFARI", Mobile::isSafari());
$smarty->assign("SKIN", Mobile::config('Default.Skin'));
return $smarty;
}
示例7: checkGetMobile
public static function checkGetMobile()
{
if (isset($_GET['tomobile'])) {
if ($_GET['tomobile'] == 1) {
Mobile::setMobile(1);
}
if ($_GET['tomobile'] == 0) {
Mobile::setMobile(0);
}
}
}
示例8: m_not_mobile
private function m_not_mobile(&$src, Template $template)
{
while (Tag::setof($tag, $src, 'm:not_mobile')) {
if (!Mobile::is_mobile()) {
$src = str_replace($tag->plain(), $tag->value(), $src);
} else {
$src = str_replace($tag->plain(), '', $src);
}
}
$src = $template->parse_vars($src);
}
示例9: both
public static function both($act, $arr = array())
{
if (count($arr) > 0) {
extract($arr);
}
if (Mobile::isMob()) {
$pathname = self::explodeSlash($act);
if (!@(include $pathname)) {
self::desk($act, $arr);
}
} else {
self::desk($act, $arr);
}
}
示例10: __construct
public function __construct($_variables)
{
// load parent
parent::__construct($_variables);
// define class variables
$_array = array("mobileplatform" => Mobile::isMobilePlatform(), "ordertimerange" => $this->__config->get('ordertimerange'), "timezone" => $this->__config->get('timezone'), "cachefolder" => $this->__config->get('cachefolder'));
// load class variables
$this->loadClassVariables($_array);
// load the order html
PageMainData::getOrdersHTML();
// load the page html
PageMainHTML::html();
// render page
$this->createPage();
}
示例11: add_order
/**
* @param $customer_id
* @param $total
* @return mixed
*/
public function add_order($customer_id, $delivery_id, $total)
{
$detect = new Mobile();
$device_type = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
$np_city_ref = Arr::get($_POST, 'np_city_ref');
$np_address_ref = Arr::get($_POST, 'np_address_ref');
$city = Arr::get($_POST, 'city');
$address = Arr::get($_POST, 'address');
if ($delivery_id = 1) {
$obj_city = ORM::factory('Novaposhta_City', ['Ref' => $np_city_ref]);
if ($obj_city->loaded()) {
$city = $obj_city->DescriptionRu;
}
$obj_warehouse = ORM::factory('Novaposhta_Warehouse', ['Ref' => $np_address_ref]);
if ($obj_warehouse->loaded()) {
$address = $obj_warehouse->DescriptionRu;
}
}
$obj_order = ORM::factory('Shop_Order');
$obj_order->customer_id = $customer_id;
$obj_order->delivery_id = $delivery_id;
$obj_order->total = $total;
$obj_order->checked = 0;
$obj_order->device_type = $device_type;
$obj_order->oblast = Arr::get($_POST, 'oblast');
$obj_order->region = Arr::get($_POST, 'region');
$obj_order->city = $city;
$obj_order->address = $address;
$obj_order->np_city_ref = $np_city_ref;
$obj_order->np_address_ref = $np_address_ref;
$obj_order->postcode = Arr::get($_POST, 'postcode');
$obj_order->save();
$obj_order->number = $obj_order->id . Text::random('nozero', 4);
$obj_order->save();
return $obj_order->id;
}
示例12: Main
function Main()
{
$uid = intval($this->Get['uid']);
$param = array('limit' => Mobile::config("perpage_def"), 'uid' => $uid);
$ret = Mobile::convert($this->MTagLogic->getTagList($param));
if (is_array($ret)) {
$tag_list = $ret['tag_list'];
$list_count = $ret['list_count'];
$total_record = $ret['total_record'];
$max_id = $ret['max_id'];
} else {
Mobile::show_message($ret);
}
include template('tag_list');
}
示例13: searchUser
function searchUser()
{
Mobile::logic('member');
$MemberLogic = new MemberLogic();
$q = trim($this->Get['q']);
if (empty($q)) {
Mobile::error("No Data", 400);
}
$param = array('limit' => Mobile::config("perpage_member"), 'nickname' => $q, 'max_id' => $this->Get['max_id']);
$ret = $MemberLogic->getMemberList($param);
if (is_array($ret)) {
Mobile::output($ret);
} else {
Mobile::error("No Data", $ret);
}
}
示例14: getHistoryList
function getHistoryList()
{
$uid = intval($this->Get['uid']);
if (empty($uid)) {
Mobile::show_message(300);
}
$info = Mobile::convert($this->MyPmLogic->getHistoryList(MEMBER_ID, $uid, array("per_page_num" => Mobile::config("perpage_pm"))));
if (!empty($info)) {
$pm_list = $info['pm_list'];
$current_page = empty($info['current_page']) ? 1 : $info['current_page'];
$next_page = $current_page + 1;
$total_page = intval($info['total_page']);
$list_count = count($info['pm_list']);
} else {
Mobile::show_message(400);
}
include template('pm_list');
}
示例15: __construct
public function __construct($mainClass, $DbSetting, $WebSetting, $timezone, $js, $css, $nameSpaceForApps)
{
parent::__construct($mainClass);
//start session if needed
//if(!$this->is_session_started())
// init whats needed //kalau ga perlu bisa dihilangkan tergantung kebutuhan
//set globals
global $activeLang;
//set the active lang dynamically
$this->activeLang = $activeLang;
$this->setGlobalVariables($WebSetting);
//Initialize DB
// DbChooser::setDBSelected();
//DB setting di access di overwrite spy bisa ada choosernya...
//$skolahDB = DbChooser::getDBSelected();
//$DbSetting = $this->arrDBSetting[$skolahDB];
global $DbSetting;
$this->setDB($DbSetting);
//overwrite global variable to set photopath for different schools
global $photo_path;
global $photo_url;
define('_PHOTOPATH', $photo_path);
define('_PHOTOURL', $photo_url);
//Init Template
$this->setTemplate($WebSetting);
//Init Web Parameter
$this->setParams();
//Init Timezone
$this->setTimezone($timezone);
//Init Mobile Check in untuk menentukan default
$this->setHardwareType();
if ($this->getHardwareType() == "mobile") {
Mobile::setMobile(1);
}
//cek to mobile get
Mobile::checkGetMobile();
//$nameSpaceForApps
$this->setNameSpacesForApps($nameSpaceForApps);
//add css and js
$this->template->addFilesToHead($js);
$this->template->addFilesToHead($css);
//run it
//$this->run();
}