本文整理汇总了PHP中ajax::xml方法的典型用法代码示例。如果您正苦于以下问题:PHP ajax::xml方法的具体用法?PHP ajax::xml怎么用?PHP ajax::xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ajax
的用法示例。
在下文中一共展示了ajax::xml方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
$q = $_POST['q'];
// limit
$limit = intval(min(100, max(1, postval("limit", 10))));
// ekskluder?
$exclude = "";
$exclude_ids = array();
if (isset($_POST['exclude'])) {
$exclude_ids = array_unique(array_map("intval", explode(",", $_POST['exclude'])));
if (count($exclude_ids) > 0) {
$exclude = "up_id NOT IN (" . implode(",", $exclude_ids) . ") AND ";
}
}
// ignorere egne deaktiverte spillere?
if (isset($_POST['is'])) {
$exclude .= "up_u_id != " . login::$user->id . " AND ";
}
// hent brukere
$q2 = \Kofradia\DB::quote(str_replace("_", "\\_", $q));
$result = \Kofradia\DB::get()->query("SELECT SQL_CALC_FOUND_ROWS up_id, up_name, up_access_level FROM users_players WHERE {$exclude}up_name LIKE {$q2} ORDER BY LENGTH(up_name), up_name LIMIT {$limit}");
$result2 = \Kofradia\DB::get()->query("SELECT FOUND_ROWS()");
$num = $result2->fetchColumn(0);
// logg
putlog("LOG", "%c3%bFINN-SPILLER:%b%c %u" . login::$user->player->data['up_name'] . "%u søkte etter %u{$q}%u!");
// xml
$data = '<userlist query="' . htmlspecialchars($q) . '" limit="' . $limit . '" results="' . $num . '">';
while ($row = $result->fetch()) {
$data .= '<user up_id="' . $row['up_id'] . '" up_name="' . htmlspecialchars($row['up_name']) . '">' . htmlspecialchars(game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level'])) . '</user>';
}
$data .= '</userlist>';
ajax::xml($data);
示例2: isset
<?php
require "../../app/ajax.php";
// mangler tekst?
if (!isset($_POST['text'])) {
ajax::text("ERROR:MISSING", ajax::TYPE_INVALID);
}
global $__server;
ajax::essentials();
// logg
$name = login::$logged_in ? login::$user->player->data['up_name'] : '*ukjent spiller*';
$ref = isset($_SERVER['HTTP_REFERER']) ? ' - referer: ' . $_SERVER['HTTP_REFERER'] : ' - ingen referer';
putlog("LOG", "%c3%bMIN-STATUS:%b%c %u{$name}%u hentet HTML for BB-kode{$ref}");
// sett opp html
$bb = parse_html(game::bb_to_html($_POST['text']));
// send raw html?
if (isset($_POST['plain'])) {
ajax::text($bb);
}
// send inni xml element
ajax::xml('<content>' . htmlspecialchars($bb) . '</content>');
示例3: parse_html_array
}
$xml .= '
';
}
$xml .= '</new>
<updated>';
// noen oppdaterte?
if (count($updated) > 0) {
$updated = parse_html_array($updated);
foreach ($updated as $id => $html) {
$xml .= '
<post id="' . $id . '" last_edit="' . intval($updated_last_edit[$id]) . '">' . htmlspecialchars($html) . '</post>';
}
$xml .= '
';
}
$xml .= '</updated>
<deleted>';
// noen slettede?
if (count($deleted) > 0) {
foreach ($deleted as $id) {
$xml .= '
<post>' . $id . '</post>';
}
$xml .= '
';
}
$xml .= '</deleted>
</topic>';
ajax::xml($xml);
示例4: edit_complete
/** Forumsvaret ble redigert */
protected function edit_complete()
{
// hent utvidet informasjon og returner HTML-malen inni XML
\ajax::xml('<data><reply id="' . $this->id . '" last_edit="' . $this->info['fr_last_edit'] . '">' . htmlspecialchars(parse_html($this->topic->forum->template_topic_reply($this->extended_info()))) . '</reply></data>');
}
示例5: thread_check_new_replies
/**
* Sjekk for nye svar i forumtråd
* @param inbox_thread_ajax $thread
*/
public static function thread_check_new_replies(inbox_thread_ajax $thread)
{
// mangler vi siste meldings-ID?
if (!isset($_POST['im_id'])) {
ajax::text("MANGLER-SISTE-MELDING", ajax::TYPE_INVALID);
}
$im_id = (int) $_POST['im_id'];
$last_id = $im_id;
// finn ut antal meldinger
$num_messages = $thread->num_messages();
// hent nye meldinger
$result = $thread->get_messages(NULL, NULL, "im_id > {$im_id}");
// har vi nye meldinger?
$messages = array();
if ($result->rowCount() > 0) {
// forsøk å sette ned meldingstelleren
$thread->counter_new_reset();
// gå gjennom meldingene
$i = 0;
$messages = array();
while ($row = $result->fetch()) {
$e = $num_messages - $i;
if ($i == 0) {
$last_id = $row['im_id'];
}
$messages[$row['im_id']] = $thread->reply_format($row, $e, false, true);
$i++;
}
}
// sett opp xml
$xml = '<list it_id="' . $thread->id . '" last_im_id="' . $last_id . '">';
// har vi noen meldinger?
if (count($messages) > 0) {
// fiks HTML
$messages = parse_html_array(array_reverse($messages));
// legg til meldingene
foreach ($messages as $key => $message) {
$xml .= '<message id="' . $key . '">' . htmlspecialchars($message) . '</message>';
}
}
$xml .= '</list>';
// send xml
ajax::xml($xml);
}
示例6: htmlspecialchars
ajax::xml('<userinfo u_id="' . $user['u_id'] . '">
<u_id>' . $user['u_id'] . '</u_id>
<u_reg_time_abs>' . htmlspecialchars($_base->date->get($user['u_created_time'])->format(date::FORMAT_SEC)) . '</u_reg_time_abs>
<u_reg_time_rel>' . htmlspecialchars(game::timespan($user['u_created_time'], game::TIME_ABS)) . '</u_reg_time_rel>
<u_last_online_abs>' . htmlspecialchars($_base->date->get($user['u_online_time'])->format(date::FORMAT_SEC)) . '</u_last_online_abs>
<u_last_online_rel>' . htmlspecialchars(game::timespan($user['u_online_time'], game::TIME_ABS)) . '</u_last_online_rel>
<u_ip>' . $user['u_online_ip'] . '</u_ip>
<u_email>' . htmlspecialchars($user['u_email']) . '</u_email>
<u_hits>' . $user['u_hits'] . '</u_hits>
<u_inbox_new>' . $user['u_inbox_new'] . '</u_inbox_new>
<player up_id="' . $user['up_id'] . '">
<up_id>' . $user['up_id'] . '</up_id>
<up_url>' . htmlspecialchars($__server['relative_path'] . "/p/" . rawurlencode($user['up_name'])) . '</up_url>
<up_name>' . htmlspecialchars($user['up_name']) . '</up_name>
<up_name_display>' . htmlspecialchars(game::profile_link($user['up_id'], $user['up_name'], $user['up_access_level'])) . '</up_name_display>
<up_reg_time_abs>' . htmlspecialchars($_base->date->get($user['up_created_time'])->format(date::FORMAT_SEC)) . '</up_reg_time_abs>
<up_reg_time_rel>' . htmlspecialchars(game::timespan($user['up_created_time'], game::TIME_ABS)) . '</up_reg_time_rel>
<up_status>' . htmlspecialchars($status) . '</up_status>
<up_last_online_abs>' . htmlspecialchars($_base->date->get($user['up_last_online'])->format(date::FORMAT_SEC)) . '</up_last_online_abs>
<up_last_online_rel>' . htmlspecialchars(game::timespan($user['up_last_online'], game::TIME_ABS)) . '</up_last_online_rel>
<up_activated>' . htmlspecialchars($user['up_access_level'] == 0 ? 0 : 1) . '</up_activated>
<up_profile_image>' . htmlspecialchars($profile_image) . '</up_profile_image>
<up_log_new>' . ($user['up_log_new'] + $user['up_log_ff_new']) . '</up_log_new>
<up_rank_name>' . htmlspecialchars($rank['name'] . ($rank['orig'] ? ' (' . $rank['orig'] . ')' : '')) . '</up_rank_name>
<up_rank_position>' . $user['upr_rank_pos'] . '</up_rank_position>
<up_hits>' . $user['up_hits'] . '</up_hits>
<up_cash>' . game::format_cash($user['up_cash']) . '</up_cash>
<up_bank>' . game::format_cash($user['up_bank']) . '</up_bank>
<up_money>' . game::format_cash($user['money']) . '</up_money>
<up_money_title>' . game::cash_name($user['money']) . '</up_money_title>
<up_last_interest>' . game::format_cash($user['up_interest_last']) . '</up_last_interest>
<up_bydel_latitude>' . htmlspecialchars($bydel['latitude']) . '</up_bydel_latitude>
<up_bydel_longitude>' . htmlspecialchars($bydel['longitude']) . '</up_bydel_longitude>
<up_bydel_id>' . htmlspecialchars($bydel['id']) . '</up_bydel_id>
<up_bydel_name>' . htmlspecialchars($bydel['name']) . '</up_bydel_name>
<up_health>' . ($health == 100 ? '100' : sprintf("%.2f", $health)) . '</up_health>
<up_energy>' . ($energy == 100 ? '100' : sprintf("%.2f", $energy)) . '</up_energy>
<up_protection>' . (!$user['up_protection_id'] ? 'null' : ($user['up_protection_state'] == 1 ? '100' : sprintf("%.2f", $user['up_protection_state'] * 100))) . '</up_protection>
<up_rank>' . sprintf("%.3f", login::$user->player->rank['need_points'] == 0 ? $user['up_points'] / login::$user->player->rank['points'] * 100 : ($user['up_points'] - login::$user->player->rank['points']) / login::$user->player->rank['need_points'] * 100) . ':' . $user['up_points'] . '</up_rank>
<up_wanted>' . ($user['up_wanted_level'] == 0 ? '0' : sprintf("%.1f", $user['up_wanted_level'] / 10, 1)) . '</up_wanted>
</player>
<game>
<poker_active>' . cache::fetch("poker_active", 0) . '</poker_active>
<auksjoner_active>' . game::auksjoner_active_count() . '</auksjoner_active>
<fengsel_count>' . game::fengsel_count() . '</fengsel_count>
</game>
</userinfo>');