本文整理汇总了PHP中NewsStory::uname方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory::uname方法的具体用法?PHP NewsStory::uname怎么用?PHP NewsStory::uname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsStory
的用法示例。
在下文中一共展示了NewsStory::uname方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
// We verify that the user can post comments **********************************
if (!isset($xoopsModuleConfig)) {
die;
}
if ($xoopsModuleConfig['com_rule'] == 0) {
// Comments are deactivate
die;
}
if ($xoopsModuleConfig['com_anonpost'] == 0 && !is_object($xoopsUser)) {
// Anonymous users can't post
die;
}
// ****************************************************************************
$com_itemid = isset($_GET['com_itemid']) ? intval($_GET['com_itemid']) : 0;
if ($com_itemid > 0) {
$article = new NewsStory($com_itemid);
if ($article->storyid > 0) {
$com_replytext = _POSTEDBY . ' <b>' . $article->uname() . '</b> ' . _DATE . ' <b>' . formatTimestamp($article->published(), news_getmoduleoption('dateformat')) . '</b><br /><br />' . $article->hometext();
$bodytext = $article->bodytext();
if ($bodytext != '') {
$com_replytext .= '<br /><br />' . $bodytext . '';
}
$com_replytitle = $article->title();
include_once XOOPS_ROOT_PATH . '/include/comment_new.php';
} else {
exit;
}
}
示例2: b_news_top_show
//.........这里部分代码省略.........
}
$spotlight['text'] = $tmpstory->hometext();
// Added 16 february 2007 *****************************************
$story_user = null;
$story_user = new XoopsUser($tmpstory->uid());
if (is_object($story_user)) {
$spotlight['avatar'] = XOOPS_UPLOAD_URL . '/' . $story_user->getVar('user_avatar');
}
// ****************************************************************
$spotlight['id'] = $tmpstory->storyid();
$spotlight['date'] = formatTimestamp($tmpstory->published(), $dateformat);
$spotlight['hits'] = $tmpstory->counter();
$spotlight['rating'] = number_format($tmpstory->rating(), 2);
$spotlight['votes'] = $tmpstory->votes();
if (strlen(xoops_trim($tmpstory->bodytext())) > 0) {
$spotlight['read_more'] = true;
} else {
$spotlight['read_more'] = false;
}
$spotlight['readmore'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), _MB_READMORE);
$spotlight['title_with_link'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), $tmpstory->title());
if ($tmpstory->votes() == 1) {
$spotlight['number_votes'] = _NW_ONEVOTE;
} else {
$spotlight['number_votes'] = sprintf(_NW_NUMVOTES, $tmpstory->votes());
}
$spotlight['votes_with_text'] = sprintf(_NW_NUMVOTES, $tmpstory->votes());
$spotlight['topicid'] = $tmpstory->topicid();
$spotlight['topic_title'] = $tmpstory->topic_title();
// Added, topic's image and description
$spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $tmpstory->topic_imgurl();
$spotlight['topic_description'] = $myts->displayTarea($tmpstory->topic_description, 1);
if ($displayname != 3) {
$spotlight['author'] = sprintf("%s %s", _POSTEDBY, $tmpstory->uname());
$spotlight['author_with_link'] = sprintf("%s <a href='%s'>%s</a>", _POSTEDBY, XOOPS_URL . '/userinfo.php?uid=' . $tmpstory->uid(), $tmpstory->uname());
} else {
$spotlight['author'] = '';
$spotlight['author_with_link'] = '';
}
$spotlight['author_id'] = $tmpstory->uid();
// Create the summary table under the spotlight text
if (isset($options[14]) && $options[14] == 0) {
// Use all topics
$stories = $tmpstory->getAllPublished($options[1], 0, $restricted, 0, 1, true, $options[0]);
} else {
// Use some topics
$topics = array_slice($options, 14);
$stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $topics, 1, true, $options[0]);
}
if (count($stories) > 0) {
foreach ($stories as $key => $story) {
$news = array();
$title = $story->title();
if (strlen($title) > $options[2]) {
$title = xoops_substr($title, 0, $options[2] + 3);
}
$news['title'] = $title;
$news['id'] = $story->storyid();
$news['date'] = formatTimestamp($story->published(), $dateformat);
$news['hits'] = $story->counter();
$news['rating'] = number_format($story->rating(), 2);
$news['votes'] = $story->votes();
$news['topicid'] = $story->topicid();
$news['topic_title'] = $story->topic_title();
$news['topic_color'] = '#' . $myts->displayTarea($story->topic_color);
if ($displayname != 3) {
示例3: formatTimestamp
$article_title = news_html2text($myts->undoHtmlSpecialChars($article_title));
$forumdata['topic_title'] = $article_title;
$pdf_data['title'] = $article->title();
$topic_title = $article->topic_title();
$topic_title = news_html2text($myts->undoHtmlSpecialChars($topic_title));
$pdf_data['subtitle'] = $topic_title;
$pdf_data['subsubtitle'] = '';
$pdf_data['date'] = formatTimestamp($article->published(), $dateformat);
$pdf_data['filename'] = preg_replace("/[^0-9a-z\\-_\\.]/i", '', $myts->htmlSpecialChars($article->topic_title()) . ' - ' . $article->title());
$pdf_data['filename'] = 'test';
$hometext = $article->hometext();
$bodytext = $article->bodytext();
$content = $myts->undoHtmlSpecialChars($hometext) . '<br /><br />' . $myts->undoHtmlSpecialChars($bodytext);
$content = str_replace('[pagebreak]', '<br /><br />', $content);
$pdf_data['content'] = $content;
$pdf_data['author'] = $article->uname();
//Other stuff
$puff = '<br />';
$puffer = '<br /><br /><br />';
//create the A4-PDF...
$pdf_config['slogan'] = $xoopsConfig['sitename'] . ' - ' . $xoopsConfig['slogan'];
$pdf = new PDF();
if (method_exists($pdf, 'encoding')) {
$pdf->encoding($pdf_data, _CHARSET);
}
$pdf->SetCreator($pdf_config['creator']);
$pdf->SetTitle($pdf_data['title']);
$pdf->SetAuthor($pdf_config['url']);
$pdf->SetSubject($pdf_data['author']);
$out = $pdf_config['url'] . ', ' . $pdf_data['author'] . ', ' . $pdf_data['title'] . ', ' . $pdf_data['subtitle'] . ', ' . $pdf_data['subsubtitle'];
$pdf->SetKeywords($out);
示例4: Stats
/**
* Statistics about stories, topics and authors
*
* You can reach the statistics from the admin part of the news module by clicking on the "Statistics" tabs
* The number of visible elements in each table is equal to the module's option called "storycountadmin"
* There are 3 kind of different statistics :
* - Topics statistics
* For each topic you can see its number of articles, the number of time each topics was viewed, the number
* of attached files, the number of expired articles and the number of unique authors.
* - Articles statistics
* This part is decomposed in 3 tables :
* a) Most readed articles
* This table resumes, for all the news in your database, the most readed articles.
* The table contains, for each news, its topic, its title, the author and the number of views.
* b) Less readed articles
* That's the opposite action of the previous table and its content is the same
* c) Best rated articles
* You will find here the best rated articles, the content is the same that the previous tables, the last column is just changing and contains the article's rating
* - Authors statistics
* This part is also decomposed in 3 tables
* a) Most readed authors
* To create this table, the program compute the total number of reads per author and displays the most readed author and the number of views
* b) Best rated authors
* To created this table's content, the program compute the rating's average of each author and create a table
* c) Biggest contributors
* The goal of this table is to know who is creating the biggest number of articles.
*/
function Stats()
{
global $xoopsModule, $xoopsConfig, $xoopsModuleConfig;
xoops_cp_header();
$myts =& MyTextSanitizer::getInstance();
if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) {
include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
} else {
include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
}
adminmenu(6);
$news = new NewsStory();
$stats = array();
$stats = $news->GetStats($xoopsModuleConfig['storycountadmin']);
$totals = array(0, 0, 0, 0, 0);
printf("<h1>%s</h1>\n", _AM_NEWS_STATS);
// First part of the stats, everything about topics
$storiespertopic = $stats['storiespertopic'];
$readspertopic = $stats['readspertopic'];
$filespertopic = $stats['filespertopic'];
$expiredpertopic = $stats['expiredpertopic'];
$authorspertopic = $stats['authorspertopic'];
$class = '';
echo "<div style='text-align: center;'><b>" . _AM_NEWS_STATS0 . "</b><br />\n";
echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _NW_ARTICLES . "</td><td>" . _NW_VIEWS . "</td><td>" . _AM_UPLOAD_ATTACHFILE . "</td><td>" . _AM_EXPARTS . "</td><td>" . _AM_NEWS_STATS1 . "</td></tr>";
foreach ($storiespertopic as $topicid => $data) {
$url = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/index.php?storytopic=" . $topicid;
$views = 0;
if (array_key_exists($topicid, $readspertopic)) {
$views = $readspertopic[$topicid];
}
$attachedfiles = 0;
if (array_key_exists($topicid, $filespertopic)) {
$attachedfiles = $filespertopic[$topicid];
}
$expired = 0;
if (array_key_exists($topicid, $expiredpertopic)) {
$expired = $expiredpertopic[$topicid];
}
$authors = 0;
if (array_key_exists($topicid, $authorspertopic)) {
$authors = $authorspertopic[$topicid];
}
$articles = $data['cpt'];
$totals[0] += $articles;
$totals[1] += $views;
$totals[2] += $attachedfiles;
$totals[3] += $expired;
$class = $class == 'even' ? 'odd' : 'even';
printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td><td align='right'>%u</td></tr>\n", $url, $myts->displayTarea($data['topic_title']), $articles, $views, $attachedfiles, $expired, $authors);
}
$class = $class == 'even' ? 'odd' : 'even';
printf("<tr class='" . $class . "'><td align='center'><b>%s</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td align='right'><b>%u</b></td><td> </td>\n", _AM_NEWS_STATS2, $totals[0], $totals[1], $totals[2], $totals[3]);
echo "</table></div><br /><br /><br />";
// Second part of the stats, everything about stories
// a) Most readed articles
$mostreadednews = $stats['mostreadednews'];
echo "<div style='text-align: center;'><b>" . _AM_NEWS_STATS3 . "</b><br /><br />" . _AM_NEWS_STATS4 . "<br />\n";
echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_TITLE . "</td><td>" . _AM_POSTER . "</td><td>" . _NW_VIEWS . "</td></tr>\n";
foreach ($mostreadednews as $storyid => $data) {
$url1 = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/index.php?storytopic=" . $data['topicid'];
$url2 = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?storyid=" . $storyid;
$url3 = XOOPS_URL . '/userinfo.php?uid=' . $data['uid'];
$class = $class == 'even' ? 'odd' : 'even';
printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='left'><a href='%s' target='_blank'>%s</a></td><td><a href='%s' target='_blank'>%s</a></td><td align='right'>%u</td></tr>\n", $url1, $myts->displayTarea($data['topic_title']), $url2, $myts->displayTarea($data['title']), $url3, $myts->htmlSpecialChars($news->uname($data['uid'])), $data['counter']);
}
echo "</table>";
// b) Less readed articles
$lessreadednews = $stats['lessreadednews'];
echo '<br /><br />' . _AM_NEWS_STATS5;
echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_TITLE . "</td><td>" . _AM_POSTER . "</td><td>" . _NW_VIEWS . "</td></tr>\n";
foreach ($lessreadednews as $storyid => $data) {
$url1 = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/index.php?storytopic=" . $data['topicid'];
//.........这里部分代码省略.........
示例5: keyhighlighter
{
$color = news_getmoduleoption('highlightcolor');
if (substr($color, 0, 1) != '#') {
$color = '#' . $color;
}
return '<span style="font-weight: bolder; background-color: ' . $color . ';">' . $matches[0] . '</span>';
}
$highlight = false;
$highlight = news_getmoduleoption('keywordshighlight');
if ($highlight && isset($_GET['keywords'])) {
$keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords'])));
$h = new keyhighlighter($keywords, true, 'my_highlighter');
$story['text'] = $h->highlight($story['text']);
}
// ****************************************************************************************************************
$story['poster'] = $article->uname();
if ($story['poster']) {
$story['posterid'] = $article->uid();
$story['poster'] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $story['posterid'] . '">' . $story['poster'] . '</a>';
$tmp_user = new XoopsUser($article->uid());
$story['poster_avatar'] = XOOPS_UPLOAD_URL . '/' . $tmp_user->getVar('user_avatar');
$story['poster_signature'] = $tmp_user->getVar('user_sig');
$story['poster_email'] = $tmp_user->getVar('email');
$story['poster_url'] = $tmp_user->getVar('url');
$story['poster_from'] = $tmp_user->getVar('user_from');
unset($tmp_user);
} else {
$story['poster'] = '';
$story['posterid'] = 0;
$story['poster_avatar'] = '';
$story['poster_signature'] = '';
示例6: isset
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
$com_itemid = isset($HTTP_GET_VARS['com_itemid']) ? intval($HTTP_GET_VARS['com_itemid']) : 0;
if ($com_itemid > 0) {
$article = new NewsStory($com_itemid);
$com_replytext = _POSTEDBY . ' <b>' . $article->uname() . '</b> ' . _DATE . ' <b>' . formatTimestamp($article->published()) . '</b><br /><br />' . $article->hometext();
$bodytext = $article->bodytext();
if ($bodytext != '') {
$com_replytext .= '<br /><br />' . $bodytext . '';
}
$com_replytitle = $article->title();
include XOOPS_ROOT_PATH . '/include/comment_new.php';
}
示例7: formatTimestamp
require_once XOOPS_ROOT_PATH . '/modules/news/pdf/tcpdf.php';
$filename = XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
if (file_exists($filename)) {
include_once $filename;
} else {
include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
}
$filename = XOOPS_ROOT_PATH . '/modules/news/pdf/config/lang/' . _LANGCODE . '.php';
if (file_exists($filename)) {
include_once $filename;
} else {
include_once XOOPS_ROOT_PATH . '/modules/news/pdf/config/lang/en.php';
}
$dateformat = news_getmoduleoption('dateformat');
$content = '';
$content .= '<b><i><u>' . $myts->undoHtmlSpecialChars($article->title()) . '</u></i></b><br /><b>' . $myts->undoHtmlSpecialChars($article->topic_title()) . '</b><br />' . _POSTEDBY . ' : ' . $myts->undoHtmlSpecialChars($article->uname()) . '<br />' . _MD_POSTEDON . ' ' . formatTimestamp($article->published(), $dateformat) . '<br /><br /><br />';
$content .= $myts->undoHtmlSpecialChars($article->hometext()) . '<br />' . $myts->undoHtmlSpecialChars($article->bodytext());
$content = str_replace('[pagebreak]', '<br />', $content);
$content = news_unhtml($content);
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
$doc_title = $myts->undoHtmlSpecialChars($article->title());
$doc_keywords = 'XOOPS';
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle($doc_title);
$pdf->SetSubject($doc_title);
$pdf->SetKeywords($doc_keywords);
$firstLine = news_unhtml($article->title());
$secondLine = news_unhtml(XOOPS_URL . '/modules/news/article.php?storyid=1' . $storyid);
$pdf->SetHeaderData('', '', $firstLine, $secondLine);