本文整理汇总了PHP中format_word函数的典型用法代码示例。如果您正苦于以下问题:PHP format_word函数的具体用法?PHP format_word怎么用?PHP format_word使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_word函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render_article
function render_article($subject, $article, $info)
{
global $locale;
$category = "<a href='" . INFUSIONS . "articles/articles.php?cat_id=" . $info['cat_id'] . "'>" . $info['cat_name'] . "</a>\n";
$comment = "<a href='" . INFUSIONS . "articles/articles.php?article_id=" . $info['article_id'] . "#comments'> " . format_word($info['article_comments'], $locale['fmt_comment']) . " </a>\n";
echo render_breadcrumbs();
echo "<!--pre_article-->";
echo "<article>\n";
echo "<div class='news-action text-right'>";
echo "<a title='" . $locale['global_075'] . "' href='" . BASEDIR . "print.php?type=A&item_id=" . $info['article_id'] . "'><i class='entypo print'></i></a>";
echo !empty($info['edit_link']) ? "<a href='" . $info['edit_link'] . "' title='" . $locale['global_076'] . "' /><i class='entypo pencil'></i></a>\n" : '';
echo "</div>\n";
echo "<div class='news-info'>" . ucfirst($locale['posted']) . " <span class='news-date'>" . showdate("%d %b %Y", $info['article_date']) . "</span> " . $locale['in'] . " {$category} " . $locale['and'] . " {$comment}</div>\n";
echo "<h2 class='news-title'>{$subject}</h2>";
echo "<div class='article'>\n";
echo ($info['article_breaks'] == "y" ? nl2br($article) : $article) . "<br />\n";
echo "</div>\n";
echo "<hr />\n";
echo "<div class='news-user-info clearfix m-b-10'>\n";
echo "<h4>" . $locale['about'] . " <a href='" . BASEDIR . "profile.php?lookup=" . $info['user_id'] . "'>" . $info['user_name'] . "</a>\n</h4>";
echo "<div class='pull-left m-r-10'>" . display_avatar($info, '80px') . "</div>\n";
echo "<strong>" . getuserlevel($info['user_level']) . "</strong><br/>\n";
echo "<strong>" . $locale['joined'] . showdate('newsdate', $info['user_joined']) . "</strong><br/>\n";
echo "</div>\n";
echo "</article>";
echo "<!--sub_article-->";
echo $info['page_nav'];
echo "<hr />\n";
if ($info['article_allow_comments']) {
showcomments("A", DB_ARTICLES, "article_id", $_GET['article_id'], INFUSIONS . "articles/articles.php?article_id=" . $_GET['article_id']);
}
if ($info['article_allow_ratings']) {
showratings("A", $_GET['article_id'], INFUSIONS . "articles/articles.php?article_id=" . $_GET['article_id']);
}
}
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:35,代码来源:articles.php
示例2: render_comments
function render_comments($c_data, $c_info)
{
global $locale;
opentable(format_word(number_format(count($c_data)), $locale['fmt_comment']));
if (!empty($c_data)) {
echo "<div class='comments floatfix'>\n";
$c_makepagenav = '';
if ($c_info['c_makepagenav'] !== FALSE) {
echo $c_makepagenav = "<div style='text-align:center;margin-bottom:5px;'>" . $c_info['c_makepagenav'] . "</div>\n";
}
foreach ($c_data as $data) {
echo "<div class='comments_container m-b-15'><div class='pull-left m-r-10'>";
echo $data['user_avatar'];
echo "</div>\n";
echo "<div class='overflow-hide'>\n";
if ($data['edit_dell'] !== FALSE) {
echo "\n\t\t\t\t\t<div class='pull-right text-smaller comment_actions'>\n\t\t\t\t\t" . $data['edit_dell'] . "\n\t\t\t\t\t</div>\n";
}
echo "<div class='comment_name'>\n";
echo "<a href='" . FUSION_REQUEST . "#c" . $data['comment_id'] . "' id='c" . $data['comment_id'] . "' name='c" . $data['comment_id'] . "'>#" . $data['i'] . "</a> ";
echo $data['comment_name'];
echo "<span class='text-smaller mid-opacity m-l-10'>" . $data['comment_datestamp'] . "</span>\n";
echo "</div>\n";
echo "<div class='comment_message'>" . $data['comment_message'] . "</div>\n";
echo "</div>\n</div>\n";
}
echo $c_makepagenav;
if ($c_info['admin_link'] !== FALSE) {
echo "<div style='float:right' class='comment_admin'>" . $c_info['admin_link'] . "</div>\n";
}
echo "</div>\n";
} else {
echo "<div class='no_comment'>\n";
echo $locale['c101'] . "\n";
echo "</div>\n";
}
closetable();
}
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:38,代码来源:render_functions.php
示例3: render_comments
function render_comments($c_data, $c_info)
{
global $locale, $settings;
if (!empty($c_data)) {
echo "<div class='clearfix m-b-20'>\n";
if ($c_info['admin_link'] !== FALSE) {
echo "<div class='pull-right'>" . $c_info['admin_link'] . "</div>\n";
}
echo "<h2 class='m-t-0 pull-left display-inline-block'>" . format_word(count($c_data), $locale['fmt_comment']) . "</h2>\n";
echo "</div>\n";
echo "<div class='comments clearfix'>\n";
foreach ($c_data as $data) {
$comm_count = "<a href='" . FUSION_REQUEST . "#c" . $data['comment_id'] . "' id='c" . $data['comment_id'] . "' name='c" . $data['comment_id'] . "'>#" . $data['i'] . "</a>";
echo "<div class='m-t-20 comment-main clearfix'>\n";
echo $settings['comments_avatar'] ? "<div class='comment-avatar pull-left m-r-10'>" . $data['user_avatar'] . "</div>\n" : '';
echo "<div class='overflow-hide'>\n";
echo "<div class='comment-header'>\n";
echo "<div class='pull-right'>\n";
echo "<span class='comment-count text-dark m-r-10'>" . $comm_count . "</span>\n";
if ($data['edit_dell'] !== FALSE) {
echo "<span class='comment_actions'>" . $data['edit_dell'] . "\n</span>\n";
}
echo "</div>";
echo "<h4 class='display-inline'>" . $data['comment_name'] . "</h4>\n<span class='m-l-5 text-smaller m-t-5 text-lighter'>" . $data['comment_datestamp'] . "</span>";
echo "</div>\n";
echo "<div class='comments-body'>\n";
echo $data['comment_message'];
echo "</div>\n";
echo "</div>\n";
echo "</div>\n";
}
echo $c_info['c_makepagenav'] ? "<div class='flleft'>" . $c_info['c_makepagenav'] . "</div>\n" : "";
echo "</div>\n";
} else {
echo "<div class='nocomments-message spacer'>" . $locale['c101'] . "</div>\n";
}
}
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:37,代码来源:render_comments.php
示例4: display_comments
function display_comments($news_comments, $link = FALSE, $class = FALSE, $mode = '1')
{
global $locale;
$start_link = $link ? "<a class='comments-item " . $class . "' href='" . $link . "'>" : '';
$end_link = $link ? "</a>\n" : '';
$str = $mode == 1 ? format_word($news_comments, $locale['fmt_comment']) : $news_comments;
if ($news_comments > 0) {
return $start_link . "<i title='" . $locale['global_073'] . "' class='entypo icomment high-opacity m-l-0'></i>" . $str . $end_link;
} else {
return $start_link . "<i title='" . sprintf($locale['global_089'], $locale['global_077']) . "' class='entypo icomment high-opacity m-l-0'></i> " . $str . $end_link;
}
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:12,代码来源:theme_functions_include.php
示例5: get_thread_post
/**
* Get thread posts info
*/
private function get_thread_post()
{
global $forum_settings, $locale, $userdata;
$user_sig_module = \PHPFusion\UserFields::check_user_field('user_sig');
$user_web_module = \PHPFusion\UserFields::check_user_field('user_web');
$userid = isset($userdata['user_id']) ? (int) $userdata['user_id'] : 0;
switch ($this->thread_info['section']) {
case 'oldest':
$sortCol = 'post_datestamp ASC';
break;
case 'latest':
$sortCol = 'post_datestamp DESC';
break;
case 'high':
$sortCol = 'vote_points DESC';
break;
default:
$sortCol = 'post_datestamp ASC';
}
// @todo: where to calculate has voted without doing it in while loop?
require_once INCLUDES . "mimetypes_include.php";
$result = dbquery("\n\t\t\t\t\tSELECT p.*,\n\t\t\t\t\tt.thread_id,\n\t\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar, u.user_level, u.user_posts, u.user_groups, u.user_joined, u.user_lastvisit, u.user_ip,\n\t\t\t\t\t" . ($user_sig_module ? " u.user_sig," : "") . ($user_web_module ? " u.user_web," : "") . "\n\t\t\t\t\tu2.user_name AS edit_name, u2.user_status AS edit_status,\n\t\t\t\t\tcount(a1.attach_id) 'attach_image_count',\n\t\t\t\t\tcount(a2.attach_id) 'attach_files_count',\n\t\t\t\t\tSUM(v.vote_points) as vote_points, count(v2.thread_id) as has_voted\n\t\t\t\t\tFROM " . DB_FORUM_POSTS . " p\n\t\t\t\t\tINNER JOIN " . DB_FORUM_THREADS . " t ON t.thread_id = p.thread_id\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.post_id = p.post_id\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v2 on v2.thread_id = p.thread_id AND v2.vote_user = '" . $userid . "'\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " u ON p.post_author = u.user_id\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.post_id = p.post_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.post_id = p.post_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\tWHERE p.thread_id='" . intval($_GET['thread_id']) . "' AND post_hidden='0'\n\t\t\t\t\t" . ($this->thread_info['thread']['forum_type'] == '4' ? "OR p.post_id='" . intval($this->thread_info['post_firstpost']) . "'" : '') . "\n\t\t\t\t\tGROUP by p.post_id\n\t\t\t\t\tORDER BY {$sortCol} LIMIT " . intval($_GET['rowstart']) . ", " . intval($forum_settings['posts_per_page']));
$this->thread_info['post_rows'] = dbrows($result);
if ($this->thread_info['post_rows'] > 0) {
/* Set Threads Navigation */
$this->thread_info['thread_posts'] = format_word($this->thread_info['post_rows'], $locale['fmt_post']);
$this->thread_info['page_nav'] = '';
if ($this->thread_info['max_post_items'] > $this->thread_info['posts_per_page']) {
$this->thread_info['page_nav'] = "<div class='pull-right'>" . makepagenav($_GET['rowstart'], $this->thread_info['posts_per_page'], $this->thread_info['max_post_items'], 3, INFUSIONS . "forum/viewthread.php?thread_id=" . $this->thread_info['thread']['thread_id'] . (isset($_GET['highlight']) ? "&highlight=" . urlencode($_GET['highlight']) : '') . "&") . "</div>";
}
$i = 1;
while ($pdata = dbarray($result)) {
// Format Post Message
$post_message = $pdata['post_smileys'] ? parsesmileys($pdata['post_message']) : $pdata['post_message'];
$post_message = nl2br(parseubb($post_message));
if (isset($_GET['highlight'])) {
$post_message = "<div class='search_result'>" . $post_message . "</div>\n";
}
// Marker
$marker = array('link' => "#post_" . $pdata['post_id'], "title" => "#" . ($i + $_GET['rowstart']), 'id' => "post_" . $pdata['post_id']);
$post_marker = "<a class='marker' href='" . $marker['link'] . "' id='" . $marker['id'] . "'>" . $marker['title'] . "</a>";
$post_marker .= "<a title='" . $locale['forum_0241'] . "' href='#top'><i class='entypo up-open'></i></a>\n";
// Post Attachments
$post_attachments = "";
if ($pdata['attach_files_count'] || $pdata['attach_image_count']) {
if ($this->getThreadPermission("can_download_attach")) {
$attachResult = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . intval($pdata['post_id']) . "'");
if (dbrows($attachResult) > 0) {
$aImage = "";
$aFiles = "";
while ($attachData = dbarray($attachResult)) {
if (in_array($attachData['attach_mime'], img_mimeTypes())) {
$aImage .= display_image_attach($attachData['attach_name'], "50", "50", $pdata['post_id']) . "\n";
} else {
$aFiles .= "<div class='display-inline-block'><i class='entypo attach'></i><a href='" . FUSION_SELF . "?thread_id=" . $pdata['thread_id'] . "&getfile=" . $attachData['attach_id'] . "'>" . $attachData['attach_name'] . "</a> ";
$aFiles .= "[<span class='small'>" . parsebytesize(filesize(INFUSIONS . "forum/attachments/" . $attachData['attach_name'])) . " / " . $attachData['attach_count'] . $locale['forum_0162'] . "</span>]</div>\n";
}
}
if (!empty($aFiles)) {
$post_attachments .= "<div class='emulated-fieldset'>\n";
$post_attachments .= "<span class='emulated-legend'>" . profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']) . $locale['forum_0154'] . ($pdata['attach_files_count'] > 1 ? $locale['forum_0158'] : $locale['forum_0157']) . "</span>\n";
$post_attachments .= "<div class='attachments-list m-t-10'>" . $aFiles . "</div>\n";
$post_attachments .= "</div>\n";
}
if (!empty($aImage)) {
$post_attachments .= "<div class='emulated-fieldset'>\n";
$post_attachments .= "<span class='emulated-legend'>" . profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']) . $locale['forum_0154'] . ($pdata['attach_image_count'] > 1 ? $locale['forum_0156'] : $locale['forum_0155']) . "</span>\n";
$post_attachments .= "<div class='attachments-list'>" . $aImage . "</div>\n";
$post_attachments .= "</div>\n";
if (!defined('COLORBOX')) {
define('COLORBOX', TRUE);
add_to_head("<link rel='stylesheet' href='" . INCLUDES . "jquery/colorbox/colorbox.css' type='text/css' media='screen' />");
add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/colorbox/jquery.colorbox.js'></script>");
add_to_jquery("\$('a[rel^=\"attach\"]').colorbox({ current: '" . $locale['forum_0159'] . " {current} " . $locale['forum_0160'] . " {total}',width:'80%',height:'80%'});");
}
}
} else {
$post_attachments = "Failed to fetch the attachment";
}
} else {
$post_attachments = "<small><i class='fa fa-clipboard'></i> " . $locale['forum_0184'] . "</small>\n";
}
}
$pdata += array("user_online" => $pdata['user_lastvisit'] >= time() - 3600 ? TRUE : FALSE, "is_first_post" => $pdata['post_id'] == $this->thread_info['post_firstpost'] ? TRUE : FALSE, "is_last_post" => $pdata['post_id'] == $this->thread_info['post_lastpost'] ? TRUE : FALSE, "user_profile_link" => profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']), "user_avatar_image" => display_avatar($pdata, '40px', FALSE, FALSE, 'img-rounded'), "user_ip" => $forum_settings['forum_ips'] && iMOD ? $locale['forum_0268'] . ' ' . $pdata['post_ip'] : '', "user_post_count" => format_word($pdata['user_posts'], $locale['fmt_post']), "print" => array('link' => BASEDIR . "print.php?type=F&item_id=" . $_GET['thread_id'] . "&post=" . $pdata['post_id'] . "&nr=" . ($i + $_GET['rowstart']), 'title' => $locale['forum_0179']), "post_marker" => $post_marker, "marker" => $marker, "post_attachments" => $post_attachments);
$pdata['post_message'] = $post_message;
/**
* User Stuffs, Sig, User Message, Web
*/
// Quote & Edit Link
if ($this->getThreadPermission("can_reply")) {
if (!$this->thread_info['thread']['thread_locked']) {
$pdata['post_quote'] = array('link' => INFUSIONS . "forum/viewthread.php?action=reply&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'] . "&quote=" . $pdata['post_id'], 'title' => $locale['forum_0266']);
if (iMOD || ($forum_settings['forum_edit_lock'] == TRUE && $pdata['is_last_post'] || $forum_settings['forum_edit_lock'] == FALSE) && $userdata['user_id'] == $pdata['post_author'] && ($forum_settings['forum_edit_timelimit'] <= 0 || time() - $forum_settings['forum_edit_timelimit'] * 60 < $pdata['post_datestamp'])) {
$pdata['post_edit'] = array('link' => INFUSIONS . "forum/viewthread.php?action=edit&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], 'title' => $locale['forum_0265']);
}
$pdata['post_reply'] = array('link' => INFUSIONS . "forum/viewthread.php?action=reply&forum_id=" . $pdata['forum_id'] . "&thread_id=" . $pdata['thread_id'] . "&post_id=" . $pdata['post_id'], 'title' => $locale['forum_0509']);
} elseif (iMOD) {
//.........这里部分代码省略.........
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:101,代码来源:Viewthread.php
示例6: parseInfo
/** Custom data formatter */
function parseInfo($data)
{
global $locale, $dl_settings;
$download_image = '';
if ($data['download_image'] && $dl_settings['download_screenshot'] == "1") {
$hiRes_image_path = get_download_image_path($data['download_image'], $data['download_image_thumb'], TRUE);
$lowRes_image_path = get_download_image_path($data['download_image'], $data['download_image_thumb'], FALSE);
$download_image = "<a href='" . INFUSIONS . "downloads/downloads.php?download_id=" . $data['download_id'] . "'>" . thumbnail($lowRes_image_path, '100px') . "</a>";
}
return array('download_anchor' => "<a name='download_" . $data['download_id'] . "' id='download_" . $data['download_id'] . "'></a>", 'download_description_short' => nl2br(parseubb(parsesmileys(html_entity_decode(stripslashes($data['download_description_short']))))), 'download_description' => nl2br(parseubb(parsesmileys(html_entity_decode(stripslashes($data['download_description']))))), 'download_link' => INFUSIONS . "downloads/downloads.php?download_id=" . $data['download_id'], 'download_category_link' => "<a href='" . INFUSIONS . "downloads/downloads.php?cat_id=" . $data['download_cat'] . "'>" . $data['download_cat_name'] . "</a>\n", 'download_readmore_link' => "<a href='" . INFUSIONS . "downloads/downloads.php?download_id=" . $data['download_id'] . "'>" . $locale['download_1006'] . "</a>\n", 'download_title' => stripslashes($data['download_title']), 'download_image' => $download_image, 'download_thumb' => get_download_image_path($data['download_image'], $data['download_image_thumb'], FALSE), "download_count" => format_word($data['download_count'], $locale['fmt_download']), "download_comments" => format_word($data['count_comment'], $locale['fmt_comment']), 'download_sum_rating' => format_word($data['sum_rating'], $locale['fmt_rating']), 'download_count_votes' => format_word($data['count_votes'], $locale['fmt_vote']), 'download_user_avatar' => display_avatar($data, '25px', '', TRUE, 'img-rounded'), 'download_user_link' => profile_link($data['user_id'], $data['user_name'], $data['user_status'], 'strong'), 'download_post_time' => showdate('shortdate', $data['download_datestamp']), 'download_post_time2' => $locale['global_049'] . " " . timer($data['download_datestamp']), 'download_file_link' => file_exists(DOWNLOADS . '/files/' . $data['download_file']) ? INFUSIONS . "downloads/downloads.php?file_id=" . $data['download_id'] : '');
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:12,代码来源:downloads.php
示例7: format_word
function format_word($w)
{
return format_word($w, $this->language);
}
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:4,代码来源:Answers.php
示例8: do_table
function do_table($w, $values0, $values1, $values2, $values3, $values4, $ignore, $format_value, $format_word, $get_link = NULL, $extras = NULL, $optimization = 0)
{
?>
<div class="scrollable"><?php
if ($values1 and !$values2 and !$values3 and !$values4 and !$values0) {
?>
<table class="text-center inflection inflection-small" id="word<?php
echo $w->id();
?>
_forms"><?php
foreach ($values1[false] as $_1) {
?>
<tr><th><?php
echo format_value($_1);
?>
</th></tr><tr><td><?php
echo format_word(PATH($w, $_1)->get(), $w->lang(), true);
?>
</td></tr><?php
}
} else {
?>
<table class="text-left inflection" id="word<?php
echo $w->id();
?>
_forms"><?php
$first0 = $last0 = NULL;
_get_first_last($values0, $first0, $last0);
if (!$values0) {
$values0 = [FALSE];
$values1 = [$values1, "_" => $values1];
$values2 = [$values2, "_" => $values2];
$values3 = [$values3, "_" => $values3];
$values4 = [$values4, "_" => $values4];
}
foreach ($values0 as $_key => $_0) {
$name0 = $_0;
// FIXME
if ($name0 === " ") {
$name0 = FALSE;
}
if (!$values1[$_0]) {
$values1[$_0] = [FALSE];
}
if (!$values2[$_0]) {
$values2[$_0] = [FALSE];
}
if (!$values3[$_0]) {
$values3[$_0] = [FALSE];
}
if (!$values4[$_0]) {
$values4[$_0] = [FALSE];
}
$path = PATH($w, $_0);
if ($_0 !== $first0) {
// Blank row to separate sub-tables based on $values0
?>
<tr><th> </th></tr><?php
}
// values0 : table name
// values1 : major vertical
// values2 : minor vertical
// values3 : major horizontal
// values4 : minor horizontal
$_1 = (count($values1[$_0]) > 1 or $values1[$_0][0] !== FALSE);
?>
<tr><?php
$hspan1 = $_1 !== FALSE ? 2 : 1;
if ($name0 === FALSE) {
?>
<th colspan="<?php
echo $hspan1;
?>
"> </th><?php
} else {
?>
<th colspan="<?php
echo $hspan1;
?>
" class="greatest"><?php
echo $format_value($name0);
?>
</th><?php
}
if ($values3[$_0]) {
foreach ($values3[$_0] as $_3) {
?>
<th colspan="<?php
echo count($values4[$_0][$_3]);
?>
" class="major"><?php
echo $format_value($_3);
?>
</th><?php
}
}
?>
</tr><?php
if (!array_key_exists("_", $values4[$_0])) {
$values4[$_0]["_"] = [];
//.........这里部分代码省略.........
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:101,代码来源:inflection_table.php
示例9: defaultDB
if (is_callable($answers)) {
$answers = $answers($selections, defaultDB());
}
if (!is_array($answers)) {
$reason = "answers were not in an array";
return $try();
}
$process = function ($answer) use($dopick, &$stop, &$correct, $lang) {
if ($stop) {
return;
}
$ret = $dopick($answer, TRUE);
if ($ret === NULL) {
$stop = TRUE;
} else {
$ret = format_word($ret, $lang);
}
return $ret;
};
if (array_key_exists("correct", $answers) and array_key_exists("acceptable", $answers) and is_array($answers["correct"]) and is_array($answers["acceptable"])) {
$results = ["correct" => array_map($process, $answers["correct"]), "acceptable" => array_map($process, $answers["acceptable"])];
} else {
if (array_key_exists("correct", $answers) and is_array($answers["correct"]) and array_key_exists("expr", $answers) and is_string($answers["expr"])) {
$results = ["correct" => array_map($process, $answers["correct"]), "expr" => $dopick($answers["expr"], TRUE)];
} else {
$results = array_map($process, $answers);
}
}
if ($stop) {
return $try();
}
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:31,代码来源:nextQuestion.php
示例10: choose_n_unique
$res1 = choose_n_unique($res1, 4);
$res = array_merge($res0, $res1);
foreach ($res as &$r) {
$r = definition(defaultDB(), $r);
}
foreach ($res as &$r) {
$r = ["correct" => $r->word()->id() === $pick_db["word"]->id(), "value" => ((string) $r->path() ? "(" . $r->path() . ") " : "") . str_replace("\n", ", ", $r->value())];
}
return $res;
}, "choices0-tooltip" => "Pick correct definition"]]], "random-definitions-stage28-29-fr" => ["name" => "Stage 28–29 Vocabulary (FR)", "category" => "Vocabulary", "lang" => "la", "options" => [["help" => "Choose a correct definition for the given word", "selections" => ["word" => function ($_, $db, $path) {
$s = $db->searcher();
$s->stmt .= "\n\t\t\t\t\t\tWHERE word_id IN (\n\t\t\t\t\t\t\tSELECT word_id FROM definitions\n\t\t\t\t\t\t\tWHERE def_lang = 'en'\n\t\t\t\t\t\t\tAND def_type IS NULL\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND word_lang = 'la'\n\t\t\t\t\t\tAND word_id NOT IN (\n\t\t\t\t\t\t\tSELECT word_id FROM attributes\n\t\t\t\t\t\t\tWHERE attr_tag = 'template' OR attr_tag = 'hidden'\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\tSELECT attr_value FROM attributes\n\t\t\t\t\t\t\tWHERE word_id = words.word_id\n\t\t\t\t\t\t\tAND attr_tag = 'clc-stage' \n\t\t\t\t\t\t) IN (28,29)";
$s->args = [];
return $s->rand();
}], "sentence" => [$OP_LQUOTE, function ($pick_db) {
return format_word($pick_db["word"]->name());
}, $OP_RQUOTE, $OP_COLON, $OP_USER_INPUT], "answer0-language" => "en", "answer0" => function ($pick_db, $db) {
global $mysqli;
$query = $mysqli->prepare("\n\t\t\t\t\tSELECT DISTINCT def_id FROM definitions\n\t\t\t\t\tWHERE def_lang = 'en'\n\t\t\t\t\tAND def_type IS NULL\n\t\t\t\t\tAND word_id = (?)\n\t\t\t\t");
$res = NULL;
sql_getmany($query, $res, ["i", $pick_db["word"]->id()]);
$query->close();
if (!$res) {
return NULL;
}
$ret = [];
$ret2 = [];
foreach ($res as $r) {
$ret = array_merge($ret, explode("\n", definition(defaultDB(), $r)->value()));
}
foreach ($ret as $r) {
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:31,代码来源:vocab.php
示例11: makepagenav
// Start Item based on $result and $info['blog_rows']
if ($info['blog_max_rows'] > $blog_settings['blog_pagination'] && (!isset($_GET['readmore']) || !isnum($_GET['readmore']))) {
$info['blog_nav'] = makepagenav($_GET['rowstart'], $blog_settings['blog_pagination'], $info['blog_max_rows'], 3);
}
if (!empty($info['blog_rows'])) {
while ($data = dbarray($result)) {
// remove category image binding on item. each item is capable of housing hundreds of category.
$blog_image = "<a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "'>" . thumbnail(INFUSIONS . "blog/images/blog_default.jpg", '150px') . "</a>";
if ($data['blog_image']) {
$hiRes_image_path = get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2'], TRUE);
$lowRes_image_path = get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2'], FALSE);
$blog_image = "<a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "'>" . thumbnail($lowRes_image_path, '150px') . "</a>";
}
$blog_blog = parse_textarea($data['blog_blog']);
$blog_extended = parse_textarea($data['blog_extended']);
$cdata = array('blog_ialign' => $data['blog_ialign'] == 'center' ? 'clearfix' : $data['blog_ialign'], 'blog_anchor' => "<a name='blog_" . $data['blog_id'] . "' id='blog_" . $data['blog_id'] . "'></a>", 'blog_blog' => preg_replace("/<!?--\\s*pagebreak\\s*-->/i", "", $data['blog_breaks'] == "y" ? nl2br($blog_blog) : $blog_blog), 'blog_extended' => preg_replace("/<!?--\\s*pagebreak\\s*-->/i", "", $data['blog_breaks'] == "y" ? nl2br($blog_extended) : $blog_extended), 'blog_link' => INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'], 'blog_category_link' => "", 'blog_readmore_link' => "<a href='" . INFUSIONS . "blog/blog.php?readmore=" . $data['blog_id'] . "'>" . $locale['blog_1006'] . "</a>\n", 'blog_subject' => stripslashes($data['blog_subject']), 'blog_image' => $blog_image, 'blog_thumb' => get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2'], FALSE), "blog_reads" => format_word($data['blog_reads'], $locale['fmt_read']), "blog_comments" => format_word($data['count_comment'], $locale['fmt_comment']), 'blog_sum_rating' => format_word($data['sum_rating'], $locale['fmt_rating']), 'blog_count_votes' => format_word($data['count_votes'], $locale['fmt_vote']), 'blog_user_avatar' => display_avatar($data, '35px', '', TRUE, 'img-rounded'), 'blog_user_link' => profile_link($data['user_id'], $data['user_name'], $data['user_status'], 'strong'));
// refetch category per item and parse as string
if (!empty($data['blog_cat'])) {
$blog_cat = str_replace(".", ",", $data['blog_cat']);
$result2 = dbquery("SELECT blog_cat_id, blog_cat_name from " . DB_BLOG_CATS . " WHERE blog_cat_id in ({$blog_cat})");
$rows2 = dbrows($result2);
if ($rows2 > 0) {
$i = 1;
while ($catData = dbarray($result2)) {
$cdata['blog_category_link'] .= "<a href='" . INFUSIONS . "blog/blog.php?cat_id=" . $catData['blog_cat_id'] . "'>" . $catData['blog_cat_name'] . "</a>";
$cdata['blog_category_link'] .= $i == $rows2 ? "" : ", ";
$i++;
}
}
}
$data = array_merge($data, $cdata);
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:31,代码来源:blog.php
示例12: displayMoodList
/**
* Displays forum mood listing
*/
private function displayMoodList()
{
$locale = fusion_get_locale('', FORUM_ADMIN_LOCALE);
$mood_max_count = dbcount("(mood_id)", DB_FORUM_MOODS, "");
$_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $mood_max_count ? intval($_GET['rowstart']) : 0;
$mood_query = "SELECT fm.*, count(post_id) 'mood_count' FROM " . DB_FORUM_MOODS . " fm\n LEFT JOIN " . DB_POST_NOTIFY . " pn ON pn.notify_mood_id = fm.mood_id\n GROUP BY mood_id ORDER BY mood_id ASC LIMIT 0, 16";
$mood_result = dbquery($mood_query);
$rows = dbrows($mood_result);
if ($rows > 0) {
?>
<table class="table table-responsive table-striped table-hover m-t-20 m-b-20">
<thead>
<tr>
<td class="col-xs-2"><?php
echo $locale['forum_107'];
?>
</td>
<td class="col-xs-2"><?php
echo $locale['forum_108'];
?>
</td>
<td><?php
echo $locale['forum_109'];
?>
</td>
<td><?php
echo $locale['forum_115'];
?>
</td>
<td><?php
echo $locale['forum_110'];
?>
</td>
<td><?php
echo $locale['forum_111'];
?>
</td>
<td><?php
echo $locale['forum_112'];
?>
</td>
</tr>
</thead>
<tbody>
<?php
while ($data = dbarray($mood_result)) {
$edit_link = clean_request("ref=mood_form&action=edit&mood_id=" . $data['mood_id'], array("ref", "action", "mood_id"), FALSE);
$delete_link = clean_request("ref=mood_form&action=delete&mood_id=" . $data['mood_id'], array("ref", "action", "mood_id"), FALSE);
?>
<tr>
<td>
<a href="<?php
echo $edit_link;
?>
">
<?php
echo QuantumFields::parse_label($data['mood_name']);
?>
</a>
</td>
<td><?php
echo sprintf($locale['forum_113'], ucfirst(fusion_get_userdata("user_name")), QuantumFields::parse_label($data['mood_description']));
?>
</td>
<td>
<?php
if (!empty($data['mood_icon'])) {
?>
<i class="<?php
echo $data['mood_icon'];
?>
"></i>
<?php
}
?>
</td>
<td><?php
echo format_word($data['mood_count'], $locale['fmt_post']);
?>
</td>
<td><?php
echo getgroupname($data['mood_notify']);
?>
</td>
<td><?php
echo getgroupname($data['mood_access']);
?>
</td>
<td>
<a href="<?php
echo $edit_link;
?>
"><?php
echo $locale['edit'];
?>
</a> -
//.........这里部分代码省略.........
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:101,代码来源:mood.php
示例13: do_pick
function do_pick($t, $db, &$pick_db, &$reason)
{
if ($db === NULL) {
$db = defaultDB();
}
if ($t === NULL) {
$reason = "pick was null";
return $t;
} elseif (ISOP($t) or ISHTML($t)) {
return $t;
} elseif (ISPICK($t)) {
return $t->rand($db);
} elseif (is_string($t)) {
return $t;
} elseif (is_callable($t)) {
$t = _process_value($t, $pick_db, $db);
if ($t === NULL) {
$reason = "custom function returned NULL";
return $t;
} else {
return do_pick($t, $db, $pick_db, $reason);
}
} elseif (array_key_exists("condition", $t) and !$t["condition"]($pick_db, $db, null)) {
return FALSE;
} elseif (array_key_exists("value", $t)) {
return _process_value($t["value"], $pick_db, $db);
}
if (!($word = safe_get("word", $t))) {
$searcher = $db->searcher();
#var_dump(array_keys($searcher->master));
if (array_key_exists("name", $t)) {
$searcher = $searcher->name(_process_value($t["name"], $pick_db, $db));
}
if (array_key_exists("language", $t)) {
$searcher = $searcher->lang(_process_value($t["language"], $pick_db, $db));
} elseif (array_key_exists("lang", $t)) {
$searcher = $searcher->lang(_process_value($t["lang"], $pick_db, $db));
}
if (array_key_exists("speechpart", $t)) {
$searcher = $searcher->partofspeech(_process_value($t["speechpart"], $pick_db, $db));
} elseif (array_key_exists("spart", $t)) {
$searcher = $searcher->partofspeech(_process_value($t["spart"], $pick_db, $db));
}
if (array_key_exists("attr", $t)) {
foreach ($t["attr"] as $k => $v) {
$v = _process_value($v, $pick_db, $db);
if ($reverse = substr($k, 0, 1) === "!") {
$k = substr($k, 1);
$m = "only_without_attr";
} else {
$m = "only_with_attr";
}
$searcher = $searcher->{$m}($v !== NULL ? ATTR($k, $v) : ATTR($k));
}
}
$word = $searcher->rand();
}
if (!ISWORD($word)) {
$reason = "could not find a word with name " . var_export($t["name"], 1) . " and attrs " . var_export(safe_get("attr", $t), 1);
return;
}
if (array_key_exists("store_word", $t)) {
$pick_db[$t["store_word"]] = $word;
}
$word->read_paths();
$path = PATH($word);
if (array_key_exists("path", $t)) {
$p = $t["path"];
if (!is_array($p)) {
$p = _process_value($p, $pick_db, $db, $path);
}
foreach ($p as $k => $_) {
$path->add2([$k => _process_value($_, $pick_db, $db, $path)]);
}
}
if (array_key_exists("verb-gender", $t)) {
$g = $t["verb-gender"];
$g = _process_value($g, $pick_db, $db, $path);
if ($g !== NULL and $path->exists()) {
$path->add($g);
if (!$path->hasvalue()) {
$path->take("gender");
}
}
}
if ($path->hasvalue() || !(string) $path) {
$ret = $path->hasvalue() ? $path->get() : $word->name();
if (array_key_exists("store", $t)) {
$pick_db[$t["store"]] = $ret;
}
if (array_key_exists("store_path", $t)) {
$pick_db[$t["store_path"]] = $path;
}
return format_word($ret, $word->lang());
} else {
$reason = "path '{$path}' didn't exist in word with id <a target='_blank' href='dictionary.php?id=" . $word->id() . "'>" . $word->id() . "</a> or was NULL";
return;
}
}
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:99,代码来源:make_example.php
示例14: display_inflection
function display_inflection($w, $hidden = TRUE)
{
if ($c = $w->cached()) {
if (($_ = json_decode($c, true)) === NULL) {
echo $c;
return;
} else {
$c = $_;
}
for ($i = 0; $i < count($c); $i++) {
if ($i === 0) {
echo $c[$i];
} else {
echo format_word($c[$i]);
}
}
return;
} else {
ob_start();
}
$pronunciations = $w->pronunciations();
//error_log($pronunciations);
$w->clear_connections();
$connections = $w->connections();
list($values0, $values1, $values2, $values3, $values4) = word_table_values($w);
if (!$values0 and !$values1 and !$values3 and !$values4 and !$values2) {
?>
<span id="word<?php
echo $w->id();
?>
_forms">(No inflection for this word)</span><?php
return;
}
?>
Inflection
<?php
display_icon("visibility", $hidden ? "Show" : "Hide", "toggle-forms" . $w->id());
if ($pronunciations) {
?>
<span id="toggle-pronunciations<?php
echo $w->id();
?>
_outer">
[<a href="javascript:void(0)" id="toggle-pronunciations<?php
echo $w->id();
?>
">show IPA</a>]<br><br>
</span><?php
}
?>
<span id=
|
请发表评论