本文整理汇总了PHP中utf8_encodeFN函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_encodeFN函数的具体用法?PHP utf8_encodeFN怎么用?PHP utf8_encodeFN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_encodeFN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getNamespaceFromID
/**
* Returns an utf8 encoded Namespace for a Page and input Namespace
* @param $NS
* @param $PAGE
*/
function getNamespaceFromID($NS, &$PAGE)
{
global $conf;
// Check current page - if its an NS add the startpage
$clean = true;
resolve_pageid(getNS($NS), $NS, $clean);
if (!page_exists($NS) && array_pop(explode(':', $NS)) != strtolower($conf['start'])) {
// Compare to lowercase since clean lowers it.
$NS .= ':' . $conf['start'];
resolve_pageid(getNS($NS), $NS, $clean);
}
$PAGE = noNS($NS);
$NS = getNS($NS);
return utf8_encodeFN(str_replace(':', '/', $NS));
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:functions.php
示例2: getThreads
/**
* Returns an array of pages with discussion sections, sorted by recent comments
* Note: also used for content by Feed Plugin
*
* @param string $ns
* @param null|int $num
* @param string|bool $skipEmpty
* @return array
*/
function getThreads($ns, $num = null, $skipEmpty = false)
{
global $conf;
require_once DOKU_INC . 'inc/search.php';
$dir = $conf['datadir'] . utf8_encodeFN($ns ? '/' . str_replace(':', '/', $ns) : '');
// returns the list of pages in the given namespace and it's subspaces
$items = array();
search($items, $dir, 'search_allpages', array());
// add pages with comments to result
$result = array();
foreach ($items as $item) {
$id = ($ns ? $ns . ':' : '') . $item['id'];
// some checks
$perm = auth_quickaclcheck($id);
if ($perm < AUTH_READ) {
continue;
}
// skip if no permission
$file = metaFN($id, '.comments');
if (!@file_exists($file)) {
continue;
}
// skip if no comments file
$data = unserialize(io_readFile($file, false));
$status = $data['status'];
$number = $data['number'];
if (!$status || $status == 2 && !$number) {
continue;
}
// skip if comments are off or closed without comments
if ($skipEmpty == 'y' && $number == 0) {
continue;
}
// skip if discussion is empty and flag is set
$date = filemtime($file);
$meta = p_get_metadata($id);
$result[$date . '_' . $id] = array('id' => $id, 'file' => $file, 'title' => $meta['title'], 'date' => $date, 'user' => $meta['creator'], 'desc' => $meta['description']['abstract'], 'num' => $number, 'comments' => $this->td($id, $number), 'status' => $status, 'perm' => $perm, 'exists' => true, 'anchor' => 'discussion__section');
}
// finally sort by time of last comment
krsort($result);
if (is_numeric($num)) {
$result = array_slice($result, 0, $num);
}
return $result;
}
开发者ID:cziehr,项目名称:plugin-discussion,代码行数:54,代码来源:helper.php
示例3: io_sweepNS
/**
* Removes empty directories
*
* Sends IO_NAMESPACE_DELETED events for 'pages' and 'media' namespaces.
* Event data:
* $data[0] ns: The colon separated namespace path minus the trailing page name.
* $data[1] ns_type: 'pages' or 'media' namespace tree.
*
* @todo use safemode hack
* @author Andreas Gohr <[email protected]>
* @author Ben Coburn <[email protected]>
*/
function io_sweepNS($id, $basedir = 'datadir')
{
global $conf;
$types = array('datadir' => 'pages', 'mediadir' => 'media');
$ns_type = isset($types[$basedir]) ? $types[$basedir] : false;
//scan all namespaces
while (($id = getNS($id)) !== false) {
$dir = $conf[$basedir] . '/' . utf8_encodeFN(str_replace(':', '/', $id));
//try to delete dir else return
if (@rmdir($dir)) {
if ($ns_type !== false) {
$data = array($id, $ns_type);
trigger_event('IO_NAMESPACE_DELETED', $data);
}
} else {
return;
}
}
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:31,代码来源:io.php
示例4: handle_ajax_call_acl
/**
* AJAX call handler for ACL plugin
*
* @param Doku_Event $event event object by reference
* @param mixed $param empty
* @return void
*/
public function handle_ajax_call_acl(Doku_Event &$event, $param)
{
if ($event->data !== 'plugin_acl') {
return;
}
$event->stopPropagation();
$event->preventDefault();
global $ID;
global $INPUT;
if (!auth_isadmin()) {
echo 'for admins only';
return;
}
if (!checkSecurityToken()) {
echo 'CRSF Attack';
return;
}
$ID = getID();
/** @var $acl admin_plugin_acl */
$acl = plugin_load('admin', 'acl');
$acl->handle();
$ajax = $INPUT->str('ajax');
header('Content-Type: text/html; charset=utf-8');
if ($ajax == 'info') {
$acl->_html_info();
} elseif ($ajax == 'tree') {
$ns = $INPUT->str('ns');
if ($ns == '*') {
$ns = '';
}
$ns = cleanID($ns);
$lvl = count(explode(':', $ns));
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
$data = $acl->_get_tree($ns, $ns);
foreach (array_keys($data) as $item) {
$data[$item]['level'] = $lvl + 1;
}
echo html_buildlist($data, 'acl', array($acl, '_html_list_acl'), array($acl, '_html_li_acl'));
}
}
开发者ID:wernerflamme,项目名称:dokuwiki,代码行数:47,代码来源:action.php
示例5: listAttachments
/**
* List all media files.
*
* Available options are 'recursive' for also including the subnamespaces
* in the listing, and 'pattern' for filtering the returned files against
* a regular expression matching their name.
*
* @author Gina Haeussge <[email protected]>
*/
function listAttachments($ns, $options = array())
{
global $conf;
global $lang;
$ns = cleanID($ns);
if (!is_array($options)) {
$options = array();
}
if (!isset($options['recursive'])) {
$options['recursive'] = false;
}
if (auth_quickaclcheck($ns . ':*') >= AUTH_READ) {
$dir = utf8_encodeFN(str_replace(':', '/', $ns));
$data = array();
require_once DOKU_INC . 'inc/search.php';
search($data, $conf['mediadir'], 'search_media', array('recursive' => $options['recursive']), $dir);
if (!count($data)) {
return array();
}
$files = array();
foreach ($data as $item) {
if (isset($options['pattern']) && !@preg_match($options['pattern'], $item['id'])) {
continue;
}
$file = array();
$file['id'] = $item['id'];
$file['size'] = $item['size'];
$file['lastModified'] = new IXR_Date($item['mtime']);
$file['isimg'] = $item['isimg'];
$file['writable'] = $item['writeable'];
$file['perms'] = auth_quickaclcheck(getNS($item['id']) . ':*');
array_push($files, $file);
}
return $files;
} else {
return new IXR_Error(1, 'You are not allowed to list media files.');
}
}
开发者ID:jalemanyf,项目名称:wsnlocalizationscala,代码行数:47,代码来源:xmlrpc.php
示例6: collectExportPages
/**
* Obtain list of pages and title, based on url parameters
*
* @param Doku_Event $event
* @return string|bool
*/
protected function collectExportPages(Doku_Event $event)
{
global $ACT;
global $ID;
global $INPUT;
global $conf;
// list of one or multiple pages
$list = array();
if ($ACT == 'export_odt') {
$list[0] = $ID;
$title = $INPUT->str('book_title');
if (!$title) {
$title = p_get_first_heading($ID);
}
} elseif ($ACT == 'export_odtns') {
//check input for title and ns
if (!($title = $INPUT->str('book_title'))) {
$this->showPageWithErrorMsg($event, 'needtitle');
return false;
}
$docnamespace = cleanID($INPUT->str('book_ns'));
if (!@is_dir(dirname(wikiFN($docnamespace . ':dummy')))) {
$this->showPageWithErrorMsg($event, 'needns');
return false;
}
//sort order
$order = $INPUT->str('book_order', 'natural', true);
$sortoptions = array('pagename', 'date', 'natural');
if (!in_array($order, $sortoptions)) {
$order = 'natural';
}
//search depth
$depth = $INPUT->int('book_nsdepth', 0);
if ($depth < 0) {
$depth = 0;
}
//page search
$result = array();
$opts = array('depth' => $depth);
//recursive all levels
$dir = utf8_encodeFN(str_replace(':', '/', $docnamespace));
search($result, $conf['datadir'], 'search_allpages', $opts, $dir);
//sorting
if (count($result) > 0) {
if ($order == 'date') {
usort($result, array($this, '_datesort'));
} elseif ($order == 'pagename') {
usort($result, array($this, '_pagenamesort'));
}
}
foreach ($result as $item) {
$list[] = $item['id'];
}
} elseif (isset($_COOKIE['list-pagelist']) && !empty($_COOKIE['list-pagelist'])) {
// Here is $ACT == 'export_odtbook'
//is in Bookmanager of bookcreator plugin a title given?
if (!($title = $INPUT->str('book_title'))) {
$this->showPageWithErrorMsg($event, 'needtitle');
return false;
} else {
$list = explode("|", $_COOKIE['list-pagelist']);
}
} else {
//show empty bookcreator message
$this->showPageWithErrorMsg($event, 'empty');
return false;
}
$list = array_map('cleanID', $list);
return array($title, $list);
}
开发者ID:RnBConsulting,项目名称:dokuwiki-plugin-odt,代码行数:76,代码来源:action.php
示例7: _getFileBase
/**
* get to-be directory and filename (without extension)
*
* all files are stored in the media directory into 'plugin_abc/<namespaces>/'
* and the filename is a mixture of abc-id and abc-title (e.g. 42_the_title.abc|...)
*
*/
function _getFileBase($src)
{
global $ID;
global $ACT;
global $conf;
$mediadir = $conf['mediadir'];
// where to store the abc media files
$abcdir = $this->getConf('mediaNS') ? $mediadir . '/' . $this->getConf('mediaNS') : $mediadir;
io_makeFileDir($abcdir);
$fileDir = $abcdir . '/' . utf8_encodeFN(str_replace(':', '/', getNS($ID)));
// the abcID is what comes after the 'X:'
preg_match("/\\s?X\\s?:(.*?)\n/se", $src, $matchesX);
$abcID = preg_replace('/\\s?X\\s?:/', '', $matchesX[0]);
// the abcTitle is what comes after the (first) 'T:'
preg_match("/\\s?T\\s?:(.*?)\n/se", $src, $matchesT);
$abcTitle = preg_replace('/\\s?T\\s?:/', '', $matchesT[0]);
$fileName = cleanID($abcID . "_" . $abcTitle);
// no double slash when in root namespace
$slashStr = getNS($ID) ? "/" : "";
// have different fileBase for previewing
$previewPrefix = $ACT != 'preview' ? "" : "x";
$fileBase = $fileDir . $slashStr . $previewPrefix . $fileName;
// unfortunately abcm2ps seems not to be able to handle
// file names (realpath) of more than 120 characters
$realFileBaseLen = strlen(fullpath($abcdir)) - strlen($abcdir) + strlen($fileBase);
$char_len = 114;
if ($realFileBaseLen >= $char_len) {
$truncLen = strlen($fileBase) + ($char_len - $realFileBaseLen);
$fileBase = substr($fileBase, 0, $truncLen);
}
return $fileBase;
}
开发者ID:selfthinker,项目名称:dokuwiki_plugin_abc,代码行数:39,代码来源:syntax.php
示例8: _exportContainercontent
function _exportContainercontent($exporter)
{
global $ID, $INFO, $conf;
if ($ID == $conf['start']) {
$title = $conf['title'];
} elseif (isset($INFO['meta']['title'])) {
$title = $INFO['meta']['title'];
} else {
$title = $ID;
}
$exporter->setParameters('Container: ' . $title, getAbsUrl(), getAbsUrl() . 'doku.php?', 'utf-8', $this->agentlink);
// create container object
$wikicontainer = new SIOCDokuWikiContainer($ID, normalizeUri($exporter->siocURL('container', $ID)));
/* container is type=wiki */
if ($ID == $conf['start']) {
$wikicontainer->isWiki();
}
/* sioc:name */
if ($INFO['exists']) {
$wikicontainer->addTitle($INFO['meta']['title']);
}
/* has_parent */
if ($INFO['namespace']) {
$wikicontainer->addParent($INFO['namespace']);
}
// search next level entries (posts, sub containers) in container
require_once DOKU_INC . 'inc/search.php';
$dir = utf8_encodeFN(str_replace(':', '/', $ID));
$entries = array();
$posts = array();
$containers = array();
search($entries, $conf['datadir'], 'search_index', array('ns' => $ID), $dir);
foreach ($entries as $entry) {
if ($entry['type'] === 'f') {
// wikisite
$posts[] = $entry;
} elseif ($entry['type'] === 'd') {
// sub container
$containers[] = $entry;
}
}
// without sub content it can't be a container (so it does not exist as a container)
if (count($posts) + count($containers) == 0) {
$this->_exit("HTTP/1.0 404 Not Found");
}
if (count($posts) > 0) {
$wikicontainer->addArticles($posts);
}
if (count($containers) > 0) {
$wikicontainer->addContainers($containers);
}
//print_r($containers);die();
// add container to exporter
$exporter->addObject($wikicontainer);
return $exporter;
}
开发者ID:haschek,项目名称:DokuWiki-Plugin-DokuSIOC,代码行数:56,代码来源:action.php
示例9: _html_explorer
/**
* Display a tree menu to select a page or namespace
*
* @author Andreas Gohr <[email protected]>
*/
function _html_explorer()
{
global $conf;
global $ID;
global $lang;
$dir = $conf['datadir'];
$ns = $this->ns;
if (empty($ns)) {
$ns = dirname(str_replace(':', '/', $ID));
if ($ns == '.') {
$ns = '';
}
} elseif ($ns == '*') {
$ns = '';
}
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
$data = $this->_get_tree($ns);
// wrap a list with the root level around the other namespaces
array_unshift($data, array('level' => 0, 'id' => '*', 'type' => 'd', 'open' => 'true', 'label' => '[' . $lang['mediaroot'] . ']'));
echo html_buildlist($data, 'acl', array($this, '_html_list_acl'), array($this, '_html_li_acl'));
}
开发者ID:rexin,项目名称:dokuwiki,代码行数:26,代码来源:admin.php
示例10: mediaFN
/**
* returns the full path to the mediafile specified by ID
*
* The filename is URL encoded to protect Unicode chars
*
* @author Andreas Gohr <[email protected]>
* @author Kate Arzamastseva <[email protected]>
*
* @param string $id media id
* @param string|int $rev empty string or revision timestamp
* @return string full path
*/
function mediaFN($id, $rev = '')
{
global $conf;
$id = cleanID($id);
$id = str_replace(':', '/', $id);
if (empty($rev)) {
$fn = $conf['mediadir'] . '/' . utf8_encodeFN($id);
} else {
$ext = mimetype($id);
$name = substr($id, 0, -1 * strlen($ext[0]) - 1);
$fn = $conf['mediaolddir'] . '/' . utf8_encodeFN($name . '.' . (int) $rev . '.' . $ext[0]);
}
return $fn;
}
开发者ID:s7mx1,项目名称:dokuwiki,代码行数:26,代码来源:pageutils.php
示例11: die
}
if (!auth_isadmin()) {
die('for admins only');
}
if (!checkSecurityToken()) {
die('CRSF Attack');
}
$ID = getID();
$acl = plugin_load('admin', 'acl');
$acl->handle();
$ajax = $_REQUEST['ajax'];
header('Content-Type: text/html; charset=utf-8');
if ($ajax == 'info') {
$acl->_html_info();
} elseif ($ajax == 'tree') {
global $conf;
global $ID;
$dir = $conf['datadir'];
$ns = $_REQUEST['ns'];
if ($ns == '*') {
$ns = '';
}
$ns = cleanID($ns);
$lvl = count(explode(':', $ns));
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
$data = $acl->_get_tree($ns, $ns);
foreach (array_keys($data) as $item) {
$data[$item]['level'] = $lvl + 1;
}
echo html_buildlist($data, 'acl', array($acl, '_html_list_acl'), array($acl, '_html_li_acl'));
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:31,代码来源:ajax.php
示例12: bootstrap_media_nstree
/**
* Build a tree outline of available media namespaces
*
* @author Andreas Gohr <[email protected]>
*/
function bootstrap_media_nstree($ns)
{
global $conf;
global $lang;
// currently selected namespace
$ns = cleanID($ns);
if (empty($ns)) {
global $ID;
$ns = (string) getNS($ID);
}
$ns_dir = utf8_encodeFN(str_replace(':', '/', $ns));
$data = array();
search($data, $conf['mediadir'], 'search_index', array('ns' => $ns_dir, 'nofiles' => true));
// wrap a list with the root level around the other namespaces
array_unshift($data, array('level' => 0, 'id' => '', 'open' => 'true', 'label' => '[' . $lang['mediaroot'] . ']'));
// insert the current ns into the hierarchy if it isn't already part of it
$ns_parts = explode(':', $ns);
$tmp_ns = '';
$pos = 0;
foreach ($ns_parts as $level => $part) {
if ($tmp_ns) {
$tmp_ns .= ':' . $part;
} else {
$tmp_ns = $part;
}
// find the namespace parts or insert them
while ($data[$pos]['id'] != $tmp_ns) {
if ($pos >= count($data) || $data[$pos]['level'] <= $level + 1 && strnatcmp(utf8_encodeFN($data[$pos]['id']), utf8_encodeFN($tmp_ns)) > 0) {
array_splice($data, $pos, 0, array(array('level' => $level + 1, 'id' => $tmp_ns, 'open' => 'true')));
break;
}
++$pos;
}
}
echo bootstrap_toc_html_buildlist($data, '', 'bootstrap_media_nstree_item', 'bootstrap_media_nstree_li');
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:41,代码来源:tpl_functions.php
示例13: _findimages
/**
* Gather all photos matching the given criteria
*/
function _findimages(&$data)
{
global $conf;
$files = array();
// http URLs are supposed to be media RSS feeds
if (preg_match('/^https?:\\/\\//i', $data['ns'])) {
$files = $this->_loadRSS($data['ns']);
$data['_single'] = false;
} elseif (preg_match('/^facebook:/i', $data['ns'])) {
$files = $this->_loadFacebook($data['ns']);
$data['_single'] = false;
} else {
$dir = utf8_encodeFN(str_replace(':', '/', $data['ns']));
// all possible images for the given namespace (or a single image)
if (is_file($conf['mediadir'] . '/' . $dir)) {
require_once DOKU_INC . 'inc/JpegMeta.php';
$files[] = array('id' => $data['ns'], 'isimg' => preg_match('/\\.(jpe?g|gif|png)$/', $dir), 'file' => basename($dir), 'mtime' => filemtime($conf['mediadir'] . '/' . $dir), 'meta' => new JpegMeta($conf['mediadir'] . '/' . $dir));
$data['_single'] = true;
} else {
$depth = $data['recursive'] ? 0 : 1;
search($files, $conf['mediadir'], 'search_media', array('depth' => $depth), $dir);
$data['_single'] = false;
}
}
// done, yet?
$len = count($files);
if (!$len) {
return $files;
}
if ($data['single']) {
return $files;
}
// filter images
for ($i = 0; $i < $len; $i++) {
if (!$files[$i]['isimg']) {
unset($files[$i]);
// this is faster, because RE was done before
} elseif ($data['filter']) {
if (!preg_match($data['filter'], noNS($files[$i]['id']))) {
unset($files[$i]);
}
}
}
if ($len < 1) {
return $files;
}
// random?
if ($data['random']) {
shuffle($files);
} else {
// sort?
if ($data['sort'] == 'date') {
usort($files, array($this, '_datesort'));
} elseif ($data['sort'] == 'mod') {
usort($files, array($this, '_modsort'));
} elseif ($data['sort'] == 'title') {
usort($files, array($this, '_titlesort'));
}
// reverse?
if ($data['reverse']) {
$files = array_reverse($files);
}
}
// limits and offsets?
if ($data['offset']) {
$files = array_slice($files, $data['offset']);
}
if ($data['limit']) {
$files = array_slice($files, 0, $data['limit']);
}
return $files;
}
开发者ID:rabid-inventor,项目名称:dokuwiki-plugin-gallery,代码行数:75,代码来源:syntax.php
示例14: _getNamespaceList
/**
* Get a list of namespaces below the given namespace.
* Recursively fetches subnamespaces.
*
* @param string $topns The top namespace
* @return array Multi-dimensional array of all namespaces below $tns
*/
protected function _getNamespaceList($topns = '')
{
global $conf;
$topns = utf8_encodeFN(str_replace(':', '/', $topns));
$excludes = $this->getConf('addpage_exclude');
if ($excludes == "") {
$excludes = array();
} else {
$excludes = @explode(';', strtolower($excludes));
}
$searchdata = array();
search($searchdata, $conf['datadir'], 'search_namespaces', array(), $topns);
$namespaces = array();
foreach ($searchdata as $ns) {
foreach ($excludes as $exclude) {
if (strpos($ns['id'], $exclude) === 0) {
continue 2;
}
}
$namespaces[] = $ns['id'];
}
return $namespaces;
}
开发者ID:xudianyang,项目名称:wiki.phpboy.net,代码行数:30,代码来源:syntax.php
示例15: tree
/**
* Build a tree info structure from media or page directories
*
* @param int $type
* @param string $open The hierarchy to open FIXME not supported yet
* @param string $base The namespace to start from
* @return array
*/
public function tree($type = self::TYPE_PAGES, $open = '', $base = '')
{
global $conf;
$opendir = utf8_encodeFN(str_replace(':', '/', $open));
$basedir = utf8_encodeFN(str_replace(':', '/', $base));
$opts = array('pagesonly' => $type == self::TYPE_PAGES, 'listdirs' => true, 'listfiles' => true, 'sneakyacl' => $conf['sneaky_index'], 'showmsg' => false, 'depth' => 1);
$data = array();
if ($type == self::TYPE_PAGES) {
search($data, $conf['datadir'], 'search_universal', $opts, $basedir);
} elseif ($type == self::TYPE_MEDIA) {
search($data, $conf['mediadir'], 'search_universal', $opts, $basedir);
}
return $data;
}
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:22,代码来源:tree.php
示例16: ajax_index
/**
* Return sub index for index view
*
* @author Andreas Gohr <[email protected]>
*/
function ajax_index()
{
global $conf;
require_once DOKU_INC . 'inc/search.php';
require_once DOKU_INC . 'inc/html.php';
// wanted namespace
$ns = cleanID($_POST['idx']);
$dir = utf8_encodeFN(str_replace(':', '/', $ns));
$lvl = count(explode(':', $ns));
$data = array();
search($data, $conf['datadir'], 'search_index', array('ns' => $ns), $dir);
foreach ($data as $item) {
$item['level'] = $lvl + 1;
echo html_li_index($item);
echo '<div class="li">';
echo html_list_index($item);
echo '</div>';
echo '</li>';
}
}
开发者ID:jalemanyf,项目名称:wsnlocalizationscala,代码行数:25,代码来源:ajax.php
示例17: media_nstree
/**
* Build a tree outline of available media namespaces
*
* @author Andreas Gohr <[email protected]>
*/
function media_nstree($ns)
{
global $conf;
global $lang;
// currently selected namespace
$ns = cleanID($ns);
if (empty($ns)) {
global $ID;
$ns = dirname(str_replace(':', '/', $ID));
if ($ns == '.') {
$ns = '';
}
}
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
$data = array();
search($data, $conf['mediadir'], 'search_index', array('ns' => $ns, 'nofiles' => true));
// wrap a list with the root level around the other namespaces
array_unshift($data, array('level' => 0, 'id' => '', 'open' => 'true', 'label' => '[' . $lang['mediaroot'] . ']'));
echo html_buildlist($data, 'idx', 'media_nstree_item', 'media_nstree_li');
}
开发者ID:nblock,项目名称:dokuwiki,代码行数:25,代码来源:media.php
示例18: _getSyncList
/**
* Get a list of changed files
*/
function _getSyncList($type = 'pages')
{
if (!$this->_connect()) {
return array();
}
global $conf;
$no = $this->profno;
$list = array();
$ns = $this->profiles[$no]['ns'];
// get remote file list
if ($type == 'pages') {
$ok = $this->client->query('dokuwiki.getPagelist', $ns, array('depth' => (int) $this->profiles[$no]['depth'], 'hash' => true));
} else {
$ok = $this->client->query('wiki.getAttachments', $ns, array('depth' => (int) $this->profiles[$no]['depth'], 'hash' => true));
}
if (!$ok) {
msg('Failed to fetch remote file list. ' . $this->client->getErrorMessage(), -1);
return false;
}
$remote = $this->client->getResponse();
// put into synclist
foreach ($remote as $item) {
$list[$item['id']]['remote'] = $item;
unset($list[$item['id']]['remote']['id']);
}
unset($remote);
// get local file list
$local = array();
$dir = utf8_encodeFN(str_replace(':', '/', $ns));
require_once DOKU_INC . 'inc/search.php';
if ($type == 'pages') {
search($local, $conf['datadir'], 'search_allpages', array('depth' => (int) $this->profiles[$no]['depth'], 'hash' => true), $dir);
} else {
search($local, $conf['mediadir'], 'search_media', array('depth' => (int) $this->profiles[$no]['depth'], 'hash' => true), $dir);
}
// put into synclist
foreach ($local as $item) {
// skip identical files
if ($list[$item['id']]['remote']['hash'] == $item['hash']) {
unset($list[$item['id']]);
continue;
}
$list[$item['id']]['local'] = $item;
unset($list[$item['id']]['local']['id']);
}
unset($local);
ksort($list);
return $list;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:52,代码来源:admin.php
示例19: mediaFN
/**
* returns the full path to the mediafile specified by ID
*
* The filename is URL encoded to protect Unicode chars
*
* @author Andreas Gohr <[email protected]>
*/
function mediaFN($id)
{
global $conf;
$id = cleanID($id);
$id = str_replace(':', '/', $id);
$fn = $conf['mediadir'] . '/' . utf8_encodeFN($id);
return $fn;
}
开发者ID:pijoter,项目名称:dokuwiki,代码行数:15,代码来源:pageutils.php
示例20: _search_index
//.........这里部分代码省略.........
//Search optional namespaces
if (!empty($opts['nss'])) {
$nss = $opts['nss'];
for ($a = 0; $a < count($nss); $a++) {
if (preg_match("/^" . $id . "(\$|:.+)/i", $nss[$a][0], $match)) {
//It contains an optional namespace
$isopen = true;
} elseif (preg_match("/^" . $nss[$a][0] . "(:.*)/i", $id, $match)) {
//It's inside an optional namespace
if ($nss[$a][1] == -1 || substr_count($match[1], ":") < $nss[$a][1]) {
$isopen = true;
} else {
$isopen = false;
}
}
}
}
if ($opts['nons']) {
return $isopen;
} elseif ($opts['max'] > 0 && !$isopen && $lvl >= $opts['max']) {
$isopen = false;
//Stop recursive searching
$return = false;
//change type
$type = "l";
} elseif ($opts['js']) {
$return = true;
} else {
$return = $isopen;
}
//Set title and headpage
$title = $this->_getTitle($id, $headpage, $hns);
if (!$hns && $opts['nopg']) {
$hns = $id . ":" . $conf['start'];
}
} else {
//Nopg.Dont show pages
if ($opts['nopg']) {
return false;
}
$return = true;
//Nons.Set all pages at first level
if ($opts['nons']) {
$lvl = 1;
}
//don't add
if (substr($file, -4) != '.txt') {
return false;
}
//check hiddens and acl
if (isHiddenPage($id) || auth_quickaclcheck($id) < AUTH_READ) {
return false;
}
//Skip files in plugin conf
if (!empty($skip_file) && preg_match($skip_file, $id)) {
return false;
}
//Skip headpages to hide
if (!$opts['nons'] && !empty($headpage) && $opts['hide_headpage']) {
if ($id == $conf['start']) {
return false;
}
$ahp = explode(",", $headpage);
foreach ($ahp as $hp) {
switch ($hp) {
case ":inside:":
if (noNS($id) == noNS(getNS($id))) {
return false;
}
break;
case ":same:":
if (@is_dir(dirname(wikiFN($id)) . "/" . utf8_encodeFN(noNS($id)))) {
return false;
}
break;
//it' s an inside start
//it' s an inside start
case ":start:":
if (noNS($id) == $conf['start']) {
return false;
}
break;
default:
if (noNS($id) == cleanID($hp)) {
return false;
}
}
}
}
//Set title
if (!$conf['useheading'] || !($title = p_get_first_heading($id, FALSE))) {
$title = noNS($id);
}
$title = htmlspecialchars($title, ENT_QUOTES);
}
$item = array('id' => $id, 'type' => $type, 'level' => $lvl, 'open' => $isopen, 'title' => $title, 'hns' => $hns, 'file' => $file, 'return' => $return);
$item['sort'] = $this->_setorder($item);
$data[] = $item;
return $return;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:101,代码来源:indexmenu.php
注:本文中的utf8_encodeFN函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论