本文整理汇总了PHP中noNS函数的典型用法代码示例。如果您正苦于以下问题:PHP noNS函数的具体用法?PHP noNS怎么用?PHP noNS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了noNS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareFile
/**
* When we display a namespace, we want to:
* - link to it's main page (if such a page exists)
* - get the id of this main page (if the option is active)
*
* @param $ns A structure which represents a namespace
*/
function prepareFile(&$ns)
{
$idMainPage = $this->getMainPageId($ns);
$ns['title'] = $this->buildTitle($idMainPage, noNS($ns['id']));
$ns['id'] = $this->buildIdToLinkTo($idMainPage, $ns['id']);
$ns['sort'] = $this->buildSortAttribute($ns['title'], $ns['id'], $ns['mtime']);
}
示例2: saved
function saved(&$event, $param)
{
global $ID;
global $PROJECTS_REMAKE;
if (auth_quickaclcheck($ID) <= AUTH_READ) {
return;
}
$project = Project::project();
if ($project == NULL) {
return;
}
$file = $event->data['current']['ProjectFile'];
$name = noNS($ID);
if ($file == NULL) {
// check whether the file is deleted
if ($project->file($name) == NULL) {
return;
}
// it was int he project
if (!$project->remove_file($name)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
return;
}
if (!$project->update_file($file)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
}
示例3: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_qsearch()
{
global $conf;
global $lang;
$query = cleanID($_POST['q']);
if (empty($query)) {
$query = cleanID($_GET['q']);
}
if (empty($query)) {
return;
}
require_once DOKU_INC . 'inc/html.php';
require_once DOKU_INC . 'inc/fulltext.php';
$data = array();
$data = ft_pageLookup($query);
if (!count($data)) {
return;
}
print '<strong>' . $lang['quickhits'] . '</strong>';
print '<ul>';
foreach ($data as $id) {
print '<li>';
$ns = getNS($id);
if ($ns) {
$name = shorten(noNS($id), ' (' . $ns . ')', 30);
} else {
$name = $id;
}
print html_wikilink(':' . $id, $name);
print '</li>';
}
print '</ul>';
}
示例4: pagefromtemplate
function pagefromtemplate(&$event, $param)
{
if (strlen(trim($_REQUEST['newpagetemplate'])) > 0) {
global $conf;
global $INFO;
global $ID;
$tpl = io_readFile(wikiFN($_REQUEST['newpagetemplate']));
if ($this->getConf('userreplace')) {
$stringvars = array_map(create_function('$v', 'return explode(",",$v,2);'), explode(';', $_REQUEST['newpagevars']));
foreach ($stringvars as $value) {
$tpl = str_replace(trim($value[0]), trim($value[1]), $tpl);
}
}
if ($this->getConf('standardreplace')) {
// replace placeholders
$file = noNS($ID);
$page = strtr($file, '_', ' ');
$tpl = str_replace(array('@ID@', '@NS@', '@FILE@', '@!FILE@', '@!FILE!@', '@PAGE@', '@!PAGE@', '@!!PAGE@', '@!PAGE!@', '@USER@', '@NAME@', '@MAIL@', '@DATE@'), array($ID, getNS($ID), $file, utf8_ucfirst($file), utf8_strtoupper($file), $page, utf8_ucfirst($page), utf8_ucwords($page), utf8_strtoupper($page), $_SERVER['REMOTE_USER'], $INFO['userinfo']['name'], $INFO['userinfo']['mail'], $conf['dformat']), $tpl);
// we need the callback to work around strftime's char limit
$tpl = preg_replace_callback('/%./', create_function('$m', 'return strftime($m[0]);'), $tpl);
}
$event->result = $tpl;
$event->preventDefault();
}
}
示例5: buildSortAttribute
private function buildSortAttribute($pageTitle, $pageId)
{
if ($this->sortPageById) {
return noNS($pageId);
} else {
return $pageTitle;
}
}
示例6: __construct
/**
* The constructor, this creates a new project.
* Taking an array that specifies the path a project.
* This array is created from the wiki namespace path
*/
public function __construct($ID)
{
$this->ID = $ID;
$this->project_path = DOKU_DATA . implode('/', explode(":", $ID)) . '/';
$this->project_file = $this->project_path . noNS($this->ID) . '.project';
$this->mutex = new Mutex($this->project_file);
$this->version_string = PROJECTS_VERSION;
$this->create();
}
示例7: setTitle
/**
* Sets a new title in the database;
*
* @param string|null $title set null to derive from PID
*/
public function setTitle($title)
{
if ($title === null) {
$title = noNS($this->pid);
}
// only one of these will succeed
$sql = "UPDATE OR IGNORE titles SET title = ? WHERE pid = ?";
$this->sqlite->query($sql, array($title, $this->pid));
$sql = "INSERT OR IGNORE INTO titles (title, pid) VALUES (?,?)";
$this->sqlite->query($sql, array($title, $this->pid));
$this->title = $title;
}
示例8: indexmenu_search_index
function indexmenu_search_index(&$data, $base, $file, $type, $lvl, $opts)
{
global $conf;
$ret = true;
$item = array();
if ($type == 'f' && !preg_match('#\\.txt$#', $file)) {
// don't add
return false;
}
// get page id by filename
$id = pathID($file);
// check hiddens
if ($type == 'f' && isHiddenPage($id)) {
return false;
}
// bugfix for the
// /ns/
// /<ns>.txt
// case, need to force the 'directory' type
if ($type == 'f' && file_exists(dirname(wikiFN($id . ":" . noNS($id))))) {
$type = 'd';
}
// page target id = global id
$target = $id;
if ($type == 'd') {
// this will check 3 kinds of headpage:
// 1. /<ns>/<ns>.txt
// 2. /<ns>/
// /<ns>.txt
// 3. /<ns>/
// /<ns>/<start_page>
$nsa = array($id . ":" . noNS($id), $id, $id . ":" . $conf['start']);
$nspage = false;
foreach ($nsa as $nsp) {
if (@file_exists(wikiFN($nsp)) && auth_quickaclcheck($nsp) >= AUTH_READ) {
$nspage = $nsp;
break;
}
}
//headpage exists
if ($nspage) {
$target = $nspage;
} else {
// open namespace index, if headpage does not exists
$target = $target . ':';
}
}
$data[] = array('id' => $id, 'date' => @filectime(wikiFN($target)), 'type' => $type, 'target' => $target, 'title' => $conf['useheading'] && ($title = p_get_first_heading($target)) ? $title : $id, 'level' => $lvl);
if (substr_count($id, ":") > 2) {
$ret = 0;
}
return $ret;
}
示例9: isFileWanted
/**
* Check if the user wants a file to be displayed.
* Filters consider the "id" and not the "title". Therefore, the treatment is the same for files and for subnamespace.
* Moreover, filters remain valid even if the title of a page is changed.
*
* @param Array $excludedFiles A list of files that shouldn't be displayed
* @param string $file
* @return bool
*/
function isFileWanted($file) {
$wanted = true;
$noNSId = noNS($file['id']);
$wanted &= (!in_array($noNSId, $this->excludedFiles));
foreach($this->pregOn as $preg) {
$wanted &= preg_match($preg, $noNSId);
}
foreach($this->pregOff as $preg) {
$wanted &= !preg_match($preg, $noNSId);
}
return $wanted;
}
示例10: settings_plugin_siteexport_settings
function settings_plugin_siteexport_settings($functions)
{
global $ID;
$functions->debug->setDebugLevel($this->getConf('debugLevel'));
$functions->debug->setDebugFile($this->getConf('debugFile'));
if (empty($_REQUEST['pattern'])) {
$params = $_REQUEST;
$this->pattern = $functions->requestParametersToCacheHash($params);
} else {
// Set the pattern
$this->pattern = $_REQUEST['pattern'];
}
$this->isCLI = !$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name();
$this->cachetime = $this->getConf('cachetime');
if (!empty($_REQUEST['disableCache'])) {
$this->cachetime = intval($_REQUEST['disableCache']) == 1 ? 0 : $this->cachetime;
}
// Load Variables
$this->origZipFile = $this->getConf('zipfilename');
$this->ignoreNon200 = $this->getConf('ignoreNon200');
// ID
$this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
// $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
$this->zipFile = mediaFN($this->downloadZipFile);
$this->tmpDir = mediaFN(getNS($this->origZipFile));
$this->exportLinkedPages = intval($_REQUEST['exportLinkedPages']) == 1 ? true : false;
$this->namespace = $functions->getNamespaceFromID($_REQUEST['ns'], $PAGE);
$this->addParams = !empty($_REQUEST['addParams']);
$this->useTOCFile = !empty($_REQUEST['useTocFile']);
// set export Namespace - which is a virtual Root
$pg = noNS($ID);
if (empty($this->namespace)) {
$this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg);
}
$this->exportNamespace = !empty($_REQUEST['ens']) && preg_match("%^" . $functions->getNamespaceFromID($_REQUEST['ens'], $pg) . "%", $this->namespace) ? $functions->getNamespaceFromID($_REQUEST['ens'], $pg) : $this->namespace;
$this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
// Strip params that should be forwarded
$this->additionalParameters = $_REQUEST;
$functions->removeWikiVariables($this->additionalParameters, true);
$tmpID = $ID;
$ID = $this->origZipFile;
$INFO = pageinfo();
if (!$this->isCLI) {
// Workaround for the cron which cannot authenticate but has access to everything.
if ($INFO['perm'] < AUTH_DELETE) {
list($USER, $PASS) = $functions->basic_authentication();
auth_login($USER, $PASS);
}
}
$ID = $tmpID;
}
示例11: xhtml
public function xhtml()
{
global $ID;
$ns = getNS($ID);
list($files, $subprojects) = Projects_file::project_files($ns);
$generated = array();
$source = array();
foreach ($files as $id => $file) {
if ($file->type() == 'source') {
$source[$id] = $file;
} elseif ($file->type() == 'generated') {
$generated[$id] = $file;
}
}
ksort($generated);
ksort($source);
sort($subprojects);
echo '<h1>Source files</h1>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li>' . create_button('source') . '</li>' . DOKU_LF;
foreach ($source as $id => $file) {
echo '<li>' . html_wikilink($id) . ': ' . download_button($id) . ', ' . delete_button($id) . '</li>' . DOKU_LF;
}
echo '</ul>' . DOKU_LF;
echo '<h1>Generated files</h1>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li>' . create_button('generated') . '</li>' . DOKU_LF;
foreach ($generated as $id => $file) {
$make = make_button($id, $file->status() == PROJECTS_MADE);
echo '<li>' . html_wikilink($id) . ': ' . download_button($id) . ', ' . delete_button($id) . ', ' . $make . '</li>' . DOKU_LF;
}
echo '</ul>' . DOKU_LF;
echo '<h1>Subprojects</h1>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li>' . create_button($ID, 'project') . '</li>' . DOKU_LF;
foreach ($subprojects as $sub) {
echo '<li><a href="' . wl($sub . ':', array('do' => 'manage_files')) . '">' . noNS($sub) . '</a></li>' . DOKU_LF;
}
echo '</ul>' . DOKU_LF;
if ($ns) {
$name = getNS($ns);
$id = $name . ':';
if (!$name) {
$id = '/';
$name = '/ (root)';
}
echo '<h1>Parent projects</h1>' . DOKU_LF;
echo '<ul><li><a href="' . wl($id, array('do' => 'manage_files')) . '">' . $name . '</a></li></ul>' . DOKU_LF;
}
}
示例12: handle_common_pagetpl_load
public function handle_common_pagetpl_load(Doku_Event &$event, $param)
{
global $conf;
if (empty($event->data['tplfile'])) {
$path = dirname(wikiFN($event->data['id']));
$len = strlen(rtrim($conf['datadir'], '/'));
$dir = substr($path, strrpos($path, '/') + 1);
$blnFirst = true;
$blnFirstDir = true;
while (strLen($path) >= $len) {
if ($blnFirst == true && @file_exists($path . '/_' . noNS($event->data['id']) . '.txt')) {
$event->data['tplfile'] = $path . '/_' . noNS($event->data['id'] . '.txt');
break;
} elseif (@file_exists($path . '/__' . noNS($event->data['id']) . '.txt')) {
$event->data['tplfile'] = $path . '/__' . noNS($event->data['id'] . '.txt');
break;
} elseif ($blnFirst == true && @file_exists($path . '/_template.txt')) {
$event->data['tplfile'] = $path . '/_template.txt';
break;
} elseif ($blnFirst == false && $blnFirstDir == true && @file_exists($path . '/~_' . $dir . '.txt') && noNS($event->data['id']) == 'start') {
$event->data['tplfile'] = $path . '/~_' . $dir . '.txt';
break;
} elseif ($blnFirst == false && $blnFirstDir == true && @file_exists($path . '/~' . $dir . '.txt')) {
$event->data['tplfile'] = $path . '/~' . $dir . '.txt';
break;
} elseif ($blnFirst == false && @file_exists($path . '/~~_' . $dir . '.txt') && noNS($event->data['id']) == 'start') {
$event->data['tplfile'] = $path . '/~~_' . $dir . '.txt';
break;
} elseif ($blnFirst == false && @file_exists($path . '/~~' . $dir . '.txt')) {
$event->data['tplfile'] = $path . '/~~' . $dir . '.txt';
break;
} elseif (@file_exists($path . '/__template.txt')) {
$event->data['tplfile'] = $path . '/__template.txt';
break;
}
$path = substr($path, 0, strrpos($path, '/'));
if ($blnFirst == false) {
$blnFirstDir = false;
}
$blnFirst = false;
}
}
}
示例13: show
private function show()
{
global $REV;
global $ID;
$path = wikiFN($ID);
if (file_exists($path) || $REV) {
return FALSE;
}
ob_start();
echo '<h1>Page "' . noNS($ID) . '" Does Not Exist</h1>' . DOKU_LF;
echo '<ul><li>Create a:</li>' . DOKU_LF;
echo '<ul>' . DOKU_LF;
echo '<li><a href="' . wl($ID, array('do' => 'create', 'type' => 'source')) . '">' . 'source file</a></li>' . DOKU_LF;
echo '<li><a href="' . wl($ID, array('do' => 'create', 'type' => 'generated')) . '">' . 'generated file</a></li>' . DOKU_LF;
echo '<li><a href="' . wl($ID, array('do' => 'edit')) . '">' . 'plain wiki page</a></li>' . DOKU_LF;
echo '</ul>' . DOKU_LF;
echo '<li>Manage <a href="' . wl($ID, array('do' => 'manage_files')) . '">other files</a></li>' . DOKU_LF;
echo '</ul>' . DOKU_LF;
trigger_event('TPL_CONTENT_DISPLAY', $html_output, 'ptln');
return TRUE;
}
示例14: _saveMeta
/**
* Saves the name of the uploaded media file to a meta file
*/
function _saveMeta(&$event)
{
global $conf;
$id = $event->data[2];
$filename_tidy = noNS($id);
// retrieve original filename
if (isset($_GET['qqfile'])) {
// via ajax uploader
$filename_orig = (string) $_GET['qqfile'];
} elseif (isset($_POST['mediaid'])) {
if (isset($_FILES['qqfile']['name'])) {
// via ajax uploader
$filename_orig = (string) $_FILES['qqfile']['name'];
} elseif (isset($_FILES['upload']['name'])) {
// via old-fashioned upload form
$filename_orig = (string) $_FILES['upload']['name'];
} else {
return;
}
// check if filename is specified
$specified_name = (string) $_POST['mediaid'];
if ($specified_name !== '') {
$filename_orig = $specified_name;
}
} else {
return;
}
$filename_safe = $this->common->_sanitizeFileName($filename_orig);
// no need to save original filename
if ($filename_tidy === $filename_safe) {
return;
}
// fallback if suspicious characters found
if ($filename_orig !== $filename_safe) {
return;
}
// save original filename to meta file
io_saveFile(mediaMetaFN($id, '.filename'), serialize(array('filename' => $filename_safe)));
}
示例15: test_movePageWithRelativeMedia
public function test_movePageWithRelativeMedia() {
global $ID;
$ID = 'mediareltest:foo';
saveWikiText($ID,
'{{ myimage.png}} [[:start|{{ testimage.png?200x800 }}]] [[bar|{{testimage.gif?400x200}}]]
[[doku>wiki:dokuwiki|{{wiki:logo.png}}]] [[http://www.example.com|{{testimage.jpg}}]]
[[doku>wiki:foo|{{foo.gif?200x3000}}]]', 'Test setup');
idx_addPage($ID);
$opts = array();
$opts['ns'] = getNS($ID);
$opts['name'] = noNS($ID);
$opts['newns'] = '';
$opts['newname'] = 'foo';
/** @var helper_plugin_move $move */
$move = plugin_load('helper', 'move');
$this->assertTrue($move->move_page($opts));
$this->assertEquals('{{ mediareltest:myimage.png}} [[:start|{{ mediareltest:testimage.png?200x800 }}]] [[mediareltest:bar|{{mediareltest:testimage.gif?400x200}}]]
[[doku>wiki:dokuwiki|{{wiki:logo.png}}]] [[http://www.example.com|{{mediareltest:testimage.jpg}}]]
[[doku>wiki:foo|{{mediareltest:foo.gif?200x3000}}]]', rawWiki('foo'));
}