本文整理汇总了PHP中pkwk_common_headers函数的典型用法代码示例。如果您正苦于以下问题:PHP pkwk_common_headers函数的具体用法?PHP pkwk_common_headers怎么用?PHP pkwk_common_headers使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pkwk_common_headers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_ajaxrss_action
function plugin_ajaxrss_action()
{
global $get;
if ($get['t'] == 'js') {
$output = plugin_ajaxrss_output_js();
// Feeding start
pkwk_common_headers();
// header('Content-type: text/javascript');
print $output;
} else {
if ($get['t'] == 'url') {
$output = plugin_ajaxrss_output_url(decode($get['q']));
// Feeding start
pkwk_common_headers();
header('Content-type: application/xml');
if (!preg_match('/\\<\\?xml/', $output, $matches)) {
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
}
print $output;
} else {
$output = plugin_ajaxrss_output_xml();
// Feeding start
pkwk_common_headers();
header('Content-type: application/xml');
if (!preg_match('/\\<\\?xml/', $output, $matches)) {
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
}
print $output;
}
}
exit;
}
示例2: plugin_markdown_convert
/**
* Markdon Syntax
*
* @author sonots
* @license http://www.gnu.org/licenses/gpl.html GPL v2
* @link http://lsx.sourceforge.jp/?Plugin%2Fmarkdown.inc.php
* @version $Id: markdown.inc.php,v 1.2 2007-02-24 16:28:39Z sonots $
* @package plugin
*/
function plugin_markdown_convert()
{
if (defined('PLUGIN_DIR') && file_exists(PLUGIN_DIR . 'markdown.php')) {
$markdown = PLUGIN_DIR . 'markdown.php';
} elseif (defined('EXT_PLUGIN_DIR') && file_exists(EXT_PLUGIN_DIR . 'markdown.php')) {
$markdown = EXT_PLUGIN_DIR . 'markdown.php';
} else {
return "markdown(): markdown.php does not exist under " . PLUGIN_DIR . ' or ' . EXT_PLUGIN_DIR;
}
$args = func_get_args();
$body = array_pop($args);
$noskin = in_array("noskin", $args);
global $vars;
if (!(PKWK_READONLY > 0 or is_freeze($vars['page']) or plugin_markdown_is_edit_auth($vars['page']))) {
$body = htmlspecialchars($body);
}
require_once $markdown;
$body = Markdown($body);
if ($noskin) {
pkwk_common_headers();
print $body;
exit;
}
return $body;
}
示例3: plugin_cache_ref_action
function plugin_cache_ref_action()
{
global $vars;
$usage = 'Usage: plugin=cache_ref&src=filename';
if (!isset($vars['src'])) {
return array('msg' => 'Invalid argument', 'body' => $usage);
}
$filename = $vars['src'];
$ref = CACHE_DIR . $filename;
if (!file_exists($ref)) {
return array('msg' => 'Cache file not found', 'body' => $usage);
}
$got = @getimagesize($ref);
if (!isset($got[2])) {
$got[2] = FALSE;
}
switch ($got[2]) {
case 1:
$type = 'image/gif';
break;
case 2:
$type = 'image/jpeg';
break;
case 3:
$type = 'image/png';
break;
case 4:
$type = 'application/x-shockwave-flash';
break;
default:
return array('msg' => 'Seems not an image', 'body' => $usage);
}
// Care for Japanese-character-included file name
if (LANG == 'ja_JP') {
switch (UA_NAME . '/' . UA_PROFILE) {
case 'Opera/default':
// Care for using _auto-encode-detecting_ function
$filename = mb_convert_encoding($filename, 'UTF-8', 'auto');
break;
case 'MSIE/default':
$filename = mb_convert_encoding($filename, 'SJIS', 'auto');
break;
}
}
$file = htmlspecialchars($filename);
$size = filesize($ref);
// Output
pkwk_common_headers();
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Length: ' . $size);
header('Content-Type: ' . $type);
// @readfile($ref);
plus_readfile($ref);
exit;
}
示例4: plugin_gmapfun_action
function plugin_gmapfun_action()
{
global $vars;
$page = $vars['page'];
$body = '';
if (is_page($page)) {
$body = convert_html(get_source($page));
$qt = get_qt();
$before = $qt->getv('beforescript');
}
pkwk_common_headers();
print $before . $body;
exit;
}
示例5: plugin_preview_action
function plugin_preview_action()
{
global $vars;
$page = isset($vars['page']) ? $vars['page'] : '';
if (is_page($page)) {
check_readable($page, true, true);
$source = get_source($page);
array_splice($source, 10);
$body = convert_html($source);
pkwk_common_headers();
header('Content-type: text/xml');
print '<' . '?xml version="1.0" encoding="UTF-8"?' . ">\n";
print $body;
}
exit;
}
示例6: plugin_monobook_login_action
function plugin_monobook_login_action()
{
global $vars, $auth_users, $_msg_auth, $_monobook_login_messages;
if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW']) && isset($_SERVER['HTTP_AUTHORIZATION'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
}
if (auth::check_role('readonly') || !isset($_SERVER['PHP_AUTH_USER']) || !isset($auth_users[$_SERVER['PHP_AUTH_USER']]) || !isset($_SERVER['PHP_AUTH_PW']) || pkwk_hash_compute($_SERVER['PHP_AUTH_PW'], $auth_users[$_SERVER['PHP_AUTH_USER']]) !== $auth_users[$_SERVER['PHP_AUTH_USER']]) {
pkwk_common_headers();
header('WWW-Authenticate: Basic realm="' . $_msg_auth . '"');
header('HTTP/1.0 401 Unauthorized');
$msg = $_monobook_login_messages['auth_failed'];
return array('msg' => $msg, 'body' => '<p>' . $msg . '</p>');
} elseif (isset($vars['refer']) && is_page($vars['refer'])) {
header('Location: ' . get_script_uri() . '?' . rawurlencode($vars['refer']));
}
return;
}
示例7: plugin_tooltip_action
function plugin_tooltip_action()
{
global $vars;
$term = $vars['q'];
if (trim($term) == '') {
exit;
}
$glossary = plugin_tooltip_get_glossary($term, '', TRUE);
if ($glossary == FALSE) {
exit;
}
$s_glossary = convert_html($glossary);
pkwk_common_headers();
header('Content-type: text/xml');
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
print $s_glossary;
exit;
}
示例8: plugin_htmlp_convert
function plugin_htmlp_convert()
{
$args = func_get_args();
$body = array_pop($args);
if (substr($body, -1) != "\r") {
return '<p>htmlp(): no argument(s).</p>';
}
require_once 'htmlpurifier/library/HTMLPurifier.auto.php';
$purifier = new HTMLPurifier();
$body = $purifier->purify($body);
$noskin = in_array("noskin", $args);
if ($noskin) {
pkwk_common_headers();
print $body;
exit;
}
return $body;
}
示例9: plugin_xbel_action
function plugin_xbel_action()
{
global $vars, $page_title, $rss_description, $whatsnew;
$adm = empty($vars['adm']) ? 'page' : $vars['adm'];
// ユーザ認証されていない
$id = auth::check_auth();
if (empty($id)) {
$adm = 'recent';
}
$data = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">
<xbel version="1.0">
<title><![CDATA[{$page_title}]]></title>
<desc><![CDATA[{$rss_description}]]></desc>
EOD;
change_uri('', 1);
// Force absoluteURI.
switch ($adm) {
case 'list':
$pages = xbel::get_data();
break;
case 'recent':
$pages = array($whatsnew);
break;
// list
// list
default:
$page = empty($vars['page']) ? $whatsnew : $vars['page'];
$pages = array($page);
unset($page);
}
foreach ($pages as $page) {
$links = xbel::get_link_list($page);
$data .= xbel::put_body($links, $page);
}
$data .= "</xbel>\n";
pkwk_common_headers();
header('Content-type: application/xml');
print $data;
exit;
}
示例10: action
function action()
{
global $vars;
list($page, $variables, $this->action_options) = $this->parse_args_action($vars, $this->default_action_options);
if ($page == '') {
return array('msg' => $this->plugin, 'body' => '<p class="alert alert-warning">#' . $this->plugin() . ': No page is specified.</p>');
}
$source = $this->htmlinsert($page, $variables);
if ($this->error != "") {
return array('msg' => $this->plugin, 'body' => '<p class="alert alert-warning">#' . $this->plugin() . ': ' . $this->error . '</p>');
}
// no skin
pkwk_common_headers();
if ($this->action_options['content_type'] != '') {
header('Content-Type: ' . htmlsc($this->action_options['content_type']));
}
print $source;
exit;
}
示例11: plugin_html_convert
/**
* Write HTML
*
* @author sonots
* @license http://www.gnu.org/licenses/gpl.html GPL v2
* @link http://lsx.sourceforge.jp/?Plugin%2Fhtml.inc.php
* @version $Id: html.inc.php,v 2.2 2007-03-20 23:44:19Z sonots $
* @package plugin
*/
function plugin_html_convert()
{
$args = func_get_args();
$body = array_pop($args);
if (substr($body, -1) != "\r") {
return '<p>html(): no argument(s).</p>';
}
$page = $GLOBALS['vars']['page'];
if (!plugin_html_is_edit_restricted($page)) {
return "<p>html(): Current page, {$page}, must be edit_authed or frozen or whole system must be PKWK_READONLY.</p>";
}
$noskin = in_array("noskin", $args);
if ($noskin) {
pkwk_common_headers();
print $body;
exit;
}
return $body;
}
示例12: plugin_mceedit_realview
function plugin_mceedit_realview()
{
global $vars;
$vars['msg'] = preg_replace(PLUGIN_EDIT_FREEZE_REGEX, '', $vars['msg']);
$postdata = $vars['msg'];
if ($postdata) {
$postdata = make_str_rules($postdata);
$postdata = explode("\n", $postdata);
$postdata = drop_submit(convert_html($postdata));
}
// Feeding start
pkwk_common_headers();
header('Content-type: text/xml; charset=UTF-8');
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
print $postdata;
$longtaketime = getmicrotime() - MUTIME;
$taketime = sprintf('%01.03f', $longtaketime);
print '<span class="small1">(Time:' . $taketime . ')</span>';
exit;
}
示例13: action
/**
* Action Plugin Main Function
*/
function action()
{
global $vars;
$page = $vars['page'];
unset($vars['page']);
if (!isset($page) || $page == '') {
return array('msg' => $this->plugin, 'body' => '<p>' . $this->error_message(5) . '</p>');
}
$argoptions = $vars;
unset($argoptions['cmd']);
list($options, $variables) = $this->evaluate_options($argoptions, $this->defoptions);
$source = $this->htmlinsert($page, $variables);
if (!is_string($source)) {
return array('msg' => $this->plugin, 'body' => '<p>' . $this->error_message($source) . '</p>');
}
// no skin
pkwk_common_headers();
if (!empty($options['content_type'])) {
header('Content-Type: ' . htmlspecialchars($options['content_type']));
}
print $source;
exit;
}
示例14: plugin_commu_html_convert
function plugin_commu_html_convert()
{
global $vars;
//キャッシュを無効に
if (QHM_VERSION < 4.6) {
global $enable_cache;
$enable_cache = false;
} else {
$qt = get_qt();
$qt->enable_cache = false;
}
$page = $vars['page'];
if (!(PKWK_READONLY > 0 or is_freeze($page) or plugin_commu_html_is_edit_auth($page))) {
return "<p>commu_html(): Current page, {$page}, must be edit_authed or frozen or whole system must be PKWK_READONLY.</p>";
}
$args = func_get_args();
$body = array_pop($args);
$noskin = in_array("noskin", $args);
$s = array();
$r = array();
$cnt = 0;
if (isset($_SESSION['commu_user'])) {
foreach ($_SESSION['commu_user'] as $key => $val) {
$s[$cnt] = '/<%' . $key . '%>/';
$r[$cnt] = mb_convert_encoding($val, "UTF-8", "UTF-8,EUC-JP");
$cnt++;
}
$body = preg_replace($s, $r, $body);
}
if ($noskin) {
pkwk_common_headers();
print $body;
exit;
}
return $body;
}
示例15: pkwk_output_noskin
/**
* Output contents without skin
*
* PukiWiki API Extension
*
* @access public
* @static
* @param string $body html
* @param string $content_type e.g., 'text/html', 'text/css', 'text/javascript'
* @return void exit
* @uses pkwk_common_headers (PukiWiki lib/html.php)
* @version $Id: v 1.0 2008-06-05 11:14:46 sonots $
*/
function pkwk_output_noskin($body, $content_type = 'text/html')
{
pkwk_common_headers();
header('Content-Type: ' . $content_type);
print $body;
exit;
}