/** * Return parameters from mediaWiki; * use Default if parameter not provided; * use '' or 0 if Default not provided * @param $input @todo doc * @param $name @todo doc * @param $isNumber @todo doc * @return @todo doc */ protected function getVariable($input, $name, $isNumber = false) { if ($this->_pocInstance->varDefault($name)) { $out = $this->_pocInstance->varDefault($name); } else { $out = $isNumber ? 0 : ''; } if (preg_match("/^\\s*{$name}\\s*=\\s*(.*)/mi", $input, $matches)) { if ($isNumber) { $out = intval($matches[1]); } elseif ($matches[1] != null) { $out = htmlspecialchars($matches[1]); } } return $out; }
/** * @todo doc */ protected function upRevision() { if (!$this->isLatestVersion()) { switch ($this->getVersion()) { case '0.2': $this->upToVersion0_2_rev(); break; default: echo '<h1>' . $this->getVersion() . '</h1>'; } $aux = explode(' ', PieceOfCode::Property('svn-revision')); if ($this->_flags->set('POC_LATEST_REVISION', $aux[1], 'I')) { die(__FILE__ . ':' . __LINE__); } } }
/** * Register function. */ function PieceOfCode_Hooker() { PieceOfCode::Instance(); }
/** * @return Returns the singleton instance of this class PieceOfCode. */ public static function Instance() { if (!isset(self::$_Instance)) { $c = __CLASS__; self::$_Instance = new $c(); } return self::$_Instance; }