本文整理匯總了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;
}