本文整理汇总了PHP中strip_bracket函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_bracket函数的具体用法?PHP strip_bracket怎么用?PHP strip_bracket使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_bracket函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_newpage_action
function plugin_newpage_action()
{
global $vars;
$_btn_edit = _('Edit');
$_msg_newpage = _('New page');
// if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
if (auth::check_role('readonly')) {
die_message(_('PKWK_READONLY prohibits editing'));
}
if (auth::is_check_role(PKWK_CREATE_PAGE)) {
die_message(_('PKWK_CREATE_PAGE prohibits editing'));
}
if ($vars['page'] == '') {
$retvars['msg'] = $_msg_newpage;
$retvars['body'] = plugin_newpage_convert();
return $retvars;
} else {
$page = strip_bracket($vars['page']);
if (isset($vars['refer'])) {
$r_page = get_fullname($page, $vars['refer']);
$r_refer = 'refer=' . $vars['refer'];
} else {
$r_page = $page;
$r_refer = '';
}
pkwk_headers_sent();
header('Location: ' . get_page_location_uri($r_page, $r_refer));
exit;
}
}
示例2: plugin_ls2_convert
function plugin_ls2_convert()
{
global $script, $vars, $_ls2_msg_title;
$params = array('link' => FALSE, 'title' => FALSE, 'include' => FALSE, 'reverse' => FALSE, 'compact' => PLUGIN_LS2_LIST_COMPACT, '_args' => array(), '_done' => FALSE);
$args = array();
$prefix = '';
if (func_num_args()) {
$args = func_get_args();
$prefix = array_shift($args);
}
if ($prefix == '') {
$prefix = strip_bracket($vars['page']) . '/';
}
foreach ($args as $arg) {
plugin_ls2_check_arg($arg, $params);
}
$title = !empty($params['_args']) ? join(',', $params['_args']) : str_replace('$1', htmlsc($prefix), $_ls2_msg_title);
// Auto
if (!$params['link']) {
return plugin_ls2_show_lists($prefix, $params);
}
$tmp = array();
$tmp[] = 'plugin=ls2&prefix=' . rawurlencode($prefix);
if (isset($params['title'])) {
$tmp[] = 'title=1';
}
if (isset($params['include'])) {
$tmp[] = 'include=1';
}
return '<p><a href="' . $script . '?' . join('&', $tmp) . '">' . $title . '</a></p>' . "\n";
}
示例3: plugin_ls2_convert
function plugin_ls2_convert()
{
global $vars;
if (!isset($vars['page'])) {
return '';
}
$params = array('link' => FALSE, 'title' => FALSE, 'include' => FALSE, 'reverse' => FALSE, 'compact' => PLUGIN_LS2_LIST_COMPACT, '_args' => array(), '_done' => FALSE);
$args = func_get_args();
$prefix = '';
if (!empty($args)) {
$prefix = array_shift($args);
}
if ($prefix == '') {
$prefix = strip_bracket($vars['page']) . '/';
}
foreach ($args as $arg) {
plugin_ls2_check_arg($arg, $params);
}
$title = !empty($params['_args']) ? join(',', $params['_args']) : str_replace('$1', htmlsc($prefix), T_("List of pages which begin with ' \$1'"));
// Auto
if (!$params['link']) {
return '<div class="list_pages">' . plugin_ls2_show_lists($prefix, $params) . '</div>';
}
$tmp = array();
if (isset($params['title'])) {
$tmp[] = 'title=1';
}
if (isset($params['include'])) {
$tmp[] = 'include=1';
}
return '<p><a href="' . get_cmd_uri('ls2', $prefix) . join('&', $tmp) . '">' . $title . '</a></p>' . "\n";
}
示例4: plugin_splitinclude_convert
function plugin_splitinclude_convert()
{
global $vars, $get, $post;
global $_msg_splitinclude_restrict;
static $splitinclude_list = array();
//処理済ページ名の配列
if (func_num_args() == 0) {
return;
}
$splitinclude_list[$vars['page']] = TRUE;
$func_vars_num = func_num_args();
$func_vars_array = func_get_args();
$incbody = "";
foreach ($func_vars_array as $page) {
$page = strip_bracket($page);
if (!is_page($page) or isset($splitinclude_list[$page])) {
return '';
}
$splitinclude_list[$page] = TRUE;
$_page = $vars['page'];
$get['page'] = $post['page'] = $vars['page'] = $page;
$wiki = Factory::Wiki($page);
// splitincludeのときは、認証画面をいちいち出さず、後始末もこちらでつける
if ($wiki->isReadable()) {
$body = $wiki->render();
} else {
$body = str_replace('$1', $page, $_msg_splitinclude_restrict);
}
$get['page'] = $post['page'] = $vars['page'] = $_page;
$incbody .= "<div style=\"width:" . intval(96 / $func_vars_num) . "%;margin:0px 2px;vartical-align:top;float:left;\">{$body}</div>\n";
}
$incbody = "<div style=\"width:100%\">\n{$incbody}</div>\n<div style=\"display:block;\"></div>\n";
return $incbody;
}
示例5: plugin_newpage_action
function plugin_newpage_action()
{
global $vars;
$qm = get_qm();
if (PKWK_READONLY) {
die_message($qm->m['fmt_err_pkwk_readonly']);
}
if ($vars['page'] == '') {
$retvars['msg'] = $qm->m['plg_newpage']['label'];
$retvars['body'] = plugin_newpage_convert();
if (preg_match('/id="([^"]+)"/', $retvars['body'], $ms)) {
$domid = $ms[1];
//jquery ライブラリの読み込み
$qt = get_qt();
$qt->setv('jquery_include', true);
$addscript = <<<EOS
<script type="text/javascript">
jQuery(function(){
\tjQuery("#{$domid}").focus().select();
});
</script>
EOS;
$qt->appendv_once('plugin_select_fsize', 'beforescript', $addscript);
}
return $retvars;
} else {
$page = strip_bracket($vars['page']);
$r_page = rawurlencode(isset($vars['refer']) ? get_fullname($page, $vars['refer']) : $page);
$r_refer = rawurlencode($vars['refer']);
pkwk_headers_sent();
header('Location: ' . get_script_uri() . '?cmd=read&page=' . $r_page . '&refer=' . $r_refer);
exit;
}
}
示例6: plugin_unfreeze_action
function plugin_unfreeze_action()
{
global $script, $vars, $function_freeze;
global $_title_isunfreezed, $_title_unfreezed, $_title_unfreeze;
global $_msg_invalidpass, $_msg_unfreezing, $_btn_unfreeze;
$page = isset($vars['page']) ? $vars['page'] : '';
if (!$function_freeze || !is_page($page)) {
return array('msg' => '', 'body' => '');
}
$pass = isset($vars['pass']) ? $vars['pass'] : NULL;
$msg = $body = '';
if (!is_freeze($page)) {
// Unfreezed already
$msg =& $_title_isunfreezed;
$body = str_replace('$1', htmlspecialchars(strip_bracket($page)), '<p>' . $_title_isunfreezed . '</p>');
} else {
if ($pass !== NULL && pkwk_login($pass)) {
// Unfreeze
$postdata = get_source($page);
array_shift($postdata);
$postdata = join('', $postdata);
file_write(DATA_DIR, $page, $postdata, TRUE);
// Update
is_freeze($page, TRUE);
if (PLUGIN_UNFREEZE_EDIT) {
$vars['cmd'] = 'read';
// To show 'Freeze' link
$msg =& $_title_unfreezed;
$body = edit_form($page, $postdata);
} else {
$vars['cmd'] = 'read';
$msg =& $_title_unfreezed;
$body = '';
}
} else {
// Show unfreeze form
// kazuwaya
$msg =& $_title_unfreeze;
$s_page = htmlspecialchars($page);
$body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
$body .= <<<EOD
<p>{$_msg_unfreezing}</p>
<form action="{$script}" method="post">
<p>
<input type="hidden" name="cmd" value="unfreeze" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="password" name="pass" size="12" />
<input type="submit" name="ok" value="{$_btn_unfreeze}" />
</p>
</form>
EOD;
}
}
return array('msg' => $msg, 'body' => $body);
}
示例7: plugin_navibar2_convert
function plugin_navibar2_convert()
{
global $vars, $hr;
$page = strip_bracket($vars['page']);
$navi_page = plugin_navibar2_search_navipage($page);
if (!empty($navi_page)) {
return plugin_navibar2_makehtml($navi_page);
}
exist_plugin('navibar');
return do_plugin_convert('navibar', NAVIBAR2_DEFAULT_PARM) . $hr;
}
示例8: plugin_freeze_action
function plugin_freeze_action()
{
global $script, $vars, $function_freeze;
$_title_isfreezed = _(' $1 has already been frozen');
$_title_freezed = _(' $1 has been frozen.');
$_title_freeze = _('Freeze $1');
$_msg_invalidpass = _('Invalid password.');
$_msg_freezing = _('Please input the password for freezing.');
$_btn_freeze = _('Freeze');
$page = isset($vars['page']) ? $vars['page'] : '';
if (!$function_freeze || is_cantedit($page) || !is_page($page)) {
return array('msg' => '', 'body' => '');
}
$pass = isset($vars['pass']) ? $vars['pass'] : NULL;
$msg = $body = '';
if (is_freeze($page)) {
// Freezed already
$msg =& $_title_isfreezed;
$body = str_replace('$1', htmlspecialchars(strip_bracket($page)), $_title_isfreezed);
} else {
if (!auth::check_role('role_adm_contents') || $pass !== NULL && pkwk_login($pass)) {
// Freeze
$postdata = get_source($page);
array_unshift($postdata, "#freeze\n");
file_write(DATA_DIR, $page, join('', $postdata), TRUE);
// Update
is_freeze($page, TRUE);
$vars['cmd'] = 'read';
$msg =& $_title_freezed;
$body = '';
} else {
// Show a freeze form
$msg =& $_title_freeze;
$s_page = htmlspecialchars($page);
$body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
$body .= <<<EOD
<p>{$_msg_freezing}</p>
<form action="{$script}" method="post">
<div>
<input type="hidden" name="cmd" value="freeze" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="password" name="pass" size="12" />
<input type="submit" name="ok" value="{$_btn_freeze}" />
</div>
</form>
EOD;
}
}
return array('msg' => $msg, 'body' => $body);
}
示例9: plugin_freeze_action
function plugin_freeze_action()
{
global $script, $vars, $function_freeze;
global $_title_isfreezed, $_title_freezed, $_title_freeze;
global $_msg_invalidpass, $_msg_freezing, $_btn_freeze;
$qt = get_qt();
//キャッシュしない
$qt->enable_cache = false;
$page = isset($vars['page']) ? $vars['page'] : '';
if (!$function_freeze || !is_page($page)) {
return array('msg' => '', 'body' => '');
}
$pass = isset($vars['pass']) ? $vars['pass'] : NULL;
$msg = $body = '';
if (is_freeze($page)) {
// Freezed already
$msg =& $_title_isfreezed;
$body = str_replace('$1', htmlspecialchars(strip_bracket($page)), $_title_isfreezed);
} else {
if ($pass !== NULL && pkwk_login($pass)) {
// Freeze
$postdata = get_source($page);
array_unshift($postdata, "#freeze\n");
file_write(DATA_DIR, $page, join('', $postdata), TRUE);
// Update
is_freeze($page, TRUE);
$vars['cmd'] = 'read';
$msg =& $_title_freezed;
$body = '';
} else {
// Show a freeze form
$msg =& $_title_freeze;
$s_page = htmlspecialchars($page);
$body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
$body .= <<<EOD
<p>{$_msg_freezing}</p>
<form action="{$script}" method="post">
<div>
<input type="hidden" name="cmd" value="freeze" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="password" name="pass" size="12" />
<input type="submit" name="ok" value="{$_btn_freeze}" />
</div>
</form>
EOD;
}
}
return array('msg' => $msg, 'body' => $body);
}
示例10: plugin_menu_convert
function plugin_menu_convert()
{
global $vars, $menubar;
static $menu = NULL;
$num = func_num_args();
if ($num > 0) {
// Try to change default 'MenuBar' page name (only)
if ($num > 1) {
return '#menu(): Zero or One argument needed';
}
if ($menu !== NULL) {
return '#menu(): Already set: ' . htmlspecialchars($menu);
}
$args = func_get_args();
if (!is_page($args[0])) {
return '#menu(): No such page: ' . htmlspecialchars($args[0]);
} else {
$menu = $args[0];
// Set
return '';
}
} else {
// Output menubar page data
$page = $menu === NULL ? $menubar : $menu;
if (MENU_ENABLE_SUBMENU) {
$path = explode('/', strip_bracket($vars['page']));
while (!empty($path)) {
$_page = join('/', $path) . '/' . MENU_SUBMENUBAR;
if (is_page($_page)) {
$page = $_page;
break;
}
array_pop($path);
}
}
if (!is_page($page)) {
return '';
} else {
if ($vars['page'] == $page) {
return '<!-- #menu(): You already view ' . htmlspecialchars($page) . ' -->';
} else {
// Cut fixed anchors
$menutext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', get_source($page));
return preg_replace('/<ul[^>]*>/', '<ul>', convert_html($menutext));
}
}
}
}
示例11: plugin_todo_convert
/**
* ページ内で #todo 指定された場合の呼び出しエントリポイント。
*
* @returns $result = $content
*/
function plugin_todo_convert()
{
global $vars, $script;
// default is to traverse all subtopics under own topic
$page = strip_bracket($vars['page']);
switch (func_num_args()) {
case 2:
$mark = func_get_arg(1);
case 1:
$page = func_get_arg(0);
default:
}
$body = todo_generate_index($vars, $page, $mark);
# echo "<pre>"; print_r($body); exit;
return $body;
}
示例12: plugin_includesubmenu_convert
function plugin_includesubmenu_convert()
{
global $script, $vars;
$ShowPageName = FALSE;
if (func_num_args()) {
$aryargs = func_get_args();
if ($aryargs[0] == 'showpagename') {
$ShowPageName = TRUE;
}
}
$SubMenuPageName = '';
$tmppage = strip_bracket($vars['page']);
//下階層のSubMenuページ名
$SubMenuPageName1 = $tmppage . '/SubMenu';
//同階層のSubMenuページ名
$LastSlash = strrpos($tmppage, '/');
if ($LastSlash === FALSE) {
$SubMenuPageName2 = 'SubMenu';
} else {
$SubMenuPageName2 = substr($tmppage, 0, $LastSlash) . '/SubMenu';
}
//echo "$SubMenuPageName1 <br />";
//echo "$SubMenuPageName2 <br />";
//下階層にSubMenuがあるかチェック
//あれば、それを使用
if (is_page($SubMenuPageName1)) {
//下階層にSubMenu有り
$SubMenuPageName = $SubMenuPageName1;
} else {
if (is_page($SubMenuPageName2)) {
//同階層にSubMenu有り
$SubMenuPageName = $SubMenuPageName2;
} else {
//SubMenu無し
return "";
}
}
$body = convert_html(get_source($SubMenuPageName));
if ($ShowPageName) {
$r_page = rawurlencode($SubMenuPageName);
$s_page = htmlspecialchars($SubMenuPageName);
$link = "<a href=\"{$script}?cmd=edit&page={$r_page}\">{$s_page}</a>";
$body = "<h1>{$link}</h1>\n{$body}";
}
return $body;
}
示例13: plugin_footarea_convert
function plugin_footarea_convert()
{
global $vars, $footarea, $use_open_uri_in_new_window;
static $foot = NULL;
static $foothtml = NULL;
//miko patched
// Cached MenuHTML
if ($foothtml !== NULL) {
return preg_replace('/<ul class="list[^>]*>/', '<ul class="foot">', $foothtml);
}
//miko patched
if (func_num_args()) {
$args = func_get_args();
if (is_page($args[0])) {
$foot = $args[0];
}
return '';
}
$page = $foot === NULL ? $footarea : $foot;
if (FOOT_ENABLE_SUBFOOT) {
$path = explode('/', strip_bracket($vars['page']));
while (count($path)) {
$_page = join('/', $path) . '/' . FOOT_SUBFOOTBAR;
if (is_page($_page)) {
$page = $_page;
break;
}
array_pop($path);
}
}
if (!is_page($page)) {
return '';
// } else if ($vars['page'] == $page) {
// return '<!-- #footarea(): You already view ' . htmlspecialchars($page) . ' -->';
}
$foottext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', get_source($page));
if (function_exists('convert_filter')) {
$foottext = convert_filter($foottext);
}
$save_newwindow = $use_open_uri_in_new_window;
$use_open_uri_in_new_window = 0;
$foothtml = convert_html($foottext);
$use_open_uri_in_new_window = $save_newwindow;
$foothtml = str_replace("\n", '', $foothtml);
return preg_replace('/<ul class="list[^>]*>/', '<ul class="foot">', $foothtml);
}
示例14: plugin_headarea_convert
function plugin_headarea_convert()
{
global $vars, $headarea, $use_open_uri_in_new_window;
static $head = NULL;
static $headhtml = NULL;
//miko patched
// Cached MenuHTML
if ($headhtml !== NULL) {
return preg_replace('/<ul class="list[^>]*>/', '<ul class="head">', $headhtml);
}
//miko patched
if (func_num_args()) {
$args = func_get_args();
if (is_page($args[0])) {
$head = $args[0];
}
return '';
}
$page = $head === NULL ? $headarea : $head;
if (HEAD_ENABLE_SUBHEAD) {
$path = explode('/', strip_bracket($vars['page']));
while (count($path)) {
$_page = join('/', $path) . '/' . HEAD_SUBHEADBAR;
if (is_page($_page)) {
$page = $_page;
break;
}
array_pop($path);
}
}
if (!is_page($page)) {
return '';
// } else if ($vars['page'] == $page) {
// return '<!-- #headarea(): You already view ' . htmlsc($page) . ' -->';
}
$headtext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', get_source($page));
if (function_exists('convert_filter')) {
$headtext = convert_filter($headtext);
}
$save_newwindow = $use_open_uri_in_new_window;
$use_open_uri_in_new_window = 0;
$headhtml = RendererFactory::factory($headtext);
$use_open_uri_in_new_window = $save_newwindow;
$headhtml = str_replace("\n", '', $headhtml);
return preg_replace('/<ul class="list[^>]*>/', '<ul class="head">', $headhtml);
}
示例15: plugin_random_action
function plugin_random_action()
{
global $vars;
$pattern = strip_bracket($vars['refer']) . '/';
$pages = array();
foreach (get_existpages() as $_page) {
if (strpos($_page, $pattern) === 0) {
$pages[$_page] = strip_bracket($_page);
}
}
srand((double) microtime() * 1000000);
$page = array_rand($pages);
if ($page != '') {
$vars['refer'] = $page;
}
return array('body' => '', 'msg' => '');
}