本文整理汇总了PHP中EasyTemplate::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyTemplate::execute方法的具体用法?PHP EasyTemplate::execute怎么用?PHP EasyTemplate::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyTemplate
的用法示例。
在下文中一共展示了EasyTemplate::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTML
/**
* Returns HTML internals of the widget box.
*/
public function getHTML($initialData)
{
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('data' => $initialData, 'completedToday' => $this->getCompletion(), 'thresholds' => $this->getThresholds(), 'header' => $this->getHeaderHTML(), 'weather' => $this->getWeatherClass($initialData['ct']), 'countDescription' => $this->getCountDescription(), 'moreLink' => $this->getMoreLink(), 'widgetName' => $this->getName(), 'title' => $this->getLeaderboardTitle(), 'getAvatarLink' => array($this, 'getAvatarLink'), 'getUserLink' => array($this, 'getUserLink'), 'status' => $this->getWidgetStatus(), 'login' => $this->getLoginLink(), 'widgetMWName' => $this->getMWName(), 'extraInternalHTML' => $this->getExtraInternalHTML()));
$html = $tmpl->execute('widgets/dashboardWidget.tmpl.php');
return $html;
}
示例2: getCTA
public static function getCTA(&$t)
{
if (self::isActivePage() && !self::isReferredFromArticleCreator() && self::isValidTitle($t)) {
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('title' => $t->getText()));
return $tmpl->execute('AltMethodAdder.tmpl.php');
}
}
示例3: addBubbleTipToElement
public function addBubbleTipToElement($element, $cookiePrefix, $text)
{
global $wgOut;
$wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('tipsbubble.css'), 'extensions/wikihow/interfaceelements', false));
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('interfaceelements/tipsbubble.js', 'common/jquery.cookie.js'), 'extensions/wikihow', false));
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('text' => $text));
InterfaceElements::addJSVars(array('bubble_target_id' => $element, 'cookieName' => $cookiePrefix . '_b'));
$wgOut->addHTML($tmpl->execute('TipsBubble.tmpl.php'));
}
示例4: execute
function execute($par)
{
global $wgOut, $wgRequest, $wgUser, $wgParser;
wfLoadExtensionMessages("MethodGuardian");
if ($wgUser->isBlocked()) {
$wgOut->blockedPage();
return;
}
if ($wgUser->isAnon()) {
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
return;
}
$this->skipTool = new ToolSkip("methodguardian", MethodGuardian::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
if ($wgRequest->getVal('getNext')) {
$wgOut->disable();
$result = $this->getNextMethod();
echo json_encode($result);
return;
} else {
if ($wgRequest->getVal('skipMethod')) {
$wgOut->disable();
$methodId = $wgRequest->getVal('methodId');
$this->skipTool->skipItem($methodId);
$this->skipTool->unUseItem($methodId);
$result = $this->getNextMethod();
echo json_encode($result);
return;
} elseif ($wgRequest->getVal('deleteMethod')) {
$wgOut->disable();
$methodId = $wgRequest->getVal('methodId');
$articleId = $wgRequest->getVal('articleId');
$this->deleteMethod($methodId, $articleId);
$result = $this->getNextMethod();
echo json_encode($result);
return;
} elseif ($wgRequest->getVal('keepMethod')) {
$wgOut->disable();
$methodId = $wgRequest->getVal('methodId');
$articleId = $wgRequest->getVal('articleId');
$this->keepMethod($methodId, $articleId);
$result = $this->getNextMethod();
echo json_encode($result);
return;
}
}
$wgOut->setHTMLTitle(wfMsg('methodguardian'));
$wgOut->setPageTitle(wfMsg('methodguardian'));
$wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodguardian.css'), 'extensions/wikihow/altmethodadder', false));
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodguardian.js'), 'extensions/wikihow/altmethodadder', false));
$tmpl = new EasyTemplate(dirname(__FILE__));
$wgOut->addHTML($tmpl->execute('MethodGuardian.tmpl.php'));
$this->displayLeaderboards();
}
示例5: getCalculator
function getCalculator($widget)
{
global $wgArticleWidgets;
if (isset($wgArticleWidgets[$widget])) {
$tmpl = new EasyTemplate(dirname(__FILE__));
$html = $tmpl->execute($widget . '/' . $widget . '.tmpl.php');
} else {
$html = '';
}
return $html;
}
示例6: addBubbleTipToElement
public function addBubbleTipToElement($element, $cookiePrefix, $text)
{
global $wgOut;
$wgOut->addJSCode('jqck');
//jQuery Cookie. Add as JS code so we don't have duplicate includes
$wgOut->addCSSCode('tbc');
// Tips Bubble CSS
InterfaceElements::addJSVars(array('bubble_target_id' => $element, 'cookieName' => $cookiePrefix . '_b'));
$wgOut->addHTML(HtmlSnips::makeUrlTags('js', array('interfaceelements/tipsbubble.js'), 'extensions/wikihow', false));
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('text' => $text));
$wgOut->addHTML($tmpl->execute('TipsBubble.tmpl.php'));
}
示例7: getLogin
public function getLogin($isHead = false)
{
global $wgTitle;
$action_url = '/index.php?title=Special:Userlogin&action=submitlogin&' . 'type=login&returnto=' . urlencode($wgTitle->getPrefixedURL()) . '&sitelogin=1';
if (SSL_LOGIN_DOMAIN) {
$action_url = 'https://' . SSL_LOGIN_DOMAIN . $action_url;
}
if ($isHead) {
$head_suffix = "_head";
} else {
$head_suffix = "";
}
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('social_buttons' => self::getSocialLogin($head_suffix), 'suffix' => $isHead ? '_head' : '', 'action_url' => htmlspecialchars($action_url)));
$html = $tmpl->execute('userloginbox.tmpl.php');
return $html;
}
示例8: getSplashPage
public static function getSplashPage($firstURL)
{
$vars = array('firstURL' => $firstURL);
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars($vars);
return $tmpl->execute('splash.tmpl.php');
}
示例9: afterAjaxLoginHTML
public static function afterAjaxLoginHTML(&$html)
{
$tmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
if (!LoginForm::getLoginToken()) {
LoginForm::setLoginToken();
}
$tmpl->set("loginToken", LoginForm::getLoginToken());
$tmpl->set("fbButtton", FBConnect::getFBButton("sendToConnectOnLoginForSpecificForm();", "fbPrefsConnect"));
$html = $tmpl->execute('ajaxLoginMerge');
return true;
}
示例10: getAdUnitTaboola
function getAdUnitTaboola($show = true)
{
global $wgTitle;
if (self::adExclusions($wgTitle)) {
$placement = 'below-article-thumbs-pg-13';
} else {
$placement = 'below-article-thumbs';
}
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('placement' => $placement));
$s = $tmpl->execute('wikiHowAdTaboola.tmpl.php');
$hideit_style = '';
if (!$show) {
$hideit_style = ' style="display: none;"';
}
$s = "<div class='wh_ad'{$hideit_style}>{$s}</div>";
return $s;
}
示例11: getImageSlider
/**
*
* Returns an image strip of images in the given title
*
*/
function getImageSlider($title)
{
global $wgOut, $wgUser, $wgMemc, $wgLanguageCode, $wgTitle;
wfLoadExtensionMessages('ImageHelper');
$exceptions = wfMsg('ih_exceptions');
$imageExceptions = split("\n", $exceptions);
$revid = $title->getLatestRevID();
$imageName = $title->getDBkey();
// $result = $wgMemc->get(wfMemcKey("gs_pp_" . $imageName . "_" . $revid));
// if ($result) {
// return $result;
// }
if (in_array($imageName, $imageExceptions)) {
//$wgMemc->set(wfMemcKey("gs_pp_" . $imageName . "_" . $revid), "");
return "";
}
$html = "";
$imageUrl = array();
$thumbUrl = array();
$imageTitle = array();
$imageWidth = array();
$imageHeight = array();
$results = self::getImagesFromSteps($title->getArticleID(), $revid);
if (empty($results)) {
return;
}
$intro_image = self::getImageFromIntro($title->getArticleID(), $revid);
if (!empty($intro_image)) {
//add it to the beginning
array_unshift($results, $intro_image);
}
$sk = $wgUser->getSkin();
$titleLink = $sk->makeKnownLinkObj($title, "");
$count = 0;
foreach ($results as $img) {
$img = preg_replace('@\\[\\[@', '', $img);
$image = Title::newFromText($img);
if ($image && $image->getArticleID() > 0) {
$file = wfFindFile($image);
if ($file && isset($file)) {
// if (!self::thumbnail_exists($file)) {
//log this so we can act on it later
/*
CREATE TABLE slideshow_todo (
ss2d_page_id INT(8) PRIMARY KEY,
ss2d_done TINYINT(1) NOT NULL DEFAULT 0,
ss2d_error TINYINT(1) NOT NULL DEFAULT 0,
ss2d_created TIMESTAMP DEFAULT NOW()
)
*/
/* $dbw = wfGetDB(DB_MASTER);
$dbw->ignoreErrors(true);
$dbw->insert('slideshow_todo', array('ss2d_page_id' => $title->getArticleID()));
return "";
}*/
//$thumb = $file->getThumbnail(60, -1, true, true);
$thumb = $file->getThumbnail(60, -1, true, true);
$fileUrl[] = $image->getLocalURL();
$imageUrl[] = $image->getFullURL();
$thumbUrl[] = $thumb->getUrl();
$imageTitle[] = $row['il_to'];
$count++;
}
}
}
if ($count > 3) {
$a = new Article($title);
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('fileUrl' => $fileUrl, 'imageUrl' => $imageUrl, 'thumbUrl' => $thumbUrl, 'imageTitle' => $imageTitle, 'title' => $titleLink, 'numImages' => count($imageUrl), 'imgStrip' => true, 'articleID' => $title->getArticleID(), 'revid' => $revid));
if ($this->bNewLayout_02) {
$html .= $tmpl->execute('prettyPhoto3.tmpl.php');
} else {
if ($this->bInline) {
$html .= $tmpl->execute('prettyPhoto2.tmpl.php');
} else {
$html .= $tmpl->execute('prettyPhoto.tmpl.php');
}
}
}
$result = array('content' => $html, 'num_images' => count($imageUrl));
//$wgMemc->set(wfMemcKey("gs_pp_" . $imageName . "_" . $revid), $result);
return $result;
}
示例12: execute
function execute($par)
{
global $IP, $wgOut, $wgUser, $wgRequest;
if ($wgUser->getID() == 0 || !($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) {
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
return;
}
wfLoadExtensionMessages("Spellchecker");
$this->skipTool = new ToolSkip("spellchecker", "spellchecker", "sc_checkout", "sc_checkout_user", "sc_page");
$message = "";
if ($wgRequest->wasPosted()) {
$articleUrl = $wgRequest->getVal('articleName');
$title = Title::newFromURL($articleUrl);
if ($title && $title->getArticleID() > 0) {
if ($this->addArticleToWhitelist($title)) {
$message = $title->getText() . " was added to the article whitelist.";
} else {
$message = $articleUrl . " could not be added to the article whitelist.";
}
} else {
$message = $articleUrl . " could not be added to the article whitelist.";
}
}
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('message' => $message));
$wgOut->addHTML($tmpl->execute('ArticleWhitelist.tmpl.php'));
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select("spellchecker", "sc_page", array("sc_exempt" => 1));
$wgOut->addHTML("<ol>");
while ($row = $dbr->fetchObject($res)) {
$title = Title::newFromID($row->sc_page);
if ($title) {
$wgOut->addHTML("<li><a href='" . $title->getFullURL() . "'>" . $title->getText() . "</a></li>");
}
}
$wgOut->addHTML("</ol>");
$wgOut->setHTMLTitle(wfMsg('spch-articlewhitelist'));
$wgOut->setPageTitle(wfMsg('spch-articlewhitelist'));
}
示例13: execute
function execute($par)
{
global $wgOut, $wgRequest, $wgParser;
wfLoadExtensionMessages("MethodEditor");
$user = $this->getContext()->getUser();
if (!$user || $user->isBlocked()) {
$wgOut->blockedPage();
return;
}
if (!$this->userAllowed($user)) {
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
return;
}
$this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_page");
if ($wgRequest->getVal('allarticles')) {
$wgOut->setArticleBodyOnly(true);
$dbr = wfGetDB(DB_SLAVE);
$date = date('Y-m-d');
header('Content-type: application/force-download');
header('Content-disposition: attachment; filename="methods_' . $date . '.xls"');
$res = $dbr->select(MethodEditor::TABLE_NAME, array('ama_page'), array('ama_patrolled' => '1'), __METHOD__, array('GROUP BY' => 'ama_page'));
foreach ($res as $row) {
$title = Title::newFromID($row->ama_page);
if ($title) {
echo $title->getFullURL() . "\n";
}
}
return;
}
if ($wgRequest->getVal('getNext')) {
$wgOut->disable();
$result = $this->getNextMethod($wgRequest->getVal('aid'));
echo json_encode($result);
return;
} else {
if ($wgRequest->getVal('skipMethod')) {
$wgOut->disable();
$articleId = $wgRequest->getVal('articleId');
$this->skipTool->skipItem($articleId);
$this->skipTool->unUseItem($articleId);
$result = $this->getNextMethod();
echo json_encode($result);
return;
} elseif ($wgRequest->getVal('deleteMethod')) {
$wgOut->disable();
$methodId = $wgRequest->getVal('methodId');
$articleId = $wgRequest->getVal('articleId');
$method = $wgRequest->getVal('method');
$this->deleteMethod($methodId, $articleId, $method);
$result = $this->getNextMethod();
echo json_encode($result);
return;
} elseif ($wgRequest->getVal('keepMethod')) {
$wgOut->disable();
$methodId = $wgRequest->getVal('methodId');
$articleId = $wgRequest->getVal('articleId');
$altMethod = $wgRequest->getVal('method');
$altSteps = $wgRequest->getVal('steps');
$this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
$result = $this->getNextMethod();
echo json_encode($result);
return;
} elseif ($wgRequest->getVal('quickEdit')) {
$wgOut->disable();
$methodId = $wgRequest->getVal('methodId');
$articleId = $wgRequest->getVal('articleId');
$this->quickEditRecord($methodId, $articleId);
$result = $this->getNextMethod();
echo json_encode($result);
return;
} elseif ($wgRequest->getVal('clearSkip')) {
$wgOut->disable();
$this->skipTool->clearSkipCache();
echo "Skip cache has been cleared";
return;
}
}
$wgOut->setPageTitle(wfMessage('methodeditor')->text());
$wgOut->addJScode('csjs');
$wgOut->addCSScode('methc');
$wgOut->addJScode('methj');
$wgOut->addJScode('jcookj');
$wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
$groups = $user->getGroups();
$showList = in_array('staff', $groups) || in_array('staff_widget', $groups);
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('showList' => $showList));
$wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
$this->displayLeaderboards();
$wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
}
示例14: showForm
function showForm($id, $username, $email, $avatar, $error = '')
{
global $wgOut;
$origname = $username;
//make sure we have a good username
//$username = $username !== null ? $username : $this->getProposedUsername($username);
$username = $this->getProposedUsername($username);
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('username' => $username, 'origname' => $origname, 'avatar' => $avatar, 'email' => $email, 'id' => $id, 'error' => $error));
$html = $tmpl->execute('gplusform.tmpl.php');
$wgOut->addHeadItem('gpluslogin_css', HtmlSnips::makeUrlTags('css', array('gpluslogin.css'), 'extensions/wikihow/GPlusLogin', false));
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('gpluslogin.js'), 'extensions/wikihow/GPlusLogin', false));
$wgOut->addHtml($html);
}
示例15: execute
function execute($par)
{
global $wgOut, $wgUser, $wgRequest, $wgLang;
$err = "";
$target = isset($par) ? $par : $wgRequest->getVal('target');
$restore = $wgRequest->getVal('restore', null);
$sk = $wgUser->getSkin();
$wgOut->setHTMLTitle('Clear Ratings - Accuracy Patrol');
$type = $wgRequest->getVal('type', 'article');
$rateItem = new RateItem();
$ratingTool = $rateItem->getRatingTool($type);
if ($ratingTool) {
$t = $ratingTool->makeTitle($target);
}
if ($t == '') {
$wgOut->addHTML(wfMsg('clearratings_notitle'));
$this->addClearForm($target, $type, $err);
return;
}
$me = SpecialPage::getTitleFor('Clearratings', $target);
if ($wgUser->getID() == 0) {
return;
}
if ($wgRequest->wasPosted()) {
// clearing ratings
$clearId = $wgRequest->getVal('clearId', null);
if ($clearId != null) {
$ratingTool->clearRatings($clearId, $wgUser);
$wgOut->addHTML(wfMsg('clearratings_clear_finished') . "<br/><br/>");
}
}
if ($restore != null && $wgRequest->getVal('reason', null) == null) {
//ask why the user wants to resotre
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('postUrl' => $me->getFullURL(), 'params' => $_GET));
$wgOut->addHTML($tmpl->execute('restore.tmpl.php'));
return;
} else {
if ($restore != null) {
$user = $wgRequest->getVal('user');
$page = $wgRequest->getVal('page');
$reason = $wgRequest->getVal('reason');
$u = User::newFromId($user);
$up = $u->getUserPage();
$hi = $wgRequest->getVal('hi');
$low = $wgRequest->getVal('low');
$count = $ratingTool->getUnrestoredCount($page);
$ratingTool->restore($page, $user, $hi, $low);
$wgOut->addHTML("<br/><br/>" . wfMsg('clearratings_clear_restored', $sk->makeLinkObj($up, $u->getName()), $when) . "<br/><br/>");
// add the log entry
$ratingTool->logRestore($page, $low, $hi, $reason, $count);
}
}
if ($target != null && $type != null) {
$id = $ratingTool->getId($t);
if ($id === 0) {
$err = wfMsg('clearratings_no_such_title', $target);
} else {
if ($type == "article" && $t->getNamespace() != NS_MAIN) {
$err = wfMsg('clearratings_only_main', $target);
} else {
// clearing info
$ratingTool->showClearingInfo($t, $id, $me, $target);
$ap = Title::makeTitle(NS_SPECIAL, "AccuracyPatrol");
$wgOut->addHTML($sk->makeLinkObj($ap, "Return to accuracy patrol"));
}
}
}
$this->addClearForm($target, $type, $err);
}