/** * Execute special page. Only available to wikihow staff. */ function execute() { global $wgRequest, $wgOut, $wgUser, $wgLang; # don't stop execution set_time_limit(0); print "querying database...<br>\n"; $dbr = wfGetDB(DB_SLAVE); $titles = array(); $sql = 'SELECT page_title FROM page WHERE page_namespace=' . NS_MAIN . ' AND page_is_redirect=0'; $res = $dbr->query($sql); while ($obj = $res->fetchObject()) { $titles[] = Title::newFromDBkey($obj->page_title); } $wgOut->clearHTML(); $file = '/tmp/out.csv'; print "writing output to {$file}...<br>\n"; $fp = fopen($file, 'w'); fputs($fp, "url,new,new-format,old\n"); foreach ($titles as $title) { $tt = TitleTests::newFromTitle($title); if (!$tt) { continue; } list($new, $format) = $tt->getTitle(); list($old, ) = $tt->getOldTitle(); $url = 'http://www.wikihow.com/' . $title->getPartialURL(); $out = array($url, $new, $format, $old); fputcsv($fp, $out); } fclose($fp); print "done.<br>\n"; exit; }
static function getHTMLTitle($defaultHTMLTitle, $title, $isMainPage) { global $wgTitle, $wgRequest, $wgLanguageCode, $wgLang; $namespace = $wgTitle->getNamespace(); $action = $wgRequest->getVal('action', 'view'); $htmlTitle = $defaultHTMLTitle; if ($isMainPage) { $htmlTitle = 'wikiHow - ' . wfMessage('main_title')->text(); } elseif ($namespace == NS_MAIN && $wgTitle->exists() && $action == "view") { if ($wgLanguageCode == 'en') { $titleTest = TitleTests::newFromTitle($wgTitle); if ($titleTest) { $htmlTitle = $titleTest->getTitle(); } } else { $howto = wfMessage('howto', $title)->text(); $htmlTitle = wfMessage('pagetitle', $howto)->text(); } } elseif ($namespace == NS_USER || $namespace == NS_USER_TALK) { $username = $wgTitle->getText(); $htmlTitle = $wgLang->getNsText($namespace) . ": {$username} - wikiHow"; } elseif ($namespace == NS_CATEGORY) { $htmlTitle = wfMessage('category_title_tag', $wgTitle->getText())->text(); } return $htmlTitle; }
/** * Template filter callback for wikiHow skin. * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. * * @access private */ function execute() { global $wgArticle, $wgUser, $wgLang, $wgTitle, $wgRequest, $wgParser, $wgGoogleSiteVerification; global $wgOut, $wgScript, $wgStylePath, $wgLanguageCode, $wgForumLink; global $wgContLang, $wgXhtmlDefaultNamespace, $wgContLanguageCode; global $wgWikiHowSections, $IP, $wgServer, $wgServerName, $wgIsDomainTest; global $wgSSLsite, $wgSpecialPages; $prefix = ""; if (class_exists('MobileWikihow')) { $mobileWikihow = new MobileWikihow(); $result = $mobileWikihow->controller(); // false means we stop processing template if (!$result) { return; } } $action = $wgRequest->getVal('action', 'view'); if (count($wgRequest->getVal('diff')) > 0) { $action = 'diff'; } $isMainPage = $wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgTitle->getText() == wfMsgForContent('mainpage') && $action == 'view'; $isArticlePage = $wgTitle && !$isMainPage && $wgTitle->getNamespace() == NS_MAIN && $action == 'view'; $isDocViewer = $wgTitle->getText() == "DocViewer"; $isBehindHttpAuth = !empty($_SERVER['HTTP_AUTHORIZATION']); // determine whether or not the user is logged in $isLoggedIn = $wgUser->getID() > 0; $isTool = false; wfRunHooks('getToolStatus', array(&$isTool)); $sk = $wgUser->getSkin(); wikihowAds::setCategories(); if (!$isLoggedIn && $action == "view") { wikihowAds::getGlobalChannels(); } $isWikiHow = false; if ($wgArticle != null && $wgTitle->getNamespace() == NS_MAIN) { $whow = WikihowArticleEditor::newFromCurrent(); $isWikiHow = $whow->isWikihow(); } $showAds = wikihowAds::isEligibleForAds(); $isIndexed = RobotPolicy::isIndexable($wgTitle); // set the title and what not $avatar = ''; if ($wgTitle->getNamespace() == NS_USER || $wgTitle->getNamespace() == NS_USER_TALK) { $username = $wgTitle->getText(); $usernameKey = $wgTitle->getDBKey(); $avatar = $wgLanguageCode == 'en' ? Avatar::getPicture($usernameKey) : ""; $pagetitle = $username; $this->set("pagetitle", $wgLang->getNsText(NS_USER) . ": {$pagetitle} - wikiHow"); if ($wgTitle->getNamespace() == NS_USER_TALK) { $pagetitle = $wgLang->getNsText(NS_USER_TALK) . ": {$pagetitle}"; $this->set("pagetitle", "{$pagetitle} - wikiHow"); } elseif ($username == $wgUser->getName()) { //user's own page $profileboxname = wfMsg('profilebox-name'); $profile_links = "<div id='gatEditRemoveButtons'>\n\t\t\t\t\t\t\t\t<a href='/Special:Profilebox' id='gatProfileEditButton' >Edit</a>\n\t\t\t\t\t\t\t\t | <a href='#' onclick='removeUserPage(\"{$profileboxname}\");'>Remove {$profileboxname}</a>\n\t\t\t\t\t\t\t\t </div>"; } $h1 = $pagetitle . $profile_links; $this->set("title", $h1); } $title = $this->data['pagetitle']; if ($isWikiHow && $action == "view") { if ($wgLanguageCode == 'en') { if (!$this->titleTest) { $this->titleTest = TitleTests::newFromTitle($wgTitle); } if ($this->titleTest) { $title = $this->titleTest->getTitle(); } } else { $howto = wfMsg('howto', $this->data['title']); $title = wfMsg('pagetitle', $howto); } } if ($isMainPage) { $title = 'wikiHow - ' . wfMsg('main_title'); } if ($wgTitle->getNamespace() == NS_CATEGORY) { $title = wfMsg('category_title_tag', $wgTitle->getText()); } $logoutPage = $wgLang->specialPage("Userlogout"); $returnTarget = $wgTitle->getPrefixedURL(); $returnto = strcasecmp(urlencode($logoutPage), $returnTarget) ? "returnto={$returnTarget}" : ""; $login = ""; if (!$wgUser->isAnon()) { $uname = $wgUser->getName(); if (strlen($uname) > 16) { $uname = substr($uname, 0, 16) . "..."; } $login = wfMsg('welcome_back', $wgUser->getUserPage()->getFullURL(), $uname); if ($wgLanguageCode == 'en' && $wgUser->isFacebookUser()) { $login = wfMsg('welcome_back_fb', $wgUser->getUserPage()->getFullURL(), $wgUser->getName()); } elseif ($wgLanguageCode == 'en' && $wgUser->isGPlusUser()) { $gname = $wgUser->getName(); if (substr($gname, 0, 3) == 'GP_') { $gname = substr($gname, 0, 12) . '...'; } $login = wfMsg('welcome_back_gp', $wgUser->getUserPage()->getFullURL(), $gname); } } else { if ($wgLanguageCode == "en") { $login = wfMsg('signup_or_login', $returnto) . " " . wfMsg('social_connect_header'); } else { $login = wfMsg('signup_or_login', $returnto); } } //XX PROFILE EDIT/CREAT/DEL BOX DATE - need to check for pb flag in order to display this. $pbDate = ""; $pbDateFlag = 0; $profilebox_name = wfMsg('profilebox-name'); if ($wgTitle->getNamespace() == NS_USER) { if ($u = User::newFromName($wgTitle->getDBKey())) { if (UserPagePolicy::isGoodUserPage($wgTitle->getDBKey())) { $pbDate = ProfileBox::getPageTop($u); $pbDateFlag = true; } } } if (!$sk->suppressH1Tag()) { if ($isWikiHow && $action == "view") { if (Microdata::showRecipeTags() && Microdata::showhRecipeTags()) { $itemprop_name1 = " fn'"; $itemprop_name2 = ""; } else { $itemprop_name1 = "' itemprop='name'"; $itemprop_name2 = " itemprop='url'"; } $heading = "<h1 class='firstHeading" . $itemprop_name1 . "><a href=\"" . $wgTitle->getFullURL() . "\"" . $itemprop_name2 . ">" . wfMsg('howto', $this->data['title']) . "</a></h1>"; } else { if ($wgTitle->getNamespace() == NS_USER && UserPagePolicy::isGoodUserPage($wgTitle->getDBKey()) || $wgTitle->getNamespace() == NS_USER_TALK) { $heading = "<h1 class=\"firstHeading\" >" . $this->data['title'] . "</h1> " . $pbDate; if ($avatar != "") { $heading = $avatar . "<div id='avatarNameWrap'>" . $heading . "</div><div style='clear: both;'> </div>"; } } else { if ($this->data['title']) { $heading = "<h1 class='firstHeading'>" . $this->data['title'] . "</h1>"; } } } } // get the breadcrumbs / category links at the top of the page $catLinksTop = $sk->getCategoryLinks(true); wfRunHooks('getBreadCrumbs', array(&$catLinksTop)); $mainPageObj = Title::newMainPage(); if (MWNamespace::isTalk($wgTitle->getNamespace()) && $action == "view") { $isPrintable = $wgRequest->getVal("printable") == "yes"; } // QWER links for everyone on all pages //$helplink = $sk->makeLinkObj(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMsg('help')); $logoutlink = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMsg('logout')); $rsslink = "<a href='" . $wgServer . "/feed.rss'>" . wfMsg('rss') . "</a>"; $rplink = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Randompage"), wfMsg('randompage')); if ($wgTitle->getNamespace() == NS_MAIN && !$isMainPage && $wgTitle->userCanEdit()) { $links[] = array(Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL(), wfMsg('recentchangeslinked')); } //Editing Tools $uploadlink = ""; $freephotoslink = ""; $uploadlink = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Upload"), wfMsg('upload')); $freephotoslink = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "ImportFreeImages"), wfMsg('imageimport')); $relatedchangeslink = ""; if ($wgArticle != null) { $relatedchangeslink = "<li> <a href='" . Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMsg('recentchangeslinked') . "</a></li>"; } //search $searchTitle = Title::makeTitle(NS_SPECIAL, "LSearch"); $otherLanguageLinks = array(); $translationData = array(); if ($this->data['language_urls']) { foreach ($this->data['language_urls'] as $lang) { if ($lang['code'] == $wgLanguageCode) { continue; } $otherLanguageLinks[$lang['code']] = $lang['href']; $langMsg = $sk->getInterWikiCTA($lang['code'], $lang['text'], $lang['href']); if (!$langMsg) { continue; } $encLangMsg = json_encode($langMsg); $translationData[] = "'{$lang['code']}': {'msg':{$encLangMsg}}"; } } if (!$isMainPage && !$isDocViewer && !$_COOKIE["sitenoticebox"]) { $siteNotice = $sk->getSiteNotice(); } // Right-to-left languages $rtl = $wgContLang->isRTL() ? " dir='RTL'" : ''; $head_element = "<html xmlns:fb=\"https://www.facebook.com/2008/fbml\" xmlns=\"{$wgXhtmlDefaultNamespace}\" xml:lang=\"{$wgContLanguageCode}\" lang=\"{$wgContLanguageCode}\" {$rtl}>\n"; $rtl_css = ""; if ($wgContLang->isRTL()) { $rtl_css = "<style type=\"text/css\" media=\"all\">/*<![CDATA[*/ @import \\a" . wfGetPad("/extensions/min/f/skins/WikiHow/rtl.css") . "\"; /*]]>*/</style>"; $rtl_css .= "\n <!--[if IE]>\n <style type=\"text/css\">\n BODY { margin: 25px; }\n </style>\n <![endif]-->"; } $printable_media = "print"; if ($wgRequest->getVal('printable') == 'yes') { $printable_media = "all"; } $featured = false; if (false && $wgTitle->getNamespace() == NS_MAIN) { $dbr = wfGetDB(DB_SLAVE); $page_isfeatured = $dbr->selectField('page', 'page_is_featured', array("page_id={$wgTitle->getArticleID()}"), __METHOD__); $featured = $page_isfeatured == 1; } $top_search = ""; $footer_search = ""; if ($wgLanguageCode == 'en') { //INTL: Search options for the english site are a bit more complex if (!$isLoggedIn) { $top_search = GoogSearch::getSearchBox("cse-search-box"); } else { $top_search = ' <form id="bubble_search" name="search_site" action="' . $searchTitle->getFullURL() . '" method="get"> <input type="text" class="search_box" name="search" x-webkit-speech /> <input type="submit" value="Search" id="search_site_bubble" class="search_button" /> </form>'; } } else { //INTL: International search just uses Google custom search $top_search = GoogSearch::getSearchBox("cse-search-box"); } $text = $this->data['bodytext']; // Remove stray table under video section. Probably should eventually do it at // the source, but then have to go through all articles. if (strpos($text, '<a name="Video">') !== false) { $vidpattern = "<p><br /></p>\n<center>\n<table width=\"375px\">\n<tr>\n<td><br /></td>\n<td align=\"left\"></td>\n</tr>\n</table>\n</center>\n<p><br /></p>"; $text = str_replace($vidpattern, "", $text); } $this->data['bodytext'] = $text; // hack to get the FA template working, remove after we go live $fa = ''; if ($wgLanguageCode != "nl" && strpos($this->data['bodytext'], 'featurestar') !== false) { $fa = '<p id="feature_star">' . wfMsg('featured_article') . '</p>'; //$this->data['bodytext'] = preg_replace("@<div id=\"featurestar\">(.|\n)*<div style=\"clear:both\"></div>@mU", '', $this->data['bodytext']); } $body = ""; if ($wgTitle->userCanEdit() && $action != 'edit' && $action != 'diff' && $action != 'history' && ($isLoggedIn && !in_array($wgTitle->getNamespace(), array(NS_USER, NS_USER_TALK, NS_IMAGE, NS_CATEGORY)) || !in_array($wgTitle->getNamespace(), array(NS_USER, NS_USER_TALK, NS_IMAGE, NS_CATEGORY)))) { //INTL: Need bigger buttons for non-english sites $editlink_text = $wgTitle->getNamespace() == NS_MAIN ? wfMsg('editarticle') : wfMsg('edit'); $heading = '<a href="' . $wgTitle->escapeLocalURL($sk->editUrlOptions()) . '" class="edit">' . $editlink_text . '</a>' . $heading; } if ($isArticlePage || $wgTitle->getNamespace() == NS_PROJECT && $action == 'view' || $wgTitle->getNamespace() == NS_CATEGORY && !$wgTitle->exists()) { if ($wgTitle->getNamespace() == NS_PROJECT && ($wgTitle->getDbKey() == 'RSS-feed' || $wgTitle->getDbKey() == 'Rising-star-feed')) { $list_page = true; $sticky = false; } else { $list_page = false; $sticky = true; } $body .= $heading . ArticleAuthors::getAuthorHeader() . $this->data['bodytext']; $body = '<div id="bodycontents">' . $body . '</div>'; $this->data['bodytext'] = WikihowArticleHTML::processArticleHTML($body, array('sticky-headers' => $sticky, 'ns' => $wgTitle->getNamespace(), 'list-page' => $list_page)); } else { if ($action == 'edit') { $heading .= WikihowArticleEditor::grabArticleEditLinks($wgRequest->getVal("guidededitor")); } $this->data['bodyheading'] = $heading; $body = '<div id="bodycontents">' . $this->data['bodytext'] . '</div>'; if (!$isTool) { $this->data['bodytext'] = WikihowArticleHTML::processHTML($body, $action, array('show-gray-container' => $sk->showGrayContainer())); } else { // a little hack to style the no such special page messages for special pages that actually // exist if (false !== strpos($body, 'You have arrived at a "special page"')) { $body = "<div class='minor_section'>{$body}</div>"; } $this->data['bodytext'] = $body; } } // post-process the Steps section HTML to get the numbers working if ($wgTitle->getNamespace() == NS_MAIN && !$isMainPage && ($action == 'view' || $action == 'purge')) { // for preview article after edit, you have to munge the // steps of the previewHTML manually $body = $this->data['bodytext']; $opts = array(); if (!$showAds) { $opts['no-ads'] = true; } //$this->data['bodytext'] = WikihowArticleHTML::postProcess($body, $opts); } // insert avatars into discussion, talk, and kudos pages if (MWNamespace::isTalk($wgTitle->getNamespace()) || $wgTitle->getNamespace() == NS_USER_KUDOS) { $this->data['bodytext'] = Avatar::insertAvatarIntoDiscussion($this->data['bodytext']); } //$navMenu = $sk->genNavigationMenu(); $navTabs = $sk->genNavigationTabs(); //XX TALK/DISCUSSION SUBMENU // add article_inner if it's not already there, CSS needs it if (strpos($this->data['bodytext'], "article_inner") === false && wfRunHooks('WrapBodyWithArticleInner', array())) { //echo "ADDING"; //$this->data['bodytext'] = "<div class='article_inner'>{$this->data['bodytext']}</div>"; } // set up the main page $mpActions = ""; $mpWorldwide = ' '; $profileBoxIsUser = false; if ($isLoggedIn && $wgTitle && $wgTitle->getNamespace() == NS_USER) { $name = $wgTitle->getDBKey(); $profileBoxUser = User::newFromName($name); if ($profileBoxUser && $wgUser->getID() == $profileBoxUser->getID()) { $profileBoxIsUser = true; } } // Reuben (11/2013): Micro-customization as a test for BR $slowSpeedUsers = array('BR'); $isSlowSpeedUser = $wgUser && in_array($wgUser->getName(), $slowSpeedUsers); $optimizelyJS = false; if (class_exists('OptimizelyPageSelector') && $wgTitle && $wgTitle->exists()) { if (OptimizelyPageSelector::isArticleEnabled($wgTitle) && OptimizelyPageSelector::isUserEnabled($wgUser)) { $optimizelyJS = OptimizelyPageSelector::getOptimizelyTag(); } } $showSpotlightRotate = $isMainPage && $wgLanguageCode == 'en'; $showBreadCrumbs = $sk->showBreadCrumbs(); $showSideBar = $sk->showSideBar(); $showHeadSection = $sk->showHeadSection(); $showArticleTabs = $wgTitle->getNamespace() != NS_SPECIAL && !$isMainPage; if (in_array($wgTitle->getNamespace(), array(NS_IMAGE)) && (empty($action) || $action == 'view') && !$isLoggedIn) { $showArticleTabs = false; } $showWikiTextWidget = false; if (class_exists('WikitextDownloader')) { $showWikiTextWidget = WikitextDownloader::isAuthorized() && !$isDocViewer; } $showRCWidget = class_exists('RCWidget') && $wgTitle->getNamespace() != NS_USER && (!$isLoggedIn || $wgUser->getOption('recent_changes_widget_show') != '0') && ($isLoggedIn || $isMainPage) && !in_array($wgTitle->getPrefixedText(), array('Special:Avatar', 'Special:ProfileBox', 'Special:IntroImageAdder')) && strpos($wgTitle->getPrefixedText(), 'Special:Userlog') === false && !$isDocViewer && $action != 'edit'; $showFollowWidget = class_exists('FollowWidget') && !$isDocViewer && in_array($wgLanguageCode, array('en', 'de', 'es', 'pt')); $showSocialSharing = $wgTitle && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isSlowSpeedUser && class_exists('WikihowShare'); $showSliderWidget = class_exists('Slider') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isPrintable && !$isMainPage && $isIndexed && $showSocialSharing && $wgRequest->getVal('oldid') == '' && ($wgRequest->getVal('action') == '' || $wgRequest->getVal('action') == 'view'); $showTopTenTips = $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && $wgLanguageCode == 'en' && !$isPrintable && !$isMainPage && $wgRequest->getVal('oldid') == '' && ($wgRequest->getVal('action') == '' || $wgRequest->getVal('action') == 'view'); $showAltMethod = false; if (class_exists('AltMethodAdder')) { $showAltMethod = true; } $showExitTimer = $wgLanguageCode == 'en' && class_exists('BounceTimeLogger') && !$isSlowSpeedUser; $showRUM = ($isArticlePage || $isMainPage) && !$isBehindHttpAuth && !$isSlowSpeedUser; $showGoSquared = ($isArticlePage || $isMainPage) && !$isLoggedIn && !$isBehindHttpAuth && mt_rand(1, 100) <= 30; // 30% chance $showClickIgniter = !$isLoggedIn && !$isBehindHttpAuth && !$wgSSLsite; $showGA = !$isSlowSpeedUser; $showGAevents = $wgLanguageCode == 'en' && $isMainPage && !$isSlowSpeedUser; $isLiquid = false; //!$isMainPage && ( $wgTitle->getNameSpace() == NS_CATEGORY ); $showFeaturedArticlesSidebar = $action == 'view' && !$isMainPage && !$isDocViewer && !$wgSSLsite && $wgTitle->getNamespace() != NS_USER; $isSpecialPage = $wgTitle->getNamespace() == NS_SPECIAL || $wgTitle->getNamespace() == NS_MAIN && $wgRequest->getVal('action') == 'protect' || $wgTitle->getNamespace() == NS_MAIN && $wgRequest->getVal('action') == 'delete'; $showTextScroller = class_exists('TextScroller') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isPrintable && !$isMainPage && strpos($this->data['bodytext'], 'textscroller_outer') !== false; $showImageFeedback = class_exists('ImageFeedback') && ImageFeedback::isValidPage(); $showWikivideo = class_exists('WHVid') && ($wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN || $wgTitle->getNamespace() == NS_SPECIAL) && !$isPrintable && !$isMainPage && strpos($this->data['bodytext'], 'whvid_cont') !== false; $showStaffStats = !$isMainPage && $isLoggedIn && (in_array('staff', $wgUser->getGroups()) || in_array('staff_widget', $wgUser->getGroups())) && $wgTitle->getNamespace() == NS_MAIN && class_exists('Pagestats'); $showThumbsUp = class_exists('ThumbsNotifications'); $postLoadJS = $isArticlePage; // add present JS files to extensions/min/groupsConfig.php $fullJSuri = '/extensions/min/g/whjs' . (!$isArticlePage ? ',jqui' : '') . ($showExitTimer ? ',stu' : '') . ($showRCWidget ? ',rcw' : '') . ($showSpotlightRotate ? ',sp' : '') . ($showFollowWidget ? ',fl' : '') . ($showSliderWidget ? ',slj' : '') . ($showThumbsUp ? ',thm' : '') . ($showWikiTextWidget ? ',wkt' : '') . ($showAltMethod ? ',altj' : '') . ($showTopTenTips ? ',tpt' : '') . ($isMainPage ? ',hp' : '') . ($showWikivideo ? ',whv' : '') . ($showImageFeedback ? ',ii' : '') . ($showTextScroller ? ',ts' : ''); if ($wgOut->mJSminCodes) { $fullJSuri .= ',' . join(',', $wgOut->mJSminCodes); } $cachedParam = $wgRequest && $wgRequest->getVal('c') == 't' ? '&c=t' : ''; $fullJSuri .= '&r=' . WH_SITEREV . $cachedParam . '&e=.js'; $fullCSSuri = '/extensions/min/g/whcss' . (!$isArticlePage ? ',jquic,nona' : '') . ($isLoggedIn ? ',li' : '') . ($showSliderWidget ? ',slc' : '') . ($showAltMethod ? ',altc' : '') . ($showTopTenTips ? ',tptc' : '') . ($showWikivideo ? ',whvc' : '') . ($showTextScroller ? ',tsc' : '') . ($isMainPage ? ',hpc' : '') . ($showImageFeedback ? ',iic' : '') . ($isSpecialPage ? ',spc' : ''); if ($wgOut->mCSSminCodes) { $fullCSSuri .= ',' . join(',', $wgOut->mCSSminCodes); } $fullCSSuri .= '&r=' . WH_SITEREV . $cachedParam . '&e=.css'; $tabsArray = $sk->getTabsArray($showArticleTabs); wfRunHooks('JustBeforeOutputHTML', array(&$this)); ?> <!DOCTYPE html> <?php echo $head_element; ?> <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#"> <title><?php echo $title; ?> </title> <?php if ($showRUM) { ?> <script> <!-- window.UVPERF = {}; UVPERF.authtoken = 'b473c3f9-a845-4dc3-9432-7ad0441e00c3'; UVPERF.start = new Date().getTime(); //--> </script> <?php } ?> <?php if ($wgIsDomainTest) { ?> <base href="http://www.wikihow.com/" /> <?php } ?> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="verify-v1" content="/Ur0RE4/QGQIq9F46KZyKIyL0ZnS96N5x1DwQJa7bR8=" /> <meta name="google-site-verification" content="Jb3uMWyKPQ3B9lzp5hZvJjITDKG8xI8mnEpWifGXUb0" /> <meta name="msvalidate.01" content="CFD80128CAD3E726220D4C2420D539BE" /> <meta name="y_key" content="1b3ab4fc6fba3ab3" /> <meta name="p:domain_verify" content="bb366527fa38aa5bc27356b728a2ec6f" /> <?php if ($isArticlePage || $isMainPage) { ?> <link rel="alternate" media="only screen and (max-width: 640px)" href="http://<?php if ($wgLanguageCode != 'en') { echo $wgLanguageCode . "."; } ?> m.wikihow.com/<?php echo $wgTitle->getPartialUrl(); ?> "> <?php } echo Skin::makeGlobalVariablesScript($this->data); ?> <?php // add CSS files to extensions/min/groupsConfig.php ?> <style type="text/css" media="all">/*<![CDATA[*/ @import "<?php echo $fullCSSuri; ?> "; /*]]>*/</style> <?php // below is the minified http://www.wikihow.com/extensions/min/f/skins/owl/printable.css ?> <style type="text/css" media="<?php echo $printable_media; ?> ">/*<![CDATA[*/ body{background-color:#FFF;font-size:1.2em;}#header_outer{background:none;position:relative;}#header{text-align:center;}#logo_link{float:none!important;}#article_shell{float:none;padding-bottom:2em;margin:0 auto;}.sticking{position:absolute!important;top:0!important;}#actions,#notification_count,#bubble_search,#cse-search-box,#header_space,#sidebar,#breadcrumb,#originators,#article_tabs,#sliderbox,#article_rating,#end_options,#footer_outer,.edit{display:none!important;} /*]]>*/</style> <?php // Bootstapping certain javascript functions: // A function to merge one object with another; stub funcs // for button swapping (this should be done in CSS anyway); // initialize the timer for bounce stats tracking. ?> <script> <!-- var WH = WH || {}; WH.lang = WH.lang || {}; button_swap = button_unswap = function(){}; WH.exitTimerStartTime = (new Date()).getTime(); WH.mergeLang = function(A){for(i in A){v=A[i];if(typeof v==='string'){WH.lang[i]=v;}}}; //--> </script> <?php if (!$postLoadJS) { ?> <script type="text/javascript" src="<?php echo $fullJSuri; ?> "></script> <?php } ?> <?php $this->html('headlinks'); ?> <?php if (!$wgIsDomainTest) { ?> <link rel='canonical' href='<?php echo $wgTitle->getFullURL(); ?> '/> <link href="https://plus.google.com/102818024478962731382" rel="publisher" /> <?php } ?> <?php if ($sk->isUserAgentMobile()) { ?> <link media="only screen and (max-device-width: 480px)" href="<?php echo wfGetPad('/extensions/min/f/skins/WikiHow/iphone.css'); ?> " type="text/css" rel="stylesheet" /> <?php } else { ?> <!-- not mobile --> <?php } ?> <!--<![endif]--> <?php echo $rtl_css; ?> <link rel="alternate" type="application/rss+xml" title="wikiHow: How-to of the Day" href="http://www.wikihow.com/feed.rss"/> <link rel="apple-touch-icon" href="<?php echo wfGetPad('/skins/WikiHow/safari-large-icon.png'); ?> " /> <?php //= wfMsg('Test_setup') ?> <?php if (class_exists('CTALinks') && trim(wfMsgForContent('cta_feature')) == "on") { echo CTALinks::getGoogleControlScript(); } ?> <?php echo $wgOut->getHeadItems(); ?> <?php if ($wgTitle && $wgTitle->getText() == "Get Caramel off Pots and Pans") { echo wfMsg('Adunit_test_top'); } ?> <?php foreach ($otherLanguageLinks as $lang => $url) { ?> <link rel="alternate" hreflang="<?php echo $lang; ?> " href="<?php echo htmlspecialchars($url); ?> " /> <?php } ?> </head> <body <?php if ($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick'); ?> "<?php } ?> <?php if ($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload'); ?> "<?php } ?> > <?php wfRunHooks('PageHeaderDisplay', array($sk->isUserAgentMobile())); ?> <?php if (!$isLoggedIn) { echo wikihowAds::getSetup(); } ?> <div id="header_outer"><div id="header"> <ul id="actions"> <?php foreach ($navTabs as $tabid => $tab) { ?> <li id="<?php echo $tabid; ?> _li"> <div class="nav_icon"></div> <a id='<?php echo $tabid; ?> ' class='nav <?php echo $tab['status']; ?> ' href='<?php echo $tab['link']; ?> ' <?php echo $tab['mouseevents']; ?> ><?php echo $tab['text']; ?> </a> <?php echo $tab['menu']; ?> </li> <?php } ?> </ul><!--end actions--> <?php if ($sk->notifications_count > 0) { ?> <div id="notification_count" class="notice"><?php echo $sk->notifications_count; ?> </div> <?php } ?> <?php $holidayLogo = SkinWikihowskin::getHolidayLogo(); $logoPath = $holidayLogo ? $holidayLogo : '/skins/owl/images/wikihow_logo.png'; if ($wgLanguageCode != "en") { $logoPath = "/skins/owl/images/wikihow_logo_intl.png"; } ?> <a href='<?php echo $mainPageObj->getLocalURL(); ?> ' id='logo_link'><img src="<?php echo wfGetPad($logoPath); ?> " class="logo" /></a> <?php echo $top_search; ?> <?php if ($wgLanguageCode == 'zh') { ?> <style> #header #wpUserVariant { background-color: #C9DCB9; border: medium none; left: 590px; position: relative; top: -48px; } #header.shrunk #wpUserVariant { top: -35px; } .search_box { width: 119px } </style> <form action="" method="post"> <select id="wpUserVariant"> <?php $variant = $wgContLang->getPreferredVariant(); $zhVarArr = array("zh" => "选择语言", "zh-hans" => "中文(简体)", "zh-hant" => "中文(繁體)", "zh-tw" => "中文(台灣)", "zh-sg" => "中文(新加坡)", "zh-hk" => "中文(香港)"); foreach ($zhVarArr as $k => $v) { ?> <option <?php if ($variant == $k) { ?> selected <?php } ?> value="<?php echo $k; ?> "><?php echo $v; ?> </option> <?php } ?> </select> </form> <?php } ?> </div></div><!--end header--> <?php wfRunHooks('AfterHeader', array(&$wgOut)); ?> <div id="main_container" class="<?php echo $isMainPage ? 'mainpage' : ''; ?> "> <div id="header_space"></div> <div id="main"> <?php wfRunHooks('BeforeActionbar', array(&$wgOut)); ?> <div id="actionbar" class="<?php echo $isTool ? 'isTool' : ''; ?> "> <?php if ($showBreadCrumbs) { ?> <div id="gatBreadCrumb"> <ul id="breadcrumb" class="Breadcrumbs"> <?php echo $catLinksTop; ?> </ul> </div> <?php } ?> <?php if (count($tabsArray) > 0) { echo $sk->getTabsHtml($tabsArray); } ?> </div><!--end actionbar--> <script> <!-- WH.translationData = {<?php echo join(',', $translationData); ?> }; //--> </script> <?php echo $announcement; ?> <?php echo $mpActions; ?> <?php $sidebar = !$showSideBar ? 'no_sidebar' : ''; // INTL: load mediawiki messages for sidebar expand and collapse for later use in sidebar boxes $langKeys = array('navlist_collapse', 'navlist_expand', 'usernameoremail', 'password'); print Wikihow_i18n::genJSMsgs($langKeys); ?> <div id="container" class="<?php echo $sidebar; ?> "> <div id="article_shell"> <div id="article"<?php echo Microdata::genSchemaHeader(); ?> > <?php wfRunHooks('BeforeTabsLine', array(&$wgOut)); ?> <?php echo $profileBox; ?> <?php if (!$isArticlePage && !$isMainPage && $this->data['bodyheading']) { echo '<div class="wh_block">' . $this->data['bodyheading'] . '</div>'; } echo $this->html('bodytext'); echo $bottom_site_notice; $showingArticleInfo = 0; if (in_array($wgTitle->getNamespace(), array(NS_MAIN, NS_PROJECT)) && $action == 'view' && !$isMainPage) { $catLinks = $sk->getCategoryLinks(false); $authors = ArticleAuthors::getAuthorFooter(); if ($authors || is_array($this->data['language_urls']) || $catLinks) { $showingArticleInfo = 1; } ?> <div class="section"> <?php if ($showingArticleInfo) { ?> <h2 class="section_head" id="article_info_header"><span><?php echo wfMsg('article_info'); ?> </span></h2> <div id="article_info" class="section_text"> <?php } else { ?> <h2 class="section_head" id="article_tools_header"><span><?php echo wfMsg('article_tools'); ?> </span></h2> <div id="article_tools" class="section_text"> <?php } ?> <?php echo $fa; ?> <?php if ($catLinks) { ?> <p class="info"> <?php echo wfMsg('categories'); ?> : <?php echo $catLinks; ?> </p> <?php } ?> <p><?php echo $authors; ?> </p> <?php if (is_array($this->data['language_urls'])) { ?> <p class="info"><?php $this->msg('otherlanguages'); ?> :</p> <p class="info"><?php $links = array(); $sk = $wgUser->getSkin(); foreach ($this->data['language_urls'] as $langlink) { $linkText = $langlink['text']; preg_match("@interwiki-(..)@", $langlink['class'], $langCode); if (!empty($langCode[1])) { $linkText = $sk->getInterWikiLinkText($linkText, $langCode[1]); } $links[] = htmlspecialchars(trim($langlink['language'])) . ' <span><a href="' . htmlspecialchars($langlink['href']) . '">' . $linkText . "</a><span>"; } echo implode(", ", $links); ?> </p> <?php } //talk link if ($action == 'view' && MWNamespace::isTalk($wgTitle->getNamespace())) { $talk_link = '#postcomment'; } else { $talk_link = $wgTitle->getTalkPage()->getLocalURL(); } ?> <ul id="end_options"> <li class="endop_discuss"><span></span><a href="<?php echo $talk_link; ?> " id="gatDiscussionFooter"><?php echo wfMsg('at_discuss'); ?> </a></li> <li class="endop_print"><span></span><a href="<?php echo $wgTitle->getLocalUrl('printable=yes'); ?> " id="gatPrintView"><?php echo wfMsg('print'); ?> </a></li> <li class="endop_email"><span></span><a href="#" onclick="return emailLink();" id="gatSharingEmail"><?php echo wfMsg('at_email'); ?> </a></li> <?php if ($isLoggedIn) { ?> <?php if ($wgTitle->userIsWatching()) { ?> <li class="endop_watch"><span></span><a href="<?php echo $wgTitle->getLocalURL('action=unwatch'); ?> "><?php echo wfMsg('at_remove_watch'); ?> </a></li> <?php } else { ?> <li class="endop_watch"><span></span><a href="<?php echo $wgTitle->getLocalURL('action=watch'); ?> "><?php echo wfMsg('at_watch'); ?> </a></li> <?php } ?> <?php } ?> <li class="endop_edit"><span></span><a href="<?php echo $wgTitle->getEditUrl(); ?> " id="gatEditFooter"><?php echo wfMsg('edit'); ?> </a></li> <?php if ($wgTitle->getNamespace() == NS_MAIN) { ?> <li class="endop_fanmail"><span></span><a href="/Special:ThankAuthors?target=<?php echo $wgTitle->getPrefixedURL(); ?> " id="gatThankAuthors"><?php echo wfMsg('at_fanmail'); ?> </a></li> <?php } ?> </ul> <!--end end_options --> <?php if (!in_array($wgTitle->getNamespace(), array(NS_USER, NS_CATEGORY))) { ?> <?php } ?> <?php if ($showAds && $wgTitle->getNamespace() == NS_MAIN) { //only show this ad on article pages echo wikihowAds::getAdUnitPlaceholder(7); } ?> <div class="clearall"></div> </div><!--end article_info section_text--> <p class='page_stats'><?php echo $sk->pageStats(); ?> </p> <div id='article_rating'> <?php echo RateItem::showForm('article'); ?> </div> </div><!--end section--> <?php } if (in_array($wgTitle->getNamespace(), array(NS_USER, NS_MAIN, NS_PROJECT)) && $action == 'view' && !$isMainPage) { ?> </div> <!-- article --> <div id=""> <?php } ?> </div> <!--end last_question--> <div class="clearall"></div> </div> <!--end article_shell--> <?php if ($showSideBar) { $loggedOutClass = ""; if ($showAds && $wgTitle->getText() != 'Userlogin' && $wgTitle->getNamespace() == NS_MAIN) { $loggedOutClass = ' logged_out'; } ?> <div id="sidebar"> <?php echo $siteNotice; ?> <!-- Sidebar Top Widgets --> <?php foreach ($sk->mSidebarTopWidgets as $sbWidget) { ?> <?php echo $sbWidget; ?> <?php } ?> <!-- END Sidebar Top Widgets --> <?php if (!$isDocViewer) { ?> <div id="top_links" class="sidebox<?php echo $loggedOutClass; ?> " <?php echo is_numeric(wfMsg('top_links_padding')) ? ' style="padding-left:' . wfMsg('top_links_padding') . 'px;padding-right:' . wfMsg('top_links_padding') . 'px;"' : ''; ?> > <a href="/Special:Randomizer" id="gatRandom" accesskey='x' class="button secondary"><?php echo wfMsg('randompage'); ?> </a> <a href="/Special:Createpage" id="gatWriteAnArticle" class="button secondary"><?php echo wfMsg('writearticle'); ?> </a> <?php if (class_exists('Randomizer') && Randomizer::DEBUG && $wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgTitle->getArticleId()) { ?> <?php echo Randomizer::getReason($wgTitle); ?> <?php } ?> </div><!--end top_links--> <?php } ?> <?php if ($showStaffStats) { ?> <div class="sidebox" style="padding-top:10px" id="staff_stats_box"></div> <?php } ?> <?php if ($showWikiTextWidget) { ?> <div class="sidebox" id="side_rc_widget"> <a id='wikitext_downloader' href='#'>Download WikiText</a> </div><!--end sidebox--> <?php } ?> <?php if ($showAds && $wgTitle->getText() != 'Userlogin' && $wgTitle->getNamespace() == NS_MAIN) { // temporary ad code for amazon ad loading, added by Reuben 3/13, disabled 4/23, and re-enabled 5/28 if ($wgLanguageCode == 'en') { ?> <script> <!-- var aax_src='3003'; var amzn_targs = ''; var url = encodeURIComponent(document.location); try { url = encodeURIComponent("" + window.top.location); } catch(e) {} document.write("<scr"+"ipt src='//aax-us-east.amazon-Adsystem.com/e/dtb/bid?src=" + aax_src + "&u="+url+"&cb=" + Math.round(Math.random()*10000000) + "'></scr"+"ipt>"); document.close(); //--> </script> <?php } ?> <?php //only show this ad on article pages //comment out next line to turn off HHM ad if (wikihowAds::isHHM() && $wgLanguageCode == 'en') { echo wikihowAds::getHhmAd(); } else { echo wikihowAds::getCategoryAd(); } //Temporairily taking down Jane /*if (class_exists('StarterTool')) { //spellchecker test "ad" echo "<a href='/Special:StarterTool?ref=1' style='display:none' id='starter_ad'><img src='" . wfGetPad('/skins/WikiHow/images/sidebar_spelling3.png') . "' nopin='nopin' /></a>"; }*/ } //<!-- <a href="#"><img src="/skins/WikiHow/images/imgad.jpg" /></a> --> ?> <?php if ($sk->getUserLinks()) { ?> <div class='sidebox'> <?php echo $sk->getUserLinks(); ?> </div> <?php } ?> <?php $related_articles = $sk->getRelatedArticlesBox($this); //disable custom link units // if (!$isLoggedIn && $wgTitle->getNamespace() == NS_MAIN && !$isMainPage) //if ($related_articles != "") //$related_articles .= WikiHowTemplate::getAdUnitPlaceholder(2, true); if ($action == 'view' && $related_articles != "") { $related_articles = '<div id="side_related_articles" class="sidebox">' . $related_articles . '</div><!--end side_related_articles-->'; echo $related_articles; } ?> <?php if ($showSocialSharing) { ?> <div class="sidebox<?php echo $loggedOutClass; ?> " id="sidebar_share"> <h3><?php echo wfMsg('social_share'); ?> </h3> <?php if ($isMainPage) { echo WikihowShare::getMainPageShareButtons(); } else { echo WikihowShare::getTopShareButtons($isIndexed); } ?> <div style="clear:both; float:none;"></div> </div> <?php } ?> <?php if ($mpWorldwide !== "") { ?> <?php echo $mpWorldwide; ?> <?php } ?> <?php /* <!-- <div class="sidebox_shell"> <div class='sidebar_top'></div> <div id="side_fb_timeline" class="sidebox"> </div> <div class='sidebar_bottom_fold'></div> </div> --> <!--end sidebox_shell--> */ ?> <!-- Sidebar Widgets --> <?php foreach ($sk->mSidebarWidgets as $sbWidget) { ?> <?php echo $sbWidget; ?> <?php } ?> <!-- END Sidebar Widgets --> <?php //if ($isLoggedIn) echo $navMenu; ?> <?php if ($showFeaturedArticlesSidebar) { ?> <div id="side_featured_articles" class="sidebox"> <?php echo $sk->getFeaturedArticlesBox(4, 4); ?> </div> <?php } ?> <?php if ($showRCWidget) { ?> <div class="sidebox" id="side_rc_widget"> <?php RCWidget::showWidget(); ?> <p class="bottom_link"> <?php if ($isLoggedIn) { ?> <?php echo wfMsg('welcome', $wgUser->getName(), $wgUser->getUserPage()->getLocalURL()); ?> <?php } else { ?> <a href="/Special:Userlogin" id="gatWidgetBottom"><?php echo wfMsg('rcwidget_join_in'); ?> </a> <?php } ?> <a href="" id="play_pause_button" onclick="rcTransport(this); return false;" ></a> </p> </div><!--end side_recent_changes--> <?php } ?> <?php if (class_exists('FeaturedContributor') && ($wgTitle->getNamespace() == NS_MAIN || $wgTitle->getNamespace() == NS_USER) && !$isMainPage && !$isDocViewer) { ?> <div id="side_featured_contributor" class="sidebox"> <?php FeaturedContributor::showWidget(); ?> <?php if (!$isLoggedIn) { ?> <p class="bottom_button"> <a href="/Special:Userlogin" class="button secondary" id="gatFCWidgetBottom" onclick='gatTrack("Browsing","Feat_contrib_cta","Feat_contrib_wgt");'><?php echo wfMsg('fc_action'); ?> </a> </p> <?php } ?> </div><!--end side_featured_contributor--> <?php } ?> <?php //if (!$isLoggedIn) echo $navMenu; ?> <?php echo $user_links; ?> <?php if ($showFollowWidget) { ?> <div class="sidebox"> <?php FollowWidget::showWidget(); ?> </div> <?php } ?> </div><!--end sidebar--> <?php } // end if $showSideBar ?> <div class="clearall" ></div> </div> <!--end container --> </div><!--end main--> <div id="clear_footer"></div> </div><!--end main_container--> <div id="footer_outer"> <div id="footer"> <div id="footer_side"> <?php if ($isLoggedIn) { ?> <?php echo wfMsgExt('site_footer_owl', 'parse'); ?> <?php } else { ?> <?php echo wfMsgExt('site_footer_owl_anon', 'parse'); ?> <?php } ?> </div><!--end footer_side--> <div id="footer_main"> <div id="sub_footer"> <?php if ($isLoggedIn || $isMainPage) { ?> <?php echo wfMsg('sub_footer_new', wfGetPad(), wfGetPad()); ?> <?php } else { ?> <?php echo wfMsg('sub_footer_new_anon', wfGetPad(), wfGetPad()); ?> <?php } ?> </div> </div><!--end footer_main--> </div> <br class="clearall" /> </div><!--end footer--> <div id="dialog-box" title=""></div> <?php // Quick note/edit popup if ($action == 'diff' && $wgLanguageCode == 'en') { echo QuickNoteEdit::displayQuicknote(); echo QuickNoteEdit::displayQuickedit(); } // Slider box -- for non-logged in users on articles only if ($showSliderWidget) { echo Slider::getBox(); echo '<div id="slideshowdetect"></div>'; } ?> <div id="fb-root" ></div> <?php if ($postLoadJS) { ?> <script type="text/javascript" src="<?php echo $fullJSuri; ?> "></script> <?php } ?> <?php if ($optimizelyJS) { print $optimizelyJS; } ?> <?php if ($showExitTimer) { ?> <script> <!-- if (WH.ExitTimer) { WH.ExitTimer.start(); } //--> </script> <?php } ?> <?php if ($showRCWidget) { ?> <?php RCWidget::showWidgetJS(); ?> <?php } ?> <script type="text/javascript"> <!-- var _gaq = _gaq || []; <?php if ($showGA) { ?> _gaq.push(['_setAccount', 'UA-2375655-1']); _gaq.push(['_setDomainName', '.wikihow.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); <?php } ?> //--> </script> <?php if ($showGA) { ?> <?php // Google Analytics Event Track ?> <script type="text/javascript"> <!-- if (typeof Event =='undefined' || typeof Event.observe == 'undefined') { jQuery(window).load(gatStartObservers); } else { Event.observe(window, 'load', gatStartObservers); } //--> </script> <?php // END Google Analytics Event Track ?> <?php if (class_exists('CTALinks') && trim(wfMsgForContent('cta_feature')) == "on") { echo CTALinks::getGoogleControlTrackingScript(); echo CTALinks::getGoogleConversionScript(); } ?> <?php // Load event listeners ?> <?php if ($showGAevents) { ?> <script type="text/javascript"> <!-- if (typeof Event =='undefined' || typeof Event.observe == 'undefined') { jQuery(window).load(initSA); } else { Event.observe(window, 'load', initSA); } //--> </script> <?php } ?> <?php } // $showGA ?> <?php // Load event listeners all pages ?> <?php if (class_exists('CTALinks') && trim(wfMsgForContent('cta_feature')) == "on") { echo CTALinks::getBlankCTA(); } ?> <?php if ($showClickIgniter) { ?> <script type="text/javascript"> (function() { var ci = document.createElement('script'); ci.type = 'text/javascript'; ci.async = true; ci.src = 'http://cdn.clickigniter.io/ci.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ci, s); })(); </script> <?php } ?> <?php if ($showGoSquared) { ?> <script type="text/javascript"> var GoSquared = {}; GoSquared.acct = "GSN-491441-Y"; (function(w){ function gs(){ w._gstc_lt = +new Date; var d = document, g = d.createElement("script"); g.type = "text/javascript"; g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js"; g.async = true; var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(g, s); } w.addEventListener ? w.addEventListener("load", gs, false) : w.attachEvent("onload", gs); })(window); </script> <?php } ?> <?php if ($showRUM) { ?> <script> (function(){ var a=document.createElement('script'); a.type='text/javascript'; a.async=true; a.src='//yxjj4c.rumanalytics.com/sampler/basic2'; var b=document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a,b); })(); </script> <?php } ?> <?php wfRunHooks('ArticleJustBeforeBodyClose', array()); ?> <?php if (($wgRequest->getVal("action") == "edit" || $wgRequest->getVal("action") == "submit2") && $wgRequest->getVal('advanced', null) != 'true') { ?> <script type="text/javascript"> if (document.getElementById('steps') && document.getElementById('wpTextbox1') == null) { InstallAC(document.editform,document.editform.q,document.editform.btnG,"./<?php echo $wgLang->getNsText(NS_SPECIAL) . ":TitleSearch"; ?> ","en"); } </script> <?php } ?> <?php if ($wgLanguageCode == 'en' && !$isLoggedIn && class_exists('GoogSearch')) { ?> <?php echo GoogSearch::getSearchBoxJS(); ?> <?php } ?> <script type="text/javascript"> (function ($) { $(document).ready(function() { WH.addScrollEffectToTOC(); }); $(window).load(function() { if ($('.twitter-share-button').length && (!$.browser.msie || $.browser.version > 7)) { $.getScript("https://platform.twitter.com/widgets.js", function() { twttr.events.bind('tweet', function(event) { if (event) { var targetUrl; if (event.target && event.target.nodeName == 'IFRAME') { targetUrl = extractParamFromUri(event.target.src, 'url'); } _gaq.push(['_trackSocial', 'twitter', 'tweet', targetUrl]); } }); }); } if (isiPhone < 0 && isiPad < 0 && $('.gplus1_button').length) { WH.setGooglePlusOneLangCode(); var node2 = document.createElement('script'); node2.type = 'text/javascript'; node2.async = true; node2.src = 'http://apis.google.com/js/plusone.js'; $('body').append(node2); } if (typeof WH.FB != 'undefined') WH.FB.init('new'); if (typeof WH.GP != 'undefined') WH.GP.init(); if ($('#pinterest').length) { var node3 = document.createElement('script'); node3.type = 'text/javascript'; node3.async = true; node3.src = 'http://assets.pinterest.com/js/pinit.js'; $('body').append(node3); } if (typeof WH.imageFeedback != 'undefined') { WH.imageFeedback(); } }); })(jQuery); </script> <?php //Temporarily taking down Jane /* var r = Math.random(); if(r <= .05) { $('#starter_ad').show(); }*/ if ($showStaffStats) { ?> <?php echo Pagestats::getJSsnippet("article"); } echo $wgOut->getScript(); ?> <?php if (class_exists('GoodRevision')) { ?> <?php $grevid = $wgTitle ? GoodRevision::getUsedRev($wgTitle->getArticleID()) : ''; ?> <!-- shown patrolled revid=<?php echo $grevid; ?> , latest=<?php echo $wgArticle ? $wgArticle->getLatest() : ''; ?> --> <?php } echo wfReportTime(); ?> </body> </html> <?php }
/** * Save or remove the custom page title */ private static function savePageTitle($type, $pageid, $pageTitle) { $title = Title::newFromID($pageid); if (!$title) { return ''; } $dbw = wfGetDB(DB_MASTER); if ('default' == $type) { TitleTests::dbRemoveTitle($dbw, $title); } elseif ('edited' == $type && $pageTitle) { TitleTests::dbSetCustomTitle($dbw, $title, $pageTitle); } else { return ''; } $tt = TitleTests::newFromTitle($title); if ($tt) { return $tt->getTitle(); } else { return ''; } }
static function getCurrentTitleMetaDescription() { global $wgTitle; static $titleTest = null; $return = ''; if ($wgTitle->getNamespace() == NS_MAIN && $wgTitle->getFullText() == wfMsg('mainpage')) { $return = wfMsg('mainpage_meta_description'); } elseif ($wgTitle->getNamespace() == NS_MAIN) { $desc = ''; if (!$titleTest) { $titleTest = TitleTests::newFromTitle($wgTitle); if ($titleTest) { $desc = $titleTest->getMetaDescription(); } } if (!$desc) { if (!self::$wgTitleAMIcache) { self::$wgTitleAMIcache = new ArticleMetaInfo($wgTitle); } $ami = self::$wgTitleAMIcache; $desc = $ami->getDescription(); } if (!$desc) { $return = wfMsg('article_meta_description', $wgTitle->getText()); } else { $return = $desc; } } elseif ($wgTitle->getNamespace() == NS_CATEGORY) { // get keywords $subcats = self::getMetaSubcategories($wgTitle, 3); $keywords = implode(", ", $subcats); if ($keywords) { $return = wfMsg('category_meta_description', $wgTitle->getText(), $keywords); } else { $return = wfMsg('subcategory_meta_description', $wgTitle->getText(), $keywords); } } elseif ($wgTitle->getNamespace() == NS_USER) { $desc = ProfileBox::getMetaDesc(); $return = $desc; } elseif ($wgTitle->getNamespace() == NS_IMAGE) { $articles = ImageHelper::getLinkedArticles($wgTitle); if (count($articles) && $articles[0]) { $articleTitle = wfMsg('howto', $articles[0]); if (preg_match('@Step (\\d+)@', $wgTitle->getText(), $m)) { $imageNum = '#' . $m[1]; } else { $imageNum = ''; } $return = wfMsg('image_meta_description', $articleTitle, $imageNum); } else { $return = wfMsg('image_meta_description_no_article', $wgTitle->getText()); } } elseif ($wgTitle->getNamespace() == NS_SPECIAL && $wgTitle->getText() == "Popularpages") { $return = wfMsg('popularpages_meta_description'); } return $return; }
// // Copied and changed from GenTitleExtraInfo.body.php by Reuben. // require_once "commandLine.inc"; global $IP; require_once "{$IP}/skins/WikiHowSkin.php"; print "querying database...\n"; $dbr = wfGetDB(DB_SLAVE); $titles = array(); $sql = 'SELECT page_title FROM page WHERE page_namespace=' . NS_MAIN . ' AND page_is_redirect=0'; $res = $dbr->query($sql, __FILE__); while ($obj = $res->fetchObject()) { $titles[] = Title::newFromDBkey($obj->page_title); } print "found " . count($titles) . " articles.\n"; $file = isset($argv[0]) ? $argv[0] : 'out.csv'; print "writing output to {$file}...\n"; $fp = fopen($file, 'w'); fputs($fp, "url,full-title,length\n"); foreach ($titles as $title) { $tt = TitleTests::newFromTitle($title); if (!$tt) { continue; } $new = $tt->getTitle(); $url = 'http://www.wikihow.com/' . $title->getPartialURL(); $out = array($url, $new, strlen($new)); fputcsv($fp, $out); } fclose($fp); print "done.\n";