Skip to content
Permalink
Browse files

See [DokuWiki](splitbrain/dokuwiki#1971) - update `var` to `private`

  • Loading branch information...
gamma committed May 15, 2017
1 parent 1dbacc8 commit 882a7311eb8ce9e433b103f218487d19a19679aa
Showing with 190 additions and 194 deletions.
  1. +55 −56 syntax/animation.php
  2. +77 −79 syntax/item.php
  3. +58 −59 syntax/layer.php
@@ -6,98 +6,97 @@
* @author i-net software <tools@inetsoftware.de>
* @author Gerry Weissbach <gweissbach@inetsoftware.de>
*/
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
class syntax_plugin_layeranimation_animation extends DokuWiki_Syntax_Plugin {
var $currentLayer = 0;
private $currentLayer = 0;
function getType(){ return 'container';}
function getAllowedTypes() { return array('layer'); }
function getPType(){ return 'block';}
/**
* Where to sort in?
*/
function getSort(){ return 301; }
/**
* Connect pattern to lexer
*/
function connectTo($mode) {
$this->Lexer->addEntryPattern('<animation>(?=.*?</animation>)',$mode,'plugin_layeranimation_animation');
$this->Lexer->addEntryPattern('<animation .+?>(?=.*?</animation>)',$mode,'plugin_layeranimation_animation');
}
function postConnect() {
$this->Lexer->addExitPattern('</animation.*?>', 'plugin_layeranimation_animation');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, Doku_Handler $handler){
switch ($state) {
case DOKU_LEXER_ENTER:
$option = array( 'height' => '200' );
foreach ( explode(' ', substr($match, 11, -1)) as $item ) {
if ( is_numeric($item) )
$option['height'] = hsc($item);
else
$option['class'] .= ' ' . hsc($item);
}
return array('animation__start', $option, $pos);
break;
$option = array( 'height' => '200' );
foreach ( explode(' ', substr($match, 11, -1)) as $item ) {
if ( is_numeric($item) )
$option['height'] = hsc($item);
else
$option['class'] .= ' ' . hsc($item);
}
return array('animation__start', $option, $pos);
break;
case DOKU_LEXER_EXIT:
return array('animation__end', null, $pos + strlen($match));
break;
return array('animation__end', null, $pos + strlen($match));
break;
}
return false;
}
/**
* Create output
*/
/**
* Create output
*/
function render($mode, Doku_Renderer $renderer, $input) {
global $conf;
global $conf;
if($mode == 'xhtml'){
$renderer->nocache();
list($instr, $data, $pos) = $input;
switch ( $instr ) {
case 'animation__start' :
$conf['layeranimation']['currentanimation']['height'] = $data['height'];
$renderer->doc .= '<div class="layeranimation' . $data['class'] . ' noscripting' . (method_exists($renderer, "finishSectionEdit") ? ' ' . $renderer->startSectionEdit($pos, 'section', 'layeranimation') : "") . '" style="height: ' . $data['height'] . 'px">' . "\n";
break;
case 'animation__end' :
$renderer->doc .= '</div>' . "\n";
$renderer->doc .= '<div class="clearer"></div>' . "\n";
if ( method_exists($renderer, "finishSectionEdit") ) { $renderer->finishSectionEdit($pos); }
break;
default :
return false;
}
$renderer->nocache();
list($instr, $data, $pos) = $input;
switch ( $instr ) {
case 'animation__start' :
$conf['layeranimation']['currentanimation']['height'] = $data['height'];
$renderer->doc .= '<div class="layeranimation' . $data['class'] . ' noscripting' . (method_exists($renderer, "finishSectionEdit") ? ' ' . $renderer->startSectionEdit($pos, 'section', 'layeranimation') : "") . '" style="height: ' . $data['height'] . 'px">' . "\n";
break;
case 'animation__end' :
$renderer->doc .= '</div>' . "\n";
$renderer->doc .= '<div class="clearer"></div>' . "\n";
if ( method_exists($renderer, "finishSectionEdit") ) { $renderer->finishSectionEdit($pos); }
break;
default :
return false;
}
return true;
}
return false;
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :
@@ -6,122 +6,120 @@
* @author i-net software <tools@inetsoftware.de>
* @author Gerry Weissbach <gweissbach@inetsoftware.de>
*/
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
class syntax_plugin_layeranimation_item extends DokuWiki_Syntax_Plugin {
var $currentLayer = 0;
private $currentLayer = 0;
function getType(){ return 'item';}
function getAllowedTypes() { return array('container','substition','protected','disabled','formatting','paragraphs'); }
function getPType(){ return 'block';}
/**
* Where to sort in?
*/
function getSort(){ return 301; }
/**
* Connect pattern to lexer
*/
function connectTo($mode) {
$this->Lexer->addEntryPattern('<item>(?=.*?</item>)',$mode,'plugin_layeranimation_item');
$this->Lexer->addEntryPattern('<item .+?>(?=.*?</item>)',$mode,'plugin_layeranimation_item');
}
function postConnect() {
$this->Lexer->addExitPattern('</item.*?>', 'plugin_layeranimation_item');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, Doku_Handler $handler){
switch ($state) {
case DOKU_LEXER_ENTER:
list ($option, $clip) = explode('?', substr($match, 6, -1), 2);
return array('item__start', array('option' => explode(' ', $option), 'clip' => explode(':', $clip)));
break;
list ($option, $clip) = explode('?', substr($match, 6, -1), 2);
return array('item__start', array('option' => explode(' ', $option), 'clip' => explode(':', $clip)));
break;
case DOKU_LEXER_UNMATCHED:
$handler->_addCall('cdata',array($match), $pos);
return false;
break;
$handler->_addCall('cdata',array($match), $pos);
return false;
break;
case DOKU_LEXER_EXIT:
return array('item__end', null);
break;
return array('item__end', null);
break;
}
return false;
}
/**
* Create output
*/
/**
* Create output
*/
function render($mode, Doku_Renderer $renderer, $input) {
global $conf;
global $conf;
if($mode == 'xhtml'){
$renderer->nocache();
list($instr, $data) = $input;
switch ( $instr ) {
case 'item__start' :
$CSSOption = '';
$ClassOption = '';
$ClipOption = array();
foreach ( $data['option'] as $item ) {
$subItem = explode(':', $item, 2);
if ( count($subItem) == 1 )
{
$ClassOption .= ' ' . hsc(trim($item));
} else {
$CSSOption .= ' ' . hsc(trim($item));
}
}
foreach ( $data['clip'] as $item ) {
$item = hsc(trim($item));
if ( $item == 'auto' )
$ClipOption[] = $item;
else if ( is_numeric($item) )
$ClipOption[] = intval($item) . 'px';
}
if ( !empty($ClipOption) && count($ClipOption) == 4 ) {
$ClipOption = 'clip:rect(' . implode(',', $ClipOption) . ');';
} else $ClipOption = '';
$renderer->doc .= '<div class="item' . $ClassOption . '" style="' . $ClipOption . $CSSOption . '">' . "\n";
break;
case 'item__end' :
$renderer->doc .= '</div>' . "\n";
break;
default :
return false;
}
$renderer->nocache();
list($instr, $data) = $input;
switch ( $instr ) {
case 'item__start' :
$CSSOption = '';
$ClassOption = '';
$ClipOption = array();
foreach ( $data['option'] as $item ) {
$subItem = explode(':', $item, 2);
if ( count($subItem) == 1 )
{
$ClassOption .= ' ' . hsc(trim($item));
} else {
$CSSOption .= ' ' . hsc(trim($item));
}
}
foreach ( $data['clip'] as $item ) {
$item = hsc(trim($item));
if ( $item == 'auto' )
$ClipOption[] = $item;
else if ( is_numeric($item) )
$ClipOption[] = intval($item) . 'px';
}
if ( !empty($ClipOption) && count($ClipOption) == 4 ) {
$ClipOption = 'clip:rect(' . implode(',', $ClipOption) . ');';
} else $ClipOption = '';
$renderer->doc .= '<div class="item' . $ClassOption . '" style="' . $ClipOption . $CSSOption . '">' . "\n";
break;
case 'item__end' :
$renderer->doc .= '</div>' . "\n";
break;
default :
return false;
}
return true;
}
return false;
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :

0 comments on commit 882a731

Please sign in to comment.
You can’t perform that action at this time.