public static function makeWikiHowUrl(&$pageTitle) { return Misc::makeUrl($pageTitle); }
function outputArticleReport() { global $wgRequest; $urls = split("\n", trim(Misc::getUrlDecodedData($wgRequest->getVal('data')))); $dbr = wfGetDB(DB_SLAVE); $articles = array(); foreach ($urls as $url) { $t = Title::newFromText(str_replace("http://www.wikihow.com/", "", $url)); if ($t && $t->exists()) { $articles[$t->getArticleId()] = array('url' => Misc::makeUrl($t->getText())); if ($this->slowQuery) { $wikitext = Wikitext::getWikitext($dbr, $t); $articles[$t->getArticleId()]['alts'] = $this->hasAlternateMethods($wikitext) ? "Yes" : "No"; $articles[$t->getArticleId()]['size'] = $this->getArticleSize($t); $articles[$t->getArticleId()]['imgs'] = $this->hasImages($wikitext); } } } $this->addPageCounts($articles); if ($wgRequest->getVal('format') == 'csv') { $output = $this->getArticleReportCSV($articles); $this->sendFile('article_stats', $output); } else { $output = $this->getArticleReportHtml($articles); $this->sendHtml($output); } }
/** * Display data as CSV, not as a summary. */ private static function displayDataCSV($data) { self::httpDownloadHeaders(); $headers = array('__', '0-10s', '3+m', 'mobile-0-10s', 'mobile__'); print "page," . implode(",", $headers) . "\n"; foreach ($data as $page => $datum) { $line = Misc::makeUrl($page); self::computePercentagesForCSV($datum); foreach ($headers as $header) { $line .= ',' . (isset($datum[$header]) ? $datum[$header] : ''); } print "{$line}\n"; } exit; }
public function getUrl() { return Misc::makeUrl($this->page_title); }