本文整理汇总了PHP中html_btn函数的典型用法代码示例。如果您正苦于以下问题:PHP html_btn函数的具体用法?PHP html_btn怎么用?PHP html_btn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_btn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _tpl_userpage
/**
* Create link/button to user page
*
* @author Anika Henke <anika@selfthinker.org>
*/
function _tpl_userpage($userPage, $title, $link = 0, $wrapper = 0, $return = 0)
{
if (empty($_SERVER['REMOTE_USER'])) {
return;
}
global $conf;
$output = '';
$userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage);
if ($wrapper) {
$output .= "<{$wrapper}>";
}
if ($link) {
ob_start();
tpl_pagelink($userPage, $title);
$output .= ob_get_contents();
ob_end_clean();
} else {
$output .= html_btn('userpage', $userPage, '', array(), 'get', 0, $title);
}
if ($wrapper) {
$output .= "</{$wrapper}>";
}
if ($return) {
return $output;
}
echo $output;
}
示例2: parEditButton
function parEditButton($parId)
{
global $ID;
global $INFO;
$ret = '';
$params = array('do' => 'edit', 'rev' => $INFO['lastmod'], 'parid' => $parId);
$ret .= '<div class="secedit editbutton_par' . strval($parId) . '">';
$ret .= html_btn('secedit', $ID, '', $params, 'post');
$ret .= '</div>';
return $ret;
}
示例3: _tpl_register
/**
* Create link/button to register page
* DW versions > 2011-02-20 can use the core function tpl_action('register')
*
* @author Anika Henke <anika@selfthinker.org>
*/
function _tpl_register($link=0,$wrapper=0) {
global $conf;
global $lang;
global $ID;
$lang_register = !empty($lang['btn_register']) ? $lang['btn_register'] : $lang['register'];
if ($_SERVER['REMOTE_USER'] || !$conf['useacl'] || !actionOK('register')) return;
if ($wrapper) echo "<$wrapper>";
if ($link)
tpl_link(wl($ID,'do=register'),$lang_register,'class="action register" rel="nofollow"');
else
echo html_btn('register',$ID,'',array('do'=>'register'),'get',0,$lang_register);
if ($wrapper) echo "</$wrapper>";
}
示例4: _tpl_userpage
/**
* Create link/button to user page
*
* @author Anika Henke <anika@selfthinker.org>
*/
function _tpl_userpage($userPage, $title, $link = 0, $wrapper = 0)
{
if (empty($_SERVER['REMOTE_USER'])) {
return;
}
global $conf;
$userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage);
if ($wrapper) {
echo "<{$wrapper}>";
}
if ($link) {
tpl_pagelink($userPage, $title);
} else {
echo html_btn('userpage', $userPage, '', array(), 'get', 0, $title);
}
if ($wrapper) {
echo "</{$wrapper}>";
}
}
示例5: _tpl_userpage
/**
* Create link/button to user page
*
* @author Anika Henke <anika@selfthinker.org>
*/
function _tpl_userpage($userNS = 'user', $link = 0, $wrapper = false)
{
if (!$_SERVER['REMOTE_USER']) {
return;
}
global $conf;
$userPage = $userNS . ':' . $_SERVER['REMOTE_USER'] . ':' . $conf['start'];
if ($wrapper) {
echo "<{$wrapper}>";
}
if ($link) {
tpl_pagelink($userPage, tpl_getLang('userpage'));
} else {
echo html_btn('userpage', $userPage, '', array(), 0, 0, tpl_getLang('userpage'));
}
if ($wrapper) {
echo "</{$wrapper}>";
}
}
示例6: p_sidebar_xhtml
/**
* Removes the TOC of the sidebar pages and
* shows a edit button if the user has enough rights
*
* TODO sidebar caching
*
* @author Michael Klier <chi@chimeric.de>
*/
function p_sidebar_xhtml($sb, $pos, $subst = array())
{
$data = p_wiki_xhtml($sb, '', false);
if (!empty($subst)) {
$data = preg_replace($subst['pattern'], $subst['replace'], $data);
}
if (auth_quickaclcheck($sb) >= AUTH_EDIT) {
$data .= '<div class="secedit">' . html_btn('secedit', $sb, '', array('do' => 'edit', 'rev' => '', 'post')) . '</div>';
}
// strip TOC
$data = preg_replace('/<div class="toc">.*?(<\\/div>\\n<\\/div>)/s', '', $data);
// replace headline ids for XHTML compliance
$data = preg_replace('/(<h.*?><a.*?name=")(.*?)(".*?id=")(.*?)(">.*?<\\/a><\\/h.*?>)/', '\\1sb_' . $pos . '_\\2\\3sb_' . $pos . '_\\4\\5', $data);
return $data;
}
示例7: p_sidebar_xhtml
/**
* Removes the TOC of the sidebar pages and
* shows a edit button if the user has enough rights
*
*/
function p_sidebar_xhtml($sb)
{
global $conf;
$tpl = $conf['template'];
$data = p_wiki_xhtml($sb, '', false);
if (auth_quickaclcheck($sb) >= AUTH_EDIT and tpl_getConf('sidebaredit')) {
$data .= '<div class="secedit">' . html_btn('secedit', $sb, '', array('do' => 'edit', 'rev' => '', 'post')) . '</div>';
}
// strip TOC
$data = preg_replace('/<div class="toc">.*?(<\\/div>\\n<\\/div>)/s', '', $data);
// replace headline ids for XHTML compliance
$data = preg_replace('/(<h.*?><a.*?id=")(.*?)(">.*?<\\/a><\\/h.*?>)/', '\\1sb_left_\\2\\3', $data);
return $data;
}
示例8: html_revisions
//.........这里部分代码省略.........
array_pop($revisions);
// remove extra log entry
}
$date = @strftime($conf['dformat'], $INFO['lastmod']);
print p_locale_xhtml('revisions');
$form = new Doku_Form('page__revisions', wl($ID));
$form->addElement(form_makeOpenTag('ul'));
if ($INFO['exists'] && $first == 0) {
if (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
} else {
$form->addElement(form_makeOpenTag('li'));
}
$form->addElement(form_makeOpenTag('div', array('class' => 'li')));
$form->addElement(form_makeTag('input', array('type' => 'checkbox', 'name' => 'rev2[]', 'value' => 'current')));
$form->addElement(form_makeOpenTag('span', array('class' => 'date')));
$form->addElement($date);
$form->addElement(form_makeCloseTag('span'));
$form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/blank.gif', 'width' => '15', 'height' => '11', 'alt' => '')));
$form->addElement(form_makeOpenTag('a', array('class' => 'wikilink1', 'href' => wl($ID))));
$form->addElement($ID);
$form->addElement(form_makeCloseTag('a'));
$form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
$form->addElement(' – ');
$form->addElement(htmlspecialchars($INFO['sum']));
$form->addElement(form_makeCloseTag('span'));
$form->addElement(form_makeOpenTag('span', array('class' => 'user')));
$form->addElement(empty($INFO['editor']) ? '(' . $lang['external_edit'] . ')' : editorinfo($INFO['editor']));
$form->addElement(form_makeCloseTag('span'));
$form->addElement('(' . $lang['current'] . ')');
$form->addElement(form_makeCloseTag('div'));
$form->addElement(form_makeCloseTag('li'));
}
foreach ($revisions as $rev) {
$date = strftime($conf['dformat'], $rev);
$info = getRevisionInfo($ID, $rev, true);
$exists = page_exists($ID, $rev);
if ($info['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
} else {
$form->addElement(form_makeOpenTag('li'));
}
$form->addElement(form_makeOpenTag('div', array('class' => 'li')));
if ($exists) {
$form->addElement(form_makeTag('input', array('type' => 'checkbox', 'name' => 'rev2[]', 'value' => $rev)));
} else {
$form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/blank.gif', 'width' => 14, 'height' => 11, 'alt' => '')));
}
$form->addElement(form_makeOpenTag('span', array('class' => 'date')));
$form->addElement($date);
$form->addElement(form_makeCloseTag('span'));
if ($exists) {
$form->addElement(form_makeOpenTag('a', array('href' => wl($ID, "rev={$rev},do=diff", false, '&'), 'class' => 'diff_link')));
$form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/diff.png', 'width' => 15, 'height' => 11, 'title' => $lang['diff'], 'alt' => $lang['diff'])));
$form->addElement(form_makeCloseTag('a'));
$form->addElement(form_makeOpenTag('a', array('href' => wl($ID, "rev={$rev}", false, '&'), 'class' => 'wikilink1')));
$form->addElement($ID);
$form->addElement(form_makeCloseTag('a'));
} else {
$form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/blank.gif', 'width' => '15', 'height' => '11', 'alt' => '')));
$form->addElement($ID);
}
$form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
$form->addElement(' – ');
$form->addElement(htmlspecialchars($info['sum']));
$form->addElement(form_makeCloseTag('span'));
$form->addElement(form_makeOpenTag('span', array('class' => 'user')));
if ($info['user']) {
$form->addElement(editorinfo($info['user']));
if (auth_ismanager()) {
$form->addElement(' (' . $info['ip'] . ')');
}
} else {
$form->addElement($info['ip']);
}
$form->addElement(form_makeCloseTag('span'));
$form->addElement(form_makeCloseTag('div'));
$form->addElement(form_makeCloseTag('li'));
}
$form->addElement(form_makeCloseTag('ul'));
$form->addElement(form_makeButton('submit', 'diff', $lang['diff2']));
html_form('revisions', $form);
print '<div class="pagenav">';
$last = $first + $conf['recent'];
if ($first > 0) {
$first -= $conf['recent'];
if ($first < 0) {
$first = 0;
}
print '<div class="pagenav-prev">';
print html_btn('newer', $ID, "p", array('do' => 'revisions', 'first' => $first));
print '</div>';
}
if ($hasNext) {
print '<div class="pagenav-next">';
print html_btn('older', $ID, "n", array('do' => 'revisions', 'first' => $last));
print '</div>';
}
print '</div>';
}
示例9: handle_secedit_button
/**
* Handle special section edit buttons for the include plugin to get the current page
* and replace normal section edit buttons when the current page is different from the
* global $ID.
*/
function handle_secedit_button(&$event, $params)
{
// stack of included pages in the form ('id' => page, 'rev' => modification time, 'writable' => bool)
static $page_stack = array();
global $ID;
$data = $event->data;
if ($data['target'] == 'plugin_include_start' || $data['target'] == 'plugin_include_start_noredirect') {
// handle the "section edits" added by the include plugin
$fn = wikiFN($data['name']);
array_unshift($page_stack, array('id' => $data['name'], 'rev' => @filemtime($fn), 'writable' => is_writable($fn) && auth_quickaclcheck($data['name']) >= AUTH_EDIT, 'redirect' => $data['target'] == 'plugin_include_start'));
} elseif ($data['target'] == 'plugin_include_end') {
array_shift($page_stack);
} elseif (!empty($page_stack)) {
if ($page_stack[0]['writable']) {
$name = $data['name'];
unset($data['name']);
$secid = $data['secid'];
unset($data['secid']);
if ($page_stack[0]['redirect']) {
$data['redirect_id'] = $ID;
}
$event->result = "<div class='secedit editbutton_" . $data['target'] . " editbutton_" . $secid . "'>" . html_btn('secedit', $page_stack[0]['id'], '', array_merge(array('do' => 'edit', 'rev' => $page_stack[0]['rev'], 'summary' => '[' . $name . '] '), $data), 'post', $name) . '</div>';
} else {
$event->result = '';
}
} else {
return;
// return so the event won't be stopped
}
$event->preventDefault();
$event->stopPropagation();
}
示例10: tpl_button
/**
* Print one of the buttons
*
* Available Buttons are
*
* edit - edit/create/show/draft button
* history - old revisions
* recent - recent changes
* login - login/logout button - if ACL enabled
* profile - user profile button (if logged in)
* index - The index
* admin - admin page - if enough rights
* top - a back to top button
* back - a back to parent button - if available
* backlink - links to the list of backlinks
* subscription- subscribe/unsubscribe button
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*/
function tpl_button($type)
{
global $ACT;
global $ID;
global $REV;
global $NS;
global $INFO;
global $conf;
global $auth;
// check disabled actions and fix the badly named ones
$ctype = $type;
if ($type == 'history') {
$ctype = 'revisions';
}
if (!actionOK($ctype)) {
return false;
}
switch ($type) {
case 'edit':
#most complicated type - we need to decide on current action
if ($ACT == 'show' || $ACT == 'search') {
if ($INFO['writable']) {
if (!empty($INFO['draft'])) {
echo html_btn('draft', $ID, 'e', array('do' => 'draft'), 'post');
} else {
if ($INFO['exists']) {
echo html_btn('edit', $ID, 'e', array('do' => 'edit', 'rev' => $REV), 'post');
} else {
echo html_btn('create', $ID, 'e', array('do' => 'edit', 'rev' => $REV), 'post');
}
}
} else {
if (!actionOK('source')) {
return false;
}
//pseudo action
echo html_btn('source', $ID, 'v', array('do' => 'edit', 'rev' => $REV), 'post');
}
} else {
echo html_btn('show', $ID, 'v', array('do' => 'show'));
}
return true;
case 'history':
if (!actionOK('revisions')) {
return false;
}
print html_btn('revs', $ID, 'o', array('do' => 'revisions'));
return true;
case 'recent':
if (!actionOK('recent')) {
return false;
}
print html_btn('recent', $ID, 'r', array('do' => 'recent'));
return true;
case 'index':
if (!actionOK('index')) {
return false;
}
print html_btn('index', $ID, 'x', array('do' => 'index'));
return true;
case 'back':
if ($parent = tpl_getparent($ID)) {
print html_btn('back', $parent, 'b', array('do' => 'show'));
return true;
}
return false;
case 'top':
print html_topbtn();
return true;
case 'login':
if ($conf['useacl'] && $auth) {
if ($_SERVER['REMOTE_USER']) {
print html_btn('logout', $ID, '', array('do' => 'logout', 'sectok' => getSecurityToken()));
} else {
print html_btn('login', $ID, '', array('do' => 'login', 'sectok' => getSecurityToken()));
}
return true;
}
return false;
case 'admin':
//.........这里部分代码省略.........
示例11: html_recent
/**
* display recent changes
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
* @author Ben Coburn <btcoburn@silicodon.net>
*/
function html_recent($first = 0)
{
global $conf;
global $lang;
global $ID;
/* we need to get one additionally log entry to be able to
* decide if this is the last page or is there another one.
* This is the cheapest solution to get this information.
*/
$recents = getRecents($first, $conf['recent'] + 1, getNS($ID));
if (count($recents) == 0 && $first != 0) {
$first = 0;
$recents = getRecents($first, $conf['recent'] + 1, getNS($ID));
}
$hasNext = false;
if (count($recents) > $conf['recent']) {
$hasNext = true;
array_pop($recents);
// remove extra log entry
}
print p_locale_xhtml('recent');
print '<ul>';
foreach ($recents as $recent) {
$date = date($conf['dformat'], $recent['date']);
print $recent['type'] === 'e' ? '<li class="minor">' : '<li>';
print '<div class="li">';
print $date . ' ';
print '<a href="' . wl($recent['id'], "do=diff") . '">';
$p = array();
$p['src'] = DOKU_BASE . 'lib/images/diff.png';
$p['width'] = 15;
$p['height'] = 11;
$p['title'] = $lang['diff'];
$p['alt'] = $lang['diff'];
$att = buildAttributes($p);
print "<img {$att} />";
print '</a> ';
print '<a href="' . wl($recent['id'], "do=revisions") . '">';
$p = array();
$p['src'] = DOKU_BASE . 'lib/images/history.png';
$p['width'] = 12;
$p['height'] = 14;
$p['title'] = $lang['btn_revs'];
$p['alt'] = $lang['btn_revs'];
$att = buildAttributes($p);
print "<img {$att} />";
print '</a> ';
print html_wikilink(':' . $recent['id'], $conf['useheading'] ? NULL : $recent['id']);
print ' – ' . htmlspecialchars($recent['sum']);
print ' <span class="user">';
if ($recent['user']) {
print $recent['user'];
} else {
print $recent['ip'];
}
print '</span>';
print '</div>';
print '</li>';
}
print '</ul>';
print '<div class="pagenav">';
$last = $first + $conf['recent'];
if ($first > 0) {
$first -= $conf['recent'];
if ($first < 0) {
$first = 0;
}
print '<div class="pagenav-prev">';
print html_btn('newer', '', "p", array('do' => 'recent', 'first' => $first));
print '</div>';
}
if ($hasNext) {
print '<div class="pagenav-next">';
print html_btn('older', '', "n", array('do' => 'recent', 'first' => $last));
print '</div>';
}
print '</div>';
}
示例12: tpl_button
/**
* Print one of the buttons
*
* Available Buttons are
*
* edit - edit/create/show/draft button
* history - old revisions
* recent - recent changes
* login - login/logout button - if ACL enabled
* profile - user profile button (if logged in)
* index - The index
* admin - admin page - if enough rights
* top - a back to top button
* back - a back to parent button - if available
* backlink - links to the list of backlinks
* subscription- subscribe/unsubscribe button
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*/
function tpl_button($type, $return = false)
{
global $ACT;
global $ID;
global $REV;
global $NS;
global $INFO;
global $conf;
global $auth;
// check disabled actions and fix the badly named ones
$ctype = $type;
if ($type == 'history') {
$ctype = 'revisions';
}
if (!actionOK($ctype)) {
return false;
}
$out = '';
switch ($type) {
case 'edit':
// most complicated type - we need to decide on current action
if ($ACT == 'show' || $ACT == 'search') {
if ($INFO['writable']) {
if (!empty($INFO['draft'])) {
$out .= html_btn('draft', $ID, 'e', array('do' => 'draft'), 'post');
} else {
if ($INFO['exists']) {
$out .= html_btn('edit', $ID, 'e', array('do' => 'edit', 'rev' => $REV), 'post');
} else {
$out .= html_btn('create', $ID, 'e', array('do' => 'edit', 'rev' => $REV), 'post');
}
}
} else {
if (!actionOK('source')) {
return false;
}
//pseudo action
$out .= html_btn('source', $ID, 'v', array('do' => 'edit', 'rev' => $REV), 'post');
}
} else {
$out .= html_btn('show', $ID, 'v', array('do' => 'show'));
}
break;
case 'history':
if (actionOK('revisions')) {
$out .= html_btn('revs', $ID, 'o', array('do' => 'revisions'));
}
break;
case 'recent':
if (actionOK('recent')) {
$out .= html_btn('recent', $ID, 'r', array('do' => 'recent'));
}
break;
case 'index':
if (actionOK('index')) {
$out .= html_btn('index', $ID, 'x', array('do' => 'index'));
}
break;
case 'back':
if ($parent = tpl_getparent($ID)) {
$out .= html_btn('back', $parent, 'b', array('do' => 'show'));
}
break;
case 'top':
$out .= html_topbtn();
break;
case 'login':
if ($conf['useacl'] && $auth) {
if (isset($_SERVER['REMOTE_USER'])) {
$out .= html_btn('logout', $ID, '', array('do' => 'logout', 'sectok' => getSecurityToken()));
} else {
$out .= html_btn('login', $ID, '', array('do' => 'login', 'sectok' => getSecurityToken()));
}
}
break;
case 'admin':
if ($INFO['ismanager']) {
$out .= html_btn('admin', $ID, '', array('do' => 'admin'));
}
break;
//.........这里部分代码省略.........
示例13: _edit_button
/**
* Display an edit button for the included page
*/
function _edit_button()
{
global $ID;
$id = $this->entry['page'];
$perm = auth_quickaclcheck($id);
if (page_exists($id)) {
if ($perm >= AUTH_EDIT && is_writable(wikiFN($id))) {
$action = 'edit';
} else {
return '';
}
} elseif ($perm >= AUTH_CREATE) {
$action = 'create';
}
$params = array('do' => 'edit');
$params['redirect_id'] = $ID;
return '<div class="secedit">' . DOKU_LF . DOKU_TAB . html_btn($action, $id, '', $params, 'post') . DOKU_LF . '</div>' . DOKU_LF;
}
示例14: html
/**
* output appropriate html
*/
function html()
{
global $conf;
global $lang;
$go = (int) $_REQUEST['time'];
if (!$go) {
$go = time() + 60 * 60;
}
//one hour in the future to trick pagination
$min = $go - 7 * 24 * 60 * 60;
$max = $go;
echo $this->locale_xhtml('intro');
echo '<p>' . $this->getLang('range') . ' ' . strftime($conf['dformat'], $min) . ' - ' . strftime($conf['dformat'], $max) . '</p>';
echo '<table class="inline loglog">';
echo '<tr>';
echo '<th>' . $this->getLang('date') . '</th>';
echo '<th>' . $this->getLang('ip') . '</th>';
echo '<th>' . $lang['user'] . '</th>';
echo '<th>' . $this->getLang('action') . '</th>';
echo '</tr>';
$lines = $this->_readlines($min, $max);
$lines = array_reverse($lines);
foreach ($lines as $line) {
list($dt, $junk, $ip, $user, $msg) = explode("\t", $line, 5);
if ($dt < $min) {
continue;
}
if ($dt > $max) {
continue;
}
if (!$user) {
continue;
}
if ($msg == 'logged off') {
$msg = $this->getLang('off');
$class = 'off';
} elseif ($msg == 'logged in permanently') {
$msg = $this->getLang('in');
$class = 'perm';
} elseif ($msg == 'logged in temporarily') {
$msg = $this->getLang('tin');
$class = 'temp';
} elseif ($msg == 'failed login attempt') {
$msg = $this->getLang('fail');
$class = 'fail';
} else {
$msg = '****' . hsc($msg) . '****';
$class = 'error';
}
echo '<tr>';
echo '<td>' . strftime($conf['dformat'], $dt) . '</td>';
echo '<td>' . hsc($ip) . '</td>';
echo '<td>' . hsc($user) . '</td>';
echo '<td><span class="loglog_' . $class . '">' . $msg . '</span></td>';
echo '</tr>';
}
echo '</table>';
echo '<div class="pagenav">';
if ($max < time() - 7 * 24 * 60 * 60) {
echo '<div class="pagenav-prev">';
echo html_btn('newer', $ID, "p", array('do' => 'admin', 'page' => 'loglog', 'time' => $max + 7 * 24 * 60 * 60));
echo '</div>';
}
echo '<div class="pagenav-next">';
echo html_btn('older', $ID, "n", array('do' => 'admin', 'page' => 'loglog', 'time' => $min));
echo '</div>';
echo '</div>';
}
示例15: handle_secedit_button
/**
* Handle special section edit buttons for the include plugin to get the current page
* and replace normal section edit buttons when the current page is different from the
* global $ID.
*/
function handle_secedit_button(Doku_Event &$event, $params) {
// stack of included pages in the form ('id' => page, 'rev' => modification time, 'writable' => bool)
static $page_stack = array();
global $ID, $lang;
$data = $event->data;
if ($data['target'] == 'plugin_include_start' || $data['target'] == 'plugin_include_start_noredirect') {
// handle the "section edits" added by the include plugin
$fn = wikiFN($data['name']);
$perm = auth_quickaclcheck($data['name']);
array_unshift($page_stack, array(
'id' => $data['name'],
'rev' => @filemtime($fn),
'writable' => (page_exists($data['name']) ? (is_writable($fn) && $perm >= AUTH_EDIT) : $perm >= AUTH_CREATE),
'redirect' => ($data['target'] == 'plugin_include_start'),
));
} elseif ($data['target'] == 'plugin_include_end') {
array_shift($page_stack);
} elseif ($data['target'] == 'plugin_include_editbtn') {
if ($page_stack[0]['writable']) {
$params = array('do' => 'edit',
'id' => $page_stack[0]['id']);
if ($page_stack[0]['redirect'])
$params['redirect_id'] = $ID;
$event->result = '<div class="secedit">' . DOKU_LF .
html_btn('incledit', $page_stack[0]['id'], '',
$params, 'post',
$data['name'],
$lang['btn_secedit'].' ('.$page_stack[0]['id'].')') .
'</div>' . DOKU_LF;
}
} elseif (!empty($page_stack)) {
// Special handling for the edittable plugin
if ($data['target'] == 'table' && !plugin_isdisabled('edittable')) {
/* @var action_plugin_edittable $edittable */
$edittable =& plugin_load('action', 'edittable');
$data['name'] = $edittable->getLang('secedit_name');
}
if ($page_stack[0]['writable'] && isset($data['name']) && $data['name'] !== '') {
$name = $data['name'];
unset($data['name']);
$secid = $data['secid'];
unset($data['secid']);
if ($page_stack[0]['redirect'])
$data['redirect_id'] = $ID;
$event->result = "<div class='secedit editbutton_" . $data['target'] .
" editbutton_" . $secid . "'>" .
html_btn('secedit', $page_stack[0]['id'], '',
array_merge(array('do' => 'edit',
'rev' => $page_stack[0]['rev'],
'summary' => '['.$name.'] '), $data),
'post', $name) . '</div>';
} else {
$event->result = '';
}
} else {
return; // return so the event won't be stopped
}
$event->preventDefault();
$event->stopPropagation();
}