Example #1
0
 /**
  * @param WikiLingo\Expression\Plugin $plugin
  * @param string $body
  * @param WikiLingo\Renderer $renderer
  * @param WikiLingo\Parser $parser
  * @return string
  */
 public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
 {
     $header = $renderer->helper('h3');
     $header->staticChildren[] = $plugin->parameter('title');
     $accordion = parent::render($plugin, $body, $renderer, $parser);
     return $header->render() . $accordion;
 }
Example #2
0
    /**
     * @param WikiLingo\Expression\Plugin $plugin
     * @param string $body
     * @param WikiLingo\Renderer $renderer
     * @param WikiLingo\Parser $parser
     * @return string
     */
    public function render(WikiLingo\Expression\Plugin &$plugin, &$body = '', &$renderer, &$parser)
    {
        $plugin->allowLineAfter = false;
        $id = $plugin->id();
        $parser->scripts->addScript(<<<JS
\$(function() {
\tvar tabs = \$('#{$id}');
\ttabs.tabs();
});
JS
);
        if (!empty($plugin->privateAttributes['titles'])) {
            $ul = $renderer->helper('ul');
            foreach ($plugin->privateAttributes['titles'] as $tabId => $title) {
                $a = $renderer->helper('a');
                $a->attributes['href'] = '#' . $tabId;
                $a->staticChildren[] = $title;
                $li = $renderer->helper('li');
                $li->children[] = $a;
                $ul->children[] = $li;
            }
            $body = $ul->render() . $body;
        }
        $tabs = parent::render($plugin, $body, $renderer, $parser);
        return $tabs;
    }
Example #3
0
 /**
  * @param WikiLingo\Expression\Plugin $plugin
  * @param string $body
  * @param WikiLingo\Renderer $renderer
  * @param WikiLingo\Parser $parser
  * @return string
  */
 public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
 {
     $plugin->attributes['src'] = $plugin->parameter('location');
     $plugin->attributes['title'] = $plugin->parameter('title');
     $picture = parent::render($plugin, $body, $renderer, $parser);
     return $picture;
 }
Example #4
0
    /**
     * @param WikiLingo\Expression\Plugin $plugin
     * @param string $body
     * @param WikiLingo\Renderer $renderer
     * @param WikiLingo\Parser $parser
     * @return string
     */
    public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
    {
        $id = $plugin->id();
        $seconds = $plugin->parameter('seconds');
        $slideAnimation = '';
        $i = 0;
        if (!$parser->wysiwyg) {
            $children = $plugin->children('Plugin');
            $childrenCount = count($children);
            foreach ($children as $child) {
                switch ($child->type) {
                    case 'Slider':
                        $sliderId = $child->id();
                        $thisSlideSeconds = $seconds * ($childrenCount - $i - 1);
                        $i++;
                        $slideAnimation .= <<<CSS


CSS;
                        break;
                }
            }
            $totalSlideSeconds = $i * $seconds;
            $parser->scripts->addCss(<<<CSS



CSS
);
        }
        $sliders = parent::render($plugin, $body, $renderer, $parser);
        return $sliders;
    }
Example #5
0
 /**
  * @param WikiLingo\Expression\Plugin $plugin
  * @param string $body
  * @param WikiLingo\Renderer $renderer
  * @param WikiLingo\Parser $parser
  * @return string
  */
 public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
 {
     if (!isset($plugin->parent->privateAttributes['titles'])) {
         $plugin->parent->privateAttributes['titles'] = array();
     }
     $plugin->parent->privateAttributes['titles'][$plugin->id()] = $plugin->parameter('title');
     return parent::render($plugin, $body, $renderer, $parser);
 }
    /**
     * @param WikiLingo\Expression\Plugin $plugin
     * @param string $body
     * @param WikiLingo\Renderer $renderer
     * @param WikiLingo\Parser $parser
     * @return string
     */
    public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
    {
        if (!isset($plugin->parent->privateAttributes['titles'])) {
            $plugin->parent->privateAttributes['titles'] = array();
        }
        $parser->scripts->addScript(<<<JS
\$(".section:first").addClass("active");
JS
);
        $id = $plugin->id();
        //$plugin->attributes['data-anchor'] = $id;
        $plugin->parent->privateAttributes['titles'][$id] = $plugin->parameter('title');
        return parent::render($plugin, $body, $renderer, $parser);
    }
