本文整理汇总了PHP中Filters::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP Filters::convert方法的具体用法?PHP Filters::convert怎么用?PHP Filters::convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filters
的用法示例。
在下文中一共展示了Filters::convert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UsersModel
<?php
require_once 'app/autoload.php';
if (isset($_SESSION['chat_login']['id_user'])) {
// Return
$return = '';
// Update dos users
$users = new UsersModel();
$users->setFields(array('timestamp'));
$users->setData(array('timestamp' => date('Y-m-d H:i:s')));
$users->update($_SESSION['chat_login']['id_user']);
// Lendo as messages
$users = new UsersModel();
$users->setCond('id_room = ' . $_SESSION['chat_login']['id_room']);
$users->setCond('id != ' . $_SESSION['chat_login']['id_user']);
$users->setCond('active = 1');
$users->setOrderBy('user asc');
$load = $users->load_all();
$json = array();
foreach ($load as $line) {
// Retorno
$user = Filters::convert(htmlentities($line['user']));
$return .= '<a href="#" id="user_' . $line['id'] . '" rel="' . $line['id'] . '">' . $user . '</a>';
$json[] = '["' . $line['id'] . '", "' . $user . '"]';
}
echo '[' . implode(',', $json) . ']';
} else {
echo 'error';
}
示例2: MessagesModel
$send = true;
} else {
$to_user = 0;
$send = true;
}
}
// Send message
if (isset($send) && (!isset($_SESSION['chat_login']['last_send']) || isset($_SESSION['chat_login']['last_send']) && time() >= $_SESSION['chat_login']['last_send'])) {
// Last message sent
$_SESSION['chat_login']['last_send'] = $_SERVER['REQUEST_TIME'];
// Delete old messages
$messages = new MessagesModel();
$messages->setCond('timestamp < "' . date('Y-m-d H:i:s', strtotime('-' . TIME_MESSAGE_OLD . ' minutes')) . '"');
$messages->delete();
// Data
$data = new StdClass();
$data->user = Filters::convert($_SESSION['chat_login']['user']);
$data->id_user = $_SESSION['chat_login']['id_user'];
$data->message = Filters::convert($message);
$data->to_user = $to_user;
$data->id_room = $_SESSION['chat_login']['id_room'];
$data->reserved = $reserved;
$data->timestamp = date('Y-m-d H:i:s');
$fields = array_keys((array) $data);
// Insert message
$messages = new MessagesModel();
$messages->setFields($fields);
$messages->setData($data);
$messages->insert();
}
}
示例3: IpBlockModel
require 'app/autoload.php';
// Check ip blocked
$ip_block_model = new IpBlockModel();
$ip_block_model->setCond('ip = "' . $_SERVER['REMOTE_ADDR'] . '"');
$ip_block = $ip_block_model->load();
// IP block check
if (!empty($ip_block)) {
header('location: ip_block_message.php');
exit;
}
// Desativa users ociosos
UsersModel::userDeleteIdle();
// Dados enviados
if (count($_POST)) {
$user = substr($_POST['user'], 0, 20);
$user = Filters::convert($user);
$captcha = $_POST['captcha'];
$id_room = (int) $_POST['id_room'];
if ($_SESSION['captcha_code'] == $captcha) {
// Rooms
$rooms_model = new RoomsModel();
$room = $rooms_model->load($id_room);
if (count($room)) {
// Users online
$users_model = new UsersModel();
$users_model->setFieldsSelect(array('user'));
$users_model->setCond('id_room = ' . $id_room);
$users_model->setOrderBy('chat_users.id');
$users = $users_model->load_all();
$total = $users_model->count();
if ($room['capacity'] > $total) {
示例4: date
$return .= '<div class="' . $class_box . '">';
$return .= '<span class="head_msg">';
$return .= '<span class="time_msg">' . date('H:i:s', strtotime($line['timestamp'])) . '</span> ';
$return .= '<span class="user_name" rel="' . $id_user . '">' . $user_name . '</span> ';
$return .= '</span> ';
$return .= '<span class="message_user_' . $line['type'] . '">' . $message . '</span>';
$return .= '</div>';
} else {
// Whose behalf he is receiving
$name_to = Locale::setContent('All users');
$users = new UsersModel();
$users->setCond('active = 1');
$users->setCond('id = ' . $line['to_user']);
$user = $users->load_all();
if (isset($user[0]) && count($user[0])) {
$name_to = Filters::convert(htmlentities($user[0]['user']));
}
$class_box .= $line['reserved'] ? ' box_msg_reserved inline_green' : '';
$class_box .= $line['to_user'] == $_SESSION['chat_login']['id_user'] ? ' to_you_message' : '';
$class_box .= $line['id_user'] == $_SESSION['chat_login']['id_user'] ? ' for_you_message' : '';
if (MESSAGE_TYPE == 'inline') {
$class_box .= ' box_msg_inline';
}
$return .= '<div class="' . $class_box . '">';
$return .= '<span class="head_msg">';
$return .= '<span class="time_msg">' . date('H:i:s', strtotime($line['timestamp'])) . '</span> ';
$return .= '<span class="user_name" rel="' . $id_user . '">' . $user_name . '</span> ';
$return .= ($line['reserved'] ? '<b>(' . Locale::setContent('reservedly') . ')</b> ' : '') . ' ' . Locale::setContent('tells') . ' ';
$return .= '<span class="name_to" rel="' . $to_user . '">' . $name_to . '</span>: ';
$return .= '<span class="remove_message">' . Locale::setContent('Hide message') . '</span> ';
$return .= '</span>';
示例5: array
?>
</span></p>
</div>
</div>
<div id="menu">
<h4 id="users_online"><?php
echo Locale::setContent('Users online:');
?>
</h4>
<a href="#" id="user_0" rel="0" class="active_user_talk"><?php
echo Locale::setContent('All users');
?>
</a>
<?php
echo '<span class="user_me"><a href="#" id="user_' . $_SESSION['chat_login']['id_user'] . '" rel="' . $_SESSION['chat_login']['id_user'] . '">' . Filters::convert($_SESSION['chat_login']['user']) . '</a></span>';
?>
<div id="box_users">
<?php
$filters = array('all' => 'convert');
$users_model = new UsersModel();
$users_model->setCond('id_room = ' . $id_room);
$users_model->setCond('active = 1');
$users_model->setCond('id <> ' . $id_user);
$users_model->setOrderBy('user asc');
$users = $users_model->addFilter($users_model->load_all(), $filters);
foreach ($users as $load) {
echo '<a href="#" id="user_' . $load['id'] . '" rel="' . $load['id'] . '">' . $load['user'] . '</a>';
}
?>
</div>