/** * @todo doc * @param $input @todo doc * @param $params @todo doc * @param $parser @todo doc * @return @todo doc */ public function load($input, &$params, $parser) { $out = ""; /* * Clearing status. */ $this->clear(); /* * Loading configuration from tags. */ $out .= $this->loadParams($params); if ($this->_errors->ok()) { if ($this->_parseInput) { $input = $parser->recursiveTagParse($input); } $out .= $this->loadVariables($input); } /* * Loading file information */ if ($this->_errors->ok()) { $this->_fileInfo = $this->_storeCodes->getFile($this->_connection, $this->_filename, $this->_revision); if (!$this->_fileInfo) { $out .= $this->_errors->setLastError(wfMsg('poc-errmsg-no-fileinfo', $this->_connection, $this->_filename, $this->_revision)); } } return $out; }
/** * @todo doc * @param $fontcode Is the list of parameter gotten from URL. */ protected function showFontCode(array &$fontcode) { $out = ""; global $wgOut; global $wgPieceOfCodeConfig; $this->_errors->clearError(); $fileInfo = $this->_storedCodes->getFile($fontcode['connection'], $fontcode['path'], $fontcode['revision']); $this->appendTOC($out); if ($fileInfo) { $tag = ''; if (!PieceOfCode::CheckSyntaxHighlightExtension($tag)) { $out .= "<br/>" . $this->_errors->getLastError(); } $filepath = $wgPieceOfCodeConfig['uploaddirectory'] . DIRECTORY_SEPARATOR . $fileInfo['upload_path']; $st = stat($filepath); $lang = $fileInfo['lang']; if ($st['size'] > $wgPieceOfCodeConfig['maxsize']['highlighting']) { $out .= "*" . $this->_errors->setLastError(wfMsg('poc-errmsg-large-highlight', $wgPieceOfCodeConfig['maxsize']['highlighting'])); $lang = "text"; } if ($st['size'] > $wgPieceOfCodeConfig['maxsize']['showing']) { $out .= "*" . $this->_errors->setLastError(wfMsg('poc-errmsg-large-show', $wgPieceOfCodeConfig['maxsize']['showing'])); $lang = "text"; } $out .= "<h2>{$fileInfo['connection']}: {$fileInfo['path']}:{$fontcode['revision']} </h2>"; $out .= "<div class=\"PieceOfCode_code\"><{$tag} lang=\"{$lang}\" line=\"GESHI_NORMAL_LINE_NUMBERS\" start=\"1\">"; $out .= file_get_contents($filepath, false, null, -1, $wgPieceOfCodeConfig['maxsize']['showing']); $out .= "</{$tag}></div>"; } else { if ($this->_errors->ok()) { $this->_errors->setLastError(wfMsg('poc-errmsg-no-fileinfo', $fontcode['connection'], $fontcode['path'], $fontcode['revision'])); } $out .= $this->_errors->getLastError(); } $out .= "<h2>" . wfMsg('poc-sinfo-links') . "</h2>\n"; $out .= "*[[Special:PieceOfCode|Back]]\n"; $wgOut->addWikiText($out); }