本文整理汇总了PHP中metaFN函数的典型用法代码示例。如果您正苦于以下问题:PHP metaFN函数的具体用法?PHP metaFN怎么用?PHP metaFN使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了metaFN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
foreach ($this->ids as $id) {
saveWikiText($id, '', 'deleted in tearDown()');
@unlink(metaFN($id, '.meta'));
}
}
示例2: handle
/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler)
{
global $ID;
global $ACT;
// don't show linkback section on blog mainpages
if (defined('IS_BLOG_MAINPAGE')) {
return false;
}
// don't allow usage of syntax in comments
if (isset($_REQUEST['comment'])) {
return false;
}
// get linkback meta file name
$file = metaFN($ID, '.linkbacks');
$data = array('send' => false, 'receive' => false, 'display' => false, 'sentpings' => array(), 'receivedpings' => array(), 'number' => 0);
if (@file_exists($file)) {
$data = unserialize(io_readFile($file, false));
}
if ($match == '~~LINKBACK~~') {
$data['receive'] = true;
$data['display'] = true;
} else {
if ($match == '~~LINKBACK:off~~') {
$data['receive'] = false;
$data['display'] = false;
} else {
$data['receive'] = false;
$data['display'] = true;
}
}
io_saveFile($file, serialize($data));
}
示例3: handle
/**
* Handle the match
*/
function handle($match, $state, $pos, &$handler)
{
global $ID, $ACT;
// strip markup
$match = substr($match, 12, -2);
// split title (if there is one)
list($match, $title) = explode('|', $match, 2);
// assign discussion state
if ($match == ':off') {
$status = 0;
} else {
if ($match == ':closed') {
$status = 2;
} else {
$status = 1;
}
}
if ($ACT == 'preview') {
return;
}
// get discussion meta file name
$file = metaFN($ID, '.comments');
$data = array();
if (@file_exists($file)) {
$data = unserialize(io_readFile($file, false));
}
$data['title'] = $title;
$data['status'] = $status;
io_saveFile($file, serialize($data));
return $status;
}
示例4: handle_approve
function handle_approve(&$event, $param)
{
global $ID, $REV, $INFO;
if ($event->data == 'show' && isset($_GET['approve'])) {
if (!$this->can_approve()) {
return;
}
//change last commit comment to Approved
$meta = p_read_metadata($ID);
$meta[current][last_change][sum] = $meta[persistent][last_change][sum] = APPROVED;
$meta[current][last_change][user] = $meta[persistent][last_change][user] = $INFO[client];
if (!array_key_exists($INFO[client], $meta[current][contributor])) {
$meta[current][contributor][$INFO[client]] = $INFO[userinfo][name];
$meta[persistent][contributor][$INFO[client]] = $INFO[userinfo][name];
}
p_save_metadata($ID, $meta);
//update changelog
//remove last line from file
$changelog_file = metaFN($ID, '.changes');
$changes = file($changelog_file, FILE_SKIP_EMPTY_LINES);
$lastLogLine = array_pop($changes);
$info = parseChangelogLine($lastLogLine);
$info[user] = $INFO[client];
$info[sum] = APPROVED;
$logline = implode("\t", $info) . "\n";
array_push($changes, $logline);
io_saveFile($changelog_file, implode('', $changes));
header('Location: ?id=' . $ID);
}
}
示例5: __construct
function __construct()
{
$ip = $_SERVER['REMOTE_ADDR'];
if ($this->is_excluded($ip, true)) {
exit("403: Not Available");
}
$this->ipaddr = $ip;
$today = getdate();
$ns_prefix = "quickstats:";
$ns = $ns_prefix . $today['mon'] . '_' . $today['year'] . ':';
$this->page_file = metaFN($ns . 'pages', '.ser');
$this->ua_file = metaFN($ns . 'ua', '.ser');
$this->ip_file = metaFN($ns . 'ip', '.ser');
$this->misc_data_file = metaFN($ns . 'misc_data', '.ser');
$this->qs_file = metaFN($ns . 'qs_data', '.ser');
$this->page_users_file = metaFN($ns . 'page_users', '.ser');
$this->page_totals_file = metaFN($ns_prefix . 'page_totals', '.ser');
$this->year_month = $today['mon'] . '_' . $today['year'];
if (preg_match('/WINNT/i', PHP_OS)) {
$this->SEP = '\\';
}
$this->show_date = $this->getConf('show_date');
$this->dw_tokens = array('do', 'sectok', 'page', 's[]', 'id', 'rev', 'idx');
$conf_tokens = $this->getConf('xcl_name_val');
if (!empty($conf_tokens)) {
$conf_tokens = explode(',', $conf_tokens);
if (!empty($conf_tokens)) {
$this->dw_tokens = array_merge($this->dw_tokens, $conf_tokens);
}
}
$this->helper = $this->loadHelper('quickstats', true);
}
示例6: __construct
function __construct()
{
$this->script_file = metaFN('epub:cache', '.ser');
$this->cache = unserialize(io_readFile($this->script_file, false));
if (!$this->cache) {
$this->cache = array();
}
}
示例7: numberingDB
function numberingDB()
{
$db = metaFN("numbering:seqnum", '.ser');
if (!file_exists($db)) {
io_saveFile($db, "", array());
}
return $db;
}
示例8: process_feed
/**
*/
function process_feed(&$event, $param)
{
global $ID;
if ($this->helper->pageUpdated()) {
$metafile = metaFN('newsfeed:wasupdated', '.meta');
io_saveFile($metafile, time() . "\n" . $ID . "\n");
$this->helper->saveFeedData($ID);
}
}
示例9: file
/**
* Return the subscription meta file for the given ID
*
* @author Adrian Lang <lang@cosmocode.de>
*
* @param string $id The target page or namespace, specified by id; Namespaces
* are identified by appending a colon.
* @return string
*/
protected function file($id)
{
$meta_fname = '.mlist';
if (substr($id, -1, 1) === ':') {
$meta_froot = getNS($id);
$meta_fname = '/' . $meta_fname;
} else {
$meta_froot = $id;
}
return metaFN((string) $meta_froot, $meta_fname);
}
示例10: subscription_filename
/**
* Get the name of the metafile tracking subscriptions to target page or
* namespace
*
* @param string $id The target page or namespace, specified by id; Namespaces
* are identified by appending a colon.
*
* @author Adrian Lang <lang@cosmocode.de>
*/
function subscription_filename($id)
{
$meta_fname = '.mlist';
if (substr($id, -1, 1) === ':') {
$meta_froot = getNS($id);
if ($meta_froot === false) {
$meta_fname = '/' . $meta_fname;
}
} else {
$meta_froot = $id;
}
return metaFN($meta_froot, $meta_fname);
}
示例11: epub_get_progress_dir
function epub_get_progress_dir($temp_user = null)
{
static $dir;
$seed = md5(rawurldecode($_POST['user']) . time());
if (!$dir) {
if (isset($_POST['client'])) {
$user = rawurldecode($_POST['client']) . ":{$seed}";
} else {
$user = $temp_user ? "{$temp_user}:{$seed}" : $seed;
}
$dir = dirname(metaFN("epub:{$user}:tmp", '.meta')) . '/';
}
return $dir;
}
示例12: handle_dokuwiki_started
public function handle_dokuwiki_started(&$event, $param)
{
global $ID, $ACT, $REV;
if ($ACT != 'show' && $ACT != '' || $REV) {
return;
}
$page = p_get_metadata($ID, 'relation isreplacedby');
// return if no redirection data
if (empty($page)) {
return;
}
if (isset($_GET['redirect'])) {
// return if redirection is temporarily disabled,
// or we have been redirected 5 times in a row
if ($_GET['redirect'] == 'no' || $_GET['redirect'] > 4) {
return;
} elseif ($_GET['redirect'] > 0) {
$redirect = $_GET['redirect'] + 1;
} else {
$redirect = 1;
}
} else {
$redirect = 1;
}
// verify metadata currency
if (@filemtime(metaFN($ID, '.meta')) < @filemtime(wikiFN($ID))) {
return;
}
// preserve #section from $page
list($page, $section) = explode('#', $page, 2);
if (isset($section)) {
$section = '#' . $section;
} else {
$section = '';
}
// prepare link for internal redirects, keep external targets
if (!preg_match('#^https?://#i', $page)) {
$page = wl($page, array('redirect' => $redirect), TRUE, '&');
if (!headers_sent() && $this->getConf('show_note')) {
// remember to show note about being redirected from another page
session_start();
$_SESSION[DOKU_COOKIE]['redirect'] = $ID;
}
}
// redirect
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $page . $section . $_SERVER['QUERY_STRING']);
exit;
}
示例13: _index
function _index($id)
{
global $INDEXER;
global $CLEAR;
global $QUIET;
// if not cleared only update changed and new files
if ($CLEAR) {
$idxtag = metaFN($id, '.indexed');
if (@file_exists($idxtag)) {
@unlink($idxtag);
}
}
_quietecho("{$id}... ");
idx_addPage($id, !$QUIET);
_quietecho("done.\n");
}
示例14: search_discussionpages
/**
* function for the search callback
*/
function search_discussionpages(&$data, $base, $file, $type, $lvl, $opts)
{
global $conf;
if ($type == 'd') {
return true;
}
// recurse into directories
if (!preg_match('#' . preg_quote('/' . DISCUSSION_NS . '/', '#') . '#u', $file)) {
return false;
}
if (!preg_match('#\\.txt$#', $file)) {
return false;
}
$id = pathID(str_replace(DISCUSSION_NS . '/', '', $file));
$data[] = array('id' => $id, 'old' => $conf['datadir'] . $file, 'new' => metaFN($id, '.comments'));
return true;
}
示例15: handle_pageredirect_redirect
function handle_pageredirect_redirect(&$event, $param) {
global $ID, $ACT, $REV;
if (($ACT == 'show' || $ACT == '') && empty($REV)) {
$page = p_get_metadata($ID,'relation isreplacedby');
// return if no redirection data
if (empty($page)) { return; }
if (isset($_GET['redirect'])) {
// return if redirection is temporarily disabled,
// or we have been redirected 5 times in a row
if ($_GET['redirect'] == 'no' || $_GET['redirect'] > 4) { return; }
elseif ($_GET['redirect'] > 0) { $redirect = $_GET['redirect'] +1; }
else { $redirect = 1; }
} else {
$redirect = 1;
}
// verify metadata currency
if (@filemtime(metaFN($ID,'.meta')) < @filemtime(wikiFN($ID))) { return; }
if (!headers_sent() && $this->getConf('show_note')) {
// remember to show note about being redirected from another page
session_start();
$_SESSION[DOKU_COOKIE]['redirect'] = $ID;
}
// preserve #section from $page
list($page, $section) = explode('#', $page, 2);
if (isset($section)) {
$section = '#' . $section;
} else {
$section = '';
}
// redirect
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".wl($page, Array('redirect' => $redirect), TRUE, '&'). $section);
exit();
}
}