本文整理汇总了PHP中SkinTemplate::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP SkinTemplate::getRequest方法的具体用法?PHP SkinTemplate::getRequest怎么用?PHP SkinTemplate::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTemplate
的用法示例。
在下文中一共展示了SkinTemplate::getRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSkinTemplateOutputPageBeforeExec
/**
* SkinTemplateOutputPageBeforeExec hook handler
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateOutputPageBeforeExec
*
* Adds a link to view the current page in 'mobile view' to the desktop footer.
*
* @param SkinTemplate $skin
* @param QuickTemplate $tpl
* @return bool
*/
public static function onSkinTemplateOutputPageBeforeExec(&$skin, &$tpl)
{
$title = $skin->getTitle();
$context = MobileContext::singleton();
if (!$context->isBlacklistedPage()) {
$footerlinks = $tpl->data['footerlinks'];
$args = $skin->getRequest()->getQueryValues();
// avoid title being set twice
unset($args['title']);
unset($args['useformat']);
$args['mobileaction'] = 'toggle_view_mobile';
$mobileViewUrl = $title->getFullURL($args);
$mobileViewUrl = MobileContext::singleton()->getMobileUrl($mobileViewUrl);
$link = Html::element('a', array('href' => $mobileViewUrl, 'class' => 'noprint stopMobileRedirectToggle'), wfMessage('mobile-frontend-view')->text());
$tpl->set('mobileview', $link);
$footerlinks['places'][] = 'mobileview';
$tpl->set('footerlinks', $footerlinks);
}
return true;
}
示例2: onSkinTemplateOutputPageBeforeExec
/**
* Modifies the logo on runtime
* @param SkinTemplate $sktemplate
* @param BaseTemplate $tpl
* @return boolean Always true to keep hook running
*/
public static function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl)
{
$sFlexiskin = $sktemplate->getRequest()->getVal('flexiskin');
if ($sFlexiskin || BsConfig::get('MW::Flexiskin::Active') != '') {
$sId = $sFlexiskin != '' ? $sFlexiskin : BsConfig::get('MW::Flexiskin::Active');
if ($sId != "default") {
$bPreview = $sktemplate->getRequest()->getVal('preview', false);
$api = new ApiMain(new DerivativeRequest($sktemplate->getRequest(), array('action' => 'flexiskin', 'type' => 'get', 'mode' => 'config', 'id' => $sId, 'preview' => $bPreview), false), true);
$api->execute();
$aResult = $api->getResultData();
$oResult = FormatJson::decode($aResult['flexiskin']);
if ($oResult->success === false) {
return true;
}
$aConfig = FormatJson::decode($oResult->config);
$sLogo = BsConfig::get("MW::Flexiskin::Logo");
if ($sLogo == "") {
return true;
}
$sPath = BS_DATA_PATH . "/flexiskin/" . $sId . "/images/";
$tpl->set('logopath', $sPath . $sLogo);
return true;
}
return true;
}
return true;
}
示例3: addApprovalButton
public static function addApprovalButton(SkinTemplate &$sktemplate, array &$links)
{
$title = $sktemplate->getRelevantTitle();
$user = $sktemplate->getUser();
if ($sktemplate->isRevisionCurrent() && ApprovedRevs::isAssignedToProject($title) && ApprovedRevs::userCanApprovePage($title, $user) && !ApprovedRevs::isLatestRevisionApproved($title)) {
/* This is somewhat a replication of code from SkinTemplate::buildContentNavigationUrls() */
$onPage = $title->equals($sktemplate->getTitle());
$request = $sktemplate->getRequest();
$action = $request->getVal('action', 'view');
/* /Code Replication */
$isInAction = $onPage && $action == 'approveprojectpage';
$links['actions']['approveprojectpage'] = array('text' => 'אישור הדף', 'href' => $title->getLocalURL('action=approveprojectpage'), 'class' => $isInAction ? 'selected' : '');
}
return true;
}
示例4: displayTabs
/**
* Display the tabs for a course or institution.
*
* @since 0.1
*
* @param SkinTemplate $sktemplate
* @param array $links
* @param Title $title
*/
protected static function displayTabs(SkinTemplate &$sktemplate, array &$links, Title $title)
{
$classes = array(EP_NS_INSTITUTION => 'EPOrg', EP_NS_COURSE => 'EPCourse');
$exists = null;
if (array_key_exists($title->getNamespace(), $classes)) {
$links['views'] = array();
$links['actions'] = array();
$user = $sktemplate->getUser();
$class = $classes[$title->getNamespace()];
$exists = $class::hasIdentifier($title->getText());
$type = $sktemplate->getRequest()->getText('action');
$isSpecial = $sktemplate->getTitle()->isSpecialPage();
if ($exists) {
$links['views']['view'] = array('class' => !$isSpecial && $type === '' ? 'selected' : false, 'text' => wfMsg('ep-tab-view'), 'href' => $title->getLocalUrl());
}
if ($user->isAllowed($class::getEditRight())) {
$links['views']['edit'] = array('class' => $type === 'edit' ? 'selected' : false, 'text' => wfMsg($exists ? 'ep-tab-edit' : 'ep-tab-create'), 'href' => $title->getLocalUrl(array('action' => 'edit')));
}
if ($exists) {
$links['views']['history'] = array('class' => $type === 'history' ? 'selected' : false, 'text' => wfMsg('ep-tab-history'), 'href' => $title->getLocalUrl(array('action' => 'history')));
if ($title->getNamespace() === EP_NS_COURSE) {
if ($user->isAllowed('ep-enroll')) {
$student = EPStudent::newFromUser($user);
if ($student === false || !$student->hasCourse(array('name' => $title->getText()))) {
$links['views']['enroll'] = array('class' => $isSpecial ? 'selected' : false, 'text' => wfMsg('ep-tab-enroll'), 'href' => SpecialPage::getTitleFor('Enroll', $title->getText())->getLocalURL());
}
}
}
}
}
}