当前位置: 首页>>代码示例>>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;未经允许,请勿转载。