本文整理汇总了PHP中qualifiedUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP qualifiedUrl函数的具体用法?PHP qualifiedUrl怎么用?PHP qualifiedUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qualifiedUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_print
function do_print($formatter, $options)
{
global $DBInfo;
$options['css_url'] = $DBInfo->url_prefix . "/css/print.css";
$formatter->nonexists = 'always';
$dum = false;
$formatter->pi = $formatter->page->get_instructions($dum);
$title = $formatter->pi['#title'];
$formatter->send_header("", $options);
kbd_handler();
print "<div id='printHeader'>";
print "<h2>{$title}</h2>";
print "</div>";
print "<div id='wikiContent'>";
$formatter->external_on = 1;
$formatter->send_page('', array('fixpath' => 1));
print "</div></div>";
print "<div id='printFooter'>";
print sprintf(_("Retrieved from %s"), qualifiedUrl($formatter->link_url($formatter->page->name))) . '<br/>';
if ($mtime = $formatter->page->mtime()) {
$lastedit = date("Y-m-d", $mtime);
$lasttime = date("H:i:s", $mtime);
print sprintf(_("last modified %s %s"), $lastedit, $lasttime);
}
print "</div></body></html>";
return;
}
示例2: do_sitemap
function do_sitemap($formatter, $options)
{
global $DBInfo;
# get page list
if ($formater->group) {
$group_pages = $DBInfo->getLikePages($formater->group);
foreach ($group_pages as $page) {
$all_pages[] = str_replace($formatter->group, '', $page);
}
} else {
$all_pages = $DBInfo->getPageLists();
}
usort($all_pages, 'strcasecmp');
$items = '';
// empty string
# process page list
$zone = '+00:00';
foreach ($all_pages as $page) {
$url = qualifiedUrl($formatter->link_url(_rawurlencode($page)));
$p = new WikiPage($page);
$t = $p->mtime();
$date = gmdate("Y-m-d\\TH:i:s", $t) . $zone;
// W3C datetime format
$item = "<url>\n";
$item .= " <loc>" . $url . "</loc>\n";
$item .= " <lastmod>" . $date . "</lastmod>\n";
$item .= "</url>\n";
$items .= $item;
}
# process output
$out = $items;
if ($options['oe'] and strtolower($options['oe']) != $DBInfo->charset) {
$charset = $options['oe'];
if (function_exists('iconv')) {
$new = iconv($DBInfo->charset, $charset, $items);
if (!$new) {
$charset = $DBInfo->charset;
}
if ($new) {
$out = $new;
}
}
} else {
$charset = $DBInfo->charset;
}
$head = <<<HEAD
<?xml version="1.0" encoding="{$charset}"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9"
url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
HEAD;
$foot = <<<FOOT
</urlset>
FOOT;
# output
header("Content-Type: text/xml");
print $head . $out . $foot;
}
示例3: macro_RandomBanner
function macro_RandomBanner($formatter, $value = "")
{
global $DBInfo;
$test = preg_match("/^([^ ,0-9]*)\\s*,?\\s*(\\d+)?\$/", $value, $match);
if ($test) {
$pagename = !empty($match[1]) ? $match[1] : '';
$number = !empty($match[2]) ? $match[2] : '';
}
if (!$pagename) {
$pagename = 'RandomBanner';
}
if (!$number) {
$number = 3;
}
#print $pagename.";".$number;
if ($DBInfo->hasPage($pagename)) {
$page = $DBInfo->getPage($pagename);
$body = $page->_get_raw_body();
} else {
return "[[RandomBanner({$value})]]";
}
$banner = array();
$lines = explode("\n", $body);
foreach ($lines as $line) {
if (substr($line, 0, 10) != ' * http://') {
continue;
}
$dummy = explode(" ", substr($line, 3), 3);
$text = !empty($dummy[1]) ? $dummy[1] : '';
$title = !empty($dummy[2]) ? $dummy[2] : '';
if (!empty($text) and preg_match(",^(http|ftp|attachment):.*\\.(gif|png|jpg|jpeg)\$,", $text, $match)) {
if ($match[1] == 'attachment') {
$fname = $pagename . '/' . substr($text, 11);
$ntext = $formatter->macro_repl('Attachment', $fname, 1);
if (!file_exists($ntext)) {
$text = $formatter->macro_repl('Attachment', $fname);
} else {
$text = qualifiedUrl($DBInfo->url_prefix . '/' . $ntext);
$text = "<img border='0' alt='{$text}' src='{$text}' title='{$title}' />";
}
} else {
$text = "<img border='0' alt='{$text}' src='{$text}' title='{$title}' />";
}
$banner[] = "<a href='{$dummy['0']}'>{$text}</a>";
}
}
$count = count($banner) - 1;
$number = min($number, $count);
$selected = array_rand($banner, $number);
if ($number == 1) {
$selected = array($selected);
}
$out = array();
foreach ($selected as $idx) {
$out[] = $banner[$idx];
}
$banners = implode(' ', $out);
return $banners;
}
示例4: do_moniedit
function do_moniedit($formatter, $options)
{
header("Content-Type: application/x-moniedit");
#header("application/x-bat");
header("Pragma: no-cache");
print $options['page'] . " " . qualifiedUrl($formatter->prefix);
return;
}
示例5: smiley_repl
function smiley_repl($smiley)
{
global $DBInfo;
if (is_array($smiley)) {
$smiley = $smiley[1];
}
// for callback
$img = $DBInfo->smileys[$smiley][3];
$alt = str_replace("<", "<", $smiley);
return $this->_img(qualifiedUrl("{$DBInfo->imgs_dir}/{$img}"));
}
示例6: do_Clip
function do_Clip($formatter, $options)
{
global $DBInfo;
$enable_replace = 1;
$keyname = $DBInfo->_getPageKey($options['page']);
$_dir = str_replace("./", '', $DBInfo->upload_dir . '/' . $keyname);
// support hashed upload dir
if (!is_dir($_dir) and !empty($DBInfo->use_hashed_upload_dir)) {
$prefix = get_hashed_prefix($keyname);
$_dir = str_replace('./', '', $DBInfo->upload_dir . '/' . $prefix . $keyname);
}
$pagename = _urlencode($options['page']);
$name = $options['value'];
if (!$name) {
$title = _("Fatal error !");
$formatter->send_header("Status: 406 Not Acceptable", $options);
$formatter->send_title($title, "", $options);
print "<h2>" . _("No filename given") . "</h2>";
$formatter->send_footer("", $options);
return;
}
$pngname = _rawurlencode($name);
//$imgpath="$_dir/$pngname";
$imgpath = "{$pngname}";
$imgparam = '';
if (file_exists($_dir . '/' . $imgpath . '.png')) {
$url = qualifiedUrl($DBInfo->url_prefix . '/' . $_dir . '/' . $imgpath . '.png');
$imgparam = "<param name='image' value='{$url}' />";
}
$png_url = "{$imgpath}.png";
$formatter->send_header("", $options);
$formatter->send_title(_("Clipboard"), "", $options);
$prefix = $formatter->prefix;
$now = time();
$url_exit = $formatter->link_url($pagename, "?ts={$now}");
$url_save = $formatter->link_url($pagename, "?action=draw");
$url_help = $formatter->link_url("ClipMacro");
$pubpath = $DBInfo->url_prefix . "/applets/ClipPlugin";
print "<h2>" . _("Cut & Paste a Clipboard Image") . "</h2>\n";
print <<<APPLET
<applet code="clip"
archive="clip.jar" codebase="{$pubpath}"
width='200' height='200' align="center">
<param name="pngpath" value="{$png_url}" />
<param name="savepath" value="{$url_save}" />
<param name="viewpath" value="{$url_exit}" />
<param name="compress" value="5" />
{$imgparam}
<b>NOTE:</b> You need a Java enabled browser to edit the drawing example.
</applet><br />
APPLET;
$formatter->send_footer("", $options);
return;
}
示例7: macro_Disqus
function macro_Disqus($formatter, $value = '')
{
global $Config;
if (!empty($formatter->pi['#nocomment'])) {
return '';
}
if (empty($Config['disqus_shortname'])) {
echo "<a href='https://disqus.com/admin/signup/'>" . _("You need to register your forum at DISQUS.") . '</a>';
return;
}
$js = <<<EOF
<script charset="utf-8" type="text/javascript">
/*<![CDATA[*/
EOF;
// set disqus_identifier
$id = $Config['disqus_shortname'] . ':';
$shortname = $Config['disqus_shortname'];
if (isset($Config['disqus_id'][0])) {
$id .= $Config['disqus_id'] . ':';
}
$id .= addslashes($formatter->page->name);
if (isset($Config['disqus_devel'])) {
$js .= 'var disqus_developer = ' . $Config['disqus_devel'] . ";\n";
}
$js .= "var disqus_url = '" . qualifiedUrl($formatter->link_url($formatter->page->urlname)) . "';\n";
$js .= "var disqus_title = '" . addslashes($formatter->page->name) . "';\n";
$js .= "var disqus_identifier = '" . $id . "';\n";
$js .= 'var disqus_container_id = \'disqus_thread\';' . "\n";
$js .= "var disqus_shortname = '" . $Config['disqus_shortname'] . "';\n";
$js .= <<<EOF
(function() {
function init() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}
if (window.addEventListener) window.addEventListener("load", init, false);
else if (window.attachEvent) window.attachEvent("onload", init);
})();
/*]]>*/
</script>
EOF;
$formatter->register_javascripts($js);
$out = '';
if (empty($value) or $value != 'notitle') {
$out = '<h3><span class="i18n" title="Comments">' . _("Comments") . '</span>';
}
$out .= '</h3><div id="disqus_thread"></div>';
$out .= '<noscript><a href="http://' . $shortname . '.disqus.com/?url=ref">' . _("View the discussion thread.") . '</a></noscript>';
return $out;
}
示例8: postfilter_fiximgpath
function postfilter_fiximgpath($formatter, $value, $options = array())
{
global $DBInfo;
$prefix = qualifiedUrl('');
$chunks = preg_split('/(<[^>]+>)/', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $sz = count($chunks); $i < $sz; $i++) {
if (preg_match('/^<img /', $chunks[$i])) {
$dumm = preg_replace('/<(img .*)src=(\'|\\")\\/([^\\2]+)\\2/i', "<\$1" . "src=\$2" . $prefix . "\$3\$2", $chunks[$i]);
$chunks[$i] = $dumm;
}
}
return implode('', $chunks);
}
示例9: do_qr
function do_qr($formatter, $params = array())
{
global $Config;
if (isset($params['value']) && isset($params['value'][0])) {
$value = $params['value'];
} else {
$encoded = _urlencode(strtr($formatter->page->name, ' ', '_'));
$value = qualifiedUrl($formatter->link_url($encoded));
}
if (!empty($Config['cache_public_dir']) and !empty($Config['cache_public_url'])) {
$fc = new Cache_text('qr', array('ext' => 'png', 'dir' => $Config['cache_public_dir']));
$pngname = $fc->getKey($value);
$pngfile = $Config['cache_public_dir'] . '/' . $pngname;
$png_url = !empty($Config['cache_public_url']) ? $Config['cache_public_url'] . '/' . $pngname : $Config['url_prefix'] . '/' . $pngfile;
} else {
$uniq = md5($value);
$pngfile = $cache_dir . '/' . $uniq . '.png';
$png_url = $cache_url . '/' . $uniq . '.png';
}
$img_exists = file_exists($pngfile);
if (!$img_exists || $formatter->refresh) {
require_once dirname(__FILE__) . '/../lib/phpqrcode.php';
QRcode::png($value, $pngfile, 'l', 3, 1);
}
if (!empty($Config['use_cache_url'])) {
header("Pragma: no-cache");
header('Cache-Control: public, max-age=0, s-maxage=0');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate', false);
$formatter->send_header(array('Status: 302', 'Location: ' . $png_url));
return null;
}
$down_mode = 'inline';
header("Content-Type: image/png\r\n");
$mtime = filemtime($pngfile);
$lastmod = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
$etag = md5($lastmod . $key);
header('Last-Modified: ' . $lastmod);
header('ETag: "' . $etag . '"');
$maxage = 60 * 60 * 24 * 30;
header('Cache-Control: public, max-age=' . $maxage);
$need = http_need_cond_request($mtime, $lastmod, $etag);
if (!$need) {
header('HTTP/1.0 304 Not Modified');
@ob_end_clean();
return null;
}
@ob_clean();
$ret = readfile($pngfile);
return null;
}
示例10: postfilter_nforge
function postfilter_nforge($formatter, $value, $options)
{
global $Config;
preg_match("@\\/([^\\/]+)\$@", $formatter->url_prefix, $proj_name);
$group_id = $Config['group_id'];
$issue = qualifiedUrl('/tracker/index.php?func=detail&group_id=' . $group_id . '&aid=');
$svn = qualifiedUrl('/scm/viewvc.php/?root=' . $proj_name[1] . '&view=rev&revision=');
$_rule = array('/(?<![a-zA-Z&])\\!?\\#([0-9]+)/', "/(?<![a-zA-Z&])\\!?r([0-9]+)/");
$_repl = array("<a href='{$issue}" . '\\1\'>#\\1</a>', "<a href='{$svn}" . '\\1\'>r\\1</a>');
$chunks = preg_split('/(<[^>]+>)/', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $sz = count($chunks); $i < $sz; $i++) {
if ($i % 2 == 0) {
$chunks[$i] = preg_replace($_rule, $_repl, $chunks[$i]);
}
}
return implode('', $chunks);
}
示例11: macro_GoogleTrans
function macro_GoogleTrans($formatter, $value)
{
global $DBInfo;
$url = qualifiedUrl($formatter->link_url($formatter->page->name));
$from = empty($value) ? substr($DBInfo->lang, 0, 2) : $value;
$enc = strtolower($DBInfo->charset);
$img_dir = $DBInfo->imgs_dir . '/interwiki';
$supported = array('en' => 'English', 'fr' => 'Francais', 'de' => 'Deutsch', 'es' => 'Espanol', 'it' => 'Italiano', 'pt' => 'Portugues', 'zh' => 'Chinese', 'ru' => 'Russian', 'ja' => 'Japanese', 'ko' => 'Korean');
if (array_key_exists($from, $supported)) {
unset($supported[$from]);
} else {
$from = 'ko';
}
$out = '';
foreach ($supported as $k => $v) {
$out .= "<a target='_top' href='http://www.google.com/translate?hl={$from}&ie={$enc}&langpair={$from}%7C" . $k . "&u={$url}' title='" . _($v) . "'><img src='{$img_dir}/" . $k . "-16.png' style='border:0' /></a>";
}
return $out;
}
示例12: macro_FreeMind
function macro_FreeMind($formatter, $value)
{
global $DBInfo;
$_dir = $DBInfo->upload_dir . '/FreeMind';
$pubpath = $formatter->url_prefix . '/applets/FreeMind';
$puburl = qualifiedUrl($formatter->url_prefix . '/' . $_dir);
return <<<APP
<applet code="freemind.main.FreeMindApplet.class" codebase="{$pubpath}"
archive="freemindbrowser.jar" width="100%" height="100%">
<param name="type" value="application/x-java-applet;version=1.4">
<param name="scriptable" value="false">
<param name="modes" value="freemind.modes.browsemode.BrowseMode">
<param name="browsemode_initial_map"
value="{$puburl}/{$value}.mm">
<!-- ^ Put the path to your map here -->
<param name="initial_mode" value="Browse">
</applet>
APP;
}
示例13: macro_MozTab
function macro_MozTab($formatter, $value)
{
global $DBInfo;
$url = qualifiedUrl($formatter->link_url("", "?action=recentchanges"));
$tab = <<<TAB
<script language="JavaScript">
/*<![CDATA[*/
function selfside() {
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
window.sidebar.addPanel ("{$DBInfo->sitename}", "{$url}","");
}
else {
var rv = window.confirm ("This Funkcion should work with Netscape 6.x or Mozilla" + "www.mozilla.org");
if (rv)
document.location.href = "http://www.mozilla.org/";
}
}
/*]]>*/
</script>
<a href="javascript:selfside();"><img src="{$DBInfo->imgs_dir}/plugin/moztab.png" border=0 title="add mozilla tab"></a>
TAB;
return $tab;
}
示例14: macro_BabelFish
function macro_BabelFish($formatter, $value, $ret = array())
{
global $Config;
$langs = array('ko', 'ja', 'en', 'de', 'fr', 'it', 'es', 'pt', 'zh');
$supported = array('ko_en', 'en_ko', 'en_de', 'en_fr', 'en_pt', 'en_it', 'en_es', 'en_ja', 'en_zh', 'fr_en', 'es_en', 'pt_en', 'it_en', 'zh_en', 'fr_de', 'de_en', 'de_fr', 'ja_en', 'ru_en');
$msg = _("BabelFish Translation");
if (empty($value)) {
$value = !empty($Config['default_babelfish_translation']) ? $Config['default_babelfish_translation'] : 'ko,en';
}
list($from, $to) = preg_split('/,\\s*/', preg_replace("/\\s+/", ' ', strtolower($value)), 2);
if (!in_array($from, $langs)) {
$from = 'en';
}
if (!in_array($to, $langs)) {
$to = 'en';
}
if ($from and $to and $from != $to) {
$msg = sprintf(_("Translate %s to %s"), $from, $to);
}
$lp = $from . "_" . $to;
$URL = qualifiedUrl($formatter->link_url($formatter->page->urlname));
$TR = "http://translate.google.com/translate?";
if (in_array($lp, $supported)) {
$URL = urlencode($URL);
$TR .= "sl={$from}&tl={$to}";
} else {
// not supported translation case
// from => en => to
$URL = urlencode($TR . "&sl={$from}&tl=en&url={$URL}");
$TR .= "&sl=en&tl={$to}";
}
$goto = $TR . '&u=' . $URL;
return <<<EOF
<img src='{$formatter->imgs_url_interwiki}{$from}-16.png' alt="{$from}"/> <a href="{$goto}"><img border='0' src='{$formatter->imgs_dir}/plugin/babelfish.png' title='{$msg}' alt='Translation@Google' /></a> <img src='{$formatter->imgs_url_interwiki}{$to}-16.png' alt="{$to}"/>
EOF;
}
示例15: do_sendping
//.........这里部分代码省略.........
print "<b>{$msg2}</b>: <input name='title' value=\"{$title}\" size='70' maxlength='70' style='width:200' /><br />\n";
if ($DBInfo->use_resizer > 1) {
echo <<<JS
<script type="text/javascript" src="{$DBInfo->url_prefix}/local/textarea.js"></script>
JS;
}
print <<<FORM
<div class="resizable-textarea" style='position:relative'><!-- IE hack -->
<textarea class="wiki resizable" id="content" wrap="virtual" name="excerpt"
rows="{$rows}" cols="{$cols}" class="wiki">{$excerpt}</textarea></div>
FORM;
$mb_msg = _("mb encoded");
$send_msg = _("Send ping");
$reset = _("Reset");
print <<<FORM2
<b>{$mb_msg}</b> <input type="checkbox" name="mbencode" {$checked} />
<input type="hidden" name="action" value="sendping" />
<span class="button"><input class="button" type="submit" value="{$send_msg}" /></span>
<span class="button"><input class="button" type="reset" value="{$reset}" /></span>
</form>
FORM2;
$formatter->send_footer("", $options);
return;
}
# send Trackback ping
$trackback_url = $options['trackback_url'];
$title = urlencode(_stripslashes($options['title']));
$blog_name = urlencode($DBInfo->sitename . ":{$options['id']}");
$excerpt = _stripslashes($options['excerpt']);
if ($options['mbencode']) {
if ($checked and function_exists('iconv') and strtolower($DBInfo->charset) != 'utf-8') {
$excerpt = iconv($DBInfo->charset, 'utf-8', $excerpt);
}
if (function_exists('mb_encode_numericentity')) {
$new = mb_encode_numericentity($excerpt, $DBInfo->convmap, 'utf-8');
if ($new) {
$excerpt = $new;
}
$new = mb_encode_numericentity($title, $DBInfo->convmap, 'utf-8');
if ($new) {
$title = $new;
}
} else {
include_once 'lib/compat.php';
$new = utf8_mb_encode($excerpt);
if ($new) {
$excerpt = $new;
}
$new = utf8_mb_encode($title);
if ($new) {
$title = $new;
}
}
}
$excerpt = urlencode($excerpt);
$url = $formatter->link_url($options['page'], "#{$options['value']}");
$url = urlencode(qualifiedUrl($url));
$query_string = "title={$title}&url={$url}&blog_name={$blog_name}&excerpt={$excerpt}";
if (strstr($trackback_url, '?')) {
$trackback_url .= "&" . $query_string;
$fp = @fopen($trackback_url, 'r');
$result = @fread($fp, 4096);
@fclose($fp);
/* debug code
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nTrackback URL query:\n\n$trackback_url\n\nResponse:\n\n");
fwrite($fp, $result);
fwrite($fp, "\n\n");
fclose($fp);
*/
} else {
$trackback_url = parse_url($trackback_url);
$http_request = 'POST ' . $trackback_url['path'] . " HTTP/1.0\r\n";
$http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
$http_request .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
$http_request .= "\r\n";
$http_request .= $query_string;
$fs = @fsockopen($trackback_url['host'], 80);
@fputs($fs, $http_request);
/* debug code
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n");
while(!@feof($fs)) {
fwrite($fp, @fgets($fs, 4096));
}
fwrite($fp, "\n\n");
fclose($fp);
*/
@fclose($fs);
}
$formatter->send_header("", $options);
$formatter->send_title(_("Trackback sent"), "", $options);
#$formatter->send_page("Return: $result");
print "Return: {$result}";
$formatter->send_footer("", $options);
return;
}