本文整理汇总了PHP中Title::getLocalUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Title::getLocalUrl方法的具体用法?PHP Title::getLocalUrl怎么用?PHP Title::getLocalUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Title
的用法示例。
在下文中一共展示了Title::getLocalUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getURL
/**
* Return absolute URL to a page to be shared (uses wgTitle)
* The path component of the URL is urlencoded to prevent confusion between sharing services
* @return string URL to be shared
*/
protected function getURL()
{
$path = $this->title->getLocalUrl();
$paths = explode('/', $path);
foreach ($paths as $index => $section) {
$paths[$index] = urlencode($section);
}
return str_replace($path, implode('/', $paths), $this->title->getFullUrl());
}
示例2: executeWhenAvailable
/**
* Render the special page
* @param string $par parameter as subpage of specialpage
*/
public function executeWhenAvailable($par = '')
{
$out = $this->getOutput();
$out->setPageTitle($this->msg('history'));
$out->addModuleStyles(array('mobile.pagelist.styles', 'mobile.pagesummary.styles'));
$this->offset = $this->getRequest()->getVal('offset', false);
if ($par) {
// enter article history view
$this->title = Title::newFromText($par);
if ($this->title && $this->title->exists()) {
// make sure, the content of the page supports the default history page
if (!self::shouldUseSpecialHistory($this->title)) {
// and if not, redirect to the default history action
$out->redirect($this->title->getLocalUrl(array('action' => 'history')));
return;
}
$this->addModules();
$this->getOutput()->addHtml(Html::openElement('div', array('class' => 'history content-unstyled')));
$this->renderHeaderBar($this->title);
$res = $this->doQuery();
$this->showHistory($res);
$this->getOutput()->addHtml(Html::closeElement('div'));
return;
}
}
$this->showPageNotFound();
}
示例3: getAction
/**
* Prepare the form action
*
* @return string
*/
private function getAction()
{
$q = array();
$q['action'] = 'delete';
if ($this->oldimage) {
$q['oldimage'] = $this->oldimage;
}
return $this->title->getLocalUrl($q);
}
示例4: executeWhenAvailable
/**
* Render the page with a list of languages the page is available in
* @param string $pagename The name of the page
*/
public function executeWhenAvailable($pagename)
{
if (!is_string($pagename) || $pagename === '') {
wfHttpError(404, $this->msg('mobile-frontend-languages-404-title')->text(), $this->msg('mobile-frontend-languages-404-desc')->text());
return;
}
$this->title = Title::newFromText($pagename);
$output = $this->getOutput();
$html = '';
if ($this->title && $this->title->exists()) {
$titlename = $this->title->getPrefixedText();
$pageTitle = $this->msg('mobile-frontend-languages-header-page', $titlename)->text();
$languages = $this->getLanguages();
$variants = $this->getLanguageVariants();
$languagesCount = count($languages);
$variantsCount = count($variants);
$html .= Html::element('p', array(), $this->msg('mobile-frontend-languages-text')->params($titlename)->numParams($languagesCount)->text());
$html .= Html::openElement('p');
$html .= Html::element('a', array('href' => $this->title->getLocalUrl()), $this->msg('returnto', $titlename)->text());
$html .= Html::closeElement('p');
if ($languagesCount > 0 || $variantsCount > 1) {
// Language variants first
if ($variantsCount > 1) {
$variantHeader = $variantsCount > 1 ? $this->msg('mobile-frontend-languages-variant-header')->text() : '';
$html .= Html::element('h2', array('id' => 'mw-mf-language-variant-header'), $variantHeader);
$html .= Html::openElement('ul', array('id' => 'mw-mf-language-variant-selection'));
foreach ($variants as $val) {
$html .= $this->makeLangListItem($val);
}
$html .= Html::closeElement('ul');
}
// Then other languages
if ($languagesCount > 0) {
$languageHeader = $this->msg('mobile-frontend-languages-header')->text();
$html .= Html::element('h2', array('id' => 'mw-mf-language-header'), $languageHeader) . Html::openElement('ul', array('id' => 'mw-mf-language-selection'));
foreach ($languages as $val) {
$html .= $this->makeLangListItem($val);
}
$html .= Html::closeElement('ul');
}
}
} else {
$pageTitle = $this->msg('mobile-frontend-languages-header')->text();
$html .= Html::element('p', array(), $this->msg('mobile-frontend-languages-nonexistent-title')->params($pagename)->text());
}
$html = MobileUI::contentElement($html);
$output->setPageTitle($pageTitle);
$output->addHTML($html);
}
示例5: getLineHtml
/**
* Gets the HTML fragment for a watched page.
*
* @param Title $title The title of the watched page
* @param int $ts When the page was last touched
* @param string $thumb An HTML fragment for the page's thumbnaiL
* @return string
*/
public static function getLineHtml(Title $title, $ts, $thumb)
{
$titleText = $title->getPrefixedText();
if ($ts) {
$ts = new MWTimestamp($ts);
$lastModified = wfMessage('mobile-frontend-watchlist-modified', $ts->getHumanTimestamp())->text();
$className = 'title';
} else {
$className = 'title new';
$lastModified = '';
}
$html = Html::openElement('li', array('class' => 'page-summary', 'title' => $titleText, 'data-id' => $title->getArticleId())) . Html::openElement('a', array('href' => $title->getLocalUrl(), 'class' => $className));
$html .= $thumb;
$html .= Html::element('h3', array(), $titleText) . Html::element('div', array('class' => 'info'), $lastModified) . Html::closeElement('a') . Html::closeElement('li');
return $html;
}
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:24,代码来源:SpecialMobileEditWatchlist.php
示例6: getTargetURL
private function getTargetURL(Title $title)
{
global $wgCreatePageEditExisting, $wgCreatePageUseVisualEditor;
$isKnown = $title->isKnown();
$query = array();
if (!$isKnown || $wgCreatePageEditExisting) {
# Preload is not yet supported by VisualEditor, but probably will be eventually.
# See https://phabricator.wikimedia.org/T51622
$query['preload'] = $this->getRequest()->getText('preload', '');
if (!$isKnown) {
$query['redlink'] = '1';
}
if ($wgCreatePageUseVisualEditor) {
$query['veaction'] = 'edit';
} else {
$query['action'] = 'edit';
}
}
return $title->getLocalUrl($query);
}
示例7: onDoEditSectionLink
/**
* Modify edit section link markup (for Oasis only)
*/
public static function onDoEditSectionLink($skin, Title $title, $section, $tooltip, &$result, $lang = false)
{
global $wgBlankImgUrl, $wgUser;
wfProfileIn(__METHOD__);
// modify Oasis only (BugId:8444)
if (!$skin instanceof SkinOasis) {
wfProfileOut(__METHOD__);
return true;
}
$result = '';
// reset result first
$editUrl = $title->getLocalUrl(array('action' => 'edit', 'section' => $section));
$class = 'editsection';
$result .= Xml::openElement('span', array('class' => $class));
$result .= Xml::openElement('a', array('href' => $editUrl, 'title' => wfMsg('oasis-section-edit-alt', $tooltip)));
$result .= Xml::element('img', array('src' => $wgBlankImgUrl, 'class' => 'sprite edit-pencil'));
$result .= wfMsg('oasis-section-edit');
$result .= Xml::closeElement('a');
$result .= Xml::closeElement('span');
wfProfileOut(__METHOD__);
return true;
}
示例8: onDoEditSectionLink
/**
* Modify edit section link markup (for Oasis only)
*/
public static function onDoEditSectionLink( $skin, Title $title, $section, $tooltip, &$result, $lang = false ) {
global $wgBlankImgUrl, $wgUser;
wfProfileIn(__METHOD__);
// modify Oasis only (BugId:8444)
if (!$skin instanceof SkinOasis) {
wfProfileOut(__METHOD__);
return true;
}
$result = ''; // reset result first
$editUrl = $title->getLocalUrl( array( 'action' => 'edit', 'section' => $section ) );
$class = 'editsection';
// RT#84733 - prompt to login if the user is an anon and can't edit right now (protected pages and wgDisableAnonEditing wikis).
if ( !$title->userCan('edit') && $wgUser->isAnon() ) {
$class .= " loginToEditProtectedPage";
}
$result .= Xml::openElement( 'span', array( 'class' => $class ) );
$result .= Xml::openElement( 'a', array(
'href' => $editUrl,
'title' => wfMsg( 'oasis-section-edit-alt', $tooltip ),
));
$result .= Xml::element( 'img', array(
'src' => $wgBlankImgUrl,
'class' => 'sprite edit-pencil',
));
$result .= wfMsg( 'oasis-section-edit' );
$result .= Xml::closeElement( 'a' );
$result .= Xml::closeElement( 'span' );
wfProfileOut(__METHOD__);
return true;
}
示例9: getPersonalUrl
/**
* Return a url to a resource or to a login screen that redirects to that resource.
* @param Title $title
* @param array $query representation of query string parameters
* @return string url
*/
protected function getPersonalUrl(Title $title, array $query = array())
{
if ($this->getUser()->isLoggedIn()) {
return $title->getLocalUrl($query);
} else {
return $this->getLoginUrl(array('returnto' => $title));
}
}
示例10: mobileFooter
/**
* Prepares links used in the mobile footer
* @param Skin $sk
* @param QuickTemplate $tpl
* @param MobileContext $ctx
* @param Title $title
* @param WebRequest $req
* @return QuickTemplate
*/
protected static function mobileFooter($sk, $tpl, $ctx, $title, $req)
{
$url = $sk->getOutput()->getProperty('desktopUrl');
if ($url) {
$url = wfAppendQuery($url, 'mobileaction=toggle_view_desktop');
} else {
$url = $title->getLocalUrl($req->appendQueryValue('mobileaction', 'toggle_view_desktop', true));
}
$url = htmlspecialchars($ctx->getDesktopUrl(wfExpandUrl($url, PROTO_RELATIVE)));
$desktop = wfMessage('mobile-frontend-view-desktop')->escaped();
$mobile = wfMessage('mobile-frontend-view-mobile')->escaped();
$sitename = self::getSitename(true);
$switcherHtml = <<<HTML
<h2>{$sitename}</h2>
<ul>
\t<li>{$mobile}</li><li><a id="mw-mf-display-toggle" href="{$url}">{$desktop}</a></li>
</ul>
HTML;
// Generate the licensing text displayed in the footer of each page.
// See Skin::getCopyright for desktop equivalent.
$license = self::getLicense('footer');
if (isset($license['link']) && $license['link']) {
$licenseText = $sk->msg($license['msg'])->rawParams($license['link'])->text();
} else {
$licenseText = '';
}
// Enable extensions to add links to footer in Mobile view, too - bug 66350
Hooks::run('MobileSiteOutputPageBeforeExec', array(&$sk, &$tpl));
// FIXME: Deprecate this hook.
Hooks::run('SkinMinervaOutputPageBeforeExec', array(&$sk, &$tpl), '1.26');
$tpl->set('mobile-switcher', $switcherHtml);
$tpl->set('mobile-license', $licenseText);
$tpl->set('privacy', $sk->footerLink('mobile-frontend-privacy-link-text', 'privacypage'));
$tpl->set('terms-use', self::getTermsLink($sk));
$tpl->set('footerlinks', array('info' => array('mobile-switcher', 'mobile-license'), 'places' => array('terms-use', 'privacy')));
return $tpl;
}
示例11: getHeaderBarLink
/**
* Gets HTML to place in the header bar. Title should always refer to a logged in user
* @param Title $title The page to link to
* @return string HTML representing the link in the header bar
*/
protected function getHeaderBarLink($title)
{
return Html::element('a', array('class' => MobileUI::iconClass('user', 'before', 'mw-mf-user'), 'href' => $title->getLocalUrl()), $title->getText());
}
开发者ID:felixonmars,项目名称:mediawiki-extensions-MobileFrontend,代码行数:9,代码来源:SpecialMobileContributions.php
示例12: getHeaderBarLink
/**
* Gets HTML to place in the header bar
* @param Title $title The page to link to
* @return string HTML representing the link in the header bar
*/
protected function getHeaderBarLink($title)
{
return Html::element('a', array('href' => $title->getLocalUrl()), $title->getText());
}
示例13: getForm
/**
* getForm
*
* Does nothing. We don't need that. Created just for the sake of compatibility.
*
* @access public
* @param Title $title
* @param $data array default null - unserialized arguments for task
* @return boolean false
*/
public function getForm($title, $data = null)
{
return '<form id="task-form" action="' . $title->getLocalUrl('action=save') . '" method="post">' . '<input type="hidden" name="wpType" value="' . $this->mType . '" /><fieldset>' . '<legend>Add Rebuild Localisation Cache task</legend>' . "<p>You are about to add a Rebuild Localisation Cache task to the TaskManager's queue. The task will be marked as successfully done immediately after form submission. It only means it has been successfully <em>queued</em> not performed. The localisation cache rebuild is performed on multiple servers independently. Each of the servers will report to the task log, once the process has been completed on that particular server. The notification will go to the log which corresponds to the <em>most recent</em> task of type rebuild_localisation_cache.</p>" . '<div style="text-align: center;">' . '<input type="submit" name="wpSubmit" value="Add task to queue" />' . '</div></fieldset></form>';
}
示例14: addCategoryPage
/**
* Hook
*
* @param $catView
* @param Title $title
* @param $row
* @param $sortkey
*
* @return bool
* @internal param $CategoryViewer
*/
public static function addCategoryPage(&$catView, &$title, &$row, $sortkey)
{
if (in_array($row->page_namespace, array(NS_BLOG_ARTICLE, NS_BLOG_LISTING))) {
/**
* initialize CategoryView->blogs array
*/
if (!isset($catView->blogs)) {
$catView->blogs = array();
}
if (F::app()->checkSkin('wikiamobile')) {
$catView->blogs[] = ['name' => $title->getText(), 'url' => $title->getLocalUrl()];
return false;
}
/**
* initialize CategoryView->blogs_start_char array
*/
if (!isset($catView->blogs_start_char)) {
$catView->blogs_start_char = array();
}
// remove user blog:foo from displayed titles (requested by Angie)
// "User blog:Homersimpson89/Best Simpsons episode..." -> "Best Simpsons episode..."
$text = $title->getSubpageText();
$userName = $title->getBaseText();
$link = $catView->getSkin()->link($title, $userName . " - " . $text);
$catView->blogs[] = $row->page_is_redirect ? '<span class="redirect-in-category">' . $link . '</span>' : $link;
// The blog entries should be sorted on the category page
// just like other pages
$catView->blogs_start_char[] = $catView->collation->getFirstLetter($sortkey);
/**
* when we return false it won't be displayed as normal category but
* in "other" categories
*/
return false;
}
return true;
}
示例15: tabAction
/**
* Builds an array with tab definition
*
* @param Title $title page where the tab links to
* @param string|array $message message key or an array of message keys (will fall back)
* @param boolean $selected display the tab as selected
* @param string $query query string attached to tab URL
* @param boolean $checkEdit check if $title exists and mark with .new if one doesn't
*
* @return array
*/
function tabAction($title, $message, $selected, $query = '', $checkEdit = false)
{
$classes = array();
if ($selected) {
$classes[] = 'selected';
}
if ($checkEdit && !$title->isKnown()) {
$classes[] = 'new';
if ($query !== '') {
$query = 'action=edit&redlink=1&' . $query;
} else {
$query = 'action=edit&redlink=1';
}
}
// wfMessageFallback will nicely accept $message as an array of fallbacks
// or just a single key
$msg = wfMessageFallback($message)->setContext($this->getContext());
if (is_array($message)) {
// for hook compatibility just keep the last message name
$message = end($message);
}
if ($msg->exists()) {
$text = $msg->text();
} else {
global $wgContLang;
$text = $wgContLang->getFormattedNsText(MWNamespace::getSubject($title->getNamespace()));
}
$result = array();
if (!wfRunHooks('SkinTemplateTabAction', array(&$this, $title, $message, $selected, $checkEdit, &$classes, &$query, &$text, &$result))) {
return $result;
}
return array('class' => implode(' ', $classes), 'text' => $text, 'href' => $title->getLocalUrl($query), 'primary' => true);
}