/** * 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 */ public function execute() { global $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() == wfMessage('mainpage')->inContentLanguage()->text() && $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 = $this->getSkin(); wikihowAds::setCategories(); if (!$isLoggedIn && $action == "view") { wikihowAds::getGlobalChannels(); } $showAds = wikihowAds::isEligibleForAds(); $isIndexed = RobotPolicy::isIndexable($wgTitle); $pageTitle = SkinWikihowSkin::getHTMLTitle($wgOut->getHTMLTitle(), $this->data['title'], $isMainPage); // set the title and what not $avatar = ''; $namespace = $wgTitle->getNamespace(); if ($namespace == NS_USER || $namespace == NS_USER_TALK) { $username = $wgTitle->getText(); $usernameKey = $wgTitle->getDBKey(); $avatar = $wgLanguageCode == 'en' ? Avatar::getPicture($usernameKey) : ""; $h1 = $username; if ($wgTitle->getNamespace() == NS_USER_TALK) { $h1 = $wgLang->getNsText(NS_USER_TALK) . ": {$username}"; } elseif ($username == $wgUser->getName()) { //user's own page $profileBoxName = wfMessage('profilebox-name')->text(); $h1 .= "<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>"; } $this->set("title", $h1); } $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 = wfMessage('welcome_back', $wgUser->getUserPage()->getFullURL(), $uname)->text(); if ($wgLanguageCode == 'en' && $wgUser->isFacebookUser()) { $login = wfMessage('welcome_back_fb', $wgUser->getUserPage()->getFullURL(), $wgUser->getName())->text(); } elseif ($wgLanguageCode == 'en' && $wgUser->isGPlusUser()) { $gname = $wgUser->getName(); if (substr($gname, 0, 3) == 'GP_') { $gname = substr($gname, 0, 12) . '...'; } $login = wfMessage('welcome_back_gp', $wgUser->getUserPage()->getFullURL(), $gname)->text(); } } else { if ($wgLanguageCode == "en") { $login = wfMessage('signup_or_login', $returnto)->text() . " " . wfMessage('social_connect_header')->text(); } else { $login = wfMessage('signup_or_login', $returnto)->text(); } } //XX PROFILE EDIT/CREAT/DEL BOX DATE - need to check for pb flag in order to display this. $pbDate = ""; $pbDateFlag = 0; $profilebox_name = wfMessage('profilebox-name')->text(); if ($wgTitle->getNamespace() == NS_USER) { if ($u = User::newFromName($wgTitle->getDBKey())) { if (UserPagePolicy::isGoodUserPage($wgTitle->getDBKey())) { $pbDate = ProfileBox::getPageTop($u); $pbDateFlag = true; } } } $heading = ''; if (!$sk->suppressH1Tag()) { if ($wgTitle->getNamespace() == NS_MAIN && $wgTitle->exists() && $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 . ">" . wfMessage('howto', $this->data['title'])->text() . "</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'] && strtolower(substr($wgTitle->getText(), 0, 9)) != 'userlogin') { $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(); $isPrintable = false; if (MWNamespace::isTalk($wgTitle->getNamespace()) && $action == "view") { $isPrintable = $wgRequest->getVal("printable") == "yes"; } // QWER links for everyone on all pages //$helplink = Linker::link(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMessage('help')->text()); $logoutlink = Linker::link(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMessage('logout')->text()); $rsslink = "<a href='" . $wgServer . "/feed.rss'>" . wfMessage('rss')->text() . "</a>"; $rplink = Linker::link(Title::makeTitle(NS_SPECIAL, "Randompage"), wfMessage('randompage')->text()); if ($wgTitle->getNamespace() == NS_MAIN && !$isMainPage && $wgTitle->userCan('edit')) { $links[] = array(Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL(), wfMessage('recentchangeslinked')->text()); } //Editing Tools $uploadlink = ""; $freephotoslink = ""; $uploadlink = Linker::link(Title::makeTitle(NS_SPECIAL, "Upload"), wfMessage('upload')->text()); $freephotoslink = Linker::link(Title::makeTitle(NS_SPECIAL, "ImportFreeImages"), wfMessage('imageimport')->text()); $relatedchangeslink = ""; if ($isArticlePage) { $relatedchangeslink = "<li> <a href='" . Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMessage('recentchangeslinked')->text() . "</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 && (!isset($_COOKIE['sitenoticebox']) || !$_COOKIE['sitenoticebox'])) { $siteNotice = $sk->getSiteNotice(); } else { $siteNotice = ''; } // Right-to-left languages $dir = $wgContLang->isRTL() ? "rtl" : "ltr"; $head_element = "<html xmlns:fb=\"https://www.facebook.com/2008/fbml\" xmlns=\"{$wgXhtmlDefaultNamespace}\" xml:lang=\"{$wgContLanguageCode}\" lang=\"{$wgContLanguageCode}\" dir='{$dir}'>\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"; } $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">' . wfMessage('featured_article')->text() . '</p>'; //$this->data['bodytext'] = preg_replace("@<div id=\"featurestar\">(.|\n)*<div style=\"clear:both\"></div>@mU", '', $this->data['bodytext']); } $body = ''; if ($wgTitle->userCan('edit') && $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 ? wfMessage('editarticle')->text() : wfMessage('edit')->text(); $heading = '<a href="' . $wgTitle->getLocalURL($sk->editUrlOptions()) . '" class="editsection">' . $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>'; $wikitext = ContentHandler::getContentText($this->getSkin()->getContext()->getWikiPage()->getContent(Revision::RAW)); $magic = WikihowArticleHTML::grabTheMagic($wikitext); $this->data['bodytext'] = WikihowArticleHTML::processArticleHTML($body, array('sticky-headers' => $sticky, 'ns' => $wgTitle->getNamespace(), 'list-page' => $list_page, 'magic-word' => $magic)); } 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(); // 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'); $slowSpeedUsers = array(); $isSlowSpeedUser = $wgUser && in_array($wgUser->getName(), $slowSpeedUsers); $optimizelyJS = false; if (class_exists('OptimizelyPageSelector') && $wgTitle) { 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', true) == 1) && ($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 && $action == 'view' && class_exists('WikihowShare'); $showSliderWidget = class_exists('Slider') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$wgTitle->isProtected() && !$isPrintable && !$isMainPage && $isIndexed && $wgLanguageCode == 'en' && $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 = false; //($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; $showUserCompletedImages = class_exists('UCIPatrol') && $wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && !$isMainPage && UCIPatrol::showUCI($this->getSkin()->getContext()->getTitle()); $showImageFeedback = class_exists('ImageFeedback') && ImageFeedback::isValidPage(); $showWikivideo = class_exists('WHVid') && ($wgTitle->exists() && $wgTitle->getNamespace() == NS_MAIN && strpos($this->data['bodytext'], 'whvid_cont') !== false || $wgTitle->getNamespace() == NS_SPECIAL) && !$isPrintable && !$isMainPage; $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' : '') . ($showUserCompletedImages ? ',uci' : '') . ($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' : '') . ($showUserCompletedImages ? ',ucic' : '') . ($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 $pageTitle; ?> </title> <?php /*Hack to add variable WH as a global variable before loading script. This is need because load.php creates a closure when loading wikibits.js Add by Gershon Bialer on 12/2/2013*/ ?> <script> <!-- var WH = WH || {}; //--> </script> <?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 } ?> <?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:0 0;position:relative}#header{text-align:center;height:63px!important;width:242px!important;background:url(/skins/owl/images/logo_lightbg_242.jpg) no-repeat center center;margin-top:15px}#article_shell{margin:0 auto;float:none;padding-bottom:2em}.sticking{position:absolute!important;top:0!important}#actions,#article_rating,#article_tabs,#breadcrumb,#bubble_search,#cse-search-box,#end_options,#footer_outer,#header_space,#logo_link,#notification_count,#originators,#sidebar,#sliderbox,.edit,.editsection,.mwimg,.section.relatedwikihows,.section.video,.whvid_cont,.altadder_section{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) { ?> <?php echo $this->html('headscripts'); ?> <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 //= wfMessage('Test_setup')->text() ?> <?php if (class_exists('CTALinks') && trim(wfMessage('cta_feature')->inContentLanguage()->text()) == "on") { echo CTALinks::getGoogleControlScript(); } ?> <?php echo $wgOut->getHeadItems(); ?> <?php if ($wgTitle && $wgTitle->getText() == "Get Caramel off Pots and Pans") { echo wfMessage('Adunit_test_top')->text(); } ?> <?php $userdir = $wgLang->getDir(); $sitedir = $wgContLang->getDir(); ?> <?php foreach ($otherLanguageLinks as $lang => $url) { ?> <link rel="alternate" hreflang="<?php echo $lang; ?> " href="<?php echo htmlspecialchars($url); ?> " /> <?php } ?> </head> <body <?php if (isset($this->data['body_ondblclick']) && $this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick'); ?> "<?php } ?> <?php if (isset($this->data['body_onload']) && $this->data['body_onload']) { ?> onload="<?php $this->text('body_onload'); ?> "<?php } ?> class="mediawiki <?php echo $userdir; ?> sitedir-<?php echo $sitedir; ?> " > <?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' href='<?php echo $tab['link']; ?> '><?php echo $tab['text']; ?> </a> <?php echo $tab['menu']; ?> </li> <?php } ?> </ul><!--end actions--> <?php if (isset($sk->notifications_count) && (int) $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 wfRunHooks('EndOfHeader', array(&$wgOut)); ?> </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 $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 if (!$isArticlePage && !$isMainPage && $this->data['bodyheading']) { echo '<div class="wh_block">' . $this->data['bodyheading'] . '</div>'; } echo $this->html('bodytext'); $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 wfMessage('article_info')->text(); ?> </span></h2> <div id="article_info" class="section_text"> <?php } else { ?> <h2 class="section_head" id="article_tools_header"><span><?php echo wfMessage('article_tools')->text(); ?> </span></h2> <div id="article_tools" class="section_text"> <?php } ?> <?php echo $fa; ?> <?php if ($catLinks) { ?> <p class="info"> <?php echo wfMessage('categories')->text(); ?> : <?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 = $this->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 wfMessage('at_discuss')->text(); ?> </a></li> <li class="endop_print"><span></span><a href="<?php echo $wgTitle->getLocalUrl('printable=yes'); ?> " id="gatPrintView"><?php echo wfMessage('print')->text(); ?> </a></li> <li class="endop_email"><span></span><a href="#" onclick="return emailLink();" id="gatSharingEmail"><?php echo wfMessage('at_email')->text(); ?> </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 wfMessage('at_remove_watch')->text(); ?> </a></li> <?php } else { ?> <li class="endop_watch"><span></span><a href="<?php echo $wgTitle->getLocalURL('action=watch'); ?> "><?php echo wfMessage('at_watch')->text(); ?> </a></li> <?php } ?> <?php } ?> <li class="endop_edit"><span></span><a href="<?php echo $wgTitle->getEditUrl(); ?> " id="gatEditFooter"><?php echo wfMessage('edit')->text(); ?> </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 wfMessage('at_fanmail')->text(); ?> </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 ($showUserCompletedImages) { ?> <div class="section"> <h2 class="section_head" id="uci_header"><span><?php echo wfMessage('user_completed_images')->text(); ?> </span></h2> <div id="uci_images" class="section_text"> <?php echo UCIPatrol::getHTMLForArticle($this->getSkin()->getContext()); ?> </div> <!-- end section_text--> </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(wfMessage('top_links_padding')->text()) ? ' style="padding-left:' . wfMessage('top_links_padding')->text() . 'px;padding-right:' . wfMessage('top_links_padding')->text() . 'px;"' : ''; ?> > <a href="/Special:Randomizer" id="gatRandom" accesskey='x' class="button secondary"><?php echo wfMessage('randompage')->text(); ?> </a> <a href="/Special:Createpage" id="gatWriteAnArticle" class="button secondary"><?php echo wfMessage('writearticle')->text(); ?> </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 $userLinks = $sk->getUserLinks(); ?> <?php if ($userLinks) { ?> <div class='sidebox'> <?php echo $userLinks; ?> </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 wfMessage('social_share')->text(); ?> </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 wfMessage('welcome', $wgUser->getName(), $wgUser->getUserPage()->getLocalURL())->text(); ?> <?php } else { ?> <a href="/Special:Userlogin" id="gatWidgetBottom"><?php echo wfMessage('rcwidget_join_in')->text(); ?> </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 wfMessage('fc_action')->text(); ?> </a> </p> <?php } ?> </div><!--end side_featured_contributor--> <?php } ?> <?php //if (!$isLoggedIn) echo $navMenu; ?> <?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 wfMessage('site_footer_owl')->parse(); ?> <?php } else { ?> <?php echo wfMessage('site_footer_owl_anon')->parse(); ?> <?php } ?> </div><!--end footer_side--> <div id="footer_main"> <div id="sub_footer"> <?php if ($isLoggedIn || $isMainPage) { ?> <?php echo wfMessage('sub_footer_new', wfGetPad(), wfGetPad())->text(); ?> <?php } else { ?> <?php echo wfMessage('sub_footer_new_anon', wfGetPad(), wfGetPad())->text(); ?> <?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) { ?> <?php echo $this->html('headscripts'); ?> <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(wfMessage('cta_feature')->inContentLanguage()->text()) == "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(wfMessage('cta_feature')->inContentLanguage()->text()) == "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(); } if (typeof WH.uciFeedback != 'undefined') { WH.uciFeedback(); } }); })(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->getBottomScripts(); ?> <?php if (class_exists('GoodRevision')) { ?> <?php $grevid = $wgTitle ? GoodRevision::getUsedRev($wgTitle->getArticleID()) : ''; $title = $this->getSkin()->getContext()->getTitle(); $latestRev = $title->getNamespace() == NS_MAIN ? $title->getLatestRevID() : ''; ?> <!-- shown patrolled revid=<?php echo $grevid; ?> , latest=<?php echo $latestRev; ?> --> <?php } echo wfReportTime(); $this->printTrail(); ?> </body> </html> <?php }
public static function generateFeedItem() { $fname = "FeedGeneralActivities:generateFeedItem"; $dbr = wfGetDB(DB_SLAVE); $msg = null; $x = rand(0, 4); switch ($x) { case 0: $count = $dbr->selectField('imageadder', 'count(*)', array('imageadder_hasimage' => 0)); $count = number_format($count, 0, ".", ","); $msg = "There are {$count} articles with no image in the introduction, start adding images <a href='/Special:Introimageadder'>now.</a>"; $t = Title::makeTitle(NS_SPECIAL, "Introimageadder"); break; case 1: $count = $dbr->selectField('recentchanges', 'count(*)', array('rc_patrolled' => 0)); $count = number_format($count, 0, ".", ","); $msg = "There are {$count} unpatrolled edits in recent changes, start patrolling <a href='/Special:RCPatrol'>now.</a>"; $t = Title::makeTitle(NS_SPECIAL, "RCPatrol"); break; case 2: $count = $dbr->selectField('editfinder', 'count(*)', array()); $count = number_format($count, 0, ".", ","); $msg = "There are {$count} articles in the repair shop, start fixing them <a href='/Special:EditFinder'>now.</a>"; $t = Title::makeTitle(NS_SPECIAL, "EditFinder"); break; case 3: $count = $dbr->selectField('qc', 'count(*)', array('qc_patrolled' => 0)); $count = number_format($count, 0, ".", ","); $msg = "There are {$count} edits in the QG queue, start patrolling them <a href='/Special:QG'>now.</a>"; $t = Title::makeTitle(NS_SPECIAL, "QG"); break; case 4: $feeds = FeaturedArticles::getFeaturedArticles(1); if (sizeof($feeds > 0)) { $url = $feeds[0][0]; $url = preg_replace("@http://www.wikihow.com/@", "", $url); $t = Title::newFromURL(urldecode($url)); if ($t) { $img = SkinWikihowskin::getGalleryImage($t, 44, 33); $msg = "<img src='{$img}'/><a href='{$t->getFullURL()}'>{$t->getText()}</a> is today's Featured Article"; } } break; } $html = ""; if ($msg) { $html = "<div class='feeditem'>{$msg}<div class='actions'><a href='{$t->getFullURL()}'>Go there now</a></div></div>"; } wfProfileOut($fname); return $html; }
static function processArticleHTML($body, $opts = array()) { global $wgUser, $wgTitle, $wgLanguageCode; $doc = PHPQuery::newDocument($body); $featurestar = pq("div#featurestar"); if ($featurestar) { $clearelement = pq($featurestar)->next(); $clearelement->remove(); $featurestar->remove(); } $ads = $wgUser->isAnon() && !@$opts['no-ads'] && wikihowAds::isEligibleForAds(); // Remove __TOC__ resulting html from all pages other than User pages if (@$opts['ns'] != NS_USER && pq('div#toc')->length) { $toc = pq('div#toc'); //in upgrade, it's no longer preceded by an h2, so deleting the intro instead :( //maybe this will change so leaving in for now. //$toc->prev()->remove(); $toc->remove(); } $sticky = ""; if (@$opts['sticky-headers']) { $sticky = " sticky "; } // Remove originators for titles that don't exist if ($wgTitle->getArticleId() == 0) { pq('#originators')->remove(); } //move firstHeading to inside the intro $firstH2 = pq("h2:first"); if (pq($firstH2)->length() == 0) { try { pq("#bodycontents")->children(":first")->wrapAll("<div class='section wh_block'></div>"); } catch (Exception $e) { } } else { try { pq($firstH2)->prevAll()->reverse()->wrapAll("<div id='intro' class='section {$sticky}'></div>"); } catch (Exception $e) { } } //add a clearall to the end of the intro pq("#intro")->append("<div class='clearall'></div>"); //removing any stray br tags at the start of the intro foreach (pq("#intro #originators")->next()->children() as $child) { if (pq($child)->is("br")) { pq($child)->remove(); } else { break; } } //add the pimpedheader to our h3s! pq('h3, h4')->prepend('<div class="altblock"></div>'); foreach (pq("h2") as $node) { $h2Parent = pq($node)->parent(); if (@$opts['ns'] == NS_USER && pq($h2Parent)->attr("id") == "toctitle") { pq("#toc")->wrapAll("<div class='section'></div>"); pq("#toc ul:first")->addClass("section_text"); continue; } //find each section //first grab the name $sectionName = mb_strtolower(pq("span.mw-headline", $node)->html()); //Remove all non-letters and numbers in all languges if ($wgLanguageCode == 'en') { $sectionName = preg_replace("/[^A-Za-z0-9]/u", '', $sectionName); } elseif ($wgLanguageCode == 'hi') { $sectionName = str_replace(' ', '', $sectionName); } else { $sectionName = preg_replace("/[^\\p{L}\\p{N}]/u", '', $sectionName); } //now find all the elements prior to the next h2 $set = array(); $h3Tags = array(); $h3Elements = array(); $priorToH3Set = array(); $h3Count = 0; foreach (pq($node)->nextAll() as $sibling) { if (pq($sibling)->is("h2")) { break; } if (pq($sibling)->is("h3")) { $h3Count++; $h3Tags[$h3Count] = $sibling; $h3Elements[$h3Count] = array(); } else { if ($h3Count > 0) { $h3Elements[$h3Count][] = $sibling; } else { $priorToH3Set[] = $sibling; } } $set[] = $sibling; } if (mb_strtolower($sectionName) == mb_strtolower(wfMessage('steps')->text())) { if ($h3Count > 0) { //has alternate methods $altMethodNames = array(); $altMethodAnchors = array(); if (count($priorToH3Set) > 0) { //needs to have a steps section prior to the //alt method try { pq($priorToH3Set)->wrapAll("<div id='{$sectionName}' class='section_text'></div>"); } catch (Exception $e) { } $overallSet = array(); $overallSet[] = $node; foreach (pq("div#{$sectionName}:first") as $temp) { $overallSet[] = $temp; } try { pq($overallSet)->wrapAll("<div class='section steps {$sticky}'></div>"); } catch (Exception $e) { } } else { //hide the h2 tag pq($node)->addClass("hidden"); } $stepsEditUrl = pq('.editsection', $node)->attr("href"); $displayMethodCount = $h3Count; $isSample = array(); for ($i = 1; $i <= $h3Count; $i++) { $isSampleItem = false; if (!is_array($h3Elements[$i]) || count($h3Elements[$i]) < 1) { $isSampleItem = false; } else { //the sd_container isn't always the first element, need to look through all foreach ($h3Elements[$i] as $node) { //not the most efficient way to do this, but couldn't get the find function to work. if (pq($node)->attr("id") == "sd_container") { $isSampleItem = true; break; } } } if ($isSampleItem) { $isSample[$i] = true; $displayMethodCount--; } else { $isSample[$i] = false; } } if ($ads) { wikihowAds::setAltMethods($displayMethodCount > 1); } //[sc] ***INTERMEDIATE STEP (remove line below) $wikihowArticle = WikihowArticleEditor::newFromTitle($wgTitle); $hasParts = $opts['magic-word'] == MagicWord::get('parts'); $displayMethod = 1; for ($i = 1; $i <= $h3Count; $i++) { //change the method title $methodTitle = pq("span.mw-headline", $h3Tags[$i])->html(); //[sc] ***INTERMEDIATE STEP (remove line below) $removeRet = WikihowArticleEditor::removeMethodNamePrefix($methodTitle); $altMethodNames[] = $methodTitle; $altMethodAnchors[] = pq("span.mw-headline", $h3Tags[$i])->attr("id"); //[sc] ***INTERMEDIATE STEP (swap if logic below) //if ($displayMethodCount > 1 && $hasParts && $opts['ns'] == NS_MAIN) { if ($displayMethodCount > 1 && !$isSample[$i] && ($removeRet['has_parts'] || $hasParts) && $opts['ns'] == NS_MAIN) { if ($methodTitle) { $methodTitle = wfMessage("part_2", $displayMethod, $displayMethodCount, $methodTitle)->text(); } else { $methodTitle = wfMessage("part_1", $displayMethod, $displayMethodCount)->text(); } $displayMethod++; } elseif ($displayMethodCount > 1 && !$isSample[$i] && $opts['ns'] == NS_MAIN) { if ($methodTitle) { $methodTitle = wfMessage("method_2", $displayMethod, $displayMethodCount, $methodTitle)->text(); } else { $methodTitle = wfMessage("method_1", $displayMethod, $displayMethodCount)->text(); } $displayMethod++; } pq("span.mw-headline", $h3Tags[$i])->html($methodTitle); //add our custom anchors $anchor_name = pq("span.mw-headline", $h3Tags[$i])->attr('id') . '_sub'; try { pq($h3Tags[$i])->before('<a name="' . $anchor_name . '" class="anchor"></a>'); } catch (Exception $e) { } //want to change the url for the edit link to //edit the whole steps section, not just the //alternate method pq(".editsection", $h3Tags[$i])->attr("href", $stepsEditUrl); $sample = $isSample[$i] ? "sample" : ""; //only wrap if there's stuff there to wrap. //This happens when people put two sub methods on top of each other without //any content between. if (count($h3Elements[$i]) > 0) { pq($h3Elements[$i])->wrapAll("<div id='{$sectionName}_{$i}' class='section_text'></div>"); } $overallSet = array(); $overallSet[] = $h3Tags[$i]; foreach (pq("div#{$sectionName}_{$i}:first") as $temp) { $overallSet[] = $temp; } try { pq($overallSet)->wrapAll("<div class='section steps {$sample} {$sticky}'></div>"); } catch (Exception $e) { } } //BEBETH - not sure we need this anymore, but not sure yet //fix for Chrome -- wrap first anchor name so it detects the spacing try { pq(".section.steps:first")->prev()->children(".anchor")->after('<br class="clearall" />')->wrapAll('<div></div>'); } catch (Exception $e) { } //now we should have all the alt methods, //let's create the links to them under the headline $charCount = 0; $maxCount = 80000; //temporarily turning off hidden headers $hiddenCount = 0; $anchorList = ""; for ($i = 0; $i < count($altMethodAnchors); $i++) { $methodName = pq('<div>' . $altMethodNames[$i] . '</div>')->text(); // remove any reference notes $methodName = preg_replace("@\\[\\d{1,3}\\]\$@", "", $methodName); $charCount += strlen($methodName); $class = ""; if ($charCount > $maxCount) { $class = "hidden excess"; $hiddenCount++; } if ($methodName == "") { continue; } $anchorList .= "<a href='#{$altMethodAnchors[$i]}_sub' class='{$class}'>{$methodName}</a>"; } $hiddentext = ""; if ($hiddenCount > 0) { $hiddenText = "<a href='#' id='method_toc_unhide'>{$hiddenCount} more method" . ($hiddenCount > 1 ? "s" : "") . "</a>"; $hiddenText .= "<a href='#' id='method_toc_hide' class='hidden'>show less methods</a>"; } else { $hiddenText = ''; } //add our little list header if ($hasParts) { //ucwords $anchorList = '<span>' . ucwords(Misc::numToWord(count($altMethodAnchors), 10)) . ' ' . wfMessage('part_3')->text() . ':</span>' . $anchorList; } else { $anchorList = '<span>' . ucwords(Misc::numToWord(count($altMethodAnchors), 10)) . ' ' . wfMessage('method_3')->text() . ':</span>' . $anchorList; } //chance to reformat the alt method_toc before output //using for running tests $bAfter = false; wfRunHooks('BeforeOutputAltMethodTOC', array($wgTitle, &$anchorList, &$bAfter)); $bAfter = true; if ($bAfter) { pq("#originators")->after("<p id='method_toc' style='margin-top:-10px'>{$anchorList}{$hiddenText}</p>"); } else { pq(".firstHeading")->after("<p id='method_toc'>{$anchorList}{$hiddenText}</p>"); } } else { //only 1 method if ($ads) { wikihowAds::setAltMethods(false); } if ($set) { try { pq($set)->wrapAll("<div id='{$sectionName}' class='section_text'></div>"); } catch (Exception $e) { } } $overallSet = array(); $overallSet[] = $node; foreach (pq("div#{$sectionName}:first") as $temp) { $overallSet[] = $temp; } try { pq($overallSet)->wrapAll("<div class='section steps {$sticky}'></div>"); } catch (Exception $e) { } } } else { //not a steps section if ($set) { $sec_id = @$opts['list-page'] ? '' : 'id="' . $sectionName . '"'; try { $new_set = pq($set)->wrapAll("<div {$sec_id} class='section_text'></div>"); } catch (Exception $e) { } } $overallSet = array(); $overallSet[] = $node; foreach (pq("div#{$sectionName}:first") as $temp) { $overallSet[] = $temp; } try { pq($overallSet)->wrapAll("<div class='section {$sectionName} {$sticky}'></div>"); } catch (Exception $e) { } if (@$opts['list-page']) { //gotta pull those dangling divs into the same space as the h2 try { pq($overallSet)->parent()->append(pq($new_set)); } catch (Exception $e) { } } // commenting this out because it's causing the following error: // "Couldn't add newnode as the previous sibling of refnode" // // format edit links for non-steps sections // // pq('span', $node)->prepend(pq('a.edit', $node)); //remove the edit link from subheaders if we're not in the steps section try { pq(".{$sectionName} h3 .editsection")->remove(); } catch (Exception $e) { } } } //add a clear to the end of each section_text to make sure //images don't bleed across the bottom pq(".section_text")->append("<div class='clearall'></div>"); // Add checkboxes to Ingredients and 'Things You Need' sections, but only to the top-most li $lis = pq('#ingredients > ul > li, #thingsyoullneed > ul > li'); foreach ($lis as $li) { $id = md5(pq($li)->html() . mt_rand(1, 100)); pq($li)->html("<input id='item_{$id}' class='css-checkbox' type='checkbox'/><label for='item_{$id}' name='item_{$id}_lbl' class='css-checkbox-label'></label><div class='checkbox-text'>" . pq($li)->html() . '</div>'); } // Move templates above article body contents and style appropriately foreach (pq('.template_top') as $template) { pq($template)->addClass('sidebox'); if (pq($template)->parent()->hasClass('tmp_li')) { pq($template)->addClass('tmp_li'); } if ($wgUser->isAnon()) { pq($template)->addClass('notice_bgcolor_lo'); } else { pq($template)->addClass('notice_bgcolor_important'); } } // put templates after the intro div pq('.template_top')->insertAfter('#intro'); //now put the step numbers in foreach (pq("div.steps .section_text > ol") as $list) { pq($list)->addClass("steps_list_2"); $stepNum = 1; foreach (pq($list)->children() as $step) { $boldStep = WikihowArticleHTML::boldFirstSentence(pq($step)->html()); pq($step)->html($boldStep); pq($step)->prepend("<div class='step_num'>{$stepNum}</div>"); pq($step)->append("<div class='clearall'></div>"); $stepNum++; } } foreach (pq(".steps:last .steps_list_2")->children(":last-child") as $step) { pq($step)->addClass("final_li"); } //move each of the large images to the top foreach (pq(".steps_list_2 li .mwimg.largeimage") as $image) { //delete any previous <br> foreach (pq($image)->prevAll() as $node) { if (pq($node)->is("br")) { pq($node)->remove(); } else { break; } } //first handle the special case where the image //ends up inside the bold tag by accident if (pq($image)->parent()->is("b")) { pq($image)->insertBefore(pq($image)->parent()); } if (pq($image)->parent()->parent()->is(".steps_list_2")) { pq($image)->parent()->prepend($image); } } //move each of the large images to the top foreach (pq(".steps_list_2 li .whvid_cont") as $vid) { //delete any previous <br> foreach (pq($vid)->prevAll() as $node) { if (pq($node)->is("br")) { pq($node)->remove(); } else { break; } } if (pq($vid)->parent()->parent()->is(".steps_list_2")) { pq($vid)->parent()->prepend($vid); } } //if there's a related articles section, make it have images $relatedSection = pq("#relatedwikihows"); if ($relatedSection) { foreach (pq("li a", $relatedSection) as $related) { $titleText = pq($related)->attr("title"); $title = Title::newFromText($titleText); if ($title) { $image = SkinWikihowskin::getArticleThumb($title, 127, 120); pq($relatedSection)->prepend($image); } pq($related)->remove(); } pq("ul", $relatedSection)->remove(); pq($relatedSection)->append("<div class='clearall'></div>"); } //remove all images in the intro that aren't //marked with the class "introimage" pq("#intro .mwimg:not(.introimage)")->remove(); //let's mark all the <p> tags that aren't inside a step. //they need special padding foreach (pq(".section.steps p") as $p) { if (pq($p)->parents(".steps_list_2")->count() == 0 && pq($p)->children(".anchor")->count() == 0) { pq($p)->addClass("lone_p"); } } // Add alt method adder cta if (class_exists("AltMethodAdder") && $wgTitle && $wgUser && $wgUser->isAnon()) { $cta = AltMethodAdder::getCTA($wgTitle); if (!is_null($cta)) { pq("div.steps:last")->after($cta); } } //add line breaks between the p tags foreach (pq("p") as $paragraph) { $sibling = pq($paragraph)->next(); if (!pq($sibling)->is("p")) { continue; } if (pq($sibling)->children(":first")->hasClass("anchor")) { continue; } $id = pq($paragraph)->attr("id"); if ($id == "originators" || $id == "method_toc") { continue; } pq($paragraph)->after("<br />"); } if ($ads) { pq(".#intro")->append(wikihowAds::getAdUnitPlaceholder('intro')); pq(".steps_list_2:first li:first")->append(wikihowAds::getAdUnitPlaceholder(0)); pq(".final_li")->append(wikihowAds::getAdUnitPlaceholder(1)); $tipsClass = mb_strtolower(wfMessage("tips")->text()); //grabs the tips section by name, but internationalized pq(".{$tipsClass} .section_text")->children()->filter("ul:last")->after(wikihowAds::getAdUnitPlaceholder('2a')); //add in the Taboola ads if ($wgLanguageCode == "en") { $sourcesClass = mb_strtolower(wfMessage("sources")->text()); //grabs the sources and citations section by name, but internationalized $sourcesClass = str_replace(' ', '', $sourcesClass); if (pq(".section.{$sourcesClass}")->length) { //put above Sources & Citations if it exists pq(".section.{$sourcesClass}")->before(wikihowAds::getAdUnitTaboola()); } else { // put above Article Info pq("#bodycontents")->after(wikihowAds::getAdUnitTaboola()); } } } $markPatrolledLink = self::getMarkPatrolledLink(); if ($markPatrolledLink) { pq('#bodycontents')->append($markPatrolledLink); } // //TEST - no intro // global $wgRequest; // $article_ids = explode("\n",ConfigStorage::dbGetConfig('wikihow-nointro-test')); // if ($wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgRequest->getVal('action') == '' && in_array($wgTitle->getArticleID(),$article_ids)) { // pq('#intro p:last')->remove(); // } return $doc->htmlOuter(); }
public function mobileSearch($q, $start, $limit = 20) { global $wgOut, $wgMemc; // Don't return more than 50 search results at a time to prevent abuse if ($limit > 50) { $limit = 50; } $key = wfMemcKey("MobileSearch", str_replace(" ", "-", $q), $start, $limit); if ($val = $wgMemc->get($key)) { return $val; } $contents = $this->googleSearchResultTitles($q, $start, $limit, 0, self::SEARCH_MOBILE); $results = array(); foreach ($contents as $t) { // Only return articles if ($t->getNamespace() != NS_MAIN) { continue; } $result = array(); $result['title'] = $t->getText(); $result['url'] = $t->getFullURL(); $result['imgurl'] = wfGetPad(SkinWikihowskin::getGalleryImage($t, 103, 80)); $result['intro'] = null; if ($r = Revision::newFromid($t->getLatestRevID())) { $intro = Wikitext::getIntro($r->getText()); $intro = trim(Wikitext::flatten($intro)); $result['intro'] = substr($intro, 0, 180); // Put an ellipsis on the end $len = strlen($result['intro']); $result['intro'] .= substr($result['intro'], $len - 1, $len) == '.' ? ".." : "..."; } if (!is_null($result['intro'])) { $results[] = array('article' => $result); } } $searchResults['results'] = $results; $json = json_encode($searchResults); $wgMemc->set($key, $json, 3600); // 1 hour header("Content-type: application/json"); $wgOut->disable(true); echo $json; }
function execute($par) { global $wgOut, $wgUser, $wgTitle, $wgLanguageCode, $wgHooks; if ($wgLanguageCode != 'en') { $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); $wgOut->setRobotPolicy('noindex,nofollow'); return; } require_once 'Leaderboard.body.php'; wfLoadExtensionMessages('RequestTopic'); $wgOut->addCSScode('suggc'); $wgOut->addJScode('suggj'); ListRequestedTopics::setActiveWidget(); ListRequestedTopics::setTopAuthorWidget(); ListRequestedTopics::getNewArticlesWidget(); $wgHooks["pageTabs"][] = array("wfRequestedTopicsTabs"); $wgOut->setHTMLTitle('Articles Started By You - wikiHow'); $wgOut->setRobotPolicy('noindex,nofollow'); //heading with link $request = '<a href="/Special:RequestTopic" class="editsection">' . wfMsg('requesttopic') . '</a>'; $heading = $request . '<h2>' . wfMsg('your_articles_header') . '</h2>'; //add surpise button $heading .= "<a href='/Special:RecommendedArticles?surprise=1' class='button buttonright secondary' id='suggested_surprise'>" . wfMsg('suggested_list_button_surprise') . "</a><br /><br /><br />"; $wgOut->addHTML($heading); if ($wgUser->getID() > 0) { $dbr = wfGetDB(DB_SLAVE); $res = $dbr->query("select * from firstedit left join page on fe_page=page_id\n\t\t\t\t\tleft join suggested_titles on page_title=st_title and page_namespace= 0 where fe_user={$wgUser->getID()} and page_id is not NULL order by st_category"); if ($dbr->numRows($res) == 0) { $wgOut->addHTML(wfMsg("yourarticles_none")); return; } $last_cat = "-"; // group it by categories // sometimes st_category is not set, so we have to grab the top category // from the title object of the target article $articles = array(); while ($row = $dbr->fetchObject($res)) { $t = Title::makeTitle(NS_MAIN, $row->page_title); $cat = $row->st_category; if ($cat == '') { $str = Categoryhelper::getTopCategory($t); if ($str != '') { $title = Title::makeTitle(NS_CATEGORY, $str); $cat = $title->getText(); } else { $cat = "Other"; } } if (!isset($articles[$cat])) { $articles[$cat] = array(); } $articles[$cat][] = $row; } foreach ($articles as $cat => $article_array) { $image = ListRequestedTopics::getCategoryImage($cat); $style = ""; if ($image == "") { $style = "style='padding-left:67px;'"; } $wgOut->addHTML('<h2>' . $cat . '</h2><div class="wh_block"><table class="suggested_titles_list">'); foreach ($article_array as $row) { $t = Title::makeTitle(NS_MAIN, $row->page_title); $ago = wfTimeAgo($row->page_touched); $authors = array_keys($this->getAuthors($t)); $a_out = array(); for ($i = 0; $i < 2 && sizeof($authors) > 0; $i++) { $a = array_shift($authors); if ($a == 'anonymous') { $a_out[] = "Anonymous"; // duh } else { $u = User::newFromName($a); if (!$u) { echo "{$a} broke"; exit; } $a_out[] = "<a href='{$u->getUserPage()->getFullURL()}'>{$u->getName()}</a>"; } } $skin = $wgUser->getSkin(); $img = SkinWikihowskin::getGalleryImage($t, 46, 35); $wgOut->addHTML("<tr><td class='article_image'><img src='{$img}' alt='' width='46' height='35' /></td>" . "<td><h3><a href='{$t->getFullURL()}' class='title'>" . wfMsg('howto', $t->getFullText()) . "</a></h3>" . "<p class='meta_info'>Authored by: <a href='{$wgUser->getUserPage()->getFullURL()}'>You</a></p>" . "<p class='meta_info'>Edits by: " . implode(", ", $a_out) . " (<a href='{$t->getFullURL()}?action=credits'>see all</a>)</p>" . "<p class='meta_info'>Last updated {$ago}</p>" . "</td>" . "<td class='view_count'>" . number_format($row->page_counter, 0, "", ",") . "</td></tr>"); } $wgOut->addHTML('</table></div>'); } } else { $rt = $wgTitle->getPrefixedURL(); $q = "returnto={$rt}"; $wgOut->addHTML(wfMsg('yourarticles_anon', $q)); } }
function formatRelated($t) { global $wgUser, $wgParser; $result = ''; if ($t && $t->exists()) { $r = Revision::newFromTitle($t); $intro = $wgParser->getSection($r->getText(), 0); $intro = Wikitext::flatten($intro); if (strlen($intro) > 250) { $intro = substr($intro, 0, 250) . '...'; } $sk = $wgUser->getSkin(); $img = SkinWikihowskin::getGalleryImage($t, 238, 139); $result .= "<div class='slide_related'>\n\t\t\t\t\t\t<a href='{$t->getFullURL()}'><img src='{$img}' alt='' width='238' height='139' class='gs_img' /></a>\n\t\t\t\t\t\t<h3><a href='{$t->getFullURL()}'>{$t->getText()}</a></h3>\n\t\t\t\t\t\t<p>{$intro}</p>\n\t\t\t\t\t\t</div>"; } return $result; }
public function parseArticle_02($article) { global $wgWikiHowSections, $wgTitle, $wgUser; $ads = $wgUser->getID() == 0; $sk = new SkinWikihowskin(); $sectionMap = array(wfMsg('Intro') => 'intro', wfMsg('Ingredients') => 'ingredients', wfMsg('Steps') => 'steps', wfMsg('Video') => 'video', wfMsg('Tips') => 'tips', wfMsg('Warnings') => 'warnings', wfMsg('relatedwikihows') => 'relatedwikihows', wfMsg('sourcescitations') => 'sources', wfMsg('thingsyoullneed') => 'thingsyoullneed'); foreach ($wgWikiHowSections as $section) { $reverse_msgs[wfMsg($section)] = $section; } $parts = preg_split("@(<h2.*</h2>)@im", $article, 0, PREG_SPLIT_DELIM_CAPTURE); $body = ''; $intro_img = ''; for ($i = 0; $i < sizeof($parts); $i++) { if ($i == 0) { //intro preg_match("/Image:(.*)\">/", $parts[$i], $matches); if (count($matches) > 0) { $img = $matches[1]; $img = preg_replace('@%27@', "'", $img); $image = Title::makeTitle(NS_IMAGE, $img); if ($image) { $file = wfFindFile($image); if ($file) { $thumb = $file->getThumbnail(200, -1, true, true); $intro_img = '<a href="' . $image->getFullUrl() . '"><img border="0" width="200" class="mwimage101" src="' . wfGetPad($thumb->url) . '" alt="" /></a>'; } } } if ($intro_img == '') { $intro_img = '<img border="0" width="200" class="mwimage101" src="' . wfGetPad('/skins/WikiHow/images/wikihow_sq_200.png') . '" alt="" />'; } $r = Revision::newFromTitle($wgTitle); $intro_text = Wikitext::getIntro($r->getText()); $intro_text = trim(Wikitext::flatten($intro_text)); $body .= '<br /><div id="color_div"></div><br />'; $body .= '<div id="article_intro">' . $intro_text . '</div>'; if ($ads) { $body .= '<div class="ad_noimage intro_ad">' . wikihowAds::getAdUnitPlaceholder('intro') . '</div>'; } } else { if (stripos($parts[$i], "<h2") === 0 && $i < sizeof($parts) - 1) { preg_match("@<span>.*</span>@", $parts[$i], $matches); $rev = ""; if (sizeof($matches) > 0) { $h2 = trim(strip_tags($matches[0])); $rev = isset($reverse_msgs[$h2]) ? $reverse_msgs[$h2] : ""; } if ($rev !== 'steps') { $body .= $parts[$i]; } $i++; if ($rev == "steps") { $body .= "\n<div id=\"steps\" class='editable'>{$parts[$i]}</div>\n"; } else { if ($rev != "") { $body .= "\n<div id=\"{$rev}\" class='article_inner editable'>{$parts[$i]}</div>\n"; } else { $body .= "\n<div class='article_inner editable'>{$parts[$i]}</div>\n"; } } } else { $body .= $parts[$i]; } } } $punct = "!\\.\\?\\:"; # valid ways of ending a sentence for bolding $i = strpos($body, '<div id="steps"'); if ($i !== false) { $j = strpos($body, '<div id=', $i + 5); } if ($j === false) { $j = strlen($body); } if ($j !== false && $i !== false) { $steps = substr($body, $i, $j - $i); $parts = preg_split("@(<[/]?ul>|<[/]?ol>|<[/]?li>)@im", $steps, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $numsteps = preg_match_all('/<li>/m', $steps, $matches); $level = 0; $steps = ""; $upper_tag = ""; $levelstack = array(); $tagstack = array(); $current_tag = ""; $current_li = 1; $donefirst = false; // used for ads to tell when we've put the ad after the first step if ($numsteps < 100) { while ($p = array_shift($parts)) { switch (strtolower($p)) { case "<ol>": $level++; if ($level == 1) { $p = '<ol class="steps_list">'; $upper_tag = "ol"; } else { $p = " <div class='listbody'>{$p}"; } if ($current_tag != "") { $tagstack[] = $current_tag; } $current_tag = "ol"; $levelstack[] = $current_li; $current_li = 1; break; case "<ul>": if ($current_tag != "") { $tagstack[] = $current_tag; } $current_tag = "ul"; $levelstack[] = $current_li; $level++; break; case "</ol>": $p .= '<div id="steps_end"></div>'; case "</ul>": $level--; if ($level == 0) { $upper_tag = ""; } $current_tag = array_pop($tagstack); $current_li = array_pop($levelstack); break; case "<li>": $closecount = 0; if ($level == 1 && $upper_tag == "ol") { $li_number = $current_li++; //$p = '<li>'. str_pad($li_number,2,'0',STR_PAD_LEFT); $p = '<li>'; # this is where things get interesting. Want to make first sentence bold! # but we need to handle cases where there are tags in the first sentence # split based on HTML tags $next = array_shift($parts); $htmlparts = preg_split("@(<[^>]*>)@im", $next, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $dummy = 0; $incaption = false; $apply_b = false; while ($x = array_shift($htmlparts)) { # if it's a tag, just append it and keep going if (preg_match("@(<[^>]*>)@im", $x)) { //tag $p .= $x; if ($x == "<span class='caption'>") { $incaption = true; } else { if ($x == "</span>" && $incaption) { $incaption = false; } } continue; } # put the closing </b> in if we hit the end of the sentence if (!$incaption) { if (!$apply_b && trim($x) != "") { $p .= '<p class="step_head"><span>' . str_pad($li_number, 2, '0', STR_PAD_LEFT) . '</span>'; $apply_b = true; } if ($apply_b) { $x = preg_replace("@([{$punct}])@im", "\$1</p>", $x, 1, &$closecount); } } $p .= $x; if ($closecount > 0) { break; } else { #echo "\n\n-----$x----\n\n"; } $dummy++; } # get anything left over $p .= implode("", $htmlparts); if ($closecount == 0) { $p .= "</b>"; } // close the bold tag if we didn't already if ($level == 1 && $current_li == 2 && $ads && !$donefirst) { $p .= '<br class="clearall" />' . wikihowAds::getAdUnitPlaceholder(0); $donefirst = true; } } break; case "</li>": $p = "<div class='clearall'></div>{$p}"; //changed BR to DIV b/c IE doesn't work with the BR clear tag break; } // switch $steps .= $p; } // while } else { $steps = substr($body, $i, $j - $i); $steps = "<div id='steps_notmunged'>\n" . $steps . "\n</div>\n"; } // we have to put the final_li in the last OL LI step, so reverse the walk of the tokens $parts = preg_split("@(<[/]?ul>|<[/]?ol>|<[/]?li>)@im", $steps, 0, PREG_SPLIT_DELIM_CAPTURE); $parts = array_reverse($parts); $steps = ""; $level = 0; $gotit = false; $donelast = false; foreach ($parts as $p) { $lp = strtolower($p); if ($lp == "</ol>") { $level++; $gotit = false; } else { if ($lp == "</ul>") { $level++; } else { if (strpos($lp, "<li") !== false && $level == 1 && !$gotit) { /// last OL step list f****r //$p = preg_replace("@<li[^>]*>@i", '<li class="steps_li final_li">', $p); $gotit = true; } else { if (strpos($lp, "<ul") !== false) { $level--; } else { if (strpos($lp, "<ol") !== false) { $level--; } else { if ($lp == "</li>" && !$donelast) { // ads after the last step if ($ads) { if (substr($body, $j) == "") { $p = "<script>missing_last_ads = true;</script>" . wikihowAds::getAdUnitPlaceholder(1) . $p; $no_third_ad = true; } else { $p = '<br />' . wikihowAds::getAdUnitPlaceholder(2) . $p; } } $donelast = true; } } } } } } $steps = $p . $steps; } $body = substr($body, 0, $i) . $steps . substr($body, $j); } /// if numsteps == 100? /// ads below tips, walk the sections and put them after the tips if ($ads) { $foundtips = false; $anchorTag = ""; foreach ($wgWikiHowSections as $s) { $isAtEnd = false; if ($s == "ingredients" || $s == "steps") { continue; } // we skip these two top sections $i = strpos($body, '<div id="' . $s . '"'); if ($i !== false) { $j = strpos($body, '<h2>', $i + strlen($s)); } else { continue; // we didnt' find this section } if ($j === false) { $j = strlen($body); // go to the end $isAtEnd = true; } if ($j !== false && $i !== false) { $section = substr($body, $i, $j - $i); if ($s == "video") { // special case for video $newsection = "<div id='video'><center>{$section}</center></div>"; $body = str_replace($section, $newsection, $body); continue; } else { if ($s == "tips") { //tip ad is now at the bottom of the tips section //need to account for the possibility of no sections below this and therefor //no anchor tag if ($isAtEnd) { $anchorTag = "<p></p>"; } $body = str_replace($section, $section . $anchorTag . wikihowAds::getAdUnitPlaceholder('2a') . '<p><br /></p>', $body); $foundtips = true; break; } else { $foundtips = true; if ($isAtEnd) { $anchorTag = "<p></p>"; } $body = str_replace($section, $section . $anchorTag . wikihowAds::getAdUnitPlaceholder(2), $body); break; } } } } if (!$foundtips && !$no_third_ad) { //must be the video section //need to put in the empty <p> tag since all the other sections have them for the anchor tags. $body .= "<p class='video_spacing'></p>" . wikihowAds::getAdUnitPlaceholder(2); } } $catlinks = $sk->getCategoryLinks($false); $authors = $sk->getAuthorFooter(); if ($authors != "" || is_array($this->data['language_urls']) || $catlinks != "") { //k, now grab the bottom stuff $article_bottom .= '<br />' . wfGetSuggestedTitles($wgTitle) . '<br /> <h2 class="section_head" id="article_info_header">' . wfMsg('article_info') . '</h2> <div id="article_info" class="article_inner"> <p>' . self::getLastEdited() . '</p> <p>' . wfMsg('categories') . ':<br/>' . $catlinks . '</p> <p>' . $authors . '</p> </div><!--end article_info-->'; } if ($wgUser->getID() == 0 && !$isMainPage && $action != 'edit' && $wgTitle->getNamespace() == NS_MAIN) { $article_bottom .= '<div class="final_ad">' . wikihowAds::getAdUnitPlaceholder(7) . '</div>'; } $article_bottom .= ' <div id="final_question"> ' . $userstats . ' <p><b>' . $sk->pageStats() . '</b></p> <div id="page_rating">' . RateArticle::showForm() . '</div> <p></p> </div> <!--end last_question--> </div> <!-- article -->'; //share buttons $url = urlencode($wgServer . "/" . $wgTitle->getPrefixedURL()); $fb = '<div class="like_button"><fb:like href="' . $url . '" send="false" layout="button_count" width="86" show_faces="false"></fb:like></div>'; $gp1 = '<div class="gplus1_button"><g:plusone size="medium" callback="plusone_vote"></g:plusone></div>'; // $fb_share = '<div class="like_button like_tools"><fb:like href="' . $url . '" send="false" layout="button_count" width="86" show_faces="false"></fb:like></div>'; $tb_admin = '<div class="admin_state"><a href="http://twitter.com/share" data-lang="' . $wgLanguageCode . '" style="display:none; background-image: none; color: #ffffff;" class="twitter-share-button" data-count="horizontal" data-via="wikiHow" data-text="How to ' . htmlspecialchars($wgTitle->getText()) . '" data-related="JackHerrick:Founder of wikiHow">Tweet</a></div>'; $tb = '<a href="http://twitter.com/share" data-lang="' . $wgLanguageCode . '" style="display:none; background-image: none; color: #ffffff;" class="twitter-share-button" data-count="horizontal" data-via="wikiHow" data-text="How to ' . htmlspecialchars($wgTitle->getText()) . '" data-related="JackHerrick:Founder of wikiHow">Tweet</a>'; $the_buttons = '<div id="share_buttons_top">' . $fb; if ($wgUser->isSysop() && $wgTitle->userCan('delete')) { $the_buttons .= $tb_admin; } else { $the_buttons .= $tb; } $the_buttons .= $gp1 . '</div>'; $title = '<h1>How to ' . $wgTitle->getText() . '</h1>'; $edited = $sk->getAuthorHeader(); $sidebar = '<div id="sidenav"><div id="showslideshow"></div><div id="pp_big_space">' . $intro_img . '</div></div>'; $main = '<div id="article_main">' . $title . $the_buttons . $edited . $body . $article_bottom . '</div>'; $article = '<div id="article_layout_' . self::ARTICLE_LAYOUT . '">' . $sidebar . $main . '</div>'; return $article; }
function getRelatedWikiHowsWidget($title) { global $wgOut; wfLoadExtensionMessages('ImageHelper'); $articles = ImageHelper::getLinkedArticles($title); $relatedArticles = array(); foreach ($articles as $t) { $related = ImageHelper::setRelatedWikiHows($t); foreach ($related as $titleString) { $relatedArticles[$titleString] = $titleString; } } $section = ''; $count = 0; $images = ''; foreach ($relatedArticles as $titleString) { $t = Title::newFromText($titleString); if ($t && $t->exists()) { $images .= SkinWikihowskin::getArticleThumb($t, 127, 140); if (++$count == 6) { break; } } } if ($count > 0) { $section .= "<h3>" . wfMsg('ih_relatedArticles') . "</h3>\n\t\t\t\t\t\t<div class='other_articles_side'>\n\t\t\t\t\t\t{$images}\n\t\t\t\t\t\t<div class='clearall'></div>\n\t\t\t\t\t\t</div>"; } return $section; }
private function getFeatureArticleImage(&$title, $width, $height) { global $wgUser; $skin = $wgUser->getSkin(); // The next line was taken from: // SkinWikihowskin::featuredArticlesLineWide() $img = SkinWikihowskin::getGalleryImage($title, $width, $height); return wfGetPad($img); }
function getFoundInArticles($doc_name, $is_mobile) { $html = ''; $dbr = wfGetDB(DB_SLAVE); $res = $dbr->select('dv_links', 'dvl_page', array('dvl_doc' => $doc_name), __METHOD__); foreach ($res as $row) { $t = Title::newFromId($row->dvl_page); if ($t && $t->exists()) { global $wgUser; $sk = $wgUser->getSkin(); $img = SkinWikihowskin::getGalleryImage($t, 44, 33); if ($is_mobile) { $html .= $sk->featuredArticlesRow($t); } else { $html .= SkinWikihowskin::getArticleThumb($t, 127, 140); } //save for meta description if (!self::$firstRelated) { self::$firstRelated = ' ' . wfMessage('dv-meta-article-prefix')->text() . ' ' . htmlspecialchars($t->getText()); self::$firstRelatedTitle = $t; } } } return $html; }
private function getBoxBgImg($db, $quiz_name, $width, $height) { global $wgUser; $page = $db->selectField('quiz_links', 'ql_page', array('ql_name' => $quiz_name), __METHOD__, array('LIMIT' => 1)); $t = Title::newFromId($page); if ($t) { $sk = $wgUser->getSkin(); $img = SkinWikihowskin::getGalleryImage($t, $width, $height); $img = wfGetPad($img); } return $img; }