本文整理汇总了PHP中get_script_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP get_script_uri函数的具体用法?PHP get_script_uri怎么用?PHP get_script_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_script_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exist_plugin
function exist_plugin($name)
{
global $vars;
static $exist = array(), $count = array();
$name = strtolower($name);
if (isset($exist[$name])) {
if (++$count[$name] > PKWK_PLUGIN_CALL_TIME_LIMIT) {
die('Alert: plugin "' . htmlspecialchars($name) . '" was called over ' . PKWK_PLUGIN_CALL_TIME_LIMIT . ' times. SPAM or someting?<br />' . "\n" . '<a href="' . get_script_uri() . '?cmd=edit&page=' . rawurlencode($vars['page']) . '">Try to edit this page</a><br />' . "\n" . '<a href="' . get_script_uri() . '">Return to frontpage</a>');
}
return $exist[$name];
}
// namespace が使える場合のみ foo/bar を受け付ける
$regex = '/^\\w{1,64}(?:\\/\\w{1,64})?$/';
if (version_compare(PHP_VERSION, 5.3, '<')) {
$regex = '/^\\w{1,64}$/';
}
if (preg_match($regex, $name) && file_exists(PLUGIN_DIR . $name . '.inc.php')) {
$exist[$name] = TRUE;
$count[$name] = 1;
require_once PLUGIN_DIR . $name . '.inc.php';
return TRUE;
} else {
$exist[$name] = FALSE;
$count[$name] = 1;
return FALSE;
}
}
示例2: plugin_relink_callback
function plugin_relink_callback($matches)
{
$atag = $matches[1];
$img = empty($matches[2]) ? '' : $matches[2];
// image tag
preg_match_all('/([^\\s^\\"]+)=\\"([^\\"]+)\\"/', $atag, $amatches);
for ($i = 0; $i < count($amatches[0]); $i++) {
$attr[$amatches[1][$i]] = $amatches[2][$i];
}
$parse_url = parse_url($attr['href']);
$scheme = isset($parse_url['scheme']) ? $parse_url['scheme'] : '';
$path = isset($parse_url['path']) ? $parse_url['path'] : '';
$query = isset($parse_url['query']) ? $parse_url['query'] : '';
$fragment = isset($parse_url['fragment']) ? '#' . $parse_url['fragment'] : '';
$script = get_script_uri();
$is_ext = $scheme && substr($attr['href'], 0, strlen($script)) !== $script;
if ($is_ext && (!$img || $img && PLUGIN_RELINK_ADD_EXTERNAL_CLASS_TO_IMAGE_LINK)) {
switch ($scheme) {
case 'mailto':
$attr['class'] = 'mail';
break;
case 'file':
$attr['class'] = 'file';
break;
default:
$attr['class'] = 'external';
}
}
if (!$is_ext) {
$attr['href'] = $path . ($query ? '?' . $query : '') . $fragment;
if (isset($attr['rel'])) {
unset($attr['rel']);
}
/*if (PLUGIN_RELINK_REWRITE_URL_TYPE && $query &&
strpos($query, 'cmd=') === FALSE && strpos($query, 'plugin=') === FALSE)
{
$s_path = substr($path, 0, strrpos($path, '/') + 1); // cut index.php
switch (PLUGIN_RELINK_REWRITE_URL_TYPE) {
case 1:
$attr['href'] = $s_path . $query . $fragment;
break;
case 2:
$attr['href'] = $s_path . str_replace('%2F', '/', $query) . '/' . $fragment;
break;
case 3:
$attr['href'] = $s_path . $query . '.html' . $fragment;
break;
case 4:
$attr['href'] = $s_path . str_replace('%2F', '/', $query) . '.html' . $fragment;
break;
}
}*/
}
$ret = '<a';
foreach ($attr as $key => $val) {
$ret .= ' ' . $key . '="' . $val . '"';
}
$ret .= '>' . $img;
return $ret;
}
示例3: plugin_doc_ini_action
function plugin_doc_ini_action()
{
global $vars, $_doc_ini_msg;
if (Auth::check_role('role_contents_admin')) {
die_message('NOT AUTHORIZED.');
}
if (empty($vars['page'])) {
return;
}
if (!is_pagename($vars['page'])) {
return '';
}
// Invalid page name;
$action = empty($vars['action']) ? '' : $vars['action'];
$retval = array();
$msg_title = sprintf($_doc_ini_msg['msg_confirmation'], $vars['page']);
if ($action === 'exec') {
return plugin_doc_ini_exec($vars['page']);
}
$script = get_script_uri();
$retval['body'] = <<<EOD
<form action="{$script}" method="post" class="doc_ini_form">
\t<input type="hidden" name="cmd" value="doc_ini" />
\t<input type="hidden" name="action" value="exec" />
\t<input type="hidden" name="page" value="{$vars['page']}" />
\t{$msg_title}
\t<input class="btn btn-primary" type="submit" value="{$_doc_ini_msg['btn_exec']}" />
</form>
EOD;
$retval['msg'] = $_doc_ini_msg['title_confirmation'];
return $retval;
}
示例4: plugin_lookup_convert
function plugin_lookup_convert()
{
global $vars;
static $id = 0;
$num = func_num_args();
if ($num == 0 || $num > 3) {
return PLUGIN_LOOKUP_USAGE;
}
$args = func_get_args();
$interwiki = htmlsc(trim($args[0]));
$button = isset($args[1]) ? trim($args[1]) : '';
$button = $button != '' ? htmlsc($button) : 'lookup';
$default = $num > 2 ? htmlsc(trim($args[2])) : '';
$s_page = htmlsc($vars['page']);
++$id;
$script = get_script_uri();
$ret = <<<EOD
<form action="{$script}" method="post">
<div>
<input type="hidden" name="plugin" value="lookup" />
<input type="hidden" name="refer" value="{$s_page}" />
<input type="hidden" name="inter" value="{$interwiki}" />
<label for="_p_lookup_{$id}">{$interwiki}:</label>
<input type="text" name="page" id="_p_lookup_{$id}" size="30" value="{$default}" />
<input type="submit" value="{$button}" />
</div>
</form>
EOD;
return $ret;
}
示例5: plugin_nego_link
function plugin_nego_link($nego, &$linkstr)
{
global $vars;
$linkstr = $linkstr === '' ? htmlspecialchars($nego) : $linkstr;
$url = get_script_uri() . '?cmd=nego' . '&nego=' . $nego . '&page=' . rawurlencode($vars['page']);
return '<a href="' . $url . '">' . $linkstr . '</a>';
}
示例6: 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;
}
}
示例7: plugin_approve_inline
function plugin_approve_inline($name)
{
global $vars;
if ($name == '') {
return '<p>approve(): empty name.</p>';
}
$config_path = PLUGIN_APPROVE_CONFIG_ROOT . $name;
$config = new YamlConfig($config_path);
if (!$config->read()) {
return '<p>approve(): failed to load config. "' . $config_path . '"</p>';
}
$pattern = $config[PLUGIN_APPROVE_KEY_PATTERN];
$page_regex = $config[PLUGIN_APPROVE_KEY_PAGE_REGEX];
$label = isset($config[PLUGIN_APPROVE_KEY_LABEL]) ? $config[PLUGIN_APPROVE_KEY_LABEL] : PLUGIN_APPROVE_DEFAULT_LABEL;
if ($pattern == '') {
return '<p>approve(): empty pattern.</p>';
}
if ($page_regex == '') {
return '<p>approve(): empty page_regex.</p>';
}
$page = $vars['page'];
if ($page == '') {
return '<p>approve(): empty page.</p>';
}
$source = get_source($page, FALSE, TRUE);
$disabled = $page_regex != '' && !preg_match($page_regex, $page) || strpos($source, $pattern) === FALSE ? 'disabled' : '';
$form = '';
$form .= '<form action="' . get_script_uri() . '?cmd=approve" method="post">';
$form .= '<input type="submit" name="submit" value="' . $label . '" ' . $disabled . ' />';
$form .= '<input type="hidden" name="name" value="' . $name . '" />';
$form .= '<input type="hidden" name="_page" value="' . $page . '" />';
$form .= '</form>';
return $form;
}
示例8: plugin_newpage_convert
function plugin_newpage_convert()
{
global $vars, $_newpage_messages;
static $id = 0;
// if (PKWK_READONLY) return ''; // Show nothing
if (Auth::check_role('readonly')) {
return '';
}
// Show nothing
if (Auth::is_check_role(PKWK_CREATE_PAGE)) {
return '';
}
$newpage = '';
if (func_num_args()) {
list($newpage) = func_get_args();
}
if (!preg_match('/^' . RendererDefines::BRACKETNAME_PATTERN . '$/', $newpage)) {
$newpage = '';
}
$s_page = Utility::htmlsc(isset($vars['refer']) ? $vars['refer'] : '');
$s_newpage = Utility::htmlsc($newpage);
++$id;
$script = get_script_uri();
$ret = <<<EOD
<form action="{$script}" method="post" class="form-inline plugin-newpage-form">
\t<input type="hidden" name="cmd" value="edit" />
\t<input type="hidden" name="refer" value="{$s_page}" />
\t<div class="form-group">
\t\t<input type="text" class="form-control" name="page" id="p_newpage_{$id}" value="{$s_newpage}" size="30" placeholder="{$_newpage_messages['form_pagename']}" />
\t</div>
\t<input type="submit" value="{$_newpage_messages['btn_new']}" class="btn btn-primary" />
</form>
EOD;
return $ret;
}
示例9: plugin_html2pdf_get_request_uri
function plugin_html2pdf_get_request_uri($init_uri = '')
{
if ($init_uri == '') {
// Set automatically
$msg = 'get_request_uri() failed: Please set $script at INI_FILE manually';
if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'][0] == '/') {
$url = SERVER_PORT == 443 ? 'https://' : 'http://';
// scheme
$url .= SERVER_NAME;
// host
$url .= SERVER_PORT == 80 ? '' : ':' . SERVER_PORT;
// port
$url .= $_SERVER['REQUEST_URI'];
} else {
global $vars;
$url = get_script_uri() . '?';
$queries = array();
$queries[] = $vars['cmd'] != '' ? 'cmd=' . rawurlencode($vars['cmd']) : '';
$queries[] = $vars['page'] != '' ? 'page=' . rawurlencode($vars['page']) : '';
$url .= implode('&', $queries);
}
if (!is_url($url, TRUE)) {
die_message($msg);
}
} else {
// Set manually
if (!is_url($init_uri, TRUE)) {
die_message('$url: Invalid URI');
}
$url = $init_uri;
}
return $url;
}
示例10: plugin_lookup_convert
function plugin_lookup_convert()
{
global $vars;
static $id = 0;
$qm = get_qm();
$num = func_num_args();
if ($num == 0 || $num > 3) {
return $qm->replace('fmt_err_cvt', 'lookup', $qm->m['plg_lookup']['err_usage']);
}
$args = func_get_args();
$interwiki = htmlspecialchars(trim($args[0]));
$button = isset($args[1]) ? trim($args[1]) : '';
$button = $button != '' ? h($button) : $qm->m['plg_lookup']['btn_submit'];
$default = $num > 2 ? h(trim($args[2])) : '';
$s_page = h($vars['page']);
++$id;
$script = get_script_uri();
$ret = <<<EOD
<form action="{$script}" method="post">
<div>
<input type="hidden" name="plugin" value="lookup" />
<input type="hidden" name="refer" value="{$s_page}" />
<input type="hidden" name="inter" value="{$interwiki}" />
<label for="_p_lookup_{$id}">{$interwiki}:</label>
<input type="text" name="page" id="_p_lookup_{$id}" size="30" value="{$default}" />
<input type="submit" value="{$button}" />
</div>
</form>
EOD;
return $ret;
}
示例11: plugin_rss10_action
function plugin_rss10_action()
{
pkwk_headers_sent();
header('Status: 301 Moved Permanently');
header('Location: ' . get_script_uri() . '?cmd=rss&ver=1.0');
// HTTP
exit;
}
示例12: plugin_recent_convert
function plugin_recent_convert()
{
global $vars, $date_format, $_recent_plugin_frame, $show_passage;
static $exec_count = 1;
$recent_lines = PLUGIN_RECENT_DEFAULT_LINES;
if (func_num_args()) {
$args = func_get_args();
if (!is_numeric($args[0]) || isset($args[1])) {
return PLUGIN_RECENT_USAGE . '<br />';
} else {
$recent_lines = $args[0];
}
}
// Show only N times
if ($exec_count > PLUGIN_RECENT_EXEC_LIMIT) {
return '#recent(): You called me too much' . '<br />' . "\n";
} else {
++$exec_count;
}
if (!file_exists(PLUGIN_RECENT_CACHE)) {
return '#recent(): Cache file of RecentChanges not found' . '<br />';
}
// Get latest N changes
$lines = file_head(PLUGIN_RECENT_CACHE, $recent_lines);
if ($lines == FALSE) {
return '#recent(): File can not open' . '<br />' . "\n";
}
$script = get_script_uri();
$date = $items = '';
foreach ($lines as $line) {
list($time, $page) = explode("\t", rtrim($line));
$_date = get_date($date_format, $time);
if ($date != $_date) {
// End of the day
if ($date != '') {
$items .= '</ul>' . "\n";
}
// New day
$date = $_date;
$items .= '<strong>' . $date . '</strong>' . "\n" . '<ul class="recent_list">' . "\n";
}
$s_page = htmlsc($page);
if ($page == $vars['page']) {
// No need to link to the page you just read, or notify where you just read
$items .= ' <li>' . $s_page . '</li>' . "\n";
} else {
$r_page = rawurlencode($page);
$passage = $show_passage ? ' ' . get_passage($time) : '';
$items .= ' <li><a href="' . $script . '?' . $r_page . '"' . ' title="' . $s_page . $passage . '">' . $s_page . '</a></li>' . "\n";
}
}
// End of the day
if ($date != '') {
$items .= '</ul>' . "\n";
}
return sprintf($_recent_plugin_frame, count($lines), $items);
}
示例13: PluginTag
function PluginTag()
{
parent::Tag();
static $conf = array();
if (empty($conf)) {
$conf['listcmd'] = get_script_uri() . '?cmd=lsx&tag=';
}
$this->conf =& $conf;
}
示例14: plugin_yetlist_action
function plugin_yetlist_action()
{
global $non_list;
global $whatsdeleted;
$qm = get_qm();
$retval = array('msg' => $qm->m['plg_yetlist']['title'], 'body' => '');
// Diff
$pages = array_diff(get_existpages(CACHE_DIR, '.ref'), get_existpages());
if (empty($pages)) {
$retval['body'] = $qm->m['plg_yetlist']['err_notexist'];
return $retval;
}
$empty = TRUE;
// Load .ref files and Output
$script = get_script_uri();
$refer_regex = '/' . $non_list . '|^' . preg_quote($whatsdeleted, '/') . '$/S';
asort($pages, SORT_STRING);
foreach ($pages as $file => $page) {
$refer = array();
foreach (file(CACHE_DIR . $file) as $line) {
list($_page) = explode("\t", rtrim($line));
$refer[] = $_page;
}
// Diff
$refer = array_diff($refer, preg_grep($refer_regex, $refer));
if (!empty($refer)) {
$empty = FALSE;
$refer = array_unique($refer);
sort($refer, SORT_STRING);
$r_refer = '';
$link_refs = array();
foreach ($refer as $_refer) {
$r_refer = rawurlencode($_refer);
$link_refs[] = '<a href="' . $script . '?' . $r_refer . '">' . htmlspecialchars($_refer) . '</a>';
}
$link_ref = join(' ', $link_refs);
unset($link_refs);
$s_page = htmlspecialchars($page);
if (PKWK_READONLY) {
$href = $s_page;
} else {
// Dangling link
$href = '<span class="noexists">' . $s_page . '<a href="' . $script . '?cmd=edit&page=' . rawurlencode($page) . '&refer=' . $r_refer . '">' . $qm->m['fmt_symbol_noexists'] . '</a></span>';
}
$retval['body'] .= '<li>' . $href . ' <em>(' . $link_ref . ')</em></li>' . "\n";
}
}
if ($empty) {
$retval['body'] = $qm->m['plg_yetlist']['err_notexist'];
return $retval;
}
if ($retval['body'] != '') {
$retval['body'] = '<ul>' . "\n" . $retval['body'] . '</ul>' . "\n";
}
return $retval;
}
示例15: plugin_intrawiki_inline
/**
* Make a link to self-pukiwiki url by omitting pukiwiki url
* so that it is not necessary to create InterWikiName for self-pukiwiki url
*
* @author sonots
* @license http://www.gnu.org/licenses/gpl.html GPL v2
* @version $Id: intrawiki.inc.php,v 1.1 2007-06-10 11:14:46 sonots $
* @package plugin
*/
function plugin_intrawiki_inline()
{
$args = func_get_args();
if (count($args) < 2) {
return 'intrawiki(): &intrawiki(pukiwiki query){linkstr};';
}
$linkstr = array_pop($args);
$query = array_shift($args);
$href = get_script_uri() . '?' . htmlspecialchars($query);
$linkstr = $linkstr !== '' ? $linkstr : htmlspecialchars($query);
return '<a href="' . $href . '">' . $linkstr . '</a>';
}