Example #7
0
    /**
     * @param WikiLingo\Expression\Plugin $plugin
     * @param string $body
     * @param WikiLingo\Renderer $renderer
     * @param WikiLingo\Parser $parser
     * @return string
     */
    public function render(WikiLingo\Expression\Plugin &$plugin, &$body = '', &$renderer, &$parser)
    {
        $id = $plugin->id();
        $parser->scripts->addScript(<<<JS
\$(function() {
\t \$( '#{$id}' ).accordion({
\t    header: 'h3'
\t });
});
JS
);
        $accordions = parent::render($plugin, $body, $renderer, $parser);
        return $accordions;
    }
Example #8
0
 /**
  * @param WikiLingo\Expression\Plugin $plugin
  * @param string $body
  * @param WikiLingo\Renderer $renderer
  * @param WikiLingo\Parser $parser
  * @return string
  */
 public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
 {
     $plugin->attributes['title'] = $plugin->parameter('title');
     $allow = $plugin->parameter('allow');
     if ($parser->wysiwyg && empty($allow)) {
         $this->htmlTagType = 'img';
         $plugin->attributes['src'] = 'img/emblem-multimedia.png';
         $flash = parent::render($plugin, $body, $renderer, $parser);
         $this->htmlTagType = 'embed';
     } else {
         $plugin->attributes['src'] = $plugin->parameter('movie');
         $flash = parent::render($plugin, $body, $renderer, $parser);
     }
     return $flash;
 }
Example #9
0
 /**
  * Clears all expression types
  */
 public function clearTypes()
 {
     $this->types = array();
     $this->typesCount = array();
     $this->pluginInstances = array();
     $this->plugins = array();
     $this->events->clear();
     Expression\Plugin::$indexes = array();
     Expression\Plugin::$customClasses = array();
     Expression\BlockType\Header::$ids = array();
 }
Example #10
0
 /**
  * @param WikiLingo\Expression\Plugin $plugin
  * @param string $body
  * @param WikiLingo\Renderer $renderer
  * @param WikiLingo\Parser $parser
  * @return string
  */
 public function render(WikiLingo\Expression\Plugin &$plugin, &$body = '', &$renderer, &$parser)
 {
     $elementName = $parser->wysiwyg && !empty($this->wysiwygTagType) ? $this->wysiwygTagType : $this->htmlTagType;
     $element = $renderer->element($this->expressionType, $elementName);
     $element->classes[] = (!empty($this->attributes['class']) ? $this->attributes['class'] . ' ' : '') . $plugin->type;
     $element->attributes['id'] = $id = $plugin->id();
     $parser->plugins[] = $id;
     $style = $this->stylize($plugin->parametersRaw);
     if (!empty($style)) {
         $element->attributes['style'] = $style;
     }
     $this->attributeDefaults($plugin->attributes);
     foreach ($plugin->attributes as $attribute => $value) {
         $element->attributes[$attribute] = $value;
     }
     if ($parser->wysiwyg) {
         $parser->scripts->addScript("");
     }
     $element->detailedAttributes += $this->detailedAttributes;
     $element->detailedAttributes['data-plugin-type'] = $plugin->type;
     $element->detailedAttributes['data-draggable'] = $this->draggable ? 'true' : 'false';
     $element->detailedAttributes['data-plugin-parameters'] = empty($plugin->parametersRaw) ? null : urlencode(json_encode($plugin->parametersRaw));
     $element->detailedAttributes['data-in-line'] = $plugin->inLine ? 'true' : 'false';
     if ($plugin->inLine) {
         $element->detailedAttributes['contenteditable'] = 'false';
         if ($this->hasHtmlBody == false && !$this->bodyIsAutoGenerated) {
             $element->setInline();
         }
     }
     if (!empty($body)) {
         $element->staticChildren[] = $body;
     }
     $renderedPluginElement = $element->render();
     return $renderedPluginElement;
 }
