/** * Produce an Admin link to the current image's admin.php caption-edit page. */ function adminLink($admin) { global $reqd_image, $php_self, $caption_path; $str = ''; if (isset($reqd_image['file']) && (!empty($admin['script_file']) || !empty($admin['full_url'])) && (!empty($admin['full_url']) || @is_file($admin['script_file'])) && !empty($php_self)) { if (empty($admin['full_url'])) { $admin_script_dir = substr(urlPath(dirname($php_self)), 1); $admin['full_url'] = $admin_script_dir . '/' . $admin['script_file']; } $admin_caption_dir = substr(urlPath($caption_path), 1); // No leading '.' $admin_img = rawurlencode($reqd_image['file']); $str = <<<EOT {$admin['before_link']}<a href="{$admin['full_url']}?op=details&D={$admin_caption_dir}&F={$admin_img}.txt&R=Qdig" title="{$admin['link_title']}" style="color:{$admin['color']}; font-weight:normal;">{$admin['link_text']}</a>{$admin['after_link']} EOT; } return $str; }
<a href="<?php echo $element['urlpath']; ?> " id="<?php echo $element['name']; ?> "> <?php echo $element['name']; ?> </a> <?php if (searchTag() && $element['location']) { ?> <small><a href="<?php echo urlPath($element['locationurl']); ?> "> <?php echo $element['location']; ?> </a></small> <?php } ?> </td> <?php if ($element['readable']) { ?> <?php if ($element['countonly']) {
<?php /** * 根据当前地址主机生成100x100的二维码 * 返回相对文件名 * 如果存在images/qr.png,直接输出该图片地址后退出 */ if (file_exists("images/qr.png")) { echo urlPath() . "images/qr.png"; exit; } include "qrlib.php"; $content = "http://" . $_SERVER["HTTP_HOST"]; $filename = "images/" . md5($content) . ".png"; // 不重复生成图片 if (file_exists($filename)) { echo urlPath() . $filename; exit; } $errorCorrectionLevel = 'H'; // 4 means 100x100 $matrixPointSize = 4; // generate image QRcode::png($content, $filename, $errorCorrectionLevel, $matrixPointSize, 2); echo urlPath() . $filename; function urlPath() { return "http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]) . DIRECTORY_SEPARATOR; }
/** * 生成url链接<br> * 使用示例:<br> * url(),<br> * url('welcome.index'),<br> * url('welcome.index','aa','bb'),<br> * url('welcome.index',array('a'=>'bb','b'=>'ccc'),'dd','ee'),<br> * url('welcome.index','dd','ee',array('a'=>'bb')),<br> * url('welcome.index',array('a'=>'bb','b'=>'ccc')),<br> * url('','aa','bb'),<br> * url('',array('a'=>'bb','b'=>'ccc'),'dd','ee'),<br> * url('',array('a'=>'bb','b'=>'ccc')),<br> * 另外可以在第一个参数开始加上:<br> * #和?用来控制url中显示入口文件名称和使用相对路经<br> * 默认不显示入口文件名称,使用绝对路经<br> * 使用示例:<br> * url('#welcome.index'),<br> * url('?welcome.index'),<br> * url('#?welcome.index'),<br> * url('?#welcome.index'),<br> * @return string */ function url() { $action = null; $argc = func_num_args(); if ($argc > 0) { $action = func_get_arg(0); } $args = array(); $get_str_arr = array(); if ($argc > 1) { for ($i = 1; $i < $argc; $i++) { if (is_array($arg = func_get_arg($i))) { foreach ($arg as $k => $v) { $get_str_arr[] = $k . '=' . urlencode($v); } } else { $args[] = $arg; } } } if (empty(WoniuLoader::$system['url_rewrite'])) { $self_name = stripos($action, '#') === 0 || stripos($action, '#') === 1 ? pathinfo(WoniuInput::server('php_self'), PATHINFO_BASENAME) : ''; $app_start = '?'; $get_start = '&'; } else { $self_name = ''; $app_start = ''; $get_start = '?'; } //是否使用相对路经检查 $path = stripos($action, '?') === 0 || stripos($action, '?') === 1 ? '' : urlPath() . '/'; $action = ltrim($action, '#?'); $url_app = $path . $self_name . (empty($args) && empty($get_str_arr) && empty($action) ? '' : $app_start) . ($action . (empty($args) || empty($action) ? '' : '/') . implode('/', $args)) . (empty($get_str_arr) ? '' : $get_start . implode('&', $get_str_arr)); return str_replace('?&', '?', $url_app); }