Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
<?php
<!--                            -->
/**
<!-- THEMA DES MONATS -->
* atroo Robert Krueger
<!--                            -->
*/
<rkw-container title="Thema des Monats">
if ( !defined( 'MEDIAWIKI' ) ) die();
<rkw-box image="https://www.tcs.ch/assets/img/test-und-sicherheit/in-jedem-alter/kinder/weblication/wThumbnails/kinder-enfants_572_381.jpg" size="large" title="Berufsorientierung für Kinder" wikilink="Kategorie:Kinder">
'''Auch an die jüngsten Wird gedacht...'''


$wgExtensionCredits['parserhook'][] = array(
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
'path' => __FILE__,
</rkw-box>
'name' => 'RKWParser',
</rkw-container>
    'version' => '1.0.0',
<!--                            -->
'author' => array(
<!-- EMPFOHLENE INHALTE -->
'[http://www.atroo.de atroo GbR]',
<!--                            -->
),
<rkw-container title="empfohlene Inhalte">
'descriptionmsg' => 'rkw-parser-description',
<rkw-box image="http://peibusinessdirectory.net/wp-content/uploads/2015/03/PEI-Sports.jpg" size="small" title="Spiel & Sport für Kinder" wikilink="Kategorie:Kinder">
'url' => 'http://www.rkw-kompetenzzentrum.de/kontakt/',
Nicht sichtbarer Text weil Bild
);
</rkw-box>
<rkw-box size="small" title="Lorem Ipsum" wikilink="Kategorie:Kinder">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</rkw-box>
<rkw-box size="small" title="Lorem Ipsum" wikilink="Kategorie:Kinder">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</rkw-box>
</rkw-container>
<!--                            -->
<!-- MEHR -->
<!--                            -->
<rkw-container title="mehr" size="full">
<rkw-box size="small" title="Lorem Ipsum" wikilink="Kategorie:Kinder">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</rkw-box>
<rkw-box size="large" title="Berufsorintierung für Kinder" wikilink="Kategorie:Kinder">
'''Auch an die jüngsten Wird gedacht...'''


$wgExtensionMessagesFiles['RKWParser'] = __DIR__ . '/RKWParser.i18n.php';
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</rkw-box>
<rkw-box size="small" title="Lorem Ipsum" wikilink="Kategorie:Kinder">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</rkw-box>
<rkw-box size="small" title="Lorem Ipsum" wikilink="Kategorie:Kinder">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</rkw-box>


$wgHooks['ParserFirstCallInit'][] = 'RKWParserClass::wfSampleSetup';
</rkw-container>
 
class RKWParserClass {
    static function wfSampleSetup( Parser $parser ) {
        $parser->setHook( 'rkw-container', 'RKWParserClass::wfRkwContainerRender' );
        $parser->setHook( 'rkw-box', 'RKWParserClass::wfRkwBoxRender' );
       
        return true;
    }
   
    static function wfRkwContainerRender( $input, array $args, Parser $parser, PPFrame $frame ) {
        //validate the state of the attributes
        if(!isset($args['title'])) {
            return RKWParserClass::createErr("title attribute in <rkw-container /> is mandatory");
        }
        if(!isset($args['size'])) {
            $args['size'] = 'half';
        }
       
        $title = $args['title'];
        $size = $args['size'];
        //parse the elements to pass down the parents size configuration to the childs
        $input = str_replace("<rkw-box", "<rkw-box parentsize='".$size."' ", $input);   
           
        //parse the input for further tag elements such as the rkw-box
        $output = $parser->recursiveTagParse( $input , $frame );
       
        $res = "<div class='rkw-container " . ($size == 'half' ? 'col-md-6' : 'col-md-12') . "'><h1 class='rkw-font-sans'>". $title ."</h1><div class='row'>" . $output . "</div></div>";
        return array( $res, 'noparse' => false , 'nowiki' => false, 'isHTML' => true);
    }
   
    static function wfRkwBoxRender( $input, array $args, Parser $parser, PPFrame $frame ) {
        //validate the state of the attributes
        if(!isset($args['title'])) {
            return RKWParserClass::createErr('title attribute in <rkw-box /> is mandatory');
        }
        if(!isset($args['wikilink']) && !isset($args['extlink'])) {
            return RKWParserClass::createErr('wikilink or extlink attribute in <rkw-box /> is mandatory');
        }
        if(!isset($args['parentsize'])) {
            return RKWParserClass::createErr('<rkw-box> has to be a child of <rkw-container>');
        }
        if(!isset($args['size'])) {
            $args['size'] = 'small';
        }
        $parentsize = $args['parentsize'];
        $boxsize = $args['size'];
        $dimclass = 'col-md-6'; //default class for parent half and box small
       
        if($parentsize == 'half' && $boxsize == 'large') {
            $dimclass = 'col-md-12';
        }else if($parentsize == 'full' && $boxsize == 'small') {
            $dimclass = 'col-md-3';
        }
        $input = $parser->recursivePreProcess($input, $frame);
        $input = $parser->recursiveTagParse($input, $frame);
       
        $content = '';
        $link = isset($args['wikilink']) ? Skin::makeUrl($args['wikilink']) : $args['extlink'];
        $img = isset($args['image']) ? '<a href="'.$link.'" class="rkw-image" style="background-image: url('.$args['image'].');"></a>' : '';
        if($boxsize == 'small') {
            //smallboxes only have image or text, image takes precedence
            if(isset($args['image'])) {
                $imgOrText = $img;
            }else{
                $imgOrText = '<div class="rkw-text rkw-font-sans">'.$input.'</div>';
            }
            $content = '<div class="rkw-title rkw-font-sans"><a href="'.$link.'">'.$args['title'].'</a></div>'.$imgOrText;
        }else{
            $content = '<div class="rkw-title rkw-font-sans"><a href="'.$link.'">'.$args['title'].'</a></div>'.$img.'<div class="rkw-text rkw-font-sans">'.$input.'</div>';
        }
        $boxcontent = '<div class="rkw-content">'.$content.'<div class="rkw-footer-blend"></div></div>';
        $res = '<div class="rkw-box '.$dimclass.' '.$boxsize.'">'.$boxcontent.'</div>';
        return array( $res, 'noparse' => false , 'nowiki' => false, 'isHTML' => true);
        //return array( $res, 'noparse' => false , 'nowiki' => false);
        //return $res;
    }
   
    static function createErr($text) {
        return "<div class='rkw-config-error'>".htmlspecialchars($text)."</div>";
    }
}

Version vom 21. Juli 2015, 16:01 Uhr

mehr

</rkw-box>

Veranstaltungen

Herausgeber

Partner