本文整理汇总了PHP中get_source函数的典型用法代码示例。如果您正苦于以下问题:PHP get_source函数的具体用法?PHP get_source怎么用?PHP get_source使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_source函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: plugin_diff_view
function plugin_diff_view($page)
{
global $script, $hr;
global $_msg_notfound, $_msg_goto, $_msg_deleted, $_msg_addline, $_msg_delline, $_title_diff;
global $_title_diff_delete;
$r_page = rawurlencode($page);
$s_page = htmlsc($page);
$menu = array('<li>' . $_msg_addline . '</li>', '<li>' . $_msg_delline . '</li>');
$is_page = is_page($page);
if ($is_page) {
$menu[] = ' <li>' . str_replace('$1', '<a href="' . $script . '?' . $r_page . '">' . $s_page . '</a>', $_msg_goto) . '</li>';
} else {
$menu[] = ' <li>' . str_replace('$1', $s_page, $_msg_deleted) . '</li>';
}
$filename = DIFF_DIR . encode($page) . '.txt';
if (file_exists($filename)) {
if (!PKWK_READONLY) {
$menu[] = '<li><a href="' . $script . '?cmd=diff&action=delete&page=' . $r_page . '">' . str_replace('$1', $s_page, $_title_diff_delete) . '</a></li>';
}
$msg = '<pre>' . diff_style_to_css(htmlsc(join('', file($filename)))) . '</pre>' . "\n";
} elseif ($is_page) {
$diffdata = trim(htmlsc(join('', get_source($page))));
$msg = '<pre><span class="diff_added">' . $diffdata . '</span></pre>' . "\n";
} else {
return array('msg' => $_title_diff, 'body' => $_msg_notfound);
}
$menu = join("\n", $menu);
$body = <<<EOD
<ul>
{$menu}
</ul>
{$hr}
EOD;
return array('msg' => $_title_diff, 'body' => $body . $msg);
}
开发者ID:nsmr0604,项目名称:pukiwiki,代码行数:35,代码来源:diff.inc.php
示例2: plugin_qform_view_action
function plugin_qform_view_action()
{
global $vars;
$page = $vars['page'];
$str = '';
$f = false;
$lines = get_source($page);
foreach ($lines as $l) {
if (trim($l) === '}}') {
$f = false;
}
if ($f) {
$str .= $l;
}
if (preg_match('/^#qform_view(.*)/', $l)) {
$f = true;
}
}
header("Cache-Control: public");
header("Pragma: public");
header("Accept-Ranges: none");
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename=qform.csv");
header("Content-Type: application/octet-stream; name=qform.csv");
echo mb_convert_encoding($str, 'Shift_JIS');
exit;
}
开发者ID:big2men,项目名称:qhm,代码行数:27,代码来源:qform_view.inc.php
示例3: plugin_ls_convert
function plugin_ls_convert()
{
global $vars;
$with_title = FALSE;
if (func_num_args()) {
$args = func_get_args();
$with_title = in_array('title', $args);
}
$prefix = $vars['page'] . '/';
$pages = array();
foreach (get_existpages() as $page) {
if (strpos($page, $prefix) === 0) {
$pages[] = $page;
}
}
natcasesort($pages);
$ls = array();
foreach ($pages as $page) {
$comment = '';
if ($with_title) {
list($comment) = get_source($page);
// 見出しの固有ID部を削除
$comment = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/', '$1$2', $comment);
$comment = '- ' . ereg_replace('^[-*]+', '', $comment);
}
$ls[] = "-[[{$page}]] {$comment}";
}
return convert_html($ls);
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:29,代码来源:ls.inc.php
示例4: plugin_html2_is_edit_auth
function plugin_html2_is_edit_auth($page, $user = '')
{
global $edit_auth, $edit_auth_pages, $auth_method_type;
if (!$edit_auth) {
return FALSE;
}
// Checked by:
$target_str = '';
if ($auth_method_type == 'pagename') {
$target_str = $page;
// Page name
} else {
if ($auth_method_type == 'contents') {
$target_str = join('', get_source($page));
// Its contents
}
}
foreach ($edit_auth_pages as $regexp => $users) {
if (preg_match($regexp, $target_str)) {
if ($user == '' || in_array($user, explode(',', $users))) {
return TRUE;
}
}
}
return FALSE;
}
开发者ID:big2men,项目名称:qhm,代码行数:26,代码来源:html2.inc.php
示例5: write
public function write()
{
$output = PKWK_YAMLCONFIG_HEAD . yaml_emit($this->getArrayCopy()) . PKWK_YAMLCONFIG_TAIL;
$source = get_source($this->page, TRUE, TRUE);
$source = $source != FALSE && preg_match(PKWK_YAMLCONFIG_PATTERN, $source) ? preg_replace(PKWK_YAMLCONFIG_PATTERN, $output, $source) : $output;
page_write($this->page, $source);
return $source;
}
开发者ID:TakeAsh,项目名称:php-TakeAsh-PKWK-Mod,代码行数:8,代码来源:yamlconfig.php
示例6: plugin_vote_action
function plugin_vote_action()
{
global $vars, $script, $cols, $rows;
global $_title_collided, $_msg_collided, $_title_updated;
global $_vote_plugin_votes;
if (PKWK_READONLY) {
die_message('PKWK_READONLY prohibits editing');
}
$postdata_old = get_source($vars['refer']);
$vote_no = 0;
$title = $body = $postdata = $postdata_input = $vote_str = '';
$matches = array();
foreach ($postdata_old as $line) {
if (!preg_match('/^#vote(?:\\((.*)\\)(.*))?$/i', $line, $matches) || $vote_no++ != $vars['vote_no']) {
$postdata .= $line;
continue;
}
$args = explode(',', $matches[1]);
$lefts = isset($matches[2]) ? $matches[2] : '';
foreach ($args as $arg) {
$cnt = 0;
if (preg_match('/^(.+)\\[(\\d+)\\]$/', $arg, $matches)) {
$arg = $matches[1];
$cnt = $matches[2];
}
$e_arg = encode($arg);
if (!empty($vars['vote_' . $e_arg]) && $vars['vote_' . $e_arg] == $_vote_plugin_votes) {
++$cnt;
}
$votes[] = $arg . '[' . $cnt . ']';
}
$vote_str = '#vote(' . @join(',', $votes) . ')' . $lefts . "\n";
$postdata_input = $vote_str;
$postdata .= $vote_str;
}
if (md5(@join('', get_source($vars['refer']))) != $vars['digest']) {
$title = $_title_collided;
$s_refer = htmlsc($vars['refer']);
$s_digest = htmlsc($vars['digest']);
$s_postdata_input = htmlsc($postdata_input);
$body = <<<EOD
{$_msg_collided}
<form action="{$script}?cmd=preview" method="post">
<div>
<input type="hidden" name="refer" value="{$s_refer}" />
<input type="hidden" name="digest" value="{$s_digest}" />
<textarea name="msg" rows="{$rows}" cols="{$cols}" id="textarea">{$s_postdata_input}</textarea><br />
</div>
</form>
EOD;
} else {
page_write($vars['refer'], $postdata);
$title = $_title_updated;
}
$vars['page'] = $vars['refer'];
return array('msg' => $title, 'body' => $body);
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:58,代码来源:vote.inc.php
示例7: plugin_fb_likegate_convert
function plugin_fb_likegate_convert()
{
global $vars, $script, $nowindow;
$qm = get_qm();
$qt = get_qt();
$editable = edit_auth($page, FALSE, FALSE);
//本文部分以外のページに設置した場合、無効にする
if (isset($vars['page_alt']) && is_page($vars['page_alt'])) {
if ($editable) {
return 'error: #fb_likegate: 本文に設置してください。';
} else {
return '';
}
}
$page = isset($vars['page']) ? $vars['page'] : '';
//キャッシュ無効
$qt->enable_cache = false;
$args = func_get_args();
if (count($args) === 0) {
return $qm->replace('fmt_err_cvt', 'fb_likegate', $qm->m['plg_fb_likegate']['err_usage']);
}
list($unlike_page) = $args;
$fb_apps_url = plugin_fb_root_get_apps_url();
//Facebook からのアクセス
if ($signed_request = plugin_fb_root_parse_request()) {
$nowindow = 1;
$edit_url = $script . '?cmd=edit&page=' . rawurlencode($page);
plugin_fb_root_set_page();
$liked = (isset($signed_request->page->liked) and !is_null($signed_request->page->liked)) ? $signed_request->page->liked : $signed_request->page['liked'];
if ($liked) {
$src = get_source($page);
foreach ($src as $i => $line) {
if (strpos($line, '#fb_likegate') === 0) {
unset($src[$i]);
break;
}
}
$body = convert_html($src);
} else {
$src = get_source($unlike_page);
foreach ($src as $i => $line) {
if (strpos($line, '#fb_page') === 0) {
unset($src[$i]);
}
}
$body = convert_html($src);
}
if ($editable) {
$add_body = convert_html($qm->replace('plg_fb_likegate.ntc_admin_fb', $edit_url, $unlike_page, $fb_apps_url));
}
force_output_message('', '', $add_body . $body);
} else {
if ($editable) {
return convert_html($qm->replace('plg_fb_likegate.ntc_admin', $unlike_page, $fb_apps_url));
}
force_output_message($qm->m['plg_fb_likegate']['ntc_title'], '', $qm->m['plg_fb_likegate']['ntc_msg']);
}
}
开发者ID:big2men,项目名称:qhm,代码行数:58,代码来源:fb_likegate.inc.php
示例8: plugin_nav_convert
/**
* QHM Nav plugin
* -------------------------------------------
*
* Copyright (c) 2014 hokuken
* http://hokuken.com/
*
* created : 2014/06/11
* modified :
*
* Switch Nav content and convert
*
* Usage :
* #nav(OtherSiteNavigator)
*
*/
function plugin_nav_convert()
{
global $vars, $navbar;
static $nav = NULL;
$qm = get_qm();
$qt = get_qt();
$num = func_num_args();
if ($num > 0) {
// Try to change default 'SiteNavigator' page name (only)
if ($num > 1) {
return '#nav: 引数が多すぎます。' . "<br />\n";
}
if ($nav !== NULL) {
return '#nav: 既に変更されています:' . h($nav) . "<br />\n";
}
if ($qt->getv('plugin_nav_source')) {
return '#nav: 既にナビの内容を変更しています。' . "<br />\n";
}
$args = func_get_args();
//ナビの内容を受け取る
if (strpos($args[0], "\r") !== FALSE) {
if (isset($vars['page_alt'])) {
return '#nav: 利用できません。';
}
$source = str_replace("\r", "\n", $args[0]);
$qt->setv_once('plugin_nav_source', $source);
return '';
}
if (!is_page($args[0])) {
return 'ページがみつかりません:' . h($args[0]) . "<br />\n";
} else {
$nav = $args[0];
// Set
return '';
}
} else {
// Output navbar page data
$page = $nav === NULL ? $navbar : $nav;
if ($source = $qt->getv('plugin_nav_source')) {
// Cut fixed anchors
$source = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', $source);
return convert_html($source);
}
if (!is_page($page)) {
return '';
} else {
if (isset($vars['preview']) && $vars['page'] == $page) {
// Cut fixed anchors
$navtext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', $vars['msg']);
return convert_html($navtext);
} else {
// Cut fixed anchors
$navtext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', get_source($page));
return convert_html($navtext);
}
}
}
}
开发者ID:big2men,项目名称:qhm,代码行数:74,代码来源:nav.inc.php
示例9: plugin_memo_action
function plugin_memo_action()
{
global $script, $vars, $cols, $rows;
global $_title_collided, $_msg_collided, $_title_updated;
if (PKWK_READONLY) {
die_message('PKWK_READONLY prohibits editing');
}
if (!isset($vars['msg']) || $vars['msg'] == '') {
return;
}
$memo_body = preg_replace('/' . "\r" . '/', '', $vars['msg']);
$memo_body = str_replace("\n", '\\n', $memo_body);
$memo_body = str_replace('"', '"', $memo_body);
// Escape double quotes
$memo_body = str_replace(',', ',', $memo_body);
// Escape commas
$postdata_old = get_source($vars['refer']);
$postdata = '';
$memo_no = 0;
foreach ($postdata_old as $line) {
if (preg_match("/^#memo\\(?.*\\)?\$/i", $line)) {
if ($memo_no == $vars['memo_no']) {
$postdata .= '#memo(' . $memo_body . ')' . "\n";
$line = '';
}
++$memo_no;
}
$postdata .= $line;
}
$postdata_input = $memo_body . "\n";
$body = '';
if (md5(@join('', get_source($vars['refer']))) != $vars['digest']) {
$title = $_title_collided;
$body = $_msg_collided . "\n";
$s_refer = htmlspecialchars($vars['refer']);
$s_digest = htmlspecialchars($vars['digest']);
$s_postdata_input = htmlspecialchars($postdata_input);
$body .= <<<EOD
<form action="{$script}?cmd=preview" method="post">
<div>
<p>
<input type="hidden" name="refer" value="{$s_refer}" />
<input type="hidden" name="digest" value="{$s_digest}" />
<textarea name="msg" rows="{$rows}" cols="{$cols}" id="textarea">{$s_postdata_input}</textarea>
</p>
</div>
</form>
EOD;
} else {
page_write($vars['refer'], $postdata);
$title = $_title_updated;
}
$retvars['msg'] =& $title;
$retvars['body'] =& $body;
$vars['page'] = $vars['refer'];
return $retvars;
}
开发者ID:lolo3-sight,项目名称:wiki,代码行数:57,代码来源:memo.inc.php
示例10: plugin_insert_action
function plugin_insert_action()
{
global $script, $vars, $cols, $rows;
global $_title_collided, $_msg_collided, $_title_updated;
if (PKWK_READONLY) {
die_message('PKWK_READONLY prohibits editing');
}
if (!isset($vars['msg']) || $vars['msg'] == '') {
return;
}
$vars['msg'] = preg_replace('/' . "\r" . '/', '', $vars['msg']);
$insert = $vars['msg'] != '' ? "\n" . $vars['msg'] . "\n" : '';
$postdata = '';
$postdata_old = get_source($vars['refer']);
$insert_no = 0;
foreach ($postdata_old as $line) {
if (!INSERT_INS) {
$postdata .= $line;
}
if (preg_match('/^#insert$/i', $line)) {
if ($insert_no == $vars['insert_no']) {
$postdata .= $insert;
}
$insert_no++;
}
if (INSERT_INS) {
$postdata .= $line;
}
}
$postdata_input = $insert . "\n";
$body = '';
if (md5(@join('', get_source($vars['refer']))) != $vars['digest']) {
$title = $_title_collided;
$body = $_msg_collided . "\n";
$s_refer = htmlsc($vars['refer']);
$s_digest = htmlsc($vars['digest']);
$s_postdata_input = htmlsc($postdata_input);
$body .= <<<EOD
<form action="{$script}?cmd=preview" method="post">
<div>
<input type="hidden" name="refer" value="{$s_refer}" />
<input type="hidden" name="digest" value="{$s_digest}" />
<textarea name="msg" rows="{$rows}" cols="{$cols}" id="textarea">{$s_postdata_input}</textarea><br />
</div>
</form>
EOD;
} else {
page_write($vars['refer'], $postdata);
$title = $_title_updated;
}
$retvars['msg'] = $title;
$retvars['body'] = $body;
$vars['page'] = $vars['refer'];
return $retvars;
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:55,代码来源:insert.inc.php
示例11: 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);
}
开发者ID:lolo3-sight,项目名称:wiki,代码行数:55,代码来源:unfreeze.inc.php
示例12: read
function read()
{
if (!is_page($this->page)) {
return FALSE;
}
$this->objs = array();
$obj =& new ConfigTable('');
$matches = array();
foreach (get_source($this->page) as $line) {
if ($line == '') {
continue;
}
$head = $line[0];
// The first letter
$level = strspn($line, $head);
if ($level > 3) {
$obj->add_line($line);
} else {
if ($head == '*') {
// Cut fixed-heading anchors
$line = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/', '$1$2', $line);
if ($level == 1) {
$this->objs[$obj->title] = $obj;
$obj =& new ConfigTable($line);
} else {
if (!is_a($obj, 'ConfigTable_Direct')) {
$obj =& new ConfigTable_Direct('', $obj);
}
$obj->set_key($line);
}
} else {
if ($head == '-' && $level > 1) {
if (!is_a($obj, 'ConfigTable_Direct')) {
$obj =& new ConfigTable_Direct('', $obj);
}
$obj->add_value($line);
} else {
if ($head == '|' && preg_match('/^\\|(.+)\\|\\s*$/', $line, $matches)) {
// Table row
if (!is_a($obj, 'ConfigTable_Sequential')) {
$obj =& new ConfigTable_Sequential('', $obj);
}
// Trim() each table cell
$obj->add_value(array_map('trim', explode('|', $matches[1])));
} else {
$obj->add_line($line);
}
}
}
}
}
$this->objs[$obj->title] = $obj;
return TRUE;
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:54,代码来源:config.php
示例13: plugin_diff_view
function plugin_diff_view($page)
{
global $script, $hr;
// global $_msg_notfound, $_msg_goto, $_msg_deleted, $_msg_addline, $_msg_delline;
// global $_title_diff, $_title_diff_delete;
if (auth::check_role('safemode')) {
die_message('PKWK_SAFE_MODE prohibits this');
}
$_msg_notfound = _('The page was not found.');
$_msg_addline = _('The added line is <span class="diff_added">THIS COLOR</span>.');
$_msg_delline = _('The deleted line is <span class="diff_removed">THIS COLOR</span>.');
$_msg_goto = _('Go to $1.');
$_msg_deleted = _(' $1 has been deleted.');
$_title_diff = _('Diff of $1');
$_title_diff_delete = _('Deleting diff of $1');
$r_page = rawurlencode($page);
$s_page = htmlspecialchars($page);
$menu = array('<li>' . $_msg_addline . '</li>', '<li>' . $_msg_delline . '</li>');
$is_page = is_page($page);
if ($is_page) {
$menu[] = ' <li>' . str_replace('$1', '<a href="' . get_page_uri($page) . '">' . $s_page . '</a>', $_msg_goto) . '</li>';
} else {
$menu[] = ' <li>' . str_replace('$1', $s_page, $_msg_deleted) . '</li>';
}
$filename = DIFF_DIR . encode($page) . '.txt';
if (file_exists($filename)) {
// if (! PKWK_READONLY) {
if (!auth::check_role('readonly')) {
$menu[] = '<li><a href="' . $script . '?cmd=diff&action=delete&page=' . $r_page . '">' . str_replace('$1', $s_page, $_title_diff_delete) . '</a></li>';
}
$source = join('', file($filename));
auth::is_role_page($source);
$msg = '<pre>' . diff_style_to_css(htmlspecialchars($source)) . '</pre>' . "\n";
} else {
if ($is_page) {
$source = join('', get_source($page));
auth::is_role_page($source);
$diffdata = trim(htmlspecialchars($source));
$msg = '<pre><span class="diff_added">' . $diffdata . '</span></pre>' . "\n";
} else {
return array('msg' => $_title_diff, 'body' => $_msg_notfound);
}
}
$menu = join("\n", $menu);
$body = <<<EOD
<ul>
{$menu}
</ul>
{$hr}
EOD;
return array('msg' => $_title_diff, 'body' => $body . $msg);
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:52,代码来源:diff.inc.php
示例14: convert_html
function convert_html($lines)
{
global $vars, $digest;
static $contents_id = 0;
// Set digest
$digest = md5(join('', get_source($vars['page'])));
if (!is_array($lines)) {
$lines = explode("\n", $lines);
}
$body =& new Body(++$contents_id);
$body->parse($lines);
return $body->toString();
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:13,代码来源:convert_html.php
示例15: plugin_source_action
function plugin_source_action()
{
global $vars, $_source_messages;
if (PKWK_SAFE_MODE) {
die_message('PKWK_SAFE_MODE prohibits this');
}
$page = isset($vars['page']) ? $vars['page'] : '';
$vars['refer'] = $page;
if (!is_page($page) || !check_readable($page, false, false)) {
return array('msg' => $_source_messages['msg_notfound'], 'body' => $_source_messages['err_notfound']);
}
return array('msg' => $_source_messages['msg_title'], 'body' => '<pre id="source">' . htmlsc(join('', get_source($page))) . '</pre>');
}
开发者ID:nsmr0604,项目名称:pukiwiki,代码行数:13,代码来源:source.inc.php
示例16: count_comment
function count_comment($page)
{
$source = join("\n", get_source($page));
if (!preg_match("/^#comment\$/m", $source)) {
return NULL;
}
require_once PLUGIN_DIR . 'comment.inc.php';
$comment_format = PLUGIN_COMMENT_FORMAT_STRING;
$comment_format = preg_replace("/MSG/", ".*", $comment_format);
$comment_format = preg_replace("/NAME/", "\\[\\[.*\\]\\]", $comment_format);
$comment_format = preg_replace("/NOW/", "&new.*", $comment_format);
return preg_match_all("/^-{$comment_format}/m", $source, $dumy);
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:13,代码来源:blikifooter.inc.php
示例17: 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;
}
开发者ID:big2men,项目名称:qhm,代码行数:14,代码来源:gmapfun.inc.php
示例18: plugin_diff_view
function plugin_diff_view($page)
{
global $script, $hr;
global $layout_pages;
$qm = get_qm();
$r_page = rawurlencode($page);
$s_page = htmlspecialchars($page);
$menu = array('<li>' . $qm->m['fmt_msg_addline'] . '</li>', '<li>' . $qm->m['fmt_msg_delline'] . '</li>');
//レイアウト部品の場合、スタイルを変更する
$is_layout = FALSE;
if (isset($layout_pages) && isset($layout_pages[$page])) {
$is_layout = TRUE;
}
$is_page = is_page($page);
if ($is_page && $is_layout) {
$menu[] = ' <li><a href="' . h($script) . '?cmd=edit&page=' . $r_page . '">' . h($layout_pages[$page]) . 'を編集する</a></li>';
} else {
if ($is_page) {
$menu[] = ' <li>' . str_replace('$1', '<a href="' . $script . '?' . $r_page . '">' . $s_page . '</a>', $qm->m['fmt_msg_goto']) . '</li>';
} else {
$menu[] = ' <li>' . str_replace('$1', $s_page, $qm->m['fmt_msg_deleted']) . '</li>';
}
}
$filename = DIFF_DIR . encode($page) . '.txt';
if (file_exists($filename)) {
if (!PKWK_READONLY) {
$menu[] = '<li><a href="' . $script . '?cmd=diff&action=delete&page=' . $r_page . '">' . $qm->replace('plg_diff.title_delete', $s_page) . '</a></li>';
}
$msg = '<pre>' . diff_style_to_css(htmlspecialchars(join('', file($filename)))) . '</pre>' . "\n";
} else {
if ($is_page) {
$diffdata = trim(htmlspecialchars(join('', get_source($page))));
$msg = '<pre><span class="diff_added">' . $diffdata . '</span></pre>' . "\n";
} else {
return array('msg' => $qm->m['plg_diff']['title'], 'body' => $qm->m['fmt_err_notfound']);
}
}
$menu = join("\n", $menu);
$body = <<<EOD
<ul>
{$menu}
</ul>
{$hr}
EOD;
$title = $qm->m['plg_diff']['title'];
if ($is_layout) {
$title = h($layout_pages[$page]) . 'の変更点';
}
return array('msg' => $title, 'body' => $body . $msg);
}
开发者ID:big2men,项目名称:qhm,代码行数:50,代码来源:diff.inc.php
示例19: 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);
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:50,代码来源:freeze.inc.php
示例20: plugin_code_action
function plugin_code_action()
{
global $vars;
global $_source_messages;
// if (PKWK_SAFE_MODE) die_message('PKWK_SAFE_MODE prohibits this');
if (auth::check_role('safemode')) {
die_message('PKWK_SAFE_MODE prohibits this');
}
$vars['refer'] = $vars['page'];
if (!is_page($vars['page']) || !check_readable($vars['page'], false, false)) {
return array('msg' => $_source_messages['msg_notfound'], 'body' => $_source_messages['err_notfound']);
}
return array('msg' => $_source_messages['msg_title'], 'body' => plugin_code_convert('pukiwiki', join('', get_source($vars['page'])) . "\n"));
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:14,代码来源:code.inc.php
注:本文中的get_source函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论