コード例 #1
0
{
    PieceOfCode::Instance();
}
function PieceOfCode_HeadHooker(&$out, &$sk)
{
    global $wgPieceOfCodeConfig;
    if ($wgPieceOfCodeConfig['autocss']) {
        global $wgPieceOfCodeExtensionWebDir;
        $script = $wgPieceOfCodeExtensionWebDir . '/includes/style.css';
        $out->addScript('<link type="text/css" rel="stylesheet" href="' . $script . '"/>');
    }
    return true;
}
if (!defined('MEDIAWIKI')) {
    die;
} else {
    /**
     * MediaWiki Extension hooks Setter.
     */
    $wgExtensionFunctions[] = 'PieceOfCode_Hooker';
    $wgHooks['BeforePageDisplay'][] = 'PieceOfCode_HeadHooker';
    $wgExtensionMessagesFiles['PieceOfCode'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PieceOfCode-dr.i18n.php';
    $wgAutoloadClasses['PieceOfCode'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PieceOfCode-dr.body.php';
    $wgSpecialPages['PieceOfCode'] = 'PieceOfCode';
    $wgSpecialPageGroups['PieceOfCode'] = 'other';
    /**
     * MediaWiki Extension Description.
     */
    $wgExtensionCredits['parserhook'][] = array('name' => PieceOfCode::Property('name'), 'version' => PieceOfCode::Property('version'), 'date' => PieceOfCode::Property('date'), 'description' => PieceOfCode::Property('description'), 'descriptionmsg' => PieceOfCode::Property('descriptionmsg'), 'author' => PieceOfCode::Property('author'), 'url' => PieceOfCode::Property('url'), 'svn-date' => PieceOfCode::Property('svn-date'), 'svn-revision' => PieceOfCode::Property('svn-revision'));
    $wgExtensionCredits['specialpage'][] = array('name' => PieceOfCode::Property('name'), 'version' => PieceOfCode::Property('version'), 'date' => PieceOfCode::Property('date'), 'description' => PieceOfCode::Property('sinfo-description'), 'descriptionmsg' => PieceOfCode::Property('sinfo-descriptionmsg'), 'author' => PieceOfCode::Property('author'), 'url' => PieceOfCode::Property('url'));
}
コード例 #2
0
 /**
  * @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__);
         }
     }
 }
コード例 #3
0
 /**
  * This is an extension of method <b>basicInformation</b>. It adds
  * section "Extension information"
  * @param $out Output text to be appended with a new seccion.
  */
 protected function _bsExtensionInformation(&$out)
 {
     global $wgPieceOfCodeConfig;
     /*
      * Section: Extension information.
      * @{
      */
     $out .= "== " . wfMsg('poc-sinfo-extension-information') . " ==\n";
     $out .= "*'''" . wfMsg('poc-sinfo-name') . ":''' " . PieceOfCode::Property('name') . "\n";
     $out .= "*'''" . wfMsg('poc-sinfo-version') . ":''' " . PieceOfCode::Property('version') . "\n";
     $out .= "*'''" . wfMsg('poc-sinfo-description') . ":''' " . PieceOfCode::Property('_description') . "\n";
     $out .= "*'''" . wfMsg('poc-sinfo-author') . ":'''\n";
     foreach (PieceOfCode::Property('author') as $author) {
         $out .= "**{$author}\n";
     }
     $out .= "*'''" . wfMsg('poc-sinfo-url') . ":''' " . PieceOfCode::Property('url') . "\n";
     if ($wgPieceOfCodeConfig['show']['installdir']) {
         $out .= "*'''" . wfMsg('poc-sinfo-installation-directory') . ":''' " . dirname(__FILE__) . "\n";
     }
     $out .= "*'''" . wfMsg('poc-sinfo-svn') . ":'''\n";
     $aux = str_replace('$', '', PieceOfCode::Property('svn-revision'));
     $aux = str_replace('LastChangedRevision: ', '', $aux);
     $out .= "**'''" . wfMsg('poc-sinfo-svn-revision') . ":''' r{$aux}\n";
     $aux = str_replace('$', '', PieceOfCode::Property('svn-date'));
     $aux = str_replace('LastChangedDate: ', '', $aux);
     $out .= "**'''" . wfMsg('poc-sinfo-svn-date') . ":''' {$aux}\n";
     /* @} */
 }