public static function loadRecommendations($filename) { $f = fopen($filename, "r"); while (!feof($f)) { $l = fgets($f); $l = chop($l); $s = preg_split("@\t@", $l); if (sizeof($s) >= 3) { $u = User::newFromName($s[0]); $t = Title::newFromId($s[1]); $score = intVal($s[2]); if ($u && $t && $score) { RecommendationPresenter::addRecommendation($u, $t, $score); if (sizeof($s) > 3) { $n = 3; while ($n < sizeof($s)) { RecommendationPresenter::addRecommendationReason($u, $t, intVal($s[$n])); $n++; } } } } } }
public function getRecBox() { global $wgUser; wfLoadExtensionMessages('Slider'); if ($wgUser->getId() == 0 || !class_exists('RecommendationPresenter')) { return false; } $t = RecommendationPresenter::getRecommendation($wgUser); if (!$t) { return false; } $theBox = "<div id='sliderbox' class='sliderbox_08'>\n\t\t\t\t\t\t<div id='slider_thanks_08'>\n\t\t\t\t\t\t\t<a href='#' id='slider_close_button'></a>\n\t\t\t\t\t\t\t<div class='slider_become_main'>\n\t\t\t\t\t\t\t\t<p class='slider_editing_text'>Can you help edit...</p><a href=\"" . $t['url'] . "&action=edit\">" . str_replace('-', ' ', $t['page_title']) . "</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>"; return $theBox; }