本文整理汇总了PHP中Title::newMainPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Title::newMainPage方法的具体用法?PHP Title::newMainPage怎么用?PHP Title::newMainPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Title
的用法示例。
在下文中一共展示了Title::newMainPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupPersonalUrls
/**
* Modify personal URLs list
*/
private function setupPersonalUrls()
{
global $wgUser;
// Import the starting set of urls from the skin template
$this->personal_urls = F::app()->getSkinTemplateObj()->data['personal_urls'];
if ($wgUser->isAnon()) {
// add login and register links for anons
//$skin = RequestContext::getMain()->getSkin();
// where to redirect after login
$query = F::app()->wg->Request->getValues();
if (isset($query['title'])) {
if (!self::isBlacklisted($query['title'])) {
$returnto = $query['title'];
} else {
$returnto = Title::newMainPage()->getPartialURL();
}
} else {
$returnto = Title::newMainPage()->getPartialURL();
}
$returnto = wfGetReturntoParam($returnto);
$this->personal_urls['login'] = array('text' => wfMsg('login'), 'href' => Skin::makeSpecialUrl('UserLogin', $returnto), 'class' => 'ajaxLogin', 'afterText' => Xml::element('img', array('src' => $this->wg->BlankImgUrl, 'class' => 'chevron', 'width' => '0', 'height' => '0'), ''));
$this->personal_urls['register'] = array('text' => wfMsg('oasis-signup'), 'href' => Skin::makeSpecialUrl('UserSignup'), 'class' => 'ajaxRegister');
} else {
// use Mypage message for userpage entry
$this->personal_urls['userpage']['text'] = wfMsg('mypage');
}
}
示例2: executeWordmark
public function executeWordmark()
{
$themeSettings = new ThemeSettings();
$settings = $themeSettings->getSettings();
$this->wordmarkText = $settings['wordmark-text'];
$this->wordmarkType = $settings['wordmark-type'];
$this->wordmarkSize = $settings['wordmark-font-size'];
$this->wordmarkFont = $settings['wordmark-font'];
$this->wordmarkFontClass = !empty($settings["wordmark-font"]) ? "font-{$settings['wordmark-font']}" : '';
$this->wordmarkUrl = '';
if ($this->wordmarkType == "graphic") {
wfProfileIn(__METHOD__ . 'graphicWordmark');
$this->wordmarkUrl = $themeSettings->getWordmarkUrl();
$imageTitle = Title::newFromText($themeSettings::WordmarkImageName, NS_IMAGE);
if ($imageTitle instanceof Title) {
$attributes = array();
$file = wfFindFile($imageTitle);
if ($file instanceof File) {
$attributes[] = 'width="' . $file->width . '"';
$attributes[] = 'height="' . $file->height . '"';
if (!empty($attributes)) {
$this->wordmarkStyle = ' ' . implode(' ', $attributes) . ' ';
}
}
}
wfProfileOut(__METHOD__ . 'graphicWordmark');
}
$this->mainPageURL = Title::newMainPage()->getLocalURL();
}
示例3: execute
/**
* Render the special page
* @param string|null $par Parameter submitted as subpage
*/
public function execute($par = '')
{
parent::execute($par);
$context = MobileContext::singleton();
wfIncrStats('mobile.options.views');
$this->returnToTitle = Title::newFromText($this->getRequest()->getText('returnto'));
if (!$this->returnToTitle) {
$this->returnToTitle = Title::newMainPage();
}
$this->setHeaders();
$context->setForceMobileView(true);
$context->setContentTransformations(false);
if (isset($this->options[$par])) {
$option = $this->options[$par];
if ($this->getRequest()->wasPosted() && isset($option['post'])) {
$func = $option['post'];
} else {
$func = $option['get'];
}
$this->{$func}();
} else {
if ($this->getRequest()->wasPosted()) {
$this->submitSettingsForm();
} else {
$this->getSettingsForm();
}
}
}
示例4: ArticleCommentCheckTitle
/**
* Check whether comments should be enabled for given title
*/
public static function ArticleCommentCheckTitle($title)
{
wfProfileIn(__METHOD__);
//enable comments only on content namespaces (use $wgArticleCommentsNamespaces if defined)
if (!self::ArticleCommentCheckNamespace($title)) {
wfProfileOut(__METHOD__);
return false;
}
//non-existing articles
if (!$title->exists()) {
wfProfileOut(__METHOD__);
return false;
}
//disable on main page (RT#33703)
if (Title::newMainPage()->getText() == $title->getText()) {
wfProfileOut(__METHOD__);
return false;
}
//disable on pages that cant be read (RT#49525)
if (!$title->userCan('read')) {
wfProfileOut(__METHOD__);
return false;
}
//blog listing? (eg: User:Name instead of User:Name/Blog_name) - do not show comments
if (ArticleComment::isBlog() && strpos($title->getText(), '/') === false) {
wfProfileOut(__METHOD__);
return false;
}
wfProfileOut(__METHOD__);
return true;
}
示例5: Wordmark
public function Wordmark()
{
$themeSettings = new ThemeSettings();
$settings = $themeSettings->getSettings();
$wordmarkURL = '';
if ($settings['wordmark-type'] == 'graphic') {
wfProfileIn(__METHOD__ . 'graphicWordmark');
$imageTitle = Title::newFromText($themeSettings::WordmarkImageName, NS_IMAGE);
$file = wfFindFile($imageTitle);
$attributes = [];
$wordmarkStyle = '';
if ($file instanceof File) {
$wordmarkURL = $file->getUrl();
$attributes[] = 'width="' . $file->width . '"';
$attributes[] = 'height="' . $file->height . '"';
if (!empty($attributes)) {
$this->wordmarkStyle = ' ' . implode(' ', $attributes) . ' ';
}
}
wfProfileOut(__METHOD__ . 'graphicWordmark');
}
$mainPageURL = Title::newMainPage()->getLocalURL();
$this->setVal('mainPageURL', $mainPageURL);
$this->setVal('wordmarkText', $settings['wordmark-text']);
$this->setVal('wordmarkFontSize', $settings['wordmark-font-size']);
$this->setVal('wordmarkUrl', $wordmarkURL);
$this->setVal('wordmarkStyle', $wordmarkStyle);
}
示例6: doBeforeContent
function doBeforeContent() {
global $wgOut;
$s = "";
$qb = $this->qbSetting();
$mainPageObj = Title::newMainPage();
$s .= file_get_contents('../wwwroot/templates/header.html');
$title = htmlspecialchars($wgOut->getPageTitle());
$s = str_replace('{PAGE_TITLE}', $title, $s);
$s .= '<tr><td>';
$s .= '<table border="0" cellpadding="0" cellspacing="0" width="760">';
$s .= '<tr>';
$s .= '<td bgcolor="#20292E" width="1"><img src="/images/pixel.gif" height="10" width="1" /><br /></td>';
$s .= '<td bgcolor="#4C626F" width="758">';
$s .= "\n<div id='content'>\n";
//$s .= '<table border="0" cellpadding="0" cellspacing="0" width="758"><tr>';
//$s .= '<td width="10"><img src="/images/pixel.gif" height="10" width="10" /><br /></td>';
//$s .= '<td width="738">';
$s .= "<div id='article'>";
$notice = wfGetSiteNotice();
if( $notice ) {
$s .= "\n<div id='siteNotice'>$notice</div>\n";
}
//$s .= $this->pageTitle();
// $s .= $this->pageSubtitle() . "\n";
return $s;
}
示例7: execute
function execute($par)
{
/**
* Some satellite ISPs use broken precaching schemes that log people out straight after
* they're logged in (bug 17790). Luckily, there's a way to detect such requests.
*/
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '&') !== false) {
wfDebug("Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n");
throw new HttpError(400, wfMessage('suspicious-userlogout'), wfMessage('loginerror'));
}
$this->setHeaders();
$this->outputHeader();
$user = $this->getUser();
$oldName = $user->getName();
$user->logout();
$out = $this->getOutput();
$out->addWikiMsg('logouttext');
// Hook.
$injected_html = '';
wfRunHooks('UserLogoutComplete', array(&$user, &$injected_html, $oldName));
$out->addHTML($injected_html);
$mReturnTo = $this->getRequest()->getVal('returnto');
$mReturnToQuery = $this->getRequest()->getVal('returntoquery');
$title = Title::newFromText($mReturnTo);
if (!empty($title)) {
$mResolvedReturnTo = strtolower(array_shift(SpecialPageFactory::resolveAlias($title->getDBKey())));
if (in_array($mResolvedReturnTo, array('userlogout', 'signup', 'connect'))) {
$titleObj = Title::newMainPage();
$mReturnTo = $titleObj->getText();
$mReturnToQuery = '';
}
}
$out->returnToMain(false, $mReturnTo, $mReturnToQuery);
}
示例8: showReturnToPage
/**
* Show a return link or redirect to it.
* Extensions can change where the link should point or inject content into the page
* (which will change it from redirect to link mode).
*
* @param string $type One of the following:
* - error: display a return to link ignoring $wgRedirectOnLogin
* - success: display a return to link using $wgRedirectOnLogin if needed
* - successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed
* @param string $returnTo
* @param array|string $returnToQuery
* @param bool $stickHTTPS Keep redirect link on HTTPS
*/
public function showReturnToPage($type, $returnTo = '', $returnToQuery = '', $stickHTTPS = false)
{
global $wgRedirectOnLogin, $wgSecureLogin;
if ($type !== 'error' && $wgRedirectOnLogin !== null) {
$returnTo = $wgRedirectOnLogin;
$returnToQuery = [];
} elseif (is_string($returnToQuery)) {
$returnToQuery = wfCgiToArray($returnToQuery);
}
// Allow modification of redirect behavior
Hooks::run('PostLoginRedirect', [&$returnTo, &$returnToQuery, &$type]);
$returnToTitle = Title::newFromText($returnTo) ?: Title::newMainPage();
if ($wgSecureLogin && !$stickHTTPS) {
$options = ['http'];
$proto = PROTO_HTTP;
} elseif ($wgSecureLogin) {
$options = ['https'];
$proto = PROTO_HTTPS;
} else {
$options = [];
$proto = PROTO_RELATIVE;
}
if ($type === 'successredirect') {
$redirectUrl = $returnToTitle->getFullURL($returnToQuery, false, $proto);
$this->getOutput()->redirect($redirectUrl);
} else {
$this->getOutput()->addReturnTo($returnToTitle, $returnToQuery, null, $options);
}
}
示例9: setUp
function setUp()
{
parent::setUp();
$parser = new Parser();
$options = new ParserOptions();
$options->setTemplateCallback(array($this, 'templateCallback'));
$parser->startExternalParse(Title::newMainPage(), $options, Parser::OT_HTML, true);
try {
$engine = new Scribunto_LuaSandboxEngine(array('parser' => $parser) + $this->sandboxOpts);
$engine->setTitle($parser->getTitle());
$engine->getInterpreter();
$this->engines['LuaSandbox'] = $engine;
} catch (Scribunto_LuaInterpreterNotFoundError $e) {
$this->markTestSkipped("LuaSandbox interpreter not available");
return;
}
try {
$engine = new Scribunto_LuaStandaloneEngine(array('parser' => $parser) + $this->standaloneOpts);
$engine->setTitle($parser->getTitle());
$engine->getInterpreter();
$this->engines['LuaStandalone'] = $engine;
} catch (Scribunto_LuaInterpreterNotFoundError $e) {
$this->markTestSkipped("LuaStandalone interpreter not available");
return;
}
}
示例10: wfSpecialRandomredirect
/**
* Main execution point
* @param $par Namespace to select the redirect from
*/
function wfSpecialRandomredirect($par = NULL)
{
global $wgOut, $wgExtraRandompageSQL, $wgContLang;
$fname = 'wfSpecialRandomredirect';
# Validate the namespace
$namespace = $wgContLang->getNsIndex($par);
if ($namespace === false || $namespace < NS_MAIN) {
$namespace = NS_MAIN;
}
# Same logic as RandomPage
$randstr = wfRandom();
$dbr =& wfGetDB(DB_SLAVE);
$use_index = $dbr->useIndexClause('page_random');
$page = $dbr->tableName('page');
$extra = $wgExtraRandompageSQL ? "AND ({$wgExtraRandompageSQL})" : '';
$sql = "SELECT page_id,page_title\n\t\tFROM {$page} {$use_index}\n\t\tWHERE page_namespace = {$namespace} AND page_is_redirect = 1 {$extra}\n\t\tAND page_random > {$randstr}\n\t\tORDER BY page_random";
$sql = $dbr->limitResult($sql, 1, 0);
$res = $dbr->query($sql, $fname);
$title = NULL;
if ($row = $dbr->fetchObject($res)) {
$title = Title::makeTitleSafe($namespace, $row->page_title);
}
# Catch dud titles and return to the main page
if (is_null($title)) {
$title = Title::newMainPage();
}
$wgOut->reportTime();
$wgOut->redirect($title->getFullUrl('redirect=no'));
}
示例11: checkInitialQueries
/**
* Checks some initial queries
* Note that $title here is *not* a Title object, but a string!
*/
function checkInitialQueries($title, $action, &$output, $request, $lang)
{
if ($request->getVal('printable') == 'yes') {
$output->setPrintable();
}
$ret = NULL;
if ('' == $title && 'delete' != $action) {
$ret = Title::newMainPage();
} elseif ($curid = $request->getInt('curid')) {
# URLs like this are generated by RC, because rc_title isn't always accurate
$ret = Title::newFromID($curid);
} else {
$ret = Title::newFromURL($title);
/* check variant links so that interwiki links don't have to worry about
the possible different language variants
*/
if (count($lang->getVariants()) > 1 && !is_null($ret) && $ret->getArticleID() == 0) {
$lang->findVariantLink($title, $ret);
}
}
if (($oldid = $request->getInt('oldid')) && (is_null($ret) || $ret->getNamespace() != NS_SPECIAL)) {
// Allow oldid to override a changed or missing title.
$rev = Revision::newFromId($oldid);
if ($rev) {
$ret = $rev->getTitle();
}
}
return $ret;
}
示例12: doAfterContent
function doAfterContent()
{
global $wgOut;
$s = "\n</div><br clear='all' />\n";
$s .= "\n<div id='footer'>";
$s .= "<table width='98%' border='0' cellspacing='0'><tr>";
$qb = $this->qbSetting();
if (1 == $qb || 3 == $qb) {
# Left
$s .= $this->getQuickbarCompensator();
}
$s .= "<td class='bottom' align='center' valign='top'>";
$s .= $this->bottomLinks();
$s .= "\n<br />" . $this->makeKnownLinkObj(Title::newMainPage()) . " | " . $this->aboutLink() . " | " . $this->searchForm(wfMsg("qbfind"));
$s .= "\n<br />" . $this->pageStats();
$s .= "</td>";
if (2 == $qb) {
# Right
$s .= $this->getQuickbarCompensator();
}
$s .= "</tr></table>\n</div>\n</div>\n";
if (0 != $qb) {
$s .= $this->quickBar();
}
return $s;
}
示例13: executeIndex
public function executeIndex() {
OasisController::addBodyClass('wikinav2');
$themeSettings = new ThemeSettings();
$settings = $themeSettings->getSettings();
$this->wordmarkText = $settings["wordmark-text"];
$this->wordmarkType = $settings["wordmark-type"];
$this->wordmarkSize = $settings["wordmark-font-size"];
$this->wordmarkFont = $settings["wordmark-font"];
if ($this->wordmarkType == "graphic") {
wfProfileIn(__METHOD__ . 'graphicWordmarkV2');
$this->wordmarkUrl = wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster());
$imageTitle = Title::newFromText($themeSettings::WordmarkImageName,NS_IMAGE);
if($imageTitle instanceof Title) {
$attributes = array();
$file = wfFindFile($imageTitle);
if($file instanceof File) {
$attributes []= 'width="' . $file->width . '"';
$attributes []= 'height="' . $file->height. '"';
if(!empty($attributes)) {
$this->wordmarkStyle = ' ' . implode(' ',$attributes) . ' ';
}
}
}
wfProfileOut(__METHOD__. 'graphicWordmarkV2');
}
$this->mainPageURL = Title::newMainPage()->getLocalURL();
$this->displaySearch = !empty($this->wg->EnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this, $this->wg->Title);
}
示例14: renderHeroTag
public static function renderHeroTag($content, array $attributes, Parser $parser, PPFrame $frame)
{
$wikiData = new WikiDataModel(Title::newMainPage()->getText());
$wikiData->setFromAttributes($attributes);
$wikiData->storeInProps();
return '';
}
示例15: setUp
public function setUp()
{
$this->setupFile = dirname(__FILE__) . '/../ShareButtons.setup.php';
parent::setUp();
$this->mockGlobalVariable('wgTitle', Title::newMainPage());
$this->mockApp();
}