function render($mode, Doku_Renderer $renderer, $data) { if ($data[0] == DOKU_LEXER_ENTER) { $renderer->emphasis_open(); } elseif ($data[0] == DOKU_LEXER_EXIT) { $renderer->emphasis_close(); } elseif ($data[0] == DOKU_LEXER_UNMATCHED) { $renderer->cdata($data[1]); } elseif ($data[0] == DOKU_LEXER_SPECIAL) { $renderer->cdata($data[1]); } return true; }
function render($mode, Doku_Renderer $renderer, $data) { $renderer->monospace_open(); $renderer->cdata(substr($data[0], 5, -5)); $renderer->monospace_close(); return true; }
function render($mode, Doku_Renderer $R, $data) { global $auth; global $conf; extract($data); if ($mode != 'xhtml' || is_null($auth)) { $R->cdata($title ? $title : $login); return true; } // fetch userinfo $uinfo = $auth->getUserData($login); // nothing found? render as text if (!$uinfo) { $R->cdata($title ? $title : $login); return true; } if (!$title) { if ($this->getConf('usefullname')) { $title = $uinfo['name']; } else { $title = $login; } } if (!$title) { $title = $login; } if ($uinfo['avatar'] && $uinfo['avatar'] != 'gravatar') { $img = $this->getConf('avatarurl') . $uinfo['avatar']; } else { $img = $this->getConf('gravatar') . md5($uinfo['mail']); } $R->doc .= '<a href="' . $this->getConf('profileurl') . $uinfo['uid'] . '" class="unblink_plugin">'; $R->doc .= hsc($title); $R->doc .= '<span class="unblink_popup" title="Visit Profile">'; $R->doc .= '<img src="' . hsc($img) . '" class="medialeft" width="64" height="64" alt="" />'; $R->doc .= '<b>' . hsc($uinfo['name']) . '</b><br />'; if ($uinfo['name'] != $login) { $R->doc .= '<i>' . hsc($login) . '</i><br />'; } $R->doc .= '<br />'; $R->doc .= hsc($uinfo['location']); $R->doc .= '</span>'; $R->doc .= '</a>'; return true; }
/** * @param string $value the user to display * @param \Doku_Renderer $R * @param string $mode * @return bool */ public function renderValue($value, \Doku_Renderer $R, $mode) { if ($mode == 'xhtml') { $name = userlink($value); $R->doc .= $name; } else { $name = userlink($value, true); $R->cdata($name); } return true; }
function render($mode, Doku_Renderer $renderer, $data) { if ($data[0] == DOKU_LEXER_ENTER) { $renderer->strong_open(); } elseif ($data[0] == DOKU_LEXER_EXIT) { $renderer->strong_close(); } else { $renderer->cdata($data[1]); } return true; }
/** * Output the stored data * * @param string|int $value the value stored in the database * @param \Doku_Renderer $R the renderer currently used to render the data * @param string $mode The mode the output is rendered in (eg. XHTML) * @return bool true if $mode could be satisfied */ public function renderValue($value, \Doku_Renderer $R, $mode) { $date = date_create($value); if ($date !== false) { $out = date_format($date, $this->config['format']); } else { $out = ''; } $R->cdata($out); return true; }
/** * print a numeric data cell * * @param string $data * @param int $span * @param bool $number */ private function cell($data = '', $span = 1, $number = true) { if ($number) { if (!$data) { $data = 0; } $align = 'right'; } else { $align = null; } $this->R->tablecell_open($span, $align); $this->R->cdata($data); $this->R->tablecell_close(); }
/** * Output the stored data * * @param string|int $value the value stored in the database * @param \Doku_Renderer $R the renderer currently used to render the data * @param string $mode The mode the output is rendered in (eg. XHTML) * @return bool true if $mode could be satisfied */ public function renderValue($value, \Doku_Renderer $R, $mode) { if ($this->config['roundto'] == -1) { $value = $this->formatWithoutRounding($value, $this->config['decpoint'], $this->config['thousands']); } else { $value = floatval($value); $value = number_format($value, $this->config['roundto'], $this->config['decpoint'], $this->config['thousands']); } if ($this->config['trimzeros'] && strpos($value, $this->config['decpoint']) !== false) { $value = rtrim($value, '0'); $value = rtrim($value, $this->config['decpoint']); } $R->cdata($this->config['prefix'] . $value . $this->config['postfix']); return true; }
/** * Create output */ function render($format, Doku_Renderer $R, $data) { if ($format != 'xhtml') { return false; } $user = strip_tags(editorinfo($data['user'])); if ($data['valid']) { $msg = sprintf($this->getLang('valid'), $user); $R->doc .= '<span class="sig_valid" title="' . $msg . '">'; } else { $msg = sprintf($this->getLang('invalid'), $user); $R->doc .= '<span class="sig_invalid" title="' . $msg . '">'; } $R->cdata($data['text']); $R->doc .= '</span>'; return true; }
function render($mode, Doku_Renderer $renderer, $data) { global $ID; preg_match('/^\\!\\[(' . $this->nested_brackets_re . ')\\][ ]?(?:\\n[ ]*)?\\[(.*?)\\]$/', $data[1], $matches); $title = $matches[1]; if ($matches[2] == '') { $rid = $matches[1]; } else { $rid = $matches[2]; } $rid = preg_replace("/ /", ".", $rid); $target = p_get_metadata($ID, 'markdowku_references_' . $rid, METADATA_RENDER_USING_CACHE); if ($target == '') { $renderer->cdata($data[1]); } else { $renderer->_media($target, $title); } return true; }
function render($mode, Doku_Renderer $renderer, $data) { global $ID; preg_match('/^\\[(' . $this->nested_brackets_re . ')\\][ ]?(?:\\n[ ]*)?\\[(.*?)\\]$/', $data[1], $matches); $title = $matches[1]; if ($matches[2] == '') { $rid = $matches[1]; } else { $rid = $matches[2]; } $rid = preg_replace("/ /", ".", $rid); $target = p_get_metadata($ID, 'markdowku_references_' . $rid, METADATA_RENDER_USING_CACHE); if ($target == '') { $renderer->cdata($data[1]); } else { if (preg_match('/^mailto:/', $target) or preg_match('<' . PREG_PATTERN_VALID_EMAIL . '>', $target)) { $target = preg_replace('/^mailto:/', '', $target); $renderer->emaillink($target, $title); } else { $renderer->externallink($target, $title); } } return true; }
/** * Render the day header * * @param Doku_Renderer $R * @param int $date */ protected function dayheader(&$R, $date) { if ($R->getFormat() == 'xhtml') { /* @var Doku_Renderer_xhtml $R */ $R->doc .= '<h3 class="changes">'; $R->cdata(dformat($date, $this->getConf('dayheaderfmt'))); $R->doc .= '</h3>'; } else { $R->header(dformat($date, $this->getConf('dayheaderfmt')), 3, 0); } }
/** * Create an empty list * * @param array $data instruction by handler() * @param array $clist keys of the columns * @param Doku_Renderer $R */ function nullList($data, $clist, $R) { $R->doc .= '<div class="dataaggregation"><p class="dataplugin_list ' . $data['classes'] . '">'; $R->cdata($this->getLang('none')); $R->doc .= '</p></div>'; }
/** * Create an empty list * * @param array $data instruction by handler() * @param array $clist keys of the columns * @param Doku_Renderer $R */ function nullList($data, $clist, Doku_Renderer $R) { switch ($R->getFormat()) { case 'xhtml': $R->doc .= '<div class="dataaggregation"><p class="dataplugin_list ' . $data['classes'] . '">'; $R->cdata($this->getLang('none')); $R->doc .= '</p></div>'; break; case 'odt': $R->p_open(); $R->cdata($this->getLang('none')); $R->p_close(); break; } }
/** * Render schema data * * Currently completely renderer agnostic * * @todo we currently have no schema headlines * * @param string $mode Renderer mode * @param Doku_Renderer $R The renderer * @param array $data The data from the handler() function * @return bool If rendering was successful. */ public function render($mode, Doku_Renderer $R, $data) { global $ID; global $INFO; global $REV; if ($ID != $INFO['id']) { return true; } if (!$INFO['exists']) { return true; } if ($this->hasBeenRendered) { return true; } // do not render the output twice on the same page, e.g. when another page has been included $this->hasBeenRendered = true; $assignments = new Assignments(); $tables = $assignments->getPageAssignments($ID); if (!$tables) { return true; } if ($mode == 'xhtml') { $R->doc .= '<div id="plugin__struct_output">'; } foreach ($tables as $table) { $schemadata = AccessTable::byTableName($table, $ID, $REV); $schemadata->optionSkipEmpty(true); $data = $schemadata->getData(); if (!count($data)) { continue; } $R->table_open(); $R->tablethead_open(); $R->tablerow_open(); $R->tableheader_open(2); $R->cdata($table); $R->tableheader_close(); $R->tablerow_close(); $R->tablethead_open(); $R->tabletbody_open(); foreach ($data as $field) { $R->tablerow_open(); $R->tableheader_open(); $R->cdata($field->getColumn()->getTranslatedLabel()); $R->tableheader_close(); $R->tablecell_open(); $field->render($R, $mode); $R->tablecell_close(); $R->tablerow_close(); } $R->tabletbody_close(); $R->table_close(); } if ($mode == 'xhtml') { $R->doc .= '</div>'; } return true; }
/** * Output the stored data * * @param string|int $value the value stored in the database * @param \Doku_Renderer $R the renderer currently used to render the data * @param string $mode The mode the output is rendered in (eg. XHTML) * @return bool true if $mode could be satisfied */ public function renderValue($value, \Doku_Renderer $R, $mode) { $value = $this->displayValue($value); $R->cdata($value); return true; }
function render($mode, Doku_Renderer &$renderer, $opt) { global $INFO; if ($mode == 'metadata') { return false; } if ($mode == 'xhtml') { $renderer->nocache(); $Hajax = plugin_load('helper', 'ajaxedit'); if (!$Hajax) { msg('Plugin ajaxedit is missing'); } if ($opt["mode"] == 'weekpicker') { $mode = 'week'; $empty = hsc($this->getConf('emptyStringWeek')); } else { if ($opt["mode"] == 'datepicker') { $mode = 'date'; $empty = hsc($this->getConf('emptyStringDate')); } } if ($opt['date'] === "") { $opt['date'] = $empty; } //insert selector if writable if ($this->iswriter() == TRUE && $Hajax) { $id = $opt["id"]; $renderer->cdata("\n"); $image = DOKU_URL . "lib/plugins/datepicker/" . $mode . ".gif"; switch ($opt['option']) { case '#': $renderer->doc .= "<a class='" . $mode . "picker' style='cursor:pointer;' id='" . $mode . "picker__button__" . $id . "'>"; $renderer->doc .= "<img src='{$image}' alt='Kalender' onload='" . $mode . "pickerInit(" . $id . ",\"" . $empty . "\")' style='display:none;' />"; $renderer->doc .= "<span class='" . $mode . "picker' id='" . $mode . "picker__show__" . $id . "' >"; $renderer->doc .= hsc($opt['date']); $renderer->doc .= "</span></a>"; break; case '\\': $renderer->doc .= "<span class='" . $mode . "picker' id='" . $mode . "picker__show__" . $id . "'>"; $renderer->doc .= hsc($opt['date']) . "</span><br>"; $renderer->doc .= "<img class='" . $mode . "picker' src='{$image}' alt='Kalender' style='cursor:pointer;' id='" . $mode . "picker__button__" . $id . "' onload='" . $mode . "pickerInit(" . $id . ",\"" . $empty . "\")' />"; break; case false: $renderer->doc .= "<span class='" . $mode . "picker' id='" . $mode . "picker__show__" . $id . "'>"; $renderer->doc .= hsc($opt['date']) . "</span>"; $renderer->doc .= "<img class='" . $mode . "picker' src='{$image}' alt='Kalender' style='cursor:pointer;' id='" . $mode . "picker__button__" . $id . "' onload='" . $mode . "pickerInit(" . $id . ",\"" . $empty . "\")' />"; break; } } else { $renderer->doc .= hsc($opt['date']); } } else { $renderer->doc .= hsc($opt['date']); } return true; }
public function render($mode, Doku_Renderer $renderer, $data) { global $DOKUTRANSLATE_NEST; global $ID; global $ACT; global $TEXT; global $REV; # No metadata rendering if ($mode == 'metadata') { return false; } # Allow exporting the page if (substr($ACT, 0, 7) == 'export_') { # Ignore plugin-specific markup, just let text through if ($data[0] != DOKU_LEXER_UNMATCHED) { return true; } $renderer->cdata($data[1]); return true; # Not exporting, allow only XHTML } else { if ($mode != 'xhtml') { return false; } } # Load instructions for original text on first call if (is_null($this->origIns)) { $DOKUTRANSLATE_NEST++; $this->origIns = getCleanInstructions(dataPath($ID) . '/orig.txt'); $this->meta = loadTranslationMeta($ID); $this->parCounter = 0; $DOKUTRANSLATE_NEST--; } $parid = getParID(); $edithere = in_array($ACT, array('edit', 'preview')) && $parid == $this->parCounter; switch ($data[0]) { # Open the table case DOKU_LEXER_ENTER: $renderer->doc .= '<table width="100%" class="dokutranslate"><tbody><tr>'; $cls = parReviewClass($this->meta, $this->parCounter); # Start the cell with proper review class if (empty($cls)) { $renderer->doc .= '<td width="50%">'; } else { $renderer->doc .= '<td width="50%" class="' . $cls . '">'; } # Paragraph anchor (yes, empty named anchor is valid) $renderer->doc .= "<a name=\"_par{$this->parCounter}\"></a>\n"; # Insert edit form if we're editing the first paragraph if ($edithere) { startEditForm($renderer); } break; # Dump original text and close the row # Dump original text and close the row case DOKU_LEXER_SPECIAL: # Generate edit button if ($ACT == 'show') { if (empty($REV)) { $renderer->doc .= parEditButton($this->parCounter); } $renderer->doc .= $this->_renderReviews($ID, $this->meta, $this->parCounter); # Finish erasure if we're editing this paragraph } else { if ($edithere) { endEditForm($renderer); $renderer->doc .= $this->_renderReviews($ID, $this->meta, $this->parCounter); } } $renderer->doc .= "</td>\n"; if (needsReview($ID, $this->meta, $this->parCounter) || $edithere) { $renderer->doc .= '<td class="reviewme">'; } else { $renderer->doc .= '<td>'; } # If this condition fails, somebody's been messing # with the data if (current($this->origIns) !== FALSE) { $renderer->nest(current($this->origIns)); next($this->origIns); } $renderer->doc .= "</td></tr>\n<tr>"; $this->parCounter++; $cls = parReviewClass($this->meta, $this->parCounter); # Start the cell with proper review class if (empty($cls)) { $renderer->doc .= '<td width="50%">'; } else { $renderer->doc .= '<td width="50%" class="' . $cls . '">'; } # Paragraph anchor (yes, empty named anchor is valid) $renderer->doc .= "<a name=\"_par{$this->parCounter}\"></a>\n"; # Insert edit form if we're editing this paragraph if (in_array($ACT, array('edit', 'preview')) && getParID() == $this->parCounter) { startEditForm($renderer); } break; # Dump the rest of the original text and close the table # Dump the rest of the original text and close the table case DOKU_LEXER_EXIT: # Generate edit button if ($ACT == 'show') { if (empty($REV)) { $renderer->doc .= parEditButton($this->parCounter); } $renderer->doc .= $this->_renderReviews($ID, $this->meta, $this->parCounter); # Finish erasure if we're editing the last paragraph } else { if (in_array($ACT, array('edit', 'preview'))) { $parid = getParID(); if ($parid == $this->parCounter) { endEditForm($renderer); $renderer->doc .= $this->_renderReviews($ID, $this->meta, $this->parCounter); # Invalid paragraph ID, show form here } else { if ($parid > $this->parCounter) { startEditForm($renderer, true); } } } } $renderer->doc .= "</td>\n"; if (needsReview($ID, $this->meta, $this->parCounter) || $edithere) { $renderer->doc .= '<td class="reviewme">'; } else { $renderer->doc .= '<td>'; } # Loop to make sure all remaining text gets dumped # (external edit safety) while (current($this->origIns) !== FALSE) { $renderer->nest(current($this->origIns)); next($this->origIns); } $renderer->doc .= '</td></tr></tbody></table>'; break; # Just sanitize and dump the text # Just sanitize and dump the text default: $renderer->cdata($data[1]); break; } return true; }
/** * Render xhtml output or metadata * * @param string $mode Renderer mode (supported modes: xhtml and metadata) * @param Doku_Renderer $renderer The renderer * @param array $data The data from the handler function * @return bool If rendering was successful. */ function render($mode, &$renderer, $data) { global $lang; $flags = $data; if ($mode == 'xhtml') { /* @var Doku_Renderer_xhtml $renderer */ // prevent caching to ensure content is always fresh $renderer->info['cache'] = false; /* @var helper_plugin_pagelist $pagelist */ // let Pagelist Plugin do the work for us if (plugin_isdisabled('pagelist') || !($pagelist = plugin_load('helper', 'pagelist'))) { msg($this->getLang('missing_pagelistplugin'), -1); return false; } // Prepare the flags for the pagelist plugin $configflags = explode(',', str_replace(" ", "", $this->getConf('pagelist_flags'))); $flags = array_merge($configflags, $flags); foreach ($flags as $key => $flag) { if ($flag == "") { unset($flags[$key]); } } // print the search form $renderer->doc .= $this->getForm(); // get the tag input data $tags = $this->getTagSearchString(); if ($tags != NULL) { /* @var helper_plugin_tag $my */ if ($my =& plugin_load('helper', 'tag')) { $pages = $my->getTopic($this->getNS(), '', $tags); } // Display a message when no pages were found if (!isset($pages) || !$pages) { $renderer->p_open(); $renderer->cdata($lang['nothingfound']); $renderer->p_close(); } else { // display the actual search results $pagelist->setFlags($flags); $pagelist->startList(); foreach ($pages as $page) { $pagelist->addPage($page); } $renderer->doc .= $pagelist->finishList(); } } return true; } return false; }
/** * Output the stored data * * @param string|int $value the value stored in the database * @param \Doku_Renderer $R the renderer currently used to render the data * @param string $mode The mode the output is rendered in (eg. XHTML) * @return bool true if $mode could be satisfied */ public function renderValue($value, \Doku_Renderer $R, $mode) { $R->cdata($this->config['prefix'] . $value . $this->config['postfix']); return true; }
/** * Create an empty table * * @param array $data instruction by handler() * @param array $clist keys of the columns * @param Doku_Renderer $R */ function nullList($data, $clist, $R) { $R->doc .= $this->preList($clist, $data); $R->tablerow_open(); $R->tablecell_open(count($clist), 'center'); $R->cdata($this->getLang('none')); $R->tablecell_close(); $R->tablerow_close(); $R->doc .= '</table></div>'; }
/** * Create output */ function render($mode, Doku_Renderer &$renderer, $opt) { if ($mode == 'metadata') { return false; } // load file data if ($opt['file']) { if (preg_match('/^https?:\\/\\//i', $opt['file'])) { require_once DOKU_INC . 'inc/HTTPClient.php'; $http = new DokuHTTPClient(); $opt['content'] = $http->get($opt['file']); if ($opt['content'] === false) { $renderer->cdata('Failed to fetch remote CSV data'); return true; } } else { $renderer->info['cache'] = false; if (auth_quickaclcheck(getNS($opt['file']) . ':*') < AUTH_READ) { $renderer->cdata('Access denied to CSV data'); return true; } else { $file = mediaFN($opt['file']); $opt['content'] = io_readFile($file); } } // if not valid UTF-8 is given we assume ISO-8859-1 if (!utf8_check($opt['content'])) { $opt['content'] = utf8_encode($opt['content']); } } // check if there is content $content =& $opt['content']; $content = trim($content); if ($content === '') { $renderer->cdata('No csv data found'); return true; } // Export the csv file $targetfile = ''; $export = $opt['export']; if ($export != '') { $targetfile = htmlspecialchars(trim($export)); if (auth_quickaclcheck(getNS($targetfile . ':*')) < AUTH_EDIT) { $renderer->cdata('Access denied: Could not create download link.'); $targetfile = ''; return true; } else { $file = mediaFN($targetfile); if (file_put_contents($file, $content, LOCK_EX) > 0) { $linkname = $opt['linkname']; if ($linkname == '') { $linkname = 'Download CSV file'; } } else { $targetfile = ''; $renderer->cdata('Failed to write ' . $file . ': Could not create download link.'); return true; } } } // get the first row - it will define the structure $row = $this->csv_explode_row($content, $opt['delim'], $opt['enclosure'], $opt['escape']); $maxcol = count($row); $line = 0; // create the table and start rendering $renderer->table_open($maxcol); while ($row !== false) { // make sure we have enough columns $row = array_pad($row, $maxcol, ''); // render $renderer->tablerow_open(); for ($i = 0; $i < $maxcol;) { $span = 1; // lookahead to find spanning cells if ($opt['span_empty_cols']) { for ($j = $i + 1; $j < $maxcol; $j++) { if ($row[$j] === '') { $span++; } else { break; } } } // open cell if ($line < $opt['hdr_rows'] || $i < $opt['hdr_cols']) { $renderer->tableheader_open($span); } else { $renderer->tablecell_open($span); } // print cell content, call linebreak() for newlines $lines = explode("\n", $row[$i]); $cnt = count($lines); for ($k = 0; $k < $cnt; $k++) { $renderer->cdata($lines[$k]); if ($k < $cnt - 1) { $renderer->linebreak(); } } // close cell if ($line < $opt['hdr_rows'] || $i < $opt['hdr_cols']) { $renderer->tableheader_close(); } else { $renderer->tablecell_close(); } $i += $span; } $renderer->tablerow_close(); // get next row $row = $this->csv_explode_row($content, $opt['delim'], $opt['enclosure'], $opt['escape']); $line++; } $renderer->table_close(); if ($targetfile != '') { $renderer->internalmedia($targetfile, $linkname); } return true; }
/** * Create output * * @param string $format Renderer mode (supported modes: xhtml) * @param Doku_Renderer $renderer The renderer * @param array $data The data from the handler() function * @return bool If rendering was successful. */ function render($format, Doku_Renderer $renderer, $data) { if ($format == 'metadata') { return false; } if ($data[0] != DOKU_LEXER_SPECIAL) { return false; } $hlp = plugin_load('helper', 'rating'); $list = $hlp->best($data[1]['lang'], $data[1]['startdate'], 20); if ($data[1]['tag'] == 'ol') { $renderer->listo_open(); } else { $renderer->listu_open(); } $num_items = 0; foreach ($list as $item) { if (auth_aclcheck($item['page'], '', null) < AUTH_READ) { continue; } if (!page_exists($item['page'])) { continue; } $num_items = $num_items + 1; $renderer->listitem_open(1); if (strpos($item['page'], ':') === false) { $item['page'] = ':' . $item['page']; } $renderer->internallink($item['page']); if ($data[1]['score'] === 'true') { $renderer->cdata(' (' . $item['val'] . ')'); } $renderer->listitem_close(); if ($num_items >= 10) { break; } } if ($data[1]['tag'] == 'ol') { $renderer->listo_close(); } else { $renderer->listu_close(); } return true; }