当前位置: 首页>>代码示例>>PHP>>正文


PHP getNS函数代码示例

本文整理汇总了PHP中getNS函数的典型用法代码示例。如果您正苦于以下问题:PHP getNS函数的具体用法?PHP getNS怎么用?PHP getNS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getNS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTree

 /**
  * get a list of namespace / page files
  *
  * @param string $folder an already converted filesystem folder of the current namespace
  */
 function getTree($folder = ':')
 {
     global $conf;
     global $ID;
     // read tree structure from pages and media
     $ofolder = $folder;
     if ($folder == '*' || $folder == '') {
         $folder = ':';
     }
     if ($folder[0] != ':') {
         $folder = resolve_id($folder, $ID);
     }
     $dir = strtr(cleanID($folder), ':', '/');
     if (!($this->cache() && is_array($data = $this->cache()->get('explorertree_cache_' . $dir)))) {
         $data = array();
         search($data, $conf['datadir'], 'search_index', array('ns' => getNS($ID)), $dir, $dir == '' ? 1 : count(explode('/', $dir)) + 1);
         $count = count($data);
         if ($count > 0) {
             for ($i = 1; $i < $count; $i++) {
                 if ($data[$i - 1]['id'] == $data[$i]['id'] && $data[$i - 1]['type'] == $data[$i]['type']) {
                     unset($data[$i]);
                     $i++;
                     // duplicate found, next $i can't be a duplicate, so skip forward one
                 }
             }
         }
         if ($this->cache()) {
             $this->cache()->set($cache_id = 'explorertree_cache_' . $dir, $data, 60);
             // store the data itself (cache for one minute)
         }
     }
     return $data;
 }
开发者ID:Klap-in,项目名称:explorertree,代码行数:38,代码来源:helper.php

示例2: tpl_sidebar_content

function tpl_sidebar_content()
{
    global $ID, $REV, $ACT, $conf;
    // save globals
    $saveID = $ID;
    $saveREV = $REV;
    $saveACT = $ACT;
    // discover file to be displayed in navigation sidebar
    $fileSidebar = '';
    if (tpl_getConf('page')) {
        $fileSidebar = getSidebarFN(getNS($ID), tpl_getConf('page'));
    }
    // determine what to display
    if ($fileSidebar) {
        $ID = $fileSidebar;
        $REV = '';
        $ACT = 'show';
        #    print p_wiki_xhtml($fileSidebar,'',false);
        tpl_content();
    } else {
        #    global $IDX;
        #    html_index($IDX);
        #    $ID = getNS($ID);
        $REV = '';
        $ACT = 'index';
        tpl_content();
    }
    // restore globals
    $ID = $saveID;
    $REV = $saveREV;
    $ACT = $saveACT;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:32,代码来源:tplfn_sidebar.php

示例3: handle

 function handle($match, $state, $pos, &$handler)
 {
     global $ID;
     $match = substr($match, 7, -2);
     // strip {{blog> from start and }} from end
     list($match, $flags) = explode('&', $match, 2);
     $flags = explode('&', $flags);
     $flags[] = 'link';
     // always make the first header of a blog entry a permalink
     list($match, $refine) = explode(' ', $match, 2);
     list($ns, $num) = explode('?', $match, 2);
     if (!is_numeric($num)) {
         if (is_numeric($ns)) {
             $num = $ns;
             $ns = '';
         } else {
             $num = 5;
         }
     }
     if ($ns == '') {
         $ns = cleanID($this->getConf('namespace'));
     } elseif ($ns == '*' || $ns == ':') {
         $ns = '';
     } elseif ($ns == '.') {
         $ns = getNS($ID);
     } else {
         $ns = cleanID($ns);
     }
     return array($ns, $num, $flags, $refine);
 }
开发者ID:kosenconf,项目名称:kcweb,代码行数:30,代码来源:blog.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: 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>';
}
开发者ID:jalemanyf,项目名称:wsnlocalizationscala,代码行数:38,代码来源:ajax.php

示例6: normalize

 function normalize($value, $hint)
 {
     global $ID;
     // fragment reference special case
     if (!empty($hint) && substr($hint, -1) == '#') {
         $value = $hint . $value;
         resolve_pageid(getNS($hint), $value, $exists);
         return $value;
     }
     $base = $hint ?: getNS($ID);
     // check for local link, and prefix full page id
     // (local links don't get resolved by resolve_pageid)
     if (preg_match('/^#.+/', $value)) {
         $value = $ID . $value;
     }
     // resolve page id with respect to selected base
     resolve_pageid($base, $value, $exists);
     // if the value is empty after resolving, it is a reference to the
     // root starting page. (We can not put the emtpy string into the
     // database as a normalized reference -- this will create problems)
     if ($value == '') {
         global $conf;
         $value = $conf['start'];
     }
     return $value;
 }
