當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Vote::display方法代碼示例

本文整理匯總了PHP中Vote::display方法的典型用法代碼示例。如果您正苦於以下問題:PHP Vote::display方法的具體用法?PHP Vote::display怎麽用?PHP Vote::display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Vote的用法示例。


在下文中一共展示了Vote::display方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderVote

 /**
  * Callback function for registerParserHook.
  *
  * @param $input String: user-supplied input, unused
  * @param $args Array: user-supplied arguments, unused
  * @param $parser Parser: instance of Parser, unused
  * @return String: HTML
  */
 public static function renderVote($input, $args, $parser)
 {
     global $wgOut;
     wfProfileIn(__METHOD__);
     // Disable parser cache (sadly we have to do this, because the caching is
     // messing stuff up; we want to show an up-to-date rating instead of old
     // or totally wrong rating, i.e. another page's rating...)
     $parser->disableCache();
     // Add CSS & JS
     // In order for us to do this *here* instead of having to do this in
     // registerParserHook(), we must've disabled parser cache
     $wgOut->addModules('ext.voteNY');
     // Define variable - 0 means that we'll get that green voting box by default
     $type = 0;
     // Determine what kind of a voting gadget the user wants: a box or pretty stars?
     if (preg_match("/^\\s*type\\s*=\\s*(.*)/mi", $input, $matches)) {
         $type = htmlspecialchars($matches[1]);
     } elseif (!empty($args['type'])) {
         $type = intval($args['type']);
     }
     $articleID = $wgOut->getTitle()->getArticleID();
     switch ($type) {
         case 0:
             $vote = new Vote($articleID);
             break;
         case 1:
             $vote = new VoteStars($articleID);
             break;
         default:
             $vote = new Vote($articleID);
     }
     $output = $vote->display();
     wfProfileOut(__METHOD__);
     return $output;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:43,代碼來源:VoteHooks.php

示例2: RenderVote

function RenderVote($input)
{
    global $wgUser, $wgTitle, $wgOut;
    $wgOut->addScript("<script type=\"text/javascript\" src=\"extensions/Vote-Mag/Vote.js\"></script>\n");
    require_once 'VoteClass.php';
    getValue($type, $input, "type");
    switch ($type) {
        case 0:
            $Vote = new Vote($wgTitle->mArticleID);
            break;
        case 1:
            $Vote = new VoteStars($wgTitle->mArticleID);
            break;
        default:
            $Vote = new Vote($wgTitle->mArticleID);
    }
    $Vote->setUser($wgUser->mName, $wgUser->mId);
    $output = $Vote->display();
    return $output;
}
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:20,代碼來源:Vote.php


注:本文中的Vote::display方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。