本文整理汇总了PHP中noNS函数的典型用法代码示例。如果您正苦于以下问题:PHP noNS函数的具体用法?PHP noNS怎么用?PHP noNS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了noNS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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']);
}
开发者ID:phillip-hopper,项目名称:nspages,代码行数:14,代码来源:namespacePreparer.php
示例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;
}
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:30,代码来源:metadata.php
示例3: ajax_qsearch
/**
* Searches for matching pagenames
*
* @author Andreas Gohr <[email protected]>
*/
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>';
}
开发者ID:jalemanyf,项目名称:wsnlocalizationscala,代码行数:38,代码来源:ajax.php
示例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();
}
}
开发者ID:jasongrout,项目名称:dokuwiki-newpagetemplate,代码行数:25,代码来源:action.php
示例5: buildSortAttribute
private function buildSortAttribute($pageTitle, $pageId)
{
if ($this->sortPageById) {
return noNS($pageId);
} else {
return $pageTitle;
}
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:8,代码来源:pagePreparer.php
示例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();
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:14,代码来源:project.php
示例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;
}
开发者ID:cosmocode,项目名称:dokuwiki-plugin-struct,代码行数:17,代码来源:Title.php
示例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;
}
开发者ID:jacobbates,项目名称:Help-Desk-Wiki-Theme,代码行数:53,代码来源:generate_index.php
示例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;
}
开发者ID:rusidea,项目名称:analitika,代码行数:21,代码来源:filePreparer.php
示例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;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:51,代码来源:settings.php
示例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;
}
}
开发者ID:roverrobot,项目名称:projects,代码行数:50,代码来源:manage_files.php
示例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;
}
}
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:43,代码来源:findtemplate.php
示例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;
}
开发者ID:roverrobot,项目名称:projects,代码行数:21,代码来源:render.php
示例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)));
}
开发者ID:kazmiya,项目名称:dokuwiki-plugin-preservefilenames,代码行数:42,代码来源:action_angua.php
示例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'));
}
开发者ID:neutrinog,项目名称:Door43,代码行数:23,代码来源:mediamove.test.php
示例16: button_rename_use
private function button_rename_use($range)
{
global $ID;
if (auth_quickaclcheck($ID) < AUTH_EDIT) {
return '';
}
$self = noNS($ID);
$project = Project::project();
if ($project == NULL) {
return '';
}
$files = array('');
foreach (array_keys($project->files()) as $file) {
if ($file != $self) {
$files[] = $file;
}
}
$form = new Doku_Form("change_use");
$form->addHidden('do', 'change_use');
$form->addHidden('range', $range);
$form->addElement(form_makeMenuField('use', $files, '', '', '', '', array("onchange" => "submit();")));
return $form->getForm();
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:23,代码来源:use.php
示例17: pageTemplate
/**
* Returns the pagetemplate contents for the ID's namespace
*
* @author Andreas Gohr <[email protected]>
*/
function pageTemplate($data)
{
$id = $data[0];
global $conf;
global $INFO;
$tpl = io_readFile(dirname(wikiFN($id)) . '/_template.txt');
$tpl = str_replace('@ID@', $id, $tpl);
$tpl = str_replace('@NS@', getNS($id), $tpl);
$tpl = str_replace('@PAGE@', strtr(noNS($id), '_', ' '), $tpl);
$tpl = str_replace('@USER@', $_SERVER['REMOTE_USER'], $tpl);
$tpl = str_replace('@NAME@', $INFO['userinfo']['name'], $tpl);
$tpl = str_replace('@MAIL@', $INFO['userinfo']['mail'], $tpl);
$tpl = str_replace('@DATE@', date($conf['dformat']), $tpl);
return $tpl;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:20,代码来源:common.php
示例18: html_search
/**
* Run a search and display the result
*
* @author Andreas Gohr <[email protected]>
*/
function html_search()
{
global $conf;
global $QUERY;
global $ID;
global $lang;
$intro = p_locale_xhtml('searchpage');
// allow use of placeholder in search intro
$intro = str_replace(array('@QUERY@', '@SEARCH@'), array(hsc(rawurlencode($QUERY)), hsc($QUERY)), $intro);
echo $intro;
flush();
//show progressbar
print '<div class="centeralign" id="dw__loading">' . NL;
print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--' . NL;
print 'showLoadBar();' . NL;
print '//--><!]]></script>' . NL;
print '<br /></div>' . NL;
flush();
//do quick pagesearch
$data = array();
$data = ft_pageLookup($QUERY, true, useHeading('navigation'));
if (count($data)) {
print '<div class="search_quickresult">';
print '<h3>' . $lang['quickhits'] . ':</h3>';
print '<ul class="search_quickhits">';
foreach ($data as $id => $title) {
print '<li> ';
if (useHeading('navigation')) {
$name = $title;
} else {
$ns = getNS($id);
if ($ns) {
$name = shorten(noNS($id), ' (' . $ns . ')', 30);
} else {
$name = $id;
}
}
print html_wikilink(':' . $id, $name);
print '</li> ';
}
print '</ul> ';
//clear float (see http://www.complexspiral.com/publications/containing-floats/)
print '<div class="clearer"></div>';
print '</div>';
}
flush();
//do fulltext search
$data = ft_pageSearch($QUERY, $regex);
if (count($data)) {
$num = 1;
foreach ($data as $id => $cnt) {
print '<div class="search_result">';
print html_wikilink(':' . $id, useHeading('navigation') ? null : $id, $regex);
if ($cnt !== 0) {
print ': <span class="search_cnt">' . $cnt . ' ' . $lang['hits'] . '</span><br />';
if ($num < FT_SNIPPET_NUMBER) {
// create snippets for the first number of matches only
print '<div class="search_snippet">' . ft_snippet($id, $regex) . '</div>';
}
$num++;
}
print '</div>';
flush();
}
} else {
print '<div class="nothing">' . $lang['nothingfound'] . '</div>';
}
//hide progressbar
print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--' . NL;
print 'hideLoadBar("dw__loading");' . NL;
print '//--><!]]></script>' . NL;
flush();
}
开发者ID:nefercheprure,项目名称:dokuwiki,代码行数:78,代码来源:html.php
示例19: _audio
/**
* Embed audio in HTML
*
* @author Anika Henke <[email protected]>
*
* @param string $src - ID of audio to embed
* @param array $atts - additional attributes for the <audio> tag
* @return string
*/
function _audio($src, $atts = array())
{
$files = array();
$isExternal = media_isexternal($src);
if ($isExternal) {
// take direct source for external files
list(, $srcMime) = mimetype($src);
$files[$srcMime] = $src;
} else {
// prepare alternative formats
$extensions = array('ogg', 'mp3', 'wav');
$files = media_alternativefiles($src, $extensions);
}
$out = '';
// open audio tag
$out .= '<audio ' . buildAttributes($atts) . ' controls="controls">' . NL;
$fallback = '';
// output source for each alternative audio format
foreach ($files as $mime => $file) {
if ($isExternal) {
$url = $file;
$linkType = 'externalmedia';
} else {
$url = ml($file, '', true, '&');
$linkType = 'internalmedia';
}
$title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file)));
$out .= '<source src="' . hsc($url) . '" type="' . $mime . '" />' . NL;
// alternative content (just a link to the file)
$fallback .= $this->{$linkType}($file, $title, null, null, null, $cache = null, $linking = 'linkonly', $return = true);
}
// finish
$out .= $fallback;
$out .= '</audio>' . NL;
return $out;
}
开发者ID:sawachan,项目名称:dokuwiki,代码行数:45,代码来源:xhtml.php
示例20: getTopic
/**
* Returns a list of pages with a certain tag; very similar to ft_backlinks()
*
* @param string $ns A namespace to which all pages need to belong, "." for only the root namespace
* @param int $num The maximum number of pages that shall be returned
* @param string $tag The tag that shall be searched
* @return array The list of pages
*
* @author Esther Brunner <[email protected]>
*/
function getTopic($ns = '', $num = NULL, $tag = '')
{
if (!$tag) {
$tag = $_REQUEST['tag'];
}
$tag = $this->_parseTagList($tag, true);
$result = array();
// find the pages using topic.idx
$pages = $this->_tagIndexLookup($tag);
if (!count($pages)) {
return $result;
}
foreach ($pages as $page) {
// exclude pages depending on ACL and namespace
if ($this->_notVisible($page, $ns)) {
continue;
}
$tags = $this->_getSubjectMetadata($page);
// don't trust index
if (!$this->_checkPageTags($tags, $tag)) {
continue;
}
// get metadata
$meta = p_get_metadata($page);
$perm = auth_quickaclcheck($page);
// skip drafts unless for users with create privilege
$draft = $meta['type'] == 'draft';
if ($draft && $perm < AUTH_CREATE) {
continue;
}
$title = $meta['title'];
$date = $this->sort == 'mdate' ? $meta['date']['modified'] : $meta['date']['created'];
$taglinks = $this->tagLinks($tags);
// determine the sort key
if ($this->sort == 'id') {
$key = $page;
} elseif ($this->sort == 'ns') {
$pos = strrpos($page, ':');
if ($pos === false) {
$key = "" . $page;
} else {
$key = substr_replace($page, "", $pos, 1);
}
$key = str_replace(':', "", $key);
} elseif ($this->sort == 'pagename') {
$key = noNS($page);
} elseif ($this->sort == 'title') {
$key = utf8_strtolower($title);
if (empty($key)) {
$key = str_replace('_', ' ', noNS($page));
}
} else {
$key = $date;
}
// make sure that the key is unique
$key = $this->_uniqueKey($key, $result);
$result[$key] = array('id' => $page, 'title' => $title, 'date' => $date, 'user' => $meta['creator'], 'desc' => $meta['description']['abstract'], 'cat' => $tags[0], 'tags' => $taglinks, 'perm' => $perm, 'exists' => true, 'draft' => $draft);
if ($num && count($result) >= $num) {
break;
}
}
// finally sort by sort key
if ($this->getConf('sortorder') == 'ascending') {
ksort($result);
} else {
krsort($result);
}
return $result;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:79,代码来源:helper.php
注:本文中的noNS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论