开发者ID:virk,项目名称:dokuwiki-strata,代码行数:26,代码来源:page.php

示例7: tpl_sidebar

function tpl_sidebar($user_defined_page_name = "")
{
    global $ID, $REV, $conf;
    // save globals
    $saveID = $ID;
    $saveREV = $REV;
    // discover file to be displayed in navigation sidebar
    $fileSidebar = '';
    // damien
    $pagename = "";
    if ($user_defined_page_name != "") {
        $pagename = $user_defined_page_name;
    } else {
        if (isset($conf['sidebar']['page'])) {
            $pagename = $conf['sidebar']['page'];
        }
    }
    if ($pagename != "") {
        $fileSidebar = getSidebarFN(getNS($ID), $pagename);
    }
    // determine what to display
    if ($fileSidebar) {
        $ID = $fileSidebar;
        $REV = '';
        print p_wiki_xhtml($ID, $REV, false);
    } else {
        global $IDX;
        html_index($IDX);
    }
    // restore globals
    $ID = $saveID;
    $REV = $saveREV;
}
开发者ID:postgresqlfr,项目名称:pgfr_materials,代码行数:33,代码来源:tplfn_sidebar.php

示例8: handle

 /**
  * Handle the match
  */
 function handle($match, $state, $pos, &$handler)
 {
     global $ID;
     $match = substr($match, 9, -11);
     // strip markup
     list($flags, $match) = explode('>', $match, 2);
     $flags = explode('&', substr($flags, 1));
     $items = explode('*', $match);
     $pages = array();
     $c = count($items);
     for ($i = 0; $i < $c; $i++) {
         if (!preg_match('/\\[\\[(.+?)\\]\\]/', $items[$i], $match)) {
             continue;
         }
         list($id, $title, $description) = explode('|', $match[1], 3);
         list($id, $section) = explode('#', $id, 2);
         if (!$id) {
             $id = $ID;
         }
         resolve_pageid(getNS($ID), $id, $exists);
         // page has an image title
         if ($title && preg_match('/\\{\\{(.+?)\\}\\}/', $title, $match)) {
             list($image, $title) = explode('|', $match[1], 2);
             list($ext, $mime) = mimetype($image);
             if (!substr($mime, 0, 5) == 'image') {
                 $image = '';
             }
             $pages[] = array('id' => $id, 'section' => cleanID($section), 'title' => trim($title), 'image' => trim($image), 'description' => trim($description), 'exists' => $exists);
             // text title (if any)
         } else {
             $pages[] = array('id' => $id, 'section' => cleanID($section), 'title' => trim($title), 'description' => trim($description), 'exists' => $exists);
         }
     }
     return array($flags, $pages);
 }
开发者ID:kosenconf,项目名称:kcweb,代码行数:38,代码来源:syntax.php

示例9: handle

 function handle($match, $state, $pos, &$handler)
 {
     global $ID;
     $options['overwrite'] = TRUE;
     $options['renameable'] = TRUE;
     $ns = getNS($ID);
     return array('uploadns' => hsc($ns), 'para' => $options);
 }
开发者ID:Jocai,项目名称:Door43,代码行数:8,代码来源:syntax.php

