本文整理汇总了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;
}
示例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;
}