Example #11
0
    /**
     * @param WikiLingo\Expression\Plugin $plugin
     * @param string $body
     * @param WikiLingo\Renderer $renderer
     * @param WikiLingo\Parser $parser
     * @return string
     */
    public function render(WikiLingo\Expression\Plugin &$plugin, &$body = '', &$renderer, &$parser)
    {
        $plugin->allowLineAfter = false;
        $id = $plugin->id();
        $anchors = array();
        if (!$parser->wysiwyg) {
            if (!empty($plugin->privateAttributes['titles'])) {
                //menu
                $ul = Type::Helper($renderer->helper('ul'));
                $ul->attributes['id'] = $id . '-menu';
                $i = 1;
                //anchors for sections
                foreach ($plugin->privateAttributes['titles'] as $sectionId => $title) {
                    $link = Type::Helper($renderer->helper('span'));
                    $link->attributes['href'] = $sectionId;
                    $link->attributes['onclick'] = <<<JS
\$.fn.fullpage.moveTo({$i});
return false;
JS;
                    $i++;
                    //$anchors[] = $a->attributes['data-index'] = $i++;
                    //$a->attributes['id'] = $sectionId . '-anchor';
                    $link->staticChildren[] = $title;
                    $li = Type::Helper($renderer->helper('li'));
                    $li->children[] = $link;
                    $ul->children[] = $li;
                }
                $body .= $ul->render();
                $anchorsJson = json_encode($anchors);
                Type::Scripts($parser->scripts)->addScriptLocation('~/bower_components/fullPage.js/jquery.fullPage.js')->addCssLocation('~/bower_components/fullPage.js/jquery.fullPage.css')->addScript(<<<JS
    \$(function() {
        \$.fn.fullpage({
            anchors: {$anchorsJson},
            easing: 'easeInOutQuad',
            scrollSpeed: 1100,
            menu: '#{$id}-menu'
        });
    });
JS
)->addCss(<<<CSS
#{$id}-menu {
    height: 40px;
    left: 0;
    margin: 0;
    padding: 0;
    position: fixed;
    top: 0;
    width: 100%;
    list-style: none outside none;
}

#{$id}-menu li {
    background-color: rgba(255, 255, 255, 0.5);
    color: #000000;
    border-radius: 10px;
    display: inline-block;
    margin: 10px;
}

#{$id}-menu li.active {
    background-color: rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
}

#{$id}-menu li span {
    display: block;
    padding: 9px 18px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

CSS
);
            }
        }
        $tabs = parent::render($plugin, $body, $renderer, $parser);
        return $tabs;
    }
 public function __construct(&$parser)
 {
     Expression\Plugin::$indexes = array();
     $this->expected = (new WikiLingoTestExpression\NoLineSkipping($parser))->source;
     $this->source = $parser->parse($this->expected);
 }
 public function __construct(&$parser)
 {
     Expression\Plugin::$indexes = array();
     $this->source = "{DIV()}\n" . "{DIV()}\n" . "{DIV()}\n" . "{DIV()}\n" . "{DIV}{DIV}{DIV}{DIV}\n" . ";foo:foo definition\n" . ";foo2:foo2 definition\n" . "[[__bold__]\n" . "Test" . "''Test Italics''\n";
     $this->expected = "<div class='Div' id='Div4'>" . "<br/>" . "<div class='Div' id='Div3'>" . "<br/>" . "<div class='Div' id='Div2'>" . "<br/>" . "<div class='Div' id='Div1'>" . "<br/>" . "</div>" . "</div>" . "</div>" . "</div>" . "<dl>" . "<dt>foo</dt>" . "<dd>foo definition</dd>" . "<dt>foo2</dt>" . "<dd>foo2 definition</dd>" . "</dl>" . "<a href='[__bold__'>[__bold__</a><br/>" . "Test<i>Test Italics</i><br/>";
 }
 public function __construct(&$parser)
 {
     Expression\Plugin::$indexes = array();
     $this->source = "# foo{DIV()}\n" . " Continuation1\n" . "Continuation2{DIV}\n" . "# bar";
     $this->expected = '<ol>' . "<li><span class='whitespace'> </span>foo" . "<div class='Div' id='Div1'>" . "<br/>" . "<span class='whitespace'> </span>Continuation1" . "<br/>" . 'Continuation2' . '</div>' . '</li>' . "<li><span class='whitespace'> </span>bar</li>" . '</ol>';
 }
