本文整理汇总了PHP中DataProvider::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP DataProvider::singleton方法的具体用法?PHP DataProvider::singleton怎么用?PHP DataProvider::singleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataProvider
的用法示例。
在下文中一共展示了DataProvider::singleton方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WidgetTopContentGetSectionsList
function WidgetTopContentGetSectionsList()
{
wfProfileIn(__METHOD__);
$provider =& DataProvider::singleton();
list($links, $active) = $provider->GetTopFiveArray();
unset($links['community']);
wfProfileOut(__METHOD__);
return array(0 => $links, 1 => $active);
}
示例2: WidgetNewPages
function WidgetNewPages($id, $params)
{
wfProfileIn(__METHOD__);
$items = array();
if (class_exists('DataProvider')) {
$items = DataProvider::singleton()->GetNewlyCreatedArticles();
}
wfProfileOut(__METHOD__);
return count($items) > 0 ? WidgetFramework::wrapLinks($items) . WidgetFramework::moreLink(Title::newFromText('Newpages', NS_SPECIAL)->getLocalURL()) : wfMsg('widget-empty-list');
}
示例3: WidgetTopUsers
function WidgetTopUsers($id, $params)
{
wfProfileIn(__METHOD__);
$links = array();
if (class_exists('DataProvider')) {
$articles =& DataProvider::singleton()->GetTopFiveUsers();
if (is_array($articles) && count($articles) > 0) {
foreach ($articles as $article) {
$links[] = array('href' => $article['url'], 'name' => $article['text']);
}
}
}
wfProfileOut(__METHOD__);
return WidgetFramework::wrapLinks($links);
}
示例4: WidgetMostVisited
function WidgetMostVisited($id, $params)
{
wfProfileIn(__METHOD__);
$items = array();
if (class_exists('DataProvider')) {
$articles =& DataProvider::singleton()->GetMostVisitedArticles();
if (is_array($articles) && count($articles) > 0) {
foreach ($articles as $article) {
$items[] = array('href' => $article['url'], 'name' => $article['text']);
}
}
}
//print_pre($items);
wfProfileOut(__METHOD__);
return count($items) > 0 ? WidgetFramework::wrapLinks($items) . WidgetFramework::moreLink(Title::newFromText('Top', NS_SPECIAL)->getLocalURL() . '/most_visited') : wfMsg('widget-empty-list');
}
示例5: WidgetTopVoted
function WidgetTopVoted($id, $params)
{
wfProfileIn(__METHOD__);
$items = array();
if (class_exists('DataProvider')) {
$articles =& DataProvider::singleton()->GetTopVotedArticles();
if (is_array($articles) && count($articles) > 0) {
foreach ($articles as $article) {
$items[] = array('href' => $article['url'], 'name' => $article['text']);
}
}
}
//print_pre($items);
wfProfileOut(__METHOD__);
return count($items) > 0 ? WidgetFramework::wrapLinks($items) : wfMsg('widget-empty-list');
}
示例6: highestRatedParserHook
/**
* parser hook for <topvotedlist> tag
* @return string tag body
*/
public static function highestRatedParserHook($input, $args, $parser)
{
$args = self::extractArgs($args);
$tagBody = '<ul class="cfTopVotedListTag">';
foreach (DataProvider::singleton()->GetTopVotedArticles($args['limit']) as $article) {
$tagBody .= '<li><a href="' . htmlspecialchars($article['url']) . '">' . htmlspecialchars($article['text']) . '</a></li>';
}
$tagBody .= '</ul>';
return $tagBody;
}