本文整理汇总了PHP中Filter::alphanum方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::alphanum方法的具体用法?PHP Filter::alphanum怎么用?PHP Filter::alphanum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter::alphanum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$theme = Theme::load($themeID);
// validate the theme
if (empty($theme)) {
$json = array('error' => 'That theme does not exist.');
exit(json_encode($json));
}
// save the new theme
$user->setThemeID($theme->getID());
$user->save();
// send us back
Session::setMessage("Theme changed.");
$json = array('success' => '1');
echo json_encode($json);
} elseif ($action == 'notification') {
$notificationType = Filter::alphanum($_POST['notificationType']);
$notificationValue = Filter::alphanum($_POST['notificationValue']);
// convert checkbox value to database-friendly 1 or 0
$value = $notificationValue == 'notify' ? 1 : 0;
// figure out which User setter to use based on notification type
switch ($notificationType) {
case 'chkCommentTaskLeading':
$user->setNotifyCommentTaskLeading($value);
break;
case 'chkEditTaskJoined':
$user->setNotifyEditTaskAccepted($value);
break;
case 'chkCommentTaskJoined':
$user->setNotifyCommentTaskAccepted($value);
break;
case 'chkCommentTaskUpdate':
$user->setNotifyCommentTaskUpdate($value);
示例2: alphaDigets
/**
* Return only alpha and digits chars
*
* @param $value
* @return mixed
*
* @deprecated See JBZoo\Utils\Filter
*/
public static function alphaDigets($value)
{
return Filter::alphanum($value);
}
示例3: strtotime
//Format Deadline, if empty or an invalid date is given, default to a week from today
if (!empty($line[3])) {
$deadline = strtotime($line[3]);
if ($deadline == false) {
$deadline = strtotime("+1 week");
$deadline = date("Y-m-d H:i:s", $deadline);
} else {
$deadline = date("Y-m-d H:i:s", $deadline);
}
} else {
$deadline = strtotime("+1 week");
$deadline = date("Y-m-d H:i:s", $deadline);
}
//Format Leader, if empty or an invalid name is given, don't enter in anyone
if (!empty($line[4])) {
$leaderId = User::loadByUsername(Filter::alphanum($line[4]));
//***need to change with Chloe's updated user filter***
if (empty($leaderId)) {
$leaderId = Session::getUserID();
}
} else {
//$leaderId = NULL;
$leaderId = Session::getUserID();
}
}
//Create Task Record
$title = Filter::text($line[0]);
$description = Filter::text(iconv(mb_detect_encoding($line[1], mb_detect_order(), true), "UTF-8", $line[1]));
$task = new Task(array('creator_id' => Session::getUserID(), 'leader_id' => $leaderId, 'project_id' => $projectId, 'title' => $title, 'description' => $description, 'status' => 1, 'deadline' => $deadline, 'num_needed' => $numberOfPeople));
array_push($taskArray, $task);
//Increment row in file
示例4: ProjectUser
<?php
require_once "../../global.php";
$inviteID = Filter::numeric($_POST['inviteID']);
$invite = Invitation::load($inviteID);
$response = Filter::alphanum($_POST['response']);
if ($response == 'accept') {
// add the user to the project
if ($invite->getTrusted()) {
$relationship = ProjectUser::TRUSTED;
} else {
$relationship = ProjectUser::MEMBER;
}
$pu = new ProjectUser(array('project_id' => $invite->getProjectID(), 'user_id' => $invite->getInviteeID(), 'relationship' => $relationship));
$pu->save();
// update the invite
$invite->setResponse(Invitation::ACCEPTED);
$invite->setDateResponded(date("Y-m-d H:i:s"));
$invite->save();
// prep for logging
$eventTypeID = 'accept_member_invitation';
$successMsg = 'You accepted the invitation.';
} else {
// update the invite
$invite->setResponse(Invitation::DECLINED);
$invite->setDateResponded(date("Y-m-d H:i:s"));
$invite->save();
// prep for logging
$eventTypeID = 'decline_member_invitation';
$successMsg = 'You declined the invitation.';
}