Example #15
0
    /**
     * @param WikiLingo\Expression\Plugin $plugin
     * @param string $body
     * @param WikiLingo\Renderer $renderer
     * @param WikiLingo\Parser $parser
     * @return string
     */
    public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
    {
        if (!$parser->wysiwyg) {
            $plugin->attributes['data-active'] = 'true';
            $foreColor = $plugin->parameter("fore-color");
            $accentColor = $plugin->parameter("accent-color");
            $backgroundColor = $plugin->parameter("background-color");
            $backgroundColorHighlighted = $plugin->parameter("background-color-highlighted");
            $parser->scripts->addCss(<<<CSS
/* Menu Start */
.Menu[data-active] {
\tbackground: {$backgroundColor}; /* Old browsers */
\tcolor: {$foreColor};
\tbox-shadow: inset {$backgroundColor} 1px 1px 0, inset {$backgroundColor} -1px -1px 0;
\t-moz-box-shadow: inset {$backgroundColor} 1px 1px 0, inset {$backgroundColor} -1px -1px 0;
\tposition: relative;
}
.Menu[data-active] ul, .Menu[data-active] li {
\tlist-style:none;
\tpadding:0;
\tmargin:0;
\tdisplay:inline;
\tbackground-color: inherit;
}
.Menu[data-active] ul li{
\tfloat:left;
\tposition:relative;
\tbackground-color: inherit;
}
.Menu[data-active] ul li li{
    width: 100%;
}
.Menu[data-active] ul li a{
\tdisplay:block;
\tpadding:8px 12px 8px 12px;
\tmargin: 0;
\tfont-size:18px;
\twhite-space:nowrap;
\t-webkit-transition: background .3s ease-in-out;
\t-moz-transition: background .3s ease-in-out;
\t-o-transition: background .3s ease-in-out;
\tcolor: {$foreColor};
\ttext-decoration: none;
}
.Menu[data-active] ul li a:hover{
\tbackground:{$backgroundColorHighlighted};
}
.Menu[data-active] ul ul{
\tposition:absolute;
\ttop:-99999px;
\tleft:0;
\topacity: 0; /* Hide sub level */
\t-webkit-transition: opacity .5s ease-in-out;
\t-moz-transition: opacity .5s ease-in-out;
\t-o-transition: opacity .5s ease-in-out;
\tborder-top:none;
\tbox-shadow:{$accentColor} 0 3px 4px;
}
.Menu[data-active] ul ul ul {
\tposition:absolute;
\ttop:-99999px;
\tleft:100%;
\topacity: 0;
\t-webkit-transition: opacity .5s ease-in-out; /* Hide sub levels */
\t-moz-transition: opacity .5s ease-in-out;
\t-o-transition: opacity .5s ease-in-out;
}
.Menu[data-active] ul li:hover>ul{
\topacity: 1;
\tposition:absolute;
\ttop:99%;
\tleft:0;
}
.Menu[data-active] ul ul li:hover>ul{
\tposition:absolute;
\ttop:0;
\tleft:100%;
\topacity: 1;
\tbackground:{$accentColor};
}

/* Menu End */
CSS
);
        }
        $menu = parent::render($plugin, $body, $renderer, $parser);
        return $menu;
    }
Example #16
0
 /**
  * @param WikiLingo\Expression\Plugin $plugin
  * @param string $body
  * @param WikiLingo\Renderer $renderer
  * @param WikiLingo\Parser $parser
  * @return string
  */
 public function render(WikiLingo\Expression\Plugin &$plugin, &$body, &$renderer, &$parser)
 {
     $plugin->attributes['title'] = htmlspecialchars($plugin->parameter('title'));
     $slider = parent::render($plugin, $body, $renderer, $parser);
     return $slider;
 }