本文整理汇总了PHP中ca_users::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_users::getVar方法的具体用法?PHP ca_users::getVar怎么用?PHP ca_users::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_users
的用法示例。
在下文中一共展示了ca_users::getVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
*
*/
public static function send($pn_user_id, $ps_message)
{
global $AUTH_CURRENT_USER_ID, $g_request;
if (!function_exists("curl_init")) {
return false;
}
if ($pn_user_id == $AUTH_CURRENT_USER_ID) {
$t_user = $g_request->user;
// use request user object
} else {
$t_user = new ca_users($pn_user_id);
}
if (!$t_user->getPrimaryKey()) {
return null;
}
if (!$t_user->get('sms_number')) {
return null;
}
if (!($vn_sendhub_contact_id = $t_user->getVar('sms_sendhub_contact_id')) || $t_user->getVar('sms_sendhub_phone_number') != $t_user->get('sms_number')) {
if (!($vn_sendhub_contact_id = WLPlugSMSSendHub::addContact($t_user))) {
// TODO: check and log errors here
return null;
}
}
$vs_user = $t_user->getAppConfig()->get('sms_user');
$vs_api_key = $t_user->getAppConfig()->get('sms_api_key');
$vs_url = "https://api.sendhub.com/v1/messages/?username={$vs_user}&api_key={$vs_api_key}";
$o_ch = curl_init();
$ps_message = stripslashes(rawurldecode($ps_message));
$ps_message = trim(preg_replace("!\n+!", "\\" . "n", $ps_message));
curl_setopt($o_ch, CURLOPT_URL, $vs_url);
curl_setopt($o_ch, CURLOPT_HEADER, false);
curl_setopt($o_ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($o_ch, CURLOPT_POSTFIELDS, '{"contacts":[' . $vn_sendhub_contact_id . '],"text":"' . $ps_message . '"}');
curl_setopt($o_ch, CURLOPT_RETURNTRANSFER, 1);
$vs_return = curl_exec($o_ch);
$va_return = json_decode($vs_return);
// TODO: check and log errors here
curl_close($o_ch);
return true;
}
示例2: Db
<?php
require '../../../setup.php';
require_once __CA_LIB_DIR__ . "/core/Db.php";
require_once __CA_MODELS_DIR__ . "/ca_users.php";
$o_db = new Db();
$q_users = $o_db->query("select user_id from ca_users");
$t_user = new ca_users();
while ($q_users->nextRow()) {
$t_user->load($q_users->get("user_id"));
$t_user->setMode(ACCESS_WRITE);
$t_user->setPreference("user_profile_field_of_research", $t_user->getVar("field_of_research"));
$t_user->update();
}