1<?php 2/** 3 * Mikio Syntax Plugin: Placeholder 4 * 5 * @link http://github.com/nomadjimbob/mikioplugin 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 * @author James Collins <james.collins@outlook.com.au> 8 */ 9if (!defined('DOKU_INC')) die(); 10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once(dirname(__FILE__).'/core.php'); 12 13class syntax_plugin_mikioplugin_placeholder extends syntax_plugin_mikioplugin_core { 14 public $tag = 'placeholder'; 15 public $hasEndTag = false; 16 public $options = array( 17 'width' => array('type' => 'size', 'default' => ''), 18 'height' => array('type' => 'size', 'default' => ''), 19 'text' => array('type' => 'text', 'default' => ''), 20 'color' => array('type' => 'text', 'default' => 'var(--mikiop-border-color)'), 21 'text-color' => array('type' => 'text', 'default' => 'currentColor'), 22 ); 23 24 public function render_lexer_special(Doku_Renderer $renderer, $data) { 25 $styles = $this->buildStyle(array('width' => $data['width'], 'height' => $data['height']), TRUE); 26 27 $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'placeholder"' . $styles . '>'; 28 $renderer->doc .= '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img">'; 29 $renderer->doc .= '<rect width="100%" height="100%" fill="' . $data['color'] . '"></rect>'; 30 $renderer->doc .= '<text x="50%" y="50%" fill="' .$data['text-color'] . '" dominant-baseline="middle" text-anchor="middle">' . $data['text'] . '</text>'; 31 $renderer->doc .= '</svg>'; 32 $renderer->doc .= '</div>'; 33 } 34} 35?>