示例10: render

 /**
  * Create output
  */
 function render($mode, &$renderer, $data)
 {
     global $ID;
     global $conf;
     $ns = $data[0];
     if ($ns == '') {
         $ns = cleanID($this->getConf('namespace'));
     } elseif ($ns == '*') {
         $ns = '';
     } elseif ($ns == '.') {
         $ns = getNS($ID);
     }
     $pages = $this->_monthArchive($ns, $data[1], $data[2]);
     if (!count($pages)) {
         return true;
     }
     // nothing to display
     if ($mode == 'xhtml') {
         // prevent caching to ensure content is always fresh
         $renderer->info['cache'] = false;
         $renderer->doc .= '<table class="archive">';
         foreach ($pages as $page) {
             $renderer->doc .= '<tr><td class="page">';
             // page title
             $id = $page['id'];
             $title = $page['title'];
             if (!$title) {
                 $title = str_replace('_', ' ', noNS($id));
             }
             $renderer->doc .= $renderer->internallink(':' . $id, $title) . '</td>';
             // author
             if ($this->getConf('archive_showuser')) {
                 if ($page['user']) {
                     $renderer->doc .= '<td class="user">' . $page['user'] . '</td>';
                 } else {
                     $renderer->doc .= '<td class="user">&nbsp;</td>';
                 }
             }
             // creation date
             if ($this->getConf('archive_showdate')) {
                 $renderer->doc .= '<td class="date">' . date($conf['dformat'], $page['date']) . '</td>';
             }
             $renderer->doc .= '</tr>';
         }
         $renderer->doc .= '</table>';
         return true;
         // for metadata renderer
     } elseif ($mode == 'metadata') {
         foreach ($pages as $page) {
             $id = $page['id'];
             $renderer->meta['relation']['references'][$id] = true;
         }
         return true;
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:openaqua-svn,代码行数:59,代码来源:archive.php

示例11: analyze

 /** 
  * The files used in this file
  */
 public function analyze($file)
 {
     $content = $this->remove_comments($file->content());
     $ns = getNS($id);
     $inputs = $this->find_command($ns, 'input', $content);
     $includes = $this->find_command($ns, 'include', $content);
     $graphs = $this->find_command($ns, 'includegraphics', $content, ".pdf");
     $bibs = $this->find_command($ns, 'bibliography', $content, ".bib");
     return array_merge($inputs, $includes, $graphs, $bibs);
 }
开发者ID:roverrobot,项目名称:projects,代码行数:13,代码来源:latex.php

示例12: handle

 /**
  * Handle the match
  */
 function handle($match, $state, $pos, &$handler)
 {
     global $ID;
     $match = substr($match, 9, -2);
     //strip {{pglist> from start and }} from end
     $conf = array('ns' => getNS($ID), 'depth' => 1, 'dirs' => 0, 'files' => 0, 'me' => 0, 'sibling' => 0, 'nostart' => 0, 'any' => 0, 'date' => 0, 'fsort' => 0, 'dsort' => 0);
     list($ns, $params) = explode(' ', $match, 2);
     if ($ns) {
         if ($ns === '*') {
             $conf['ns'] = cleanID($ID);
         } else {
             if ($ns[0] === '/') {
                 $conf['ns'] = cleanID($ns);
             } else {
                 $conf['ns'] = cleanID('/' . getNS($ID) . '/' . $ns);
             }
         }
     }
     if (preg_match('/\\bdirs\\b/i', $params)) {
         $conf['dirs'] = 1;
     }
     if (preg_match('/\\bfiles\\b/i', $params)) {
         $conf['files'] = 1;
     }
     if (preg_match('/\\bme\\b/i', $params)) {
         $conf['me'] = 1;
     }
     if (preg_match('/\\bsibling\\b/i', $params)) {
         $conf['sibling'] = 1;
     }
     if (preg_match('/\\bsame\\b/i', $params)) {
         $conf['same'] = 1;
     }
     if (preg_match('/\\bany\\b/i', $params)) {
         $conf['any'] = 1;
     }
     if (preg_match('/\\bnostart\\b/i', $params)) {
         $conf['nostart'] = 1;
     }
     if (preg_match('/\\bdate\\b/i', $params)) {
         $conf['date'] = 1;
     }
     if (preg_match('/\\bfsort\\b/i', $params)) {
         $conf['fsort'] = 1;
     }
     if (preg_match('/\\bdsort\\b/i', $params)) {
         $conf['dsort'] = 1;
     }
     if (preg_match('/\\b(\\d+)\\b/i', $params, $m)) {
         $conf['depth'] = $m[1];
     }
     $conf['dir'] = str_replace(':', '/', $conf['ns']);
     // prepare data
     return $conf;
 }
开发者ID:TorMec,项目名称:pglist,代码行数:58,代码来源:syntax.php

示例13: orph_Check_InternalLinks

 /**
  * Search for internal wiki links in page $file
  */
 function orph_Check_InternalLinks(&$data, $base, $file, $type, $lvl, $opts)
 {
     global $conf;
     define('LINK_PATTERN', '%\\[\\[([^\\]|#]*)(#[^\\]|]*)?\\|?([^\\]]*)]]%');
     if (!preg_match("/.*\\.txt\$/", $file)) {
         return;
     }
     $currentID = pathID($file);
     $currentNS = getNS($currentID);
     if ($conf['allowdebug']) {
         echo sprintf("<p><b>%s</b>: %s</p>\n", $file, $currentID);
     }
     // echo "  <!-- checking file: $file -->\n";
     $body = @file_get_contents($conf['datadir'] . $file);
     // ignores entries in <nowiki>, %%, <code> and emails with @
     foreach (array('/<nowiki>.*?<\\/nowiki>/', '/%%.*?%%/', '@<code[^>]*?>.*?<\\/code>@siu', '@<file[^>]*?>.*?<\\/file>@siu') as $ignored) {
         $body = preg_replace($ignored, '', $body);
     }
     $links = array();
     preg_match_all(LINK_PATTERN, $body, $links);
     foreach ($links[1] as $link) {
         if ($conf['allowdebug']) {
             echo sprintf("--- Checking %s<br />\n", $link);
         }
         if (0 < strlen(ltrim($link)) and !preg_match('/^[a-zA-Z0-9\\.]+>{1}.*$/u', $link) and !preg_match('/^\\\\\\\\[\\w.:?\\-;,]+?\\\\/u', $link) and !preg_match('#^([a-z0-9\\-\\.+]+?)://#i', $link) and !preg_match('<' . PREG_PATTERN_VALID_EMAIL . '>', $link) and !preg_match('!^#.+!', $link)) {
             $pageExists = false;
             resolve_pageid($currentNS, $link, $pageExists);
             if ($conf['allowdebug']) {
                 echo sprintf("---- link='%s' %s ", $link, $pageExists ? 'EXISTS' : 'MISS');
             }
             if (strlen(ltrim($link)) > 0 and !auth_quickaclcheck($link) < AUTH_READ) {
                 // should be visible to user
                 //echo "      <!-- adding $link -->\n";
                 if ($conf['allowdebug']) {
                     echo ' A_LINK';
                 }
                 $link = utf8_strtolower($link);
                 $this->orph_handle_link($data, $link);
             } else {
                 if ($conf['allowdebug']) {
                     echo ' EMPTY_OR_FORBIDDEN';
                 }
             }
         } else {
             if ($conf['allowdebug']) {
                 echo ' NOT_INTERNAL';
             }
         }
         if ($conf['allowdebug']) {
             echo "<br />\n";
         }
     }
     // end of foreach link
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:57,代码来源:helper.php

示例14: handle

 function handle($match, $state, $pos, &$handler)
 {
     global $ID;
     $match = substr($match, 10, -2);
     // strip {{archive> from start and }} from end
     list($match, $flags) = explode('&', $match, 2);
     $flags = explode('&', $flags);
     list($match, $refine) = explode(' ', $match, 2);
     list($ns, $rest) = explode('?', $match, 2);
     if (!$rest) {
         $rest = $ns;
         $ns = '';
     }
     if ($ns == '') {
         $ns = cleanID($this->getConf('namespace'));
     } elseif ($ns == '*' || $ns == ':') {
         $ns = '';
     } elseif ($ns == '.') {
         $ns = getNS($ID);
     } else {
         $ns = cleanID($ns);
     }
     // daily archive
     if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $rest)) {
         list($year, $month, $day) = explode('-', $rest, 3);
         $start = mktime(0, 0, 0, $month, $day, $year);
         $end = $start + 24 * 60 * 60;
         // monthly archive
     } elseif (preg_match("/\\d{4}-\\d{2}/", $rest)) {
         list($year, $month) = explode('-', $rest, 2);
         // calculate start and end times
         $nextmonth = $month + 1;
         $year2 = $year;
         if ($nextmonth > 12) {
             $nextmonth = 1;
             $year2 = $year + 1;
         }
         $start = mktime(0, 0, 0, $month, 1, $year);
         $end = mktime(0, 0, 0, $nextmonth, 1, $year2);
         // a whole year
     } elseif (preg_match("/\\d{4}/", $rest)) {
         $start = mktime(0, 0, 0, 1, 1, $rest);
         $end = mktime(0, 0, 0, 1, 1, $rest + 1);
         // all entries from that namespace up to now
     } elseif ($rest == '*') {
         $start = 0;
         $end = time();
         // unknown format
     } else {
         return false;
     }
     return array($ns, $start, $end, $flags, $refine);
 }
开发者ID:kosenconf,项目名称:kcweb,代码行数:53,代码来源:archive.php

示例15: handle

 /**
  * Handler to prepare matched data for the rendering process
  *
  * @param   string       $match   The text matched by the patterns
  * @param   int          $state   The lexer state for the match
  * @param   int          $pos     The character position of the matched text
  * @param   Doku_Handler $handler The Doku_Handler object
  * @return  bool|array Return an array with all data you want to use in render, false don't add an instruction
  */
 public function handle($match, $state, $pos, Doku_Handler $handler)
 {
     global $ID;
     $ns = substr($match, 8, strpos($match, '|') - 8);
     $id = $ns . ':start';
     resolve_pageid(getNS($ID), $id, $exists);
     $ns = getNS($id);
     $title = substr($match, strpos($match, '|') + 1, -2);
     $link = '?do=export_pdfns&book_ns=' . $ns . '&book_title=' . $title;
     $title = substr($title, 0, strpos($title, '&'));
     return array('link' => $link, 'title' => sprintf($this->getLang('export_ns'), $ns, $title), $state, $pos);
 }
开发者ID:phillip-hopper,项目名称:dokuwiki-plugin-dw2pdf,代码行数:21,代码来源:exportlink.php


注:本文中的getNS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。