/** * * This function takes a domain and a specific articleId * and removes all external links in that article's * "sources and citations" section that * match the given domain. * */ function removeLinkFromSourcesCitations($domain, $articleId, $sources) { global $stillNeedRemoval; $title = Title::newFromID($articleId); if ($title && $title->getNamespace() == NS_MAIN) { $article = new Article($title); $wikihow = WikihowArticleEditor::newFromArticle($article); $escapedDomain = preg_quote($domain); if ($wikihow->hasSection($sources)) { $index = $wikihow->getSectionNumber($sources); $revision = Revision::newFromTitle($title); $sectionText = $article->getSection($revision->getText(), $index); //remove the header $sectionText = str_replace("== " . wfMsg("sources") . " ==" . "\n", "", $sectionText); if (preg_match('@' . $escapedDomain . '@i', $sectionText) > 0) { //replace the whole line containing the domain $newText = trim(preg_replace('@.*' . $escapedDomain . '[^\\n\\*]*$@im', '', $sectionText)); //now get rid of any double line breaks $newText = trim(preg_replace('@\\n{2,}@', "\n", $newText)); if ($index != -1) { if ($newText != "" && substr($newText, 0, 2) != "[[") { //empty section or possibly only a international link $newText = "== " . wfMsg("sources") . " ==" . "\n" . $newText; } $newText = $article->replaceSection($index, $newText); if ($article->doEdit($newText, "removing unwanted links")) { echo "Removed links from " . $title->getFullUrl('action=history') . "\n"; return 1; } } } } else { $articleText = $article->getContent(); if (preg_match('@' . $escapedDomain . '@i', $articleText) > 0) { $stillNeedRemoval[] = array($title->getFullUrl(), $domain); } } } else { if ($title) { //not a main namespace article $stillNeedRemoval[] = array($title->getFullUrl(), $domain); } } return 0; }
private function getRelatedWikihowsFromSource($title, $num) { global $wgParser; $whow = WikihowArticleEditor::newFromTitle($title); if (!$whow) { return ''; } $related = $whow->getSection('related wikihows'); $preg = "/\\|[^\\]]*/"; $related = preg_replace($preg, "", $related); //splice and dice $rarray = split("\n", $related); $related = implode("\n", array_splice($rarray, 0, $num)); $options = new ParserOptions(); $output = $wgParser->parse($related, $title, $options); $ra = $this->addTargetBlank($output->getText()); return $ra; }
private static function checkForRecipeMicrodata() { global $wgTitle, $wgUser, $wgRequest; static $calculated = false; if ($calculated) { return; } $calculated = true; if ($wgTitle && $wgTitle->getNamespace() == NS_MAIN && $wgTitle->exists() && $wgRequest->getVal('oldid') == '' && ($wgRequest->getVal('action') == '' || $wgRequest->getVal('action') == 'view')) { if (true || wikihowAds::$mCategories['Recipes'] != null) { $wikihow = WikihowArticleEditor::newFromTitle($wgTitle); $index = $wikihow->getSectionNumber('ingredients'); if ($index != -1) { self::$showRecipeTags = true; //our hRecipe subset if (stripos($wgTitle->getText(), 'muffin') > 0) { self::$showhRecipeTags = true; } } } } }
/** * Perform one of the "standard" actions */ function performAction(&$output, &$article, &$title, &$user, &$request) { wfProfileIn('MediaWiki::performAction'); if (!wfRunHooks('MediaWikiPerformAction', array($output, $article, $title, $user, $request))) { wfProfileOut('MediaWiki::performAction'); return; } $action = $this->getVal('Action'); if (in_array($action, $this->getVal('DisabledActions', array()))) { /* No such action; this will switch to the default case */ $action = 'nosuchaction'; } switch ($action) { case 'view': $output->setSquidMaxage($this->getVal('SquidMaxage')); $article->view(); break; case 'watch': case 'unwatch': case 'delete': case 'revert': case 'rollback': case 'protect': case 'unprotect': case 'info': case 'markpatrolled': case 'render': case 'deletetrackback': case 'purge': $article->{$action}(); break; case 'print': $article->view(); break; case 'dublincore': if (!$this->getVal('EnableDublinCoreRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nodublincore')); } else { require_once 'includes/Metadata.php'; wfDublinCoreRdf($article); } break; case 'creativecommons': if (!$this->getVal('EnableCreativeCommonsRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons')); } else { require_once 'includes/Metadata.php'; wfCreativeCommonsRdf($article); } break; case 'credits': require_once 'includes/Credits.php'; showCreditsPage($article); break; case 'submit': case 'submit2': if (session_id() == '') { /* Send a cookie so anons get talk message notifications */ wfSetupSession(); } /* Continue... */ /* Continue... */ case 'edit': if (wfRunHooks('CustomEditor', array($article, $user))) { $internal = $request->getVal('internaledit'); $external = $request->getVal('externaledit'); $section = $request->getVal('section'); $oldid = $request->getVal('oldid'); ///------------------------------------------- // XXADDED // do we have a title? if not, it's a new article, use the wrapper. if ($request->getVal('advanced') != 'true') { $newArticle = false; // if it's not new, is it already a wikiHow? $validWikiHow = false; if ($title->getNamespace() == NS_MAIN && $request->getVal('section', null) == null) { if ($request->getVal("title") == "") { $newArticle = true; } else { if ($title->getArticleID() == 0) { $newArticle = true; } } if (!$newArticle) { $validWikiHow = WikihowArticleEditor::useWrapperForEdit($article); } } // use the wrapper if it's a new article or // if it's an existing wikiHow article $t = $request->getVal('title', null); $editor = $user->getOption('defaulteditor', ''); if (empty($editor)) { $editor = $user->getOption('useadvanced', false) ? 'advanced' : 'visual'; } if ($t != null && $t != wfMsg('mainpage') && $editor == 'advanced' && !$request->getVal('override', null)) { // use advanced if they have already set a title // and have the default preference setting #echo "uh oh!"; } else { if ($action != "submit") { if ($newArticle || $action == 'submit2' || $validWikiHow && ($editor != 'advanced' || $request->getVal("override", "") == "yes")) { require_once 'EditPageWrapper.php'; $editor = new EditPageWrapper($article); $editor->edit(); break; } else { #echo "uh oh!"; } } } } if (!$this->getVal('UseExternalEditor') || $action == 'submit' || $internal || $section || $oldid || !$user->getOption('externaleditor') && !$external) { $editor = new EditPage($article); $editor->submit(); } elseif ($this->getVal('UseExternalEditor') && ($external || $user->getOption('externaleditor'))) { $mode = $request->getVal('mode'); $extedit = new ExternalEdit($article, $mode); $extedit->edit(); } } break; case 'history': global $wgRequest; if ($wgRequest->getFullRequestURL() == $title->getInternalURL('action=history')) { $output->setSquidMaxage($this->getVal('SquidMaxage')); } $history = new PageHistory($article); $history->history(); break; case 'raw': $raw = new RawPage($article); $raw->view(); break; default: if (wfRunHooks('UnknownAction', array($action, $article))) { $output->showErrorPage('nosuchaction', 'nosuchactiontext'); return; } } wfProfileOut('MediaWiki::performAction'); }
function execute($par) { global $wgRequest, $wgOut; $wgOut->disable(); $whow = WikihowArticleEditor::newFromRequest($wgRequest); if ($wgRequest->getVal('parse') == '1') { $body = $wgOut->parse($whow->formatWikiText()); $magic = WikihowArticleHTML::grabTheMagic($whow->formatWikiText()); echo WikihowArticleHTML::processArticleHTML($body, array('magic-word' => $magic)); } else { echo $whow->formatWikiText(); } return; }
} else { echo implode(",", $suggestions) . "\n"; } } else { echo "no suggestions\n"; } } function spellCheck($string) { return preg_replace_callback('/\\b(\\w|\')+\\b/', 'spellCheckWord', $string); } $t = null; if (isset($argv[0])) { $t = Title::newFromURL(urldecode($argv[0])); } else { $rp = new RandomPage(); $t = $rp->getRandomTitle(); } echo "Doing {$t->getFullURL()}\n"; $r = Revision::newFromTitle($t); if (!$r) { echo "can't get revision for this bad boy\n"; } $text = $r->getText(); $newtext = WikihowArticleEditor::textify($text, array('remove_ext_links' => 1)); echo "text ...{$newtext}\n\n"; $pspell = pspell_new('en', 'american', '', 'utf-8', PSPELL_FAST); spellCheck($newtext); if ($bad == 0) { echo "No misspellings\n"; }
function execute($par) { global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgDBname, $wgScriptPath; global $wgRequest, $wgSitename, $wgLanguageCode; global $wgScript; $fname = "wfSpecialEmailLink"; if ($wgRequest->getVal('fromajax')) { $wgOut->setArticleBodyOnly(true); } $this->setHeaders(); $me = Title::makeTitle(NS_SPECIAL, "EmailLink"); $action = $me->getFullURL(); $fc = new FancyCaptcha(); $pass_captcha = true; $name = $from = $r1 = $r2 = $r3 = $m = ""; if ($wgRequest->wasPosted()) { $pass_captcha = $fc->passCaptcha(); $email = $wgRequest->getVal("email"); $name = $wgRequest->getVal("name"); $recipient1 = $wgRequest->getVal('recipient1'); $recipient2 = $wgRequest->getVal('recipient2'); $recipient3 = $wgRequest->getVal('recipient3'); if (preg_match("@kittens683\\@aol.com@", $recipient1) || preg_match("@kittens683\\@aol.com@", $recipient2) || preg_match("@kittens683\\@aol.com@", $recipient3)) { return; } $message = $wgRequest->getVal('message'); } if (!$wgRequest->wasPosted() || !$pass_captcha) { if ($wgUser->getID() > 0 && !$wgUser->canSendEmail()) { $userEmail = $wgUser->getEmail(); // If there is no verification time stamp and no email on record, show initial message to have a user input a valid email address if (empty($userEmail)) { wfDebug("User can't send.\n"); $wgOut->errorpage("mailnologin", "mailnologintext"); } else { // When user does have an email on record, but has not verified it yet wfDebug("User can't send without verification.\n"); $wgOut->errorpage("mailnologin", "mailnotverified"); } return; } $titleKey = isset($par) ? $par : $wgRequest->getVal('target'); if ($titleKey == "") { $wgOut->addHTML("<br/></br><font color=red>" . wfMsg('error-no-title') . "</font>"); return; } $titleObj = Title::newFromURL($titleKey); if (!$titleObj) { $titleObj = Title::newFromURL(urldecode($titleKey)); } if (!$titleObj || $titleObj->getArticleID() < 0) { $wgOut->addHTML("<br/></br><font color=red>" . wfMsg('error-article-not-found') . "</font>"); return; } else { $titleKey = $titleObj->getDBKey(); } $articleObj = new Article($titleObj); $subject = $titleObj->getText(); $titleText = $titleObj->getText(); if (WikihowArticleEditor::articleIsWikiHow($articleObj)) { $subject = wfMsg('howto', $subject); $titleText = wfMsg('howto', $titleText); } $subject = wfMsg('wikihow-article-subject', $subject); if ($titleObj->getText() == wfMsg('mainpage')) { $subject = wfMsg('wikihow-article-subject-main-page'); } // add the form HTML $article_title = wfMsg('article') . ":"; if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) { $wgOut->addHTML("<br/><br/>" . wfMsg('know-someone-answer-topic-request')); $article_title = wfMsg('topic-requested') . ":"; } if ($titleObj->getNamespace() != NS_MAIN && $titleObj->getNamespace() != NS_ARTICLE_REQUEST && $titleObj->getNamespace() != NS_PROJECT) { $wgOut->errorPage('emaillink', 'emaillink_invalidpage'); return; } if ($titleObj->getText() == "Books For Africa") { $message = wfMsg('friend-sends-article-email-africa-body'); } $titleKey = urlencode($titleKey); $token = $this->getToken1(); $wgOut->addHTML("\n<link type='text/css' rel='stylesheet' href='" . wfGetPad('/extensions/wikihow/common/jquery-ui-themes/jquery-ui.css?rev=' . WH_SITEREV) . "' />\n<form id=\"emaillink\" method=\"post\" action=\"{$action}\">\n<input type=\"hidden\" name=\"target\" value=\"{$titleKey}\">\n<input type=\"hidden\" name=\"token\" value=\"{$token}\">\n<table border=\"0\">\n<tr>\n<td valign=\"top\" colspan=\"1\" class='mw-label'>{$article_title}</td>\n<td valign=\"top\" colspan=\"2\">{$titleText}</td>\n</tr>\n"); if ($wgUser->getID() <= 0) { $wgOut->addHTML("\n<tr>\n<td valign=\"top\" colspan=\"1\" class='mw-label'>" . wfMsg('your-name') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"name\" value=\"{$name}\" class='input_med'></td>\n</tr>\n<tr>\n<td valign=\"top\" colspan=\"1\" class='mw-label'>" . wfMsg('your-email') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"email\" value=\"{$email}\" class='input_med'></td>\n</tr>"); } $wgOut->addHTML("\n<tr>\n<td valign=\"top\" width=\"300px\" colspan=\"1\" rowspan='3' class='mw-label'>" . wfMsg('recipient-emails') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"recipient1\" value=\"{$recipient1}\" class='input_med'></td>\n</tr>\n<tr>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"recipient2\" value=\"{$recipient2}\" class='input_med'></td>\n</tr>\n<tr>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"recipient3\" value=\"{$recipient3}\" class='input_med'></td>\n</tr>\n<!--<tr>\n<td valign=\"top\" colspan=\"1\">" . wfMsg('emailsubject') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"subject\" value=\"{$subject}\" class='input_med'></td>\n</tr>-->\n<tr>\n<td colspan=\"1\" valign=\"top\" class='mw-label'>" . wfMsg('emailmessage') . ":</td>\n<td colspan=\"2\"><TEXTAREA rows=\"5\" cols=\"55\" name=\"message\">{$message}</TEXTAREA></td>\n</tr>\n<tr>\n<TD> </TD>\n<TD colspan=\"2\"><br/>\n" . wfMsgWikiHTML('emaillink_captcha') . "\n" . ($pass_captcha ? "" : "<br><br/><font color='red'>Sorry, that phrase was incorrect, try again.</font><br/><br/>") . "\n" . $fc->getForm('') . "\n</TD>\n</tr>\n<tr>\n<TD> </TD>\n<TD colspan=\"2\"><br/>\n<input type='submit' name=\"wpEmaiLinkSubmit\" value=\"" . wfMsg('submit') . "\" class=\"button primary\" />\n</td>\n</tr>\n<tr>\n<TD colspan=\"3\">\n<br/><br/>\n" . wfMsg('share-message-three-friends') . "\n</TD>\n</TR>\n\n"); // do this if the user isn't logged in $wgOut->addHTML("</table> </form>"); } else { if ($wgUser->pingLimiter('emailfriend')) { $wgOut->rateLimited(); wfProfileOut("{$fname}-checks"); wfProfileOut($fname); return false; } $usertoken = $wgRequest->getVal('token'); $token1 = $this->getToken1(); $token2 = $this->getToken2(); if ($usertoken != $token1 && $usertoken != $token2) { $this->reject(); echo "token {$usertoken} {$token1} {$token2}\n"; exit; return; } // check referrer $good_referer = Title::makeTitle(NS_SPECIAL, "EmailLink")->getFullURL(); $referer = $_SERVER["HTTP_REFERER"]; if (strpos($refer, $good_referer) != 0) { $this->reject(); echo "referrer bad\n"; exit; } // this is a post, accept the POST data and create the Request article $recipient1 = $_POST['recipient1']; $recipient2 = $_POST['recipient2']; $recipient3 = $_POST['recipient3']; $titleKey = $_POST['target']; $message = $_POST['message']; if ($titleKey == "Books-For-Africa") { $titleKey = "wikiHow:" . $titleKey; } $titleKey = urldecode($titleKey); $titleObj = Title::newFromDBKey($titleKey); if ($titleObj->getArticleID() <= 0) { $this->reject(); echo "no article id\n"; exit; } $dbkey = $titleObj->getDBKey(); $articleObj = new Article($titleObj); $subject = $titleObj->getText(); $how_to = $subject; if (WikihowArticleEditor::articleIsWikiHow($articleObj)) { $subject = wfMsg("howto", $subject); } $how_to = $subject; if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) { $subject = wfMsg('subject-requested-howto') . ": " . wfMsg("howto", $subject); } else { if ($titleObj->getNamespace() == NS_PROJECT) { $subject = wfMsg('friend-sends-article-email-africa-subject'); } else { $subject = wfMsg('wikihow-article-subject', $subject); } } if ($titleObj->getNamespace() != NS_MAIN && $titleObj->getNamespace() != NS_ARTICLE_REQUEST && $titleObj->getNamespace() != NS_PROJECT) { $wgOut->errorPage('emaillink', 'emaillink_invalidpage'); return; } // for the body of the email $titleText = $titleObj->getText(); if ($titleText != wfMsg('mainpage')) { $summary = Article::getSection($articleObj->getContent(true), 0); // trip out all MW and HTML tags $summary = ereg_replace("<.*>", "", $summary); $summary = ereg_replace("\\[\\[.*\\]\\]", "", $summary); $summary = ereg_replace("\\{\\{.*\\}\\}", "", $summary); } $url = $titleObj->getFullURL(); $from_name = ""; $validEmail = ""; if ($wgUser->getID() > 0) { $from_name = $wgUser->getName(); $real_name = $wgUser->getRealName(); if ($real_name != "") { $from_name = $real_name; } $email = $wgUser->getEmail(); if ($email != "") { $validEmail = $email; $from_name .= "<{$email}>"; } else { $from_name .= "<*****@*****.**>"; } } else { $email = $wgRequest->getVal("email"); $name = $wgRequest->getVal("name"); if ($email == "") { $email = "*****@*****.**"; } else { $validEmail = $email; } $from_name = "{$name} <{$email}>"; } if (strpos($email, "\n") !== false || strpos($recipient1, "\n") !== false || strpos($recipient2, "\n") !== false || strpos($recipient3, "\n") !== false || strpos($title, "\n") !== false) { echo "reciep\n"; exit; $this->reject(); return; } $r_array = array(); $num_recipients = 0; if ($recipient1 != "") { $num_recipients++; $x = split(";", $recipient1); $r_array[] = $x[0]; } if ($recipient2 != "") { $num_recipients++; $x = split(";", $recipient2); $r_array[] = $x[0]; } if ($recipient3 != "") { $num_recipients++; $x = split(";", $recipient3); $r_array[] = $x[0]; } if ($titleObj->getNamespace() == NS_PROJECT) { $r_array[] = '*****@*****.**'; } if ($validEmail != "" && !in_array($validEmail, $r_array)) { $num_recipients++; $r_array[] = $validEmail; } if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) { $body = "{$message}\n\n----------------\n\n\t" . wfMsg('article-request-email', $how_to, "http://www.wikihow.com/index.php?title2={$dbkey}&action=easy&requested={$dbkey}", "http://www.wikihow.com/Request:{$dbkey}", "http://www.wikihow.com/" . wfMsg('writers-guide-url'), "http://www.wikihow.com/" . wfMsg('about-wikihow-url') . ""); } else { if ($titleObj->getText() == wfMsg('mainpage')) { $body = "{$message}\n\n----------------\n\n\t" . wfMsg('friend-sends-article-email-main-page') . "\n\n\t"; } else { if ($titleObj->getNamespace() == NS_PROJECT) { $body = "{$message}"; } else { $body = "{$message}\n\n----------------\n\n" . wfMsg('friend-sends-article-email', $how_to, $summary, $url) . "\n\n\t"; } } } $from = new MailAddress($email); foreach ($r_array as $address) { $address = preg_replace("@,.*@", "", $address); $to = new MailAddress($address); $sbody = $body; if ($address == $validEmail) { $sbody = wfMsg('copy-email-from-yourself') . "\n\n" . $sbody; } if (!userMailer($to, $from, $subject, $sbody, false)) { //echo "got an en error\n"; } } SiteStatsUpdate::addLinksEmailed($num_recipients); $this->thanks(); } }
/** * Executes the Easyimageupload special page and all its sub-calls */ public function execute($par) { global $wgRequest, $wgUser, $wgOut, $wgLang, $wgServer; wfLoadExtensionMessages('Easyimageupload'); self::setTemplatePath(); if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } $wgOut->setArticleBodyOnly(true); if ($wgRequest->getVal('getuploadform')) { $wgOut->addHTML(self::getUploadBox()); } elseif ($wgRequest->getVal('uploadform1')) { $wgOut->addHTML(EasyTemplate::html('eiu_error_box.tmpl.php')); $this->uploadImage($wgRequest->getVal('src')); } elseif ($wgRequest->getVal('uploadform2')) { $wgOut->addHTML(EasyTemplate::html('eiu_error_box.tmpl.php')); $type = $wgRequest->getVal('type'); $name = $wgRequest->getVal('name'); $mwname = $wgRequest->getVal('mwname'); $error = $this->insertImage($type, $name, $mwname); $vars = !empty($error) ? array('error' => $error) : array(); $wgOut->addHTML(EasyTemplate::html('eiu_add_error.tmpl.php', $vars)); } elseif ($wgRequest->getVal('ImageIsConflict')) { $wgOut->addHTML(EasyTemplate::html('eiu_error_box.tmpl.php')); if ($wgRequest->getVal('ImageUploadUseExisting')) { $name = $wgRequest->getVal('ImageUploadExistingName'); $wgRequest->setVal('type', 'existing'); } elseif ($wgRequest->getVal('ImageUploadRename')) { $name = $wgRequest->getVal('ImageUploadRenameName') . '.' . $wgRequest->getVal('ImageUploadRenameExtension'); $wgRequest->setVal('type', 'overwrite'); } $wgRequest->setVal('name', $name); $type = $wgRequest->getVal('type'); $name = $wgRequest->getVal('name'); $mwname = $wgRequest->getVal('mwname'); $error = $this->insertImage($type, $name, $mwname); $vars = !empty($error) ? array('error' => $error) : array(); $wgOut->addHTML(EasyTemplate::html('eiu_add_error.tmpl.php', $vars)); } elseif ($wgRequest->getVal('preview-resize')) { $url = $wgRequest->getVal('url'); self::resizeAndDisplayImage($url); } elseif ($wgRequest->getVal('intro-image-adder')) { $separator = EasyTemplate::html('eiu_separator.tmpl.php'); $articleTitle = $wgRequest->getVal('article-title'); $searchterms = $wgRequest->getVal('searchterms'); $t = Title::newFromText($articleTitle); $whow = WikihowArticleEditor::newFromTitle($t); $intro = $whow->getSection("summary"); $intro = WikihowArticleEditor::removeWikitext($intro); $articleTitleLink = $t->getLocalURL(); $vars = array('title' => $articleTitle, 'titlelink' => $articleTitleLink, 'searchterms' => $searchterms, 'intro' => $intro); $html = EasyTemplate::html('iia_eiu_header.tmpl.php', $vars); $wgOut->addHTML($html); $wgOut->addHTML(EasyTemplate::html('eiu_error_box.tmpl.php')); $wgOut->addHTML(EasyTemplate::html('iia_eiu_find_box.tmpl.php', $vars)); $wgOut->addHTML($html); $html = EasyTemplate::html('eiu_footer.tmpl.php'); $wgOut->addHTML($html); } elseif ($wgRequest->getVal('intro-image-adder2')) { $this->uploadImage($wgRequest->getVal('src'), true); } else { // initial menu $separator = EasyTemplate::html('eiu_separator.tmpl.php'); $articleTitle = $wgRequest->getVal('article-title'); $vars = array('title' => $articleTitle); $html = EasyTemplate::html('eiu_header.tmpl.php', $vars); $wgOut->addHTML($html); $wgOut->addHTML(EasyTemplate::html('eiu_error_box.tmpl.php')); // assert wgRequest->wasPosted() == false; $wgOut->addHTML(self::getCurrentStepBox()); $wgOut->addHTML(self::getFindBox($articleTitle)); $html = EasyTemplate::html('eiu_find_box_end.tmpl.php'); $wgOut->addHTML($html); $html = EasyTemplate::html('eiu_footer.tmpl.php'); $wgOut->addHTML($html); } }
/** * 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 }
/** * Utility method to return the wikitext for an article */ public static function getWikitext(&$dbr, $title) { global $wgTitle; if (!$title) { return false; } // an optimization if $title is $wgTitle if ($wgTitle && $wgTitle->getText() == $title->getText()) { $whow = WikihowArticleEditor::newFromCurrent(); $wikitext = $whow->mLoadText; } else { $rev = Revision::loadFromTitle($dbr, $title); if (!$rev) { return false; } $wikitext = $rev->getText(); } return $wikitext; }
/** * Convert wikitext to HTML * Do not call this function recursively. * * @param string $text text we want to parse * @param $title Title object * @param $options ParserOptions * @param $linestart boolean * @param $clearState boolean * @param int $revid number to pass in {{REVISIONID}} * @return ParserOutput a ParserOutput */ public function parse($text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null) { /** * First pass--just handle <nowiki> sections, pass the rest off * to internalParse() which does all the real work. */ global $wgUseTidy, $wgAlwaysUseTidy, $wgShowHostnames; $fname = __METHOD__ . '-' . wfGetCaller(); wfProfileIn(__METHOD__); wfProfileIn($fname); $this->startParse($title, $options, self::OT_HTML, $clearState); // AG, for upgrade 1.21: added to get image sections set up global $wgParser; $oldParser = $wgParser; $wgParser = new Parser(); WikihowArticleEditor::setImageSections($text); $wgParser = $oldParser; $this->mInputSize = strlen($text); if ($this->mOptions->getEnableLimitReport()) { $this->mOutput->resetParseStartTime(); } # Remove the strip marker tag prefix from the input, if present. if ($clearState) { $text = str_replace($this->mUniqPrefix, '', $text); } $oldRevisionId = $this->mRevisionId; $oldRevisionObject = $this->mRevisionObject; $oldRevisionTimestamp = $this->mRevisionTimestamp; $oldRevisionUser = $this->mRevisionUser; $oldRevisionSize = $this->mRevisionSize; if ($revid !== null) { $this->mRevisionId = $revid; $this->mRevisionObject = null; $this->mRevisionTimestamp = null; $this->mRevisionUser = null; $this->mRevisionSize = null; } wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$this->mStripState)); # No more strip! wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$this->mStripState)); $text = $this->internalParse($text); wfRunHooks('ParserAfterParse', array(&$this, &$text, &$this->mStripState)); $text = $this->mStripState->unstripGeneral($text); # Clean up special characters, only run once, next-to-last before doBlockLevels $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1 ', '/(\\302\\253) /' => '\\1 ', '/ (!\\s*important)/' => ' \\1'); $text = preg_replace(array_keys($fixtags), array_values($fixtags), $text); $text = $this->doBlockLevels($text, $linestart); $this->replaceLinkHolders($text); /** * The input doesn't get language converted if * a) It's disabled * b) Content isn't converted * c) It's a conversion table * d) it is an interface message (which is in the user language) */ if (!($options->getDisableContentConversion() || isset($this->mDoubleUnderscores['nocontentconvert']))) { if (!$this->mOptions->getInterfaceMessage()) { # The position of the convert() call should not be changed. it # assumes that the links are all replaced and the only thing left # is the <nowiki> mark. $text = $this->getConverterLanguage()->convert($text); } } /** * A converted title will be provided in the output object if title and * content conversion are enabled, the article text does not contain * a conversion-suppressing double-underscore tag, and no * {{DISPLAYTITLE:...}} is present. DISPLAYTITLE takes precedence over * automatic link conversion. */ if (!($options->getDisableTitleConversion() || isset($this->mDoubleUnderscores['nocontentconvert']) || isset($this->mDoubleUnderscores['notitleconvert']) || $this->mOutput->getDisplayTitle() !== false)) { $convruletitle = $this->getConverterLanguage()->getConvRuleTitle(); if ($convruletitle) { $this->mOutput->setTitleText($convruletitle); } else { $titleText = $this->getConverterLanguage()->convertTitle($title); $this->mOutput->setTitleText($titleText); } } $text = $this->mStripState->unstripNoWiki($text); wfRunHooks('ParserBeforeTidy', array(&$this, &$text)); $text = $this->replaceTransparentTags($text); $text = $this->mStripState->unstripGeneral($text); $text = Sanitizer::normalizeCharReferences($text); if ($wgUseTidy && $this->mOptions->getTidy() || $wgAlwaysUseTidy) { $text = MWTidy::tidy($text); } else { # attempt to sanitize at least some nesting problems # (bug #2702 and quite a few others) $tidyregs = array('/(<([bi])>)(<([bi])>)?([^<]*)(<\\/?a[^<]*>)([^<]*)(<\\/\\4>)?(<\\/\\2>)/' => '\\1\\3\\5\\8\\9\\6\\1\\3\\7\\8\\9', '/(<a[^>]+>)([^<]*)(<a[^>]+>[^<]*)<\\/a>(.*)<\\/a>/' => '\\1\\2</a>\\3</a>\\1\\4</a>', '/(<([aib]) [^>]+>)([^<]*)(<div([^>]*)>)(.*)(<\\/div>)([^<]*)(<\\/\\2>)/' => '\\1\\3<div\\5>\\6</div>\\8\\9', '/<([bi])><\\/\\1>/' => ''); $text = preg_replace(array_keys($tidyregs), array_values($tidyregs), $text); } if ($this->mExpensiveFunctionCount > $this->mOptions->getExpensiveParserFunctionLimit()) { $this->limitationWarn('expensive-parserfunction', $this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit()); } wfRunHooks('ParserAfterTidy', array(&$this, &$text)); # Information on include size limits, for the benefit of users who try to skirt them if ($this->mOptions->getEnableLimitReport()) { $max = $this->mOptions->getMaxIncludeSize(); $cpuTime = $this->mOutput->getTimeSinceStart('cpu'); if ($cpuTime !== null) { $this->mOutput->setLimitReportData('limitreport-cputime', sprintf("%.3f", $cpuTime)); } $wallTime = $this->mOutput->getTimeSinceStart('wall'); $this->mOutput->setLimitReportData('limitreport-walltime', sprintf("%.3f", $wallTime)); $this->mOutput->setLimitReportData('limitreport-ppvisitednodes', array($this->mPPNodeCount, $this->mOptions->getMaxPPNodeCount())); $this->mOutput->setLimitReportData('limitreport-ppgeneratednodes', array($this->mGeneratedPPNodeCount, $this->mOptions->getMaxGeneratedPPNodeCount())); $this->mOutput->setLimitReportData('limitreport-postexpandincludesize', array($this->mIncludeSizes['post-expand'], $max)); $this->mOutput->setLimitReportData('limitreport-templateargumentsize', array($this->mIncludeSizes['arg'], $max)); $this->mOutput->setLimitReportData('limitreport-expansiondepth', array($this->mHighestExpansionDepth, $this->mOptions->getMaxPPExpandDepth())); $this->mOutput->setLimitReportData('limitreport-expensivefunctioncount', array($this->mExpensiveFunctionCount, $this->mOptions->getExpensiveParserFunctionLimit())); wfRunHooks('ParserLimitReportPrepare', array($this, $this->mOutput)); $limitReport = "NewPP limit report\n"; if ($wgShowHostnames) { $limitReport .= 'Parsed by ' . wfHostname() . "\n"; } foreach ($this->mOutput->getLimitReportData() as $key => $value) { if (wfRunHooks('ParserLimitReportFormat', array($key, &$value, &$limitReport, false, false))) { $keyMsg = wfMessage($key)->inLanguage('en')->useDatabase(false); $valueMsg = wfMessage(array("{$key}-value-text", "{$key}-value"))->inLanguage('en')->useDatabase(false); if (!$valueMsg->exists()) { $valueMsg = new RawMessage('$1'); } if (!$keyMsg->isDisabled() && !$valueMsg->isDisabled()) { $valueMsg->params($value); $limitReport .= "{$keyMsg->text()}: {$valueMsg->text()}\n"; } } } // Since we're not really outputting HTML, decode the entities and // then re-encode the things that need hiding inside HTML comments. $limitReport = htmlspecialchars_decode($limitReport); wfRunHooks('ParserLimitReport', array($this, &$limitReport)); // Sanitize for comment. Note '‐' in the replacement is U+2010, // which looks much like the problematic '-'. $limitReport = str_replace(array('-', '&'), array('‐', '&'), $limitReport); $text .= "\n<!-- \n{$limitReport}-->\n"; if ($this->mGeneratedPPNodeCount > $this->mOptions->getMaxGeneratedPPNodeCount() / 10) { wfDebugLog('generated-pp-node-count', $this->mGeneratedPPNodeCount . ' ' . $this->mTitle->getPrefixedDBkey()); } } $this->mOutput->setText($text); $this->mRevisionId = $oldRevisionId; $this->mRevisionObject = $oldRevisionObject; $this->mRevisionTimestamp = $oldRevisionTimestamp; $this->mRevisionUser = $oldRevisionUser; $this->mRevisionSize = $oldRevisionSize; $this->mInputSize = false; wfProfileOut($fname); wfProfileOut(__METHOD__); return $this->mOutput; }
static function getDeleteReasonFromCode($article, &$defaultReason) { $whArticle = WikihowArticleEditor::newFromArticle($article); $intro = $whArticle->getSummary(); $matches = array(); preg_match('/{{nfd.*}}/i', $intro, $matches); if ($matches[0] != null) { $loc = stripos($matches[0], "|", 4); if ($loc) { //there is a reason $loc2 = stripos($matches[0], "|", $loc + 1); if (!$loc2) { $loc2 = stripos($matches[0], "}", $loc + 1); } //ok now grab the reason $nfdreason = substr($matches[0], $loc + 1, $loc2 - $loc - 1); switch ($nfdreason) { case 'acc': $defaultReason = "Accuracy"; break; case 'adv': $defaultReason = "Advertising"; break; case 'cha': $defaultReason = "Character"; break; case 'dan': $defaultReason = "Extremely Dangerous"; break; case 'dru': $defaultReason = "Drug focused"; break; case 'hat': $defaultReason = "Hate/racist"; break; case 'imp': $defaultReason = "Impossible"; break; case 'inc': $defaultReason = "Incomplete"; break; case 'jok': $defaultReason = "Joke"; break; case 'mea': $defaultReason = "Mean-spirited"; break; case 'not': $defaultReason = "Not a how-to"; break; case 'pol': $defaultReason = "Political opinion"; break; case 'pot': $defaultReason = "Potty humor"; break; case 'sar': $defaultReason = "Sarcastic"; break; case 'sex': $defaultReason = "Sexually explicit"; break; case 'soc': $defaultReason = "Societal Instructions"; break; case 'ill': $defaultReason = "Universally illegal"; break; case 'van': $defaultReason = "Vanity pages"; break; case 'jok': $defaultReason = "Joke"; break; case 'dup': $defaultReason = "Duplicate"; break; } } } return true; }
/** * Convert wikitext to HTML * Do not call this function recursively. * * @param string $text Text we want to parse * @param Title &$title A title object * @param array $options * @param boolean $linestart * @param boolean $clearState * @param int $revid number to pass in {{REVISIONID}} * @return ParserOutput a ParserOutput */ public function parse($text, &$title, $options, $linestart = true, $clearState = true, $revid = null) { /** * First pass--just handle <nowiki> sections, pass the rest off * to internalParse() which does all the real work. */ global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgParser; $fname = 'Parser::parse-' . wfGetCaller(); wfProfileIn(__METHOD__); wfProfileIn($fname); if ($clearState) { $this->clearState(); } $this->mOptions = $options; $this->setTitle($title); $oldRevisionId = $this->mRevisionId; $oldRevisionTimestamp = $this->mRevisionTimestamp; if ($revid !== null) { $this->mRevisionId = $revid; $this->mRevisionTimestamp = null; } //initialize the image array for later $oldParser = $wgParser; $wgParser = new Parser(); WikihowArticleEditor::setImageSections($text); $wgParser = $oldParser; $this->setOutputType(self::OT_HTML); wfRunHooks('ParserBeforeStrip', array(&$this, &$text, &$this->mStripState)); # No more strip! wfRunHooks('ParserAfterStrip', array(&$this, &$text, &$this->mStripState)); $text = $this->internalParse($text); $text = $this->mStripState->unstripGeneral($text); # Clean up special characters, only run once, next-to-last before doBlockLevels $fixtags = array('/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1 \\2', '/(\\302\\253) /' => '\\1 '); $text = preg_replace(array_keys($fixtags), array_values($fixtags), $text); # only once and last $text = $this->doBlockLevels($text, $linestart); $this->replaceLinkHolders($text); # the position of the parserConvert() call should not be changed. it # assumes that the links are all replaced and the only thing left # is the <nowiki> mark. # Side-effects: this calls $this->mOutput->setTitleText() $text = $wgContLang->parserConvert($text, $this); $text = $this->mStripState->unstripNoWiki($text); wfRunHooks('ParserBeforeTidy', array(&$this, &$text)); //!JF Move to its own function $uniq_prefix = $this->mUniqPrefix; $matches = array(); $elements = array_keys($this->mTransparentTagHooks); $text = Parser::extractTagsAndParams($elements, $text, $matches, $uniq_prefix); foreach ($matches as $marker => $data) { list($element, $content, $params, $tag) = $data; $tagName = strtolower($element); if (isset($this->mTransparentTagHooks[$tagName])) { $output = call_user_func_array($this->mTransparentTagHooks[$tagName], array($content, $params, $this)); } else { $output = $tag; } $this->mStripState->general->setPair($marker, $output); } $text = $this->mStripState->unstripGeneral($text); $text = Sanitizer::normalizeCharReferences($text); if ($wgUseTidy and $this->mOptions->mTidy or $wgAlwaysUseTidy) { $text = Parser::tidy($text); } else { # attempt to sanitize at least some nesting problems # (bug #2702 and quite a few others) $tidyregs = array('/(<([bi])>)(<([bi])>)?([^<]*)(<\\/?a[^<]*>)([^<]*)(<\\/\\4>)?(<\\/\\2>)/' => '\\1\\3\\5\\8\\9\\6\\1\\3\\7\\8\\9', '/(<a[^>]+>)([^<]*)(<a[^>]+>[^<]*)<\\/a>(.*)<\\/a>/' => '\\1\\2</a>\\3</a>\\1\\4</a>', '/(<([aib]) [^>]+>)([^<]*)(<div([^>]*)>)(.*)(<\\/div>)([^<]*)(<\\/\\2>)/' => '\\1\\3<div\\5>\\6</div>\\8\\9', '/<([bi])><\\/\\1>/' => ''); $text = preg_replace(array_keys($tidyregs), array_values($tidyregs), $text); } wfRunHooks('ParserAfterTidy', array(&$this, &$text)); # Information on include size limits, for the benefit of users who try to skirt them if ($this->mOptions->getEnableLimitReport()) { $max = $this->mOptions->getMaxIncludeSize(); $limitReport = "NewPP limit report\n" . "Preprocessor node count: {$this->mPPNodeCount}/{$this->mOptions->mMaxPPNodeCount}\n" . "Post-expand include size: {$this->mIncludeSizes['post-expand']}/{$max} bytes\n" . "Template argument size: {$this->mIncludeSizes['arg']}/{$max} bytes\n"; wfRunHooks('ParserLimitReport', array($this, &$limitReport)); $text .= "\n<!-- \n{$limitReport}-->\n"; } $this->mOutput->setText($text); $this->mRevisionId = $oldRevisionId; $this->mRevisionTimestamp = $oldRevisionTimestamp; wfProfileOut($fname); wfProfileOut(__METHOD__); return $this->mOutput; }
/** * Utility method to return the wikitext for an article */ public static function getWikitext(&$dbr, $title) { global $wgTitle; if (!$title) { return false; } // try to see if the wikihow article editor instance already has this title loaded $whow = WikihowArticleEditor::wikiHowArticleIfMatchingTitle($title); if ($whow) { $wikitext = $whow->mLoadText; } else { $rev = Revision::loadFromTitle($dbr, $title); if (!$rev) { return false; } $wikitext = $rev->getText(); } return $wikitext; }
function getRelatedWikihowsFromSource($r, $num) { $text = $r->getText(); $whow = WikihowArticleEditor::newFromText($text); $related = preg_replace("@^==.*@m", "", $whow->getSection('related wikihows')); $preg = "/\\|[^\\]]*/"; $related = preg_replace($preg, "", $related); $rarray = split("\n", $related); $result = ""; $count = 0; foreach ($rarray as $related) { preg_match("/\\[\\[(.*)\\]\\]/", $related, $rmatch); $t = Title::newFromText($rmatch[1]); if ($t) { $a = new Article($t); if (!$a->isRedirect()) { $result .= self::formatRelated($t); if (++$count == $num) { break; } } } } return $result; }
/** * Make an image link * @param Title $title Title object * @param File $file File object, or false if it doesn't exist * * @param array $frameParams Associative array of parameters external to the media handler. * Boolean parameters are indicated by presence or absence, the value is arbitrary and * will often be false. * thumbnail If present, downscale and frame * manualthumb Image name to use as a thumbnail, instead of automatic scaling * framed Shows image in original size in a frame * frameless Downscale but don't frame * upright If present, tweak default sizes for portrait orientation * upright_factor Fudge factor for "upright" tweak (default 0.75) * border If present, show a border around the image * align Horizontal alignment (left, right, center, none) * valign Vertical alignment (baseline, sub, super, top, text-top, middle, * bottom, text-bottom) * alt Alternate text for image (i.e. alt attribute). Plain text. * caption HTML for image caption. * * @param array $handlerParams Associative array of media handler parameters, to be passed * to transform(). Typical keys are "width" and "page". * @param string $time, timestamp of the file, set as false for current */ function makeImageLink2(Title $title, $file, $frameParams = array(), $handlerParams = array(), $time = false) { global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright; if ($file && !$file->allowInlineDisplay()) { wfDebug(__METHOD__ . ': ' . $title->getPrefixedDBkey() . " does not allow inline display\n"); return $this->makeKnownLinkObj($title); } if (!$file) { return; } // Shortcuts $fp =& $frameParams; $hp =& $handlerParams; $section = WikihowArticleEditor::getImageSection($file->getName()); // Clean up parameters $page = isset($hp['page']) ? $hp['page'] : false; if (!isset($fp['align'])) { $fp['align'] = ''; } if (!isset($fp['alt'])) { $fp['alt'] = ''; } $imageClass = ""; $prefix = $postfix = ''; $isPortrait = false; $isLarge = false; $sourceWidth = $file->getWidth(); $sourceHeight = $file->getHeight(); if ($sourceHeight > $sourceWidth) { if ($sourceWidth > 200) { $isPortrait = true; $isLarge = true; } } else { //landscape if ($sourceWidth > 400) { $isLarge = true; } } if ($section != "summary" && $section != "steps") { $isLarge = false; } if ($section == "summary") { //for intro they must specify 625 and center to have it shown if ($hp['width'] >= 625) { $imageClass .= " introimage "; } } if ($file && !isset($hp['width'])) { $hp['width'] = $file->getWidth($page); if (isset($fp['thumbnail']) || isset($fp['framed']) || isset($fp['frameless']) || !$hp['width']) { $wopt = $wgUser->getOption('thumbsize'); if (!isset($wgThumbLimits[$wopt])) { $wopt = User::getDefaultOption('thumbsize'); } // Reduce width for upright images when parameter 'upright' is used if (isset($fp['upright']) && $fp['upright'] == 0) { $fp['upright'] = $wgThumbUpright; } // Use width which is smaller: real image width or user preference width // For caching health: If width scaled down due to upright parameter, round to full __0 pixel to avoid the creation of a lot of odd thumbs $prefWidth = isset($fp['upright']) ? round($wgThumbLimits[$wopt] * $fp['upright'], -1) : $wgThumbLimits[$wopt]; if ($hp['width'] <= 0 || $prefWidth < $hp['width']) { $hp['width'] = $prefWidth; } } } //not using thumbs on large images anymore if (!$isLarge && isset($fp['thumbnail']) || isset($fp['manualthumb']) || isset($fp['framed'])) { # Create a thumbnail. Alignment depends on language # writing direction, # right aligned for left-to-right- # languages ("Western languages"), left-aligned # for right-to-left-languages ("Semitic languages") # # If thumbnail width has not been provided, it is set # to the default user option as specified in Language*.php if ($fp['align'] == '') { $fp['align'] = $wgContLang->isRTL() ? 'left' : 'right'; } return $prefix . $this->makeThumbLink2($title, $file, $fp, $hp, $time) . $postfix; } if ($file && isset($fp['frameless'])) { # For "frameless" option: do not present an image bigger than the source (for bitmap-style images) # This is the same behaviour as the "thumb" option does it already. if ($sourceWidth && !$file->mustRender() && $hp['width'] > $sourceWidth) { $hp['width'] = $sourceWidth; } } if ($file && $hp['width']) { # Create a resized image, without the additional thumbnail features if ($isLarge) { if ($isPortrait) { //it's a portrait image $height = min(550, $sourceHeight); $hp['width'] = $sourceWidth * $height / $sourceHeight; $imageClass .= " largeimage portrait"; } else { if ($isLarge) { //this is our low threshold, so show it as big as possible $hp['width'] = min(670, $sourceWidth); //now make sure it's not too tall. $newHeight = $sourceHeight * $hp['width'] / $sourceWidth; if ($newHeight > 550) { //limit all images to 550 $hp['width'] = $sourceWidth * 525 / $sourceHeight; } $imageClass .= " largeimage "; } } if ($hp['width'] < 670) { $imageClass .= " underwidth "; } } $thumb = $file->transform($hp); } else { $thumb = false; } if (!$isLarge) { $imageClass .= " t{$fp['align']}"; } if (!$thumb) { $s = $this->makeBrokenImageLinkObj($title, '', '', '', '', $time == true); } else { $s = $thumb->toHtml(array('desc-link' => true, 'href' => '', 'onclick' => 'return loadimg("' . $thumb->path . '", "' . $thumb->url . '" );', 'alt' => $fp['alt'], 'valign' => isset($fp['valign']) ? $fp['valign'] : false, 'img-class' => isset($fp['border']) ? 'thumbborder' : false)); $h = $thumb->getHeight(); $w = $thumb->getWidth(); /*$s = "<div class='rounders' style='width:{$w}px;height:{$h}px;'>$s <div class='corner top_left'></div><div class='corner top_right'></div><div class='corner bottom_left'></div><div class='corner bottom_right'></div> </div>";*/ } if ('' == $fp['align']) { $fp['align'] = 'right'; } $imageClass .= " float{$fp['align']} "; if (isset($fp['thumbnail'])) { $imageClass .= " mthumb "; } //for mobile thumb $rptLink = class_exists('InaccurateImages') ? InaccurateImages::getReportImageLink() : ""; $s = "<div class='mwimg {$imageClass}' style='max-width:{$hp['width']}px'>{$rptLink}{$s}</div>"; return str_replace("\n", ' ', $prefix . $s . $postfix); }
/** * * Checks a specific article for spelling mistakes. * */ function spellCheckArticle(&$dbw, $articleId, &$pspell, &$capsString, &$whitelistArray) { //first remove all mistakes from the mapping table $dbw->delete('spellchecker_page', array('sp_page' => $articleId), __FUNCTION__); $title = Title::newFromID($articleId); if ($title) { $revision = Revision::newFromTitle($title); if (!$revision) { continue; } $text = $revision->getText(); //now need to remove the sections we're not going to check $wikiArticle = WikihowArticleEditor::newFromText($text); $sourceText = $wikiArticle->getSection(wfMsg('sources')); //WikiHow::textify($wikiArticle->getSection(wfMsg('sources'), array('remove_ext_links'=>1))); $newtext = str_replace($sourceText, "", $text); $relatedText = $wikiArticle->getSection(wfMsg('related')); //WikiHow::textify($wikiArticle->getSection(wfMsg('sources'), array('remove_ext_links'=>1))); $newtext = str_replace($relatedText, "", $newtext); //remove reference tags $newtext = preg_replace('@<ref>[^<].*</ref>@', "", $newtext); //remove links $newtext = preg_replace('@\\[\\[[^\\]].*\\]\\]@', "", $newtext); //remove magic words $newtext = preg_replace('@__[^_]*__@', "", $newtext); //replace wierd apostrophes $newtext = str_replace('’', "'", $newtext); $newtext = WikihowArticleEditor::textify($newtext); preg_match_all('/\\b(\\w|\')+\\b/u', $newtext, $matches); //u modified allows for international characters $foundErrors = false; foreach ($matches[0] as $match) { $word_id = wikiHowDictionary::spellCheckWord($dbw, $match, $pspell, $capsString, $whitelistArray); if ($word_id > 0) { //insert into the mapping table $dbw->insert('spellchecker_page', array('sp_page' => $articleId, 'sp_word' => $word_id), __FUNCTION__, array('IGNORE')); $foundErrors = true; } } if ($foundErrors) { $sql = "INSERT INTO spellchecker (sc_page, sc_timestamp, sc_dirty, sc_errors, sc_exempt) VALUES (" . $articleId . ", " . wfTimestampNow() . ", 0, 1, 0) ON DUPLICATE KEY UPDATE sc_dirty = '0', sc_errors = '1', sc_timestamp = " . wfTimestampNow(); $dbw->query($sql, __FUNCTION__); } else { $dbw->update('spellchecker', array('sc_errors' => 0, 'sc_dirty' => 0), array('sc_page' => $articleId), __FUNCTION__); } } }
function setRelatedWikiHows($title) { global $wgTitle, $wgParser, $wgMemc, $wgUser; $key = wfMemcKey("ImageHelper_related" . $title->getArticleID()); $result = $wgMemc->get($key); if ($result) { return $result; } $templates = wfMsgForContent('ih_categories_ignore'); $templates = split("\n", $templates); $templates = str_replace("http://www.wikihow.com/Category:", "", $templates); $templates = array_flip($templates); // make the array associative. $r = Revision::newFromTitle($title); $relatedTitles = array(); if ($r) { $text = $r->getText(); $whow = WikihowArticleEditor::newFromText($text); $related = preg_replace("@^==.*@m", "", $whow->getSection('related wikihows')); if ($related != "") { $preg = "/\\|[^\\]]*/"; $related = preg_replace($preg, "", $related); $rarray = split("\n", $related); foreach ($rarray as $related) { preg_match("/\\[\\[(.*)\\]\\]/", $related, $rmatch); //check to make sure this article isn't in a category //that we don't want to show $title = Title::MakeTitle($s->page_namespace, $rmatch[1]); $cats = $title->getParentCategories(); if (is_array($cats) && sizeof($cats) > 0) { $keys = array_keys($cats); $found = false; for ($i = 0; $i < sizeof($keys) && !$found; $i++) { $t = Title::newFromText($keys[$i]); if (isset($templates[urldecode($t->getPartialURL())])) { //this article is in a category we don't want to show $found = true; break; } } if ($found) { continue; } } $relatedTitles[] = $rmatch[1]; } } else { $cats = $title->getParentCategories(); $cat1 = ''; if (is_array($cats) && sizeof($cats) > 0) { $keys = array_keys($cats); $cat1 = ''; $found = false; $templates = wfMsgForContent('ih_categories_ignore'); $templates = split("\n", $templates); $templates = str_replace("http://www.wikihow.com/Category:", "", $templates); $templates = array_flip($templates); // make the array associative. for ($i = 0; $i < sizeof($keys) && !$found; $i++) { $t = Title::newFromText($keys[$i]); if (isset($templates[urldecode($t->getPartialURL())])) { continue; } $cat1 = $t->getDBKey(); $found = true; break; } } if ($cat1 != '') { $sk = $wgUser->getSkin(); $dbr = wfGetDB(DB_SLAVE); $num = intval(wfMsgForContent('num_related_articles_to_display')); $res = $dbr->select('categorylinks', 'cl_from', array('cl_to' => $cat1), "WikiHowSkin:getRelatedArticlesBox", array('ORDER BY' => 'rand()', 'LIMIT' => $num * 2)); $count = 0; while (($row = $dbr->fetchObject($res)) && $count < $num) { if ($row->cl_from == $title->getArticleID()) { continue; } $t = Title::newFromID($row->cl_from); if (!$t) { continue; } if ($t->getNamespace() != NS_MAIN) { continue; } $relatedTitles[] = $t->getText(); $count++; } } } } $wgMemc->set(wfMemcKey("ImageHelper_related" . $title->getArticleID()), $relatedTitles); return $relatedTitles; }
* */ global $IP, $wgTitle, $wgUser; require_once '../commandLine.inc'; $dbr = wfGetDB(DB_SLAVE); $res = $dbr->select('page', '*', array('page_namespace' => 0, 'page_is_redirect' => 0), __FUNCTION__, array("LIMIT" => 20)); $ids = array(); while ($row = $dbr->fetchObject($res)) { $ids[] = $row->page_id; } $wgUser = User::newFromName("Broken-Internal-Link-Removal"); foreach ($ids as $id) { $title = Title::newFromID($id); if ($title) { $article = new Article($title); $wikiHow = new WikihowArticleEditor(); $wikiHow->loadFromArticle($article); $relatedArticles = $wikiHow->getSection(wfMsg('Relatedwikihows')); $relatedId = $wikiHow->getSectionNumber(wfMsg('Relatedwikihows')); if ($relatedArticles != "") { $changed = false; /** * The Article::getSection returns more than the * WikihowArticleEditor::getSection. So need to grab the difference * before processing so we can add it back later. */ $revision = Revision::newFromTitle($title); $fullRelated = $article->getSection($revision->getText(), $relatedId); $loc = stripos($fullRelated, $relatedArticles); $remainderRelated = substr($fullRelated, $loc + strlen($relatedArticles)); if ($remainderRelated === false) {
function getPoints($r, $d, $de, $showdetails = false) { global $wgOut; $points = 0; $oldText = ""; if ($d['revlo']) { $oldText = $d['revlo']->mText; } $newText = $d['revhi']->mText; $flatOldText = preg_replace("@[^a-zA-z]@", "", WikihowArticleEditor::textify($oldText)); // get the points based on number of new / changed words $diffhtml = $de->generateDiffBody($d['revlo']->mText, $d['revhi']->mText); $addedwords = 0; preg_match_all('@<span class="diffchange diffchange-inline">[^>]*</span>@m', $diffhtml, $matches); foreach ($matches[0] as $m) { $m = WikihowArticleEditor::textify($m); preg_match_all("@\\b\\w+\\b@", $m, $words); $addedwords += sizeof($words[0]); } preg_match_all('@<td class="diff-addedline">(.|\\n)*</td>@Um', $diffhtml, $matches); #echo $diffhtml; print_r($matches); exit; foreach ($matches[0] as $m) { if (preg_match("@diffchange-inline@", $m)) { // already accounted for in change-inline continue; } $m = WikihowArticleEditor::textify($m); // account for changes in formatting and punctuation // by flattening out the change piece of text and comparing to the // flattened old version of the text $flatM = preg_replace("@[^a-zA-z]@", "", $m); if (!empty($flatM) && strpos($flatOldText, $flatM) !== false) { continue; } preg_match_all("@\\b\\w+\\b@", $m, $words); $addedwords += sizeof($words[0]); } if ($showdetails) { $wgOut->addHTML("<h3>Points for edit (10 max):</h3><ul>"); } if (preg_match("@Reverted@", $r->mComment)) { if ($showdetails) { $wgOut->addHTML("<li>No points : reverted edit.</li></ul><hr/>"); } return 0; } if (preg_match("@Reverted edits by.*" . $d['revhi']->mUserText . "@", $d['nextcomment'])) { if ($showdetails) { $wgOut->addHTML("<li>No points: This edit was reverted by {$d['nextuser']}\n</li></ul><hr/>"); } return 0; } $wordpoints = min(floor($addedwords / 100), 5); if ($showdetails) { $wgOut->addHTML("<li>Approx # of new words: " . $addedwords . ": {$wordpoints} points (1 point per 100 words, max 5)</li>"); } $points += $wordpoints; // new images $newimagepoints = array(); preg_match_all("@\\[\\[Image:[^\\]|\\|]*@", $newText, $images); $newimages = $newimagepoints = 0; foreach ($images[0] as $i) { if (strpos($oldText, $i) === false) { $newimagepoints++; $newimages++; } } $newimagepoints = min($newimagepoints, 2); $points += $newimagepoints; if ($showdetails) { $wgOut->addHTML("<li>Number of new images: " . $newimages . ": {$newimagepoints} points (1 point per image, max 2)</li>"); } // new page points if ($d['newpage']) { if ($showdetails) { $wgOut->addHTML("<li>New page: 1 point</li>"); } $points += 1; } // template points preg_match_all("@\\{\\{[^\\}]*\\}\\}@", $newText, $templates); foreach ($templates[0] as $t) { if (strpos($oldText, $t) === false && $t != "{{reflist}}") { if ($showdetails) { $wgOut->addHTML("<li>Template added: 1 point</li>"); } $points++; break; } } // category added points preg_match_all("@\\[\\[Category:[^\\]]*\\]\\]@", $newText, $cats); foreach ($cats[0] as $c) { if (strpos($oldText, $c) === false) { if ($showdetails) { $wgOut->addHTML("<li>Category added: 1 point</li>"); } $points++; break; } } $points = min($points, 10); if ($showdetails) { $wgOut->addHTML("</ul>"); } if ($showdetails) { $wgOut->addHTML("<b>Total points: {$points}</b><hr/>"); } return $points; }
function execute($par) { global $wgRequest, $wgSitename, $wgLanguageCode, $IP; global $wgDeferredUpdateList, $wgOut, $wgUser, $wgServer; $this->setHeaders(); if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } $target = isset($par) ? $par : $wgRequest->getVal('target'); if (!$target) { $wgOut->addHTML(wfMsg('notarget')); return; } $titleObj = Title::newFromUrl(urldecode($target)); if (!$titleObj || !$titleObj->exists()) { $wgOut->addHTML('Error: bad target'); return; } $whow = WikihowArticleEditor::newFromTitle($titleObj); $rev = Revision::newFromTitle($titleObj); $article = Article::newFromTitle($titleObj, $this->getContext()); $text = $rev->getText(); if ($wgRequest->wasPosted()) { // protect from users who can't edit if (!$titleObj->userCan('edit')) { $wgOut->readOnlyPage($article->getContent(), true); return; } // construct the related wikihow section $rel_array = split("\\|", $wgRequest->getVal('related_list')); $result = ""; foreach ($rel_array as $rel) { $rel = urldecode(trim($rel)); if (!$rel) { continue; } $result .= "* [[" . $rel . "|" . wfMsg('howto', $rel) . "]]\n"; } if (strpos($text, "\n== " . wfMsg('relatedwikihows') . " ==\n") !== false) { // no newline neeeded to start with $result = "== " . wfMsg('relatedwikihows') . " ==\n" . $result; } else { $result = "\n== " . wfMsg('relatedwikihows') . " ==\n" . $result; } $text = ""; $index = 0; $content = $article->getContent(); $last_heading = ""; $inserted = false; $section = -1; $ext_links_section = -1; if ($article->getSection($content, $index) == null) { $index++; // weird where there's no summary } while (($sectiontext = $article->getSection($content, $index)) != null) { $i = strpos($sectiontext, "\n"); if ($i > 0) { $heading = substr($sectiontext, 0, $i); $heading = trim(str_replace("==", "", $heading)); if ($heading == wfMsg('relatedwikihows')) { $section = $index; break; } if ($heading == wfMsg('sources')) { $ext_links_section = $index; } } $index++; } $text = $result; $tail = ''; $text = $article->getContent(); // figure out which section to replace if related wikihows // don't exist $just_append = false; if ($section <= 0) { if ($ext_links_section > 0) { // related wikihows have to go before external links $section = $ext_links_section; // glue external links and related wikihows together // and replace external links $result = $result . "\n" . $article->getSection($content, $section); } else { $section = $index; $result = "\n" . $result; // make it a bit prettier $just_append = true; } } else { $s = $article->getSection($content, $section); $lines = split("\n", $s); for ($i = 1; $i < sizeof($lines); $i++) { $line = $lines[$i]; if (strpos($line, "*") !== 0) { // not a list item $tail .= "\n" . $line; } } } $result .= $tail; $summary = ''; if (!$just_append) { $text = $article->replaceSection($section, $result, $summary); } else { $text = $text . $result; } $watch = false; $minor = false; $forceBot = false; if ($wgUser->getID() > 0) { $watch = $wgUser->isWatched($titleObj); } $summary = wfMsg('relatedwikihows'); // summary for the edit $article->updateArticle($text, $summary, $minor, $watch, $forceBot); $this->getContext()->getOutput()->redirect($article->getTitle()->getFullURL()); } // MW should handle editing extensions better, duplication of code sucks if ($titleObj->isProtected('edit')) { if ($titleObj->isSemiProtected()) { $notice = wfMsg('semiprotectedpagewarning'); } else { $notice = wfMsg('protectedpagewarning'); } $wgOut->addWikiText($notice); } $relatedHTML = ""; $text = $article->getContent(); $relwh = $whow->getSection("related wikihows"); if ($relwh != "") { $related_vis = "show"; $relatedHTML = $relwh; $relatedHTML = str_replace("*", "", $relatedHTML); $relatedHTML = str_replace("[[", "", $relatedHTML); $relatedHTML = str_replace("]]", "", $relatedHTML); $lines = split("\n", $relatedHTML); $relatedHTML = ""; foreach ($lines as $line) { $xx = strpos($line, "|"); if ($xx !== false) { $line = substr($line, 0, $xx); } $line = trim($line); if ($line == "") { continue; } $relatedHTML .= "<option value=\"" . str_replace("\"", ""e", $line) . "\">{$line}</option>\n"; } } $me = Title::makeTitle(NS_SPECIAL, "ManageRelated"); $cssFile = wfGetPad('/extensions/min/f/extensions/wikihow/ManageRelated/managerelated.css?rev=') . WH_SITEREV; $jsFile = wfGetPad('/extensions/min/?f=extensions/wikihow/ManageRelated/managerelated.js,extensions/wikihow/common/jquery.scrollTo/jquery.scrollTo.js&rev=') . WH_SITEREV; $targetEnc = htmlspecialchars($target, ENT_QUOTES); $wgOut->addHTML(<<<EOHTML \t<style type='text/css' media='all'>/*<![CDATA[*/ @import '{$cssFile}'; /*]]>*/</style> \t<script type='text/javascript'> \t\tvar wgServer = "{$wgServer}"; \t</script> \t<script type='text/javascript' src='{$jsFile}'></script> \t<form method='POST' action='{$me->getFullURL()}' name='temp' onsubmit='return WH.ManageRelated.check();'> \tYou are currently editing related wikiHows for the article \t<a href='{$titleObj->getFullURL()}' target='new'>How to {$titleObj->getFullText()}</a>.<br/> \t<table style='padding: 10px 5px 25px 5px;'> \t<tr><td valign='top'> \t<ol><li>Enter some search terms to find related wikiHows and press 'Search'.</li></ol> \t<input type='hidden' name='target' value='{$targetEnc}'/> \t<input type='hidden' name='related_list'/> \t<input type='text' name='q'/> \t<input type='button' class='btn' onclick='WH.ManageRelated.check();' value='Search' style="margin-top: 5px;" /> \t</td> \t<td valign='top' style='padding-left: 10px; border-left: 1px solid #ddd;'> \t<div style='width: 175px; float: left;'> \t<u>Related wikiHows</u> \t</div> \t<div style='width: 175px; float: right; text-align: right; margin-bottom:5px;'> \tMove <input type=button value='Up ↑' class='btn' onclick='WH.ManageRelated.moveRelated("up");'/> <input type=button value='Down ↓' class='btn' onclick='WH.ManageRelated.moveRelated("down");'/> \t</div> \t<select size='5' id='related' ondblclick='WH.ManageRelated.viewRelated();'> \t\t{$relatedHTML} \t</select> \t<br/><br/> \t<div style='width: 205px; float: left; text-align: left; font-size: xx-small; font-style: italic;'> \t(double click item to open wikiHow in new window) \t</div> \t<div style='width: 175px; float: right; text-align: right;'> \t<input type=button onclick='WH.ManageRelated.removeRelated();' value='Remove' class='btn'/> \t<input type=button value='Save' onclick='WH.ManageRelated.submitForm();' class='btn'/> \t</div> \t</td></tr> \t<tr> \t\t<td id='lucene_results' colspan='2' valign='top' class='lucene_results' style="padding-top: 10px;"></td> \t</tr><tr> \t\t<td id='previewold' colspan='2' valign='top'></td> \t</tr></table> \t</form> \t<div id='preview'></div> EOHTML ); }
public function execute($par) { global $wgRequest, $wgOut, $IP; $target = isset($par) ? $par : $wgRequest->getVal('target'); if (is_null($target)) { $wgOut->addHTML("<b>Error:</b> No parameter passed to Copyrightchecker."); return; } $query = $wgRequest->getVal('query'); wfLoadExtensionMessages('Newarticleboost'); $title = Title::newFromURL($target); $rev = Revision::newFromTitle($title); $wgOut->setArticleBodyOnly(true); if (!$query) { // Get the text and strip the steps header, any templates, // flatten it to HTML and strip the tags if (!$rev) { echo "Revision for article not found by copyright check"; return; } $wikitext = $rev->getText(); $wikitext = preg_replace("/^==[ ]+" . wfMsg('steps') . "[ ]+==/mix", "", $wikitext); $wikitext = preg_replace("/{{[^}]*}}/im", "", $wikitext); $wikitext = WikihowArticleEditor::textify($wikitext); $parts = preg_split("@\\.@", $wikitext); shuffle($parts); $queries = array(); foreach ($parts as $p) { $p = trim($p); $words = split(" ", $p); if (sizeof($words) > 5) { if (sizeof($words) > 15) { $words = array_slice($words, 0, 15); $p = implode(" ", $words); } $queries[] = $p; if (sizeof($queries) == 2) { break; } } } $query = '"' . implode('" AND "', $queries) . '"'; } require_once dirname(__FILE__) . '/GoogleAjaxSearch.class.php'; $results = GoogleAjaxSearch::getGlobalWebResults($query, 8, null); // Filter out results from wikihow.com if (sizeof($results) > 0 && is_array($results)) { $newresults = array(); for ($i = 0; $i < sizeof($results); $i++) { if (strpos($results[$i]['url'], "http://www.wikihow.com/") === 0 || strpos($results[$i]['url'], "http://m.wikihow.com/") === 0) { continue; } $newresults[] = $results[$i]; } $results = $newresults; } // Process results if (sizeof($results) > 0 && is_array($results)) { $wgOut->addHTML(wfMsg("nap_copyrightlist", $query) . "<table width='100%'>"); for ($i = 0; $i < 3 && $i < sizeof($results); $i++) { $match = $results[$i]; $c = json_decode($match['content']); $wgOut->addHTML("<tr><td><a href='{$match['url']}' target='new'>{$match['title']}</a>\n\t\t\t\t\t<br/>{$c}\n\t\t\t\t\t<br/><font size='-2'>{$match['url']}</font></td><td style='width: 100px; text-align: right; vertical-align: top;'><a href='' onclick='return nap_copyVio(\"" . htmlspecialchars($match['url']) . "\");'>Copyvio</a></td></tr>"); } $wgOut->addHTML("</table>"); } else { $wgOut->addHTML(wfMsg('nap_nocopyrightfound', $query)); } }
private function processSteps($doc) { $steps = pq('#steps'); $methods = array(); if (!$steps->length) { return array('html' => $html); } $newDoc = phpQuery::newDocument('<div id="steps" />'); $newSteps = pq('#steps'); $name = ''; $method = pq('<div class="method" />'); $newSteps->append($method); $methods[] = array('name' => $name, 'method' => $method); foreach ($steps->children() as $node) { $pqNode = pq($node); if ($pqNode->is('h3')) { $name = pq('span', $pqNode)->html(); $method = pq('<div class="method" />'); $newSteps->append($method); $methods[] = array('name' => $name, 'method' => $method); } else { $method->append($pqNode); } } // Remove first "method" if it has an empty name and // little text if (count($methods)) { $text = trim($methods[0]['method']->text()); if (!$methods[0]['name'] && strlen($text) < 10) { // remove this mostly empty un-named first method $methods[0]['method']->remove(); unset($methods[0]); // reset array indexes $methods = array_values($methods); } } $parts = 0; foreach ($methods as $key => &$method) { $ret = WikihowArticleEditor::removeMethodNamePrefix($method['name']); if ($ret['has_parts']) { $parts++; } // Remove all samples foreach (pq('*', $method['method']) as $node) { $pq = pq($node); $class = $pq->attr('class'); // class name starts with sd_ ? if (strpos($class, 'sd_') === 0) { unset($methods[$key]); } } } $methods = array_values($methods); $methodType = $parts > count($methods) - $parts ? 'part' : 'method'; foreach ($methods as &$method) { $method['type'] = $methodType; $steps = array(); $methodParent = $method['method']; foreach (pq($method['method'])->children() as $node) { $pq = pq($node); if ($pq->is('ol')) { $steps = array_merge($steps, $this->processStepContent($pq)); } else { if ($pq->is('p') || $pq->is('ul')) { $this->removeEmptyNodes($pq); $html = trim($pq->html()); if ($html) { $steps[] = array("html" => $html); } } else { if ($pq->is('h4')) { $this->removeEmptyNodes($pq); $html = trim(strip_tags($pq->html(), "<a>")); if ($html) { $steps[] = array("heading" => $html); } } else { //$class = $pq->attr('class'); //$id = $pq->attr('id'); //$tag = $node->tagName; // not sure what to do with any leftovers here..just ignore for now //decho("class", $class); //decho("id", $id); //decho("tag", $tag); } } } } if ($steps) { $method['steps'] = $steps; } else { $method['html'] = trim($method['method']->html()); } unset($method['method']); } return $methods; }
function showEditForm($formCallback = null) { global $wgOut, $wgLanguageCode, $wgRequest, $wgTitle, $wgUser, $wgLang; $whow = null; // conflict resolution if (!$wgRequest->wasPosted()) { EditPage::showEditForm(); } $wgOut->clearHTML(); //echo $this->textbox1; exit; wfRunHooks('EditPage::showEditForm:initial', array(&$this)); // are we called with just action=edit and no title? $newArticle = false; if (($wgRequest->getVal("title") == "" || $wgTitle->getArticleID() == 0) && !$this->preview) { $newArticle = true; } $sk = $wgUser->getSkin(); if (!$this->mTitle->getArticleID() && !$this->preview) { # new article $wgOut->addHTML(wfMsg("newarticletext")); } // do we have a new article? if so, format the title if it's English $wgRequest->getVal("new_article"); if ($new_article && $wgLanguageCode == "en") { $title = $this->mTitle->getText(); $old_title = $title; $title = $this->formatTitle($title); $titleObj = Title::newFromText($title); $this->mTitle = $titleObj; $this->mArticle = new Article($titleObj); } $conflictWikiHow = null; $conflictTitle = false; if ($this->isConflict) { $s = wfMsg("editconflict", $this->mTitle->getPrefixedText()); $wgOut->setPageTitle($s); if ($new_article) { $wgOut->addHTML("<b><font color=red>" . wfMsg('page-name-exists') . "</b></font><br/><br/>"); $conflictTitle = true; } else { $this->edittime = $this->mArticle->getTimestamp(); $wgOut->addHTML(wfMsg("explainconflict")); // let the advanced editor handle the situation if ($this->isConflict) { EditPage::showEditForm(); return; } } $this->textbox2 = $this->textbox1; $conflictWikiHow = WikihowArticleEditor::newFromText($this->textbox1); $this->textbox1 = $this->mArticle->getContent(true, true); $this->edittime = $this->mArticle->getTimestamp(); } else { if ($this->mTitle->getArticleID() == 0) { $s = wfMsg('creating', "\"" . wfMsg('howto', $this->mTitle->getPrefixedText()) . "\""); } else { $s = wfMsg('editing', "\"" . wfMsg('howto', $this->mTitle->getPrefixedText()) . "\""); } if ($this->section != "") { if ($this->section == "new") { $s .= wfMsg("commentedit"); } else { $s .= wfMsg("sectionedit"); } if (!$this->preview) { $sectitle = preg_match("/^=+(.*?)=+/mi", $this->textbox1, $matches); if (!empty($matches[1])) { $this->summary = "/* " . trim($matches[1]) . " */ "; } } } $wgOut->setPageTitle($s); if ($this->oldid) { $this->mArticle->setOldSubtitle($this->oldid); $wgOut->addHTML(wfMsg("editingold")); } } if (wfReadOnly()) { $wgOut->addHTML("<strong>" . wfMsg("readonlywarning") . "</strong>"); } elseif ($isCssJsSubpage and "preview" != $formtype) { $wgOut->addHTML(wfMsg("usercssjsyoucanpreview")); } if (!$newArticle && $this->mTitle->isProtected('edit')) { if ($this->mTitle->isSemiProtected()) { $notice = wfMsg('semiprotectedpagewarning'); if (wfEmptyMsg('semiprotectedpagewarning', $notice) || $notice == '-') { $notice = ''; } } else { $notice = wfMsg('protectedpagewarning'); } $wgOut->addHTML("<div class='article_inner'>\n "); $wgOut->addWikiText($notice); $wgOut->addHTML("</div>\n"); } $q = "action=submit2&override=yes"; #if ( "no" == $redirect ) { $q .= "&redirect=no"; } $action = $this->mTitle->escapeLocalURL($q); if ($newArticle) { $main = str_replace(' ', '-', wfMsg('mainpage')); $action = str_replace("&title=" . $main, "", $action); } $summary = wfMsg("summary"); $subject = wfMsg("subject"); $minor = wfMsg("minoredit"); $watchthis = wfMsg("watchthis"); $save = wfMsg("savearticle"); $prev = wfMsg("showpreview"); $cancel = $sk->makeKnownLink($this->mTitle->getPrefixedText(), wfMsg("cancel")); $edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage')); $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow')); $copywarn = wfMsg("copyrightwarning", $sk->makeKnownLink(wfMsg("copyrightpage"))); $minoredithtml = ''; if ($wgUser->isAllowed('minoredit')) { $minoredithtml = "<input tabindex='11' type='checkbox' value='1' name='wpMinoredit'" . ($this->minoredit ? " checked='checked'" : "") . " accesskey='" . wfMsg('accesskey-minoredit') . "' id='wpMinoredit' />\n" . "<label for='wpMinoredit' title='" . wfMsg('tooltip-minoredit') . "'>{$minor}</label>\n"; } $watchhtml = ''; if ($wgUser->isLoggedIn()) { $watchhtml = "<input tabindex='12' type='checkbox' name='wpWatchthis'" . ($this->watchthis ? " checked='checked'" : "") . " accesskey=\"" . htmlspecialchars(wfMsg('accesskey-watch')) . "\" id='wpWatchthis' />\n" . "<label for='wpWatchthis' title=\"" . htmlspecialchars(wfMsg('tooltip-watch')) . "\">{$watchthis}</label>\n"; } $checkboxhtml = $minoredithtml . $watchhtml; $tabindex = 14; $buttons = $this->getEditButtons($tabindex); $footerbuttons = ""; $buttons['preview'] = "<span id='gatGuidedPreview'>{$buttons['preview']}</span>"; if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) { $footerbuttons .= "<span id='gatPSBSave'>{$buttons['save']}</span>"; $footerbuttons .= "<span id='gatPSBPreview'>{$buttons['preview']}</span>"; } $saveBtn = str_replace('accesskey="s"', "", $buttons['save']); $buttons['save'] = "<span id='gatGuidedSave'>{$saveBtn}</span>"; $buttonshtml = implode($buttons, "\n"); # if this is a comment, show a subject line at the top, which is also the edit summary. # Otherwise, show a summary field at the bottom $summarytext = htmlspecialchars($wgLang->recodeForEdit($this->summary)); # FIXME $editsummary1 = ""; if ($wgRequest->getVal('suggestion')) { $summarytext .= ($summarytext == "" ? "" : ", ") . wfMsg('suggestion_edit_summary'); } if ($this->section == "new") { $commentsubject = "{$subject}: <input tabindex='1' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' />"; $editsummary = ""; } else { $commentsubject = ""; if ($wgTitle->getArticleID() == 0 && $wgTitle->getNamespace() == NS_MAIN && $summarytext == "") { $summarytext = wfMsg('creating_new_article'); } $editsummary = "<input tabindex='10' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' /><br />"; $editsummary1 = "<input tabindex='10' type='text' value=\"{$summarytext}\" name=\"wpSummary1\" id='wpSummary1' maxlength='200' size='60' /><br />"; } // create the wikiHow if ($conflictWikiHow == null) { if ($this->textbox1 != "") { $whow = WikihowArticleEditor::newFromText($this->textbox1); } else { $whow = WikihowArticleEditor::newFromArticle($this->mArticle); } } else { $whow = $conflictWikiHow; } //********** SETTING UP THE FORM // // // // $confirm = "window.onbeforeunload = confirmExit;"; if ($wgUser->getOption('disablewarning') == '1') { $confirm = ""; } $wgOut->addHTML("<script language=\"JavaScript\">\n\t\t\t\tvar isGuided = true;\n\t\t\t\tvar needToConfirm = false;\n\t\t\t\tvar checkMinLength = true;\n\t\t\t\t{$confirm}\n\t\t\t\tfunction confirmExit() {\n\t\t\t\t\tif (needToConfirm)\n\t\t\t\t\t\treturn \"" . wfMsg('all-changes-lost') . "\";\n\t\t\t\t}\n\t\t\t\tfunction addrows(element) {\n\t\t\t\t\tif (element.rows < 32) {\n\t\t\t\t\t\telement.rows += 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction removerows(element) {\n\t\t\t\t\tif (element.rows > 4) {\n\t\t\t\t\t\telement.rows -= 4;\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.rows = 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction saveandpublish() {\n\t\t\t\t\twindow.onbeforeunload = null;\n\t\t\t\t\tdocument.editform.submit();\n\t\t\t\t}\n\t\t\t\t(function (\$) {\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('.button').click(function () {\n\t\t\t\t\t\t\tvar button = \$(this).not('.submit_button');\n\t\t\t\t\t\t\tif (button.length) {\n\t\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('textarea').focus(function () {\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\t\$('#ep_cat').live('click', function(e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tvar title = 'Categorize ' + wgTitle;\n\t\t\t\t\t\tif (title.length > 54) {\n\t\t\t\t\t\t\ttitle = title.substr(0, 54) + '...';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjQuery('#dialog-box').html('');\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('#dialog-box').load('/Special:Categorizer?a=editpage&id=' + wgArticleId, function() {\n\t\t\t\t\t\t\tjQuery('#dialog-box').dialog({\n\t\t\t\t\t\t\t\twidth: 673,\n\t\t\t\t\t\t\t\theight: 600,\n\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\t\tcloseText: 'Close',\t\n\t\t\t\t\t\t\t\tdialogClass: 'modal2',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treCenter = function() {\n\t\t\t\t\t\t\t\tjQuery('#dialog-box').dialog('option', 'position', 'center');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetTimeout('reCenter()', 100);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$.getScript('/extensions/wikihow/cattool/categorizer.js');\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\t\t\t</script>\n\t\t\t<script type=\"text/javascript\" src=\"" . wfGetPad('/extensions/min/f/skins/common/clientscript.js,/skins/common/ac.js,/extensions/wikihow/video/importvideo.js&rev=') . WH_SITEREV . "\"></script>\n\n\t\t"); if (!$this->preview) { # Don't select the edit box on preview; this interferes with seeing what's going on. $wgOut->setOnloadHandler("document.editform.title.focus(); load_cats();"); } $title = ""; //$wgOut->setOnloadHandler( "' onbeforeunload='return confirm(\"Are you sure you want to navigate away from this page? All changes will be lost!\");" ); $suggested_title = ""; if (isset($_GET["requested"])) { $t = Title::makeTitle(NS_MAIN, $_GET["requested"]); $suggested_title = $t->getText(); } if ($wgRequest->getVal('title', null) == null || $conflictTitle || $suggested_title != "") { $title = "<div id='title'><h3>" . wfMsg('title') . "</h3><br/>" . wfMsg('howto', '') . " \n\t\t\t<input autocomplete=\"off\" size=60 type=\"text\" name=\"title\" id=category tabindex=\"1\" value=\"{$suggested_title}\"></div>"; } $steps = htmlspecialchars($wgLang->recodeForEdit($whow->getSteps(true)), ENT_QUOTES); $video = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('video')))); $tips = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('tips')))); $warns = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('warnings')))); $related_text = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('relatedwikihows')))); $summary = htmlspecialchars($wgLang->recodeForEdit($whow->getSummary())); if ($newArticle || $whow->mIsNew) { if ($steps == "") { $steps = "# "; } if ($tips == "") { $tips = "* "; } if ($warns == "") { $warns = "* "; } if ($ingredients == "") { $ingredients = "* "; } } $cat = $whow->getCategoryString(); $advanced = ""; $cat_array = explode("|", $whow->getCategoryString()); $i = 0; $cat_string = ""; foreach ($cat_array as $cat) { if ($cat == "") { continue; } if ($i != 0) { $cat_string .= "," . $cat; } else { $cat_string = $cat; } $i++; } $removeButton = ""; $cat_advisory = ""; if ($cat_string != "") { $removeButton = "<input type=\"button\" name=\"change_cats\" onclick=\"removeCategories();\" value=\"" . wfMsg('remove-categories') . "\">"; } else { $cat_advisory = wfMsg('categorization-optional'); } //$cat_string = str_replace("|", ", ", $whow->getCategoryString()); //$cat_string = implode(", ", $raa); if (!$newArticle && !$whow->mIsNew && !$conflictTitle) { $oldparameters = ""; if ($wgRequest->getVal("oldid") != "") { $oldparameters = "&oldid=" . $wgRequest->getVal("oldid"); } if (!$this->preview) { $advanced = "<a class='' href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true{$oldparameters}'>" . wfMsg('advanced-editing') . "</a>"; } } elseif ($newArticle && $wgRequest->getVal('title', null) != null) { $t = Title::newFromText("CreatePage", NS_SPECIAL); //$advanced = str_replace("href=", "class='guided-button' href=", $sk->makeLinkObj($t, wfMsg('advanced-editing'))) . " |"; //$advanced = "<a href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true$oldparameters';\">".wfMsg('advanced-editing')."</a>"; $advanced = "<a class='button secondary' style='float:left;' href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true{$oldparameters}'>" . wfMsg('advanced-editing') . "</a>"; } $section_class = 'minor_section'; // MODIFIED FOR POPUP $categoryHTML = ""; if ($wgUser->getID() > 0) { $ctitle = $this->mTitle->getText(); $css = HtmlSnips::makeUrlTags('css', array('categoriespopup.css'), 'extensions/wikihow', false); if ($wgLanguageCode == 'en') { $editCatMore = "<a href=\"{$wgScriptPath}/Writer%27s-Guide?section=2#" . wfMsg('more-info-categorization') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>"; $editCatHtml = "<a href='#' id='ep_cat'>[" . wfMsg('editcategory') . "]</a><strong>{$editCatLink}</strong>"; } $categoryHTML = "\n\t\t\t\t{$css}\n\t\t\t\t<div id='categories'>\n\t\t\t\t\t<h5>" . wfMsg('add-optional-categories') . "{$editCatMore}</h5>\n\t\t\t\t\t<div id='option_cats'>\n\t\t\t\t\t{$editCatHtml}" . Categoryhelper::getCategoryOptionsForm2($cat_string, $whow->mCategories) . "\t</div>\n\t\t\t\t</div>"; } $requested = ""; if (isset($_GET['requested'])) { $requested = $_GET['requested']; } $related_vis = "hide"; $related_checked = ""; $relatedHTML = ""; if ($whow->getSection(wfMsg('relatedwikihows')) != "") { $related_vis = "show"; $relatedHTML = $whow->getSection(wfMsg('relatedwikihows')); $relatedHTML = str_replace("*", "", $relatedHTML); $relatedHTML = str_replace("[[", "", $relatedHTML); $relatedHTML = str_replace("]]", "", $relatedHTML); $lines = split("\n", $relatedHTML); $relatedHTML = ""; foreach ($lines as $line) { $xx = strpos($line, "|"); if ($xx !== false) { $line = substr($line, 0, $xx); } // Google+ hack. We don't normally allow + but will for the Goog if (false === stripos($line, 'Google+')) { $line = trim(urldecode($line)); } if ($line == "") { continue; } $relatedHTML .= "<OPTION VALUE=\"" . htmlspecialchars($line) . "\">{$line}</OPTION>\n"; } $related_checked = " CHECKED "; } $vidpreview_vis = "hide"; $vidbtn_vis = "show"; $vidpreview = "<img src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "'/>"; if ($whow->getSection(wfMsg('video')) != "") { $vidpreview_vis = "show"; $vidbtn_vis = "hide"; try { #$vt = Title::makeTitle(NS_VIDEO, $this->mTitle->getText()); #$r = Revision::newFromTitle($vt); $vidtext = $whow->getSection(wfMsg('video')); $vidpreview = $wgOut->parse($vidtext); } catch (Exception $e) { $vidpreview = "Sorry, preview is currently not available."; } } else { $vidpreview = wfMsg('video_novideoyet'); } $video_disabled = ""; $vid_alt = ""; $video_msg = ""; $video_button = "<a id='gatVideoImportEdit' type='button' onclick=\"changeVideo('" . urlencode($wgTitle->getDBKey()) . "'); return false;\" href='#' id='show_preview_button' class='button secondary' >" . wfMsg('video_change') . "</a>"; if ($wgUser->getID() == 0) { $video_disabled = "disabled"; $video_alt = "<input type='hidden' name='video' value=\"" . htmlspecialchars($video) . "\"/>"; $video_msg = wfMsg('video_loggedin'); $video_button = ""; } $things_vis = "hide"; $things = "* "; $things_checked = ""; $tyn = $whow->getSection(wfMsg("thingsyoullneed")); if ($tyn != '') { $things_vis = "show"; $things = $tyn; $things_checked = " CHECKED "; } $ingredients_vis = "hide"; $section = $whow->getSection(wfMsg("ingredients")); $ingredients_checked = ""; if ($section != '') { $ingredients_vis = "show"; $ingredients = $section; $ingredients_checked = " CHECKED "; } $sources_vis = "hide"; $sources = "* "; $sources_checked = ""; $sources = $whow->getSection(wfMsg("sources")); $sources = str_replace('<div class="references-small"><references/></div>', '', $sources); $sources = str_replace('{{reflist}}', '', $sources); if ($sources != "") { $sources_vis = "show"; $sources_checked = " CHECKED "; } $new_field = ""; if ($newArticle || $new_article) { $new_field = "<input type=hidden name=new_article value=true>"; } $lang_links = htmlspecialchars($whow->getLangLinks()); $vt = Title::makeTitle(NS_VIDEO, $this->mTitle->getText()); $vp = SpecialPage::getTitleFor("Previewvideo", $vt->getFullText()); $newArticleWarn = '<script type="text/javascript" src="' . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.js?') . WH_SITEREV . '"></script>'; $popup = Title::newFromText("UploadPopup", NS_SPECIAL); if ($wgUser->isLoggedIn()) { $token = htmlspecialchars($wgUser->editToken()); } else { $token = EDIT_TOKEN_SUFFIX; } if ('preview' == $this->formtype) { $previewOutput = $this->getPreviewText(); $this->showPreview($previewOutput); $show_weave = true; } else { $wgOut->addHTML('<div id="wikiPreview"></div>'); } if ('diff' == $this->formtype) { $this->showDiff(); $show_weave = true; } if ($show_weave) { $relBtn = $wgLanguageCode == 'en' ? PopBox::getGuidedEditorButton() : ''; $relHTML = PopBox::getPopBoxJSGuided() . PopBox::getPopBoxDiv() . PopBox::getPopBoxCSS(); $weave_links = $relHTML . '<div class="wh_block editpage_sublinks">' . $relBtn . '</div>'; } $undo = ''; if ($wgRequest->getVal('undo', null) != null) { $undo_id = $wgRequest->getVal('undo', null); $undo = "\n<input type='hidden' value=\"{$undo_id}\" name=\"wpUndoEdit\" />\n"; } $wgOut->addHTML(Easyimageupload::getUploadBoxJS()); $wgOut->addHTML("\t\n{$newArticleWarn}\n\n<div id='editpage'>\n<form id=\"editform\" name=\"editform\" method=\"post\" action=\"{$action}\"\nenctype=\"application/x-www-form-urlencoded\" onSubmit=\"return checkForm();\">\t\t"); if (is_callable($formCallback)) { call_user_func_array($formCallback, array(&$wgOut)); } $hidden_cats = ""; if (!$wgUser->isLoggedIn()) { $hidden_cats = "<input type=\"hidden\" name=\"categories22\" value=\"{$cat_string}\">"; } $token1 = md5($wgUser->getName() . $this->mTitle->getArticleID() . time()); wfTrackEditToken($wgUser, $token1, $this->mTitle, $this instanceof EditPageWrapper); $wgOut->addHTML("\n\t\t{$new_field}\n\t\t{$hidden_cats}\n\t\t<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n\t\t<input type=\"hidden\" name=\"requested\" value=\"{$requested}\">\n\t\t<input type=\"hidden\" name=\"langlinks\" value=\"{$lang_links}\">\n\t\t<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n\n\t\t{$commentsubject}\n\t\t{$title}\n\t\t<br clear='all'/>\n<script language='javascript'>\n\tvar vp_URL = '{$vp->getLocalUrl()}';\n</script>\n<script language='javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/previewvideo.js?rev=') . "'></script>\n<style type='text/css' media='all'>/*<![CDATA[*/ @import '" . wfGetPad('/extensions/min/f/extensions/wikihow/editpagewrapper.css,/extensions/wikihow/winpop.css,/extensions/wikihow/video/importvideo.css,/extensions/wikihow/cattool/categorizer.css,/extensions/wikihow/cattool/categorizer_editpage.css&rev=') . WH_SITEREV . "'; /*]]>*/</style>\n\n\t{$weave_links}\n\n\t<div id='introduction' class='{$section_class}'>\n\t\t<h2>" . wfMsg('introduction') . "\n\t\t\t<div class='head_details'>" . wfMsg('summaryinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('introduction-url') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea rows='4' cols='100' name='summary' id='summary' tabindex=\"2\" wrap=virtual>{$summary}</textarea>\n\t\t<!--a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"intro\"); return false;'>" . wfMsg('eiu-add-image-to-introduction') . "</a-->\n\t\t<div class='clearall'></div>\n\t</div>\n\n\n\t<div id='ingredients' class='{$ingredients_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('ingredients') . "\n\t\t\t<div class='head_details'>" . wfMsg('ingredients_tooltip') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('ingredients') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='ingredients' rows='4' cols='100' onKeyUp=\"addStars(event, document.editform.ingredients);\" tabindex='3' id='ingredients_text'>{$ingredients}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"ingredients\"); return false;'>" . wfMsg('eiu-add-image-to-ingredients') . "</a>\n\t</div>\n\n\t<div id='steps' class='{$section_class}'>\n\t\t<h2>" . wfMsg('steps') . "\n\t\t\t<div class='head_details'>" . wfMsg('stepsinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('steps') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='steps' rows='{$wgRequest->getVal('txtarea_steps_text', 12)}' cols='100' wrap='virtual' onKeyUp=\"addNumToSteps(event);\" tabindex='4' id='steps_text'>{$steps}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"steps\", 0); return false;'>" . wfMsg('eiu-add-image-to-steps') . "</a>\n\t</div>"); $wgOut->addHTML("<div id='video' class='{$section_class}'>\n\t\t<h2>" . wfMsg('video') . "\n\t\t\t<div class='head_details'>" . wfMsg('videoinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('video') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t{$video_alt}\n\t\t<input type='text' name='video{$video_disabled}' size='60' id='video_text' style='float:left;' value=\"{$video}\" {$video_disabled}/><br />\n\t\t{$video_button}\n\t\t<a href='javascript:showHideVideoPreview();' id='show_preview_button' class='button secondary {$vidbtn_vis}'>" . wfMsg('show_preview') . "</a>\n\t\t{$video_msg}\n\t</div>\n\t<div id='viewpreview' class='{$vidpreview_vis} {$section_class}' style='text-align: center; margin-top: 5px;'>\n\t\t<center><a onclick='showHideVideoPreview();'>" . wfMsg('ep_hide_preview') . "</a></center><br/>\n\t\t<div id='viewpreview_innards'>{$vidpreview}</div>\n\t</div>\n\n\t<div id='tips' class='{$section_class}'>\n\t\t<h2>" . wfMsg('tips') . "\n\t\t\t<div class='head_details'>" . wfMsg('listhints') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('tips') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='tips' rows='{$wgRequest->getVal('txtarea_tips_text', 12)}' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.tips);' tabindex='5' id='tips_text'>{$tips}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"tips\"); return false;'>" . wfMsg('eiu-add-image-to-tips') . "</a>\n\t</div>\n\n\t<div id='warnings' class='{$section_class}'>\n\t\t<h2>" . wfMsg('warnings') . "\n\t\t\t<div class='head_details'>" . wfMsg('optionallist') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=3#" . wfMsg('warnings') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='warnings' rows='{$wgRequest->getVal('txtarea_warnings_text', 4)}' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.warnings);' id='warnings_text' tabindex=\"6\" id='warnings_text'>{$warns}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"warnings\"); return false;'>" . wfMsg('eiu-add-image-to-warnings') . "</a>\n\t</div>\n\n\t<div id='thingsyoullneed' class='{$things_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('thingsyoullneed') . "\n\t\t\t<div class='head_details'>" . wfMsg('items') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=4#" . wfMsg('thingsyoullneed') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='thingsyoullneed' rows='4' cols='65' wrap='virtual' onKeyUp='addStars(event, document.editform.thingsyoullneed);' tabindex='7' id='thingsyoullneed_text'>{$things}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"thingsyoullneed\"); return false;'>" . wfMsg('eiu-add-image-to-thingsyoullneed') . "</a>\n\t</div>\n\n\t<div id='relatedwikihows' class='{$related_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('relatedarticlestext') . "\n\t\t\t<div class='head_details'>" . wfMsg('relatedlist') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=5#" . wfMsg('related-wikihows-url') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<div id='related_buttons'>\n\t\t\t<a href='#' class='button secondary' onclick='moveRelated(true);return false;' >" . wfMsg('epw_move_up') . "</a>\n\t\t\t<a href='#' class='button secondary' onclick='moveRelated(false);return false;'>" . wfMsg('epw_move_down') . "</a>\n\t\t\t<a href='#' class='button red' onclick='removeRelated(); return false;'>" . wfMsg('epw_remove') . "</a>\n\t\t\t<br />\n\t\t\t<br />\n\t\t</div>\n\t\t<input type=hidden value=\"\" name=\"related_list\">\n\t\t<select size='4' name='related' id='related_select' ondblclick='viewRelated();'>\n\t\t\t{$relatedHTML}\n\t\t</select>\n\t\t<br />\n\t\t<br />\n\t\t<br class='clearall'/>\n\t\t<div>\n\t\t\t<b>" . wfMsg('addtitle') . "</b><br />\n\t\t\t<input type='text' autocomplete=\"off\" maxLength='256' name='q' value='' onKeyPress=\"return keyxxx(event);\" tabindex='8'>\n\t\t</div>\n\t\t<a href='#' id='add_button' class='button secondary' onclick='add_related();return false;'>" . wfMsg('epw_add') . "</a>\n\t\t<br class='clearall'/>\n\t</div>\n\n<script language=\"JavaScript\">\n\tvar js_enabled = document.getElementById('related');\n\t\t if (js_enabled != null) {\n\t\t\t\t js_enabled.className = 'display';\n\t\t\t}\n\t</script>\n\t<noscript>\n\t\t<input type='hidden' name='no_js' value='true'>\n\t\t<div id='related'>\n\t\t\t<textarea name='related_no_js' rows='4' cols='65' wrap='virtual' onKeyUp='addStars(event, document.editform.related_no_js);' id='related_no_js' tabindex='8'>{$related_text}</textarea>\n\t\t</div>\n\t</noscript>\n\n\t<div id='sources' class='{$sources_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('sources') . "\n\t\t\t<div class='head_details'>" . wfMsg('linkstosites') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('sources-links-url') . "\" target=\"new\"> " . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='sources' rows='3' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.sources);' id='sources' tabindex='9'>{$sources}</textarea>\n\t</div>\n\n\t<div class='{$section_class}'>\n\t\t<h2>" . wfMsg('optional_options') . "</h2>\n\t\t{$categoryHTML}\n\n\t\t<div id='optional_sections'>\n\t\t\t<h5>" . wfMsg('optionalsections') . "</h5>\n\t\t\t<ul>\n\t\t\t\t<li><input type='checkbox' id='thingsyoullneed_checkbox' name='thingsyoullneed_checkbox' onclick='showhiderow(\"thingsyoullneed\", \"thingsyoullneed_checkbox\");' {$things_checked} /> <label for='thingsyoullneed_checkbox'>" . wfMsg('thingsyoullneed') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='related_checkbox' name='related_checkbox' onclick='showhiderow(\"relatedwikihows\", \"related_checkbox\");' {$related_checked} > <label for='related_checkbox'>" . wfMsg('relatedwikihows') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='sources_checkbox' name='sources_checkbox' onclick='showhiderow(\"sources\", \"sources_checkbox\");' {$sources_checked} > <label for='sources_checkbox'>" . wfMsg('sources') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='ingredients_checkbox' name='ingredients_checkbox' onclick='showhiderow(\"ingredients\", \"ingredients_checkbox\");' {$ingredients_checked} > <label for='ingredients_checkbox'>" . wfMsg('ingredients_checkbox') . "</label></li>\n\t\t\t</ul>\n\t\t</div>\n\t</div>\n\t\n\t<div class='{$section_class}'>\n\t\t<div class='editOptions'>\n\t\t\t<h2>" . wfMsg('editdetails') . "\n\t\t\t\t<div class='head_details'>" . wfMsg('summaryedit') . "</div>\n\t\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('summary') . "\" target=\"new\"> " . wfMsg('moreinfo') . "</a>\n\t\t\t</h2>\n\t\t\t{$editsummary}\n\t\t\t{$checkboxhtml}\n\t\t\t{$undo}\n\t\t\t<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n\t\t\t<input type='hidden' value=\"{$token1}\" name=\"wpEditTokenTrack\" />\n\t\t\t<div class='editButtons'>\n\t\t\t\t<a href=\"javascript:history.back()\" id=\"wpCancel\" class=\"button secondary\">" . wfMsg('cancel') . "</a>\n\t\t\t\t{$buttonshtml}\n\t\t\t</div>\n\t\t\t{$copywarn}\n\t\t</div>\n\t</div>\n\t<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n\t<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n"); if ($this->isConflict) { require_once "DifferenceEngine.php"; $wgOut->addHTML("<h2>" . wfMsg("yourdiff") . "</h2>\n"); DifferenceEngine::showDiff($this->textbox2, $this->textbox1, wfMsg("yourtext"), wfMsg("storedversion")); } if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) { $wgOut->addHTML(" <div id='edit_page_footer'>\n\t\t\t\t<table class='edit_footer'><tr><td class='summary'>\n\t\t\t\t" . wfMsg('editsummary') . ": {$editsummary1}</td>\n\t\t\t\t<td class='buttons'>{$footerbuttons}</td></tr></table>\n\t\t\t\t</div> "); } $wgOut->addHTML("</form></div>\n"); }
public static function getPinterestTitleInfo() { $whow = WikihowArticleEditor::newFromCurrent(); if (!$whow) { return ''; } $text = $whow->mLoadText; $num_steps = 0; if (preg_match("/^(.*?)==\\s*" . wfMsg('tips') . "/ms", $text, $sectionmatch)) { // has tips, let's assume valid candidate for detailed title $num_steps = preg_match_all('/^#[^*]/im', $sectionmatch[1], $matches); } if ($num_steps >= 5 && $num_steps <= 12) { $titleDetail = " in {$num_steps} Steps"; } else { $titleDetail = ''; } return $titleDetail; }