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


PHP isHiddenPage函数代码示例

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


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

示例1: 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

示例2: generate

 /**
  * Builds a Google Sitemap of all public pages known to the indexer
  *
  * The map is placed in the cache directory named sitemap.xml.gz - This
  * file needs to be writable!
  *
  * @author Michael Hamann
  * @author Andreas Gohr
  * @link   https://www.google.com/webmasters/sitemaps/docs/en/about.html
  * @link   http://www.sitemaps.org/
  */
 public function generate()
 {
     global $conf;
     if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) {
         return false;
     }
     $sitemap = Sitemapper::getFilePath();
     if (@file_exists($sitemap)) {
         if (!is_writable($sitemap)) {
             return false;
         }
     } else {
         if (!is_writable(dirname($sitemap))) {
             return false;
         }
     }
     if (@filesize($sitemap) && @filemtime($sitemap) > time() - $conf['sitemap'] * 86400) {
         // 60*60*24=86400
         dbglog('Sitemapper::generate(): Sitemap up to date');
         // FIXME: only in debug mode
         return false;
     }
     dbglog("Sitemapper::generate(): using {$sitemap}");
     // FIXME: Only in debug mode
     $pages = idx_getIndex('page', '');
     dbglog('Sitemapper::generate(): creating sitemap using ' . count($pages) . ' pages');
     $items = array();
     // build the sitemap items
     foreach ($pages as $id) {
         //skip hidden, non existing and restricted files
         if (isHiddenPage($id)) {
             continue;
         }
         if (auth_aclcheck($id, '', '') < AUTH_READ) {
             continue;
         }
         $item = SitemapItem::createFromID($id);
         if ($item !== NULL) {
             $items[] = $item;
         }
     }
     $eventData = array('items' => &$items, 'sitemap' => &$sitemap);
     $event = new Doku_Event('SITEMAP_GENERATE', $eventData);
     if ($event->advise_before(true)) {
         //save the new sitemap
         $result = io_saveFile($sitemap, Sitemapper::getXML($items));
     }
     $event->advise_after();
     return $result;
 }
开发者ID:ryankask,项目名称:dokuwiki,代码行数:61,代码来源:Sitemapper.php

示例3: handle_wikipage_write

 /**
  * called when(after) writing a new page to disk.
  * publishing is triggered from here.
  * see http://www.dokuwiki.org/devel:events_list#io_wikipage_write
  */
 function handle_wikipage_write(&$event, $param)
 {
     global $ID;
     if (!$this->getConf('enable publishing')) {
         return;
     }
     // if an old revision is safed -> run away
     if ($event->data[3]) {
         return true;
     }
     $ns = $event->data[1];
     $name = $event->data[2];
     #$path=$event->data[0][0];
     if (empty($event->data[0][1])) {
         //page has been deleted
     }
     if ($ID != $ns . (!empty($ns) ? ':' : '') . $name) {
         msg('rpcpub: not publishing wiki-page other than current page ID="' . $ID . '" <> file="' . $ns . ':' . $name . '"');
         $this->_debug('rpcpub: not publishing wiki-page other than current page ID="' . $ID . '" <> file="' . $ns . ':' . $name . '"');
         # Note: this prevents publish loops, the XML-RPC does not set $ID.
         return true;
     }
     # check if anonymous users can READ this before publishing.
     #if(auth_quickaclcheck($ID) < AUTH_EDIT || auth_aclcheck($ID, '', array()) < AUTH_READ){
     #    return true;
     #}
     if (isHiddenPage($ID)) {
         return true;
     }
     $meta = p_get_metadata($ID);
     # skip '~~DRAFT~~' - requires the blog plugin.
     if ($meta['type'] == 'draft') {
         return true;
     }
     # TODO: check for other meta-data, namespace-blacklist, etc.
     # TODO: prevent publish loops.
     $this->_wikiRpcPublish($ID);
     return true;
 }
开发者ID:x42,项目名称:dokurpcpub,代码行数:44,代码来源:action.php

示例4: _handleRecentComment

 /**
  * Internal function used by $this->getComments()
  *
  * don't call directly
  *
  * @see getRecentComments()
  * @author Andreas Gohr <andi@splitbrain.org>
  * @author Ben Coburn <btcoburn@silicodon.net>
  * @author Esther Brunner <wikidesign@gmail.com>
  *
  * @param string $line
  * @param string $ns
  * @param array  $seen
  * @return array|bool
  */
 function _handleRecentComment($line, $ns, &$seen)
 {
     if (empty($line)) {
         return false;
     }
     //skip empty lines
     // split the line into parts
     $recent = parseChangelogLine($line);
     if ($recent === false) {
         return false;
     }
     $cid = $recent['extra'];
     $fullcid = $recent['id'] . '#' . $recent['extra'];
     // skip seen ones
     if (isset($seen[$fullcid])) {
         return false;
     }
     // skip 'show comment' log entries
     if ($recent['type'] === 'sc') {
         return false;
     }
     // remember in seen to skip additional sights
     $seen[$fullcid] = 1;
     // check if it's a hidden page or comment
     if (isHiddenPage($recent['id'])) {
         return false;
     }
     if ($recent['type'] === 'hc') {
         return false;
     }
     // filter namespace or id
     if ($ns && strpos($recent['id'] . ':', $ns . ':') !== 0) {
         return false;
     }
     // check ACL
     $recent['perm'] = auth_quickaclcheck($recent['id']);
     if ($recent['perm'] < AUTH_READ) {
         return false;
     }
     // check existance
     $recent['file'] = wikiFN($recent['id']);
     $recent['exists'] = @file_exists($recent['file']);
     if (!$recent['exists']) {
         return false;
     }
     if ($recent['type'] === 'dc') {
         return false;
     }
     // get discussion meta file name
     $data = unserialize(io_readFile(metaFN($recent['id'], '.comments'), false));
     // check if discussion is turned off
     if ($data['status'] === 0) {
         return false;
     }
     $parent_id = $cid;
     // Check for the comment and all parents if they exist and are visible.
     do {
         $tcid = $parent_id;
         // check if the comment still exists
         if (!isset($data['comments'][$tcid])) {
             return false;
         }
         // check if the comment is visible
         if ($data['comments'][$tcid]['show'] != 1) {
             return false;
         }
         $parent_id = $data['comments'][$tcid]['parent'];
     } while ($parent_id && $parent_id != $tcid);
     // okay, then add some additional info
     if (is_array($data['comments'][$cid]['user'])) {
         $recent['name'] = $data['comments'][$cid]['user']['name'];
     } else {
         $recent['name'] = $data['comments'][$cid]['name'];
     }
     $recent['desc'] = strip_tags($data['comments'][$cid]['xhtml']);
     $recent['anchor'] = 'comment_' . $cid;
     return $recent;
 }
开发者ID:cziehr,项目名称:plugin-discussion,代码行数:93,代码来源:helper.php

示例5: search_index

/**
 * Build the browsable index of pages
 *
 * $opts['ns'] is the current namespace
 *
 * @author  Andreas Gohr <andi@splitbrain.org>
 */
function search_index(&$data, $base, $file, $type, $lvl, $opts)
{
    global $conf;
    $return = true;
    $item = array();
    if ($type == 'd' && !preg_match('#^' . $file . '(/|$)#', '/' . $opts['ns'])) {
        //add but don't recurse
        $return = false;
    } elseif ($type == 'f' && ($opts['nofiles'] || substr($file, -4) != '.txt')) {
        //don't add
        return false;
    }
    $id = pathID($file);
    if ($type == 'd' && $conf['sneaky_index'] && auth_quickaclcheck($id . ':') < AUTH_READ) {
        return false;
    }
    //check hidden
    if (isHiddenPage($id)) {
        return false;
    }
    //check ACL
    if ($type == 'f' && auth_quickaclcheck($id) < AUTH_READ) {
        return false;
    }
    $data[] = array('id' => $id, 'type' => $type, 'level' => $lvl, 'open' => $return);
    return $return;
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:34,代码来源:search.php

示例6: _ft_pageSearch

/**
 * Returns a list of matching documents for the given query
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Kazutaka Miyasaka <kazmiya@gmail.com>
 */
function _ft_pageSearch(&$data)
{
    $Indexer = idx_get_indexer();
    // parse the given query
    $q = ft_queryParser($Indexer, $data['query']);
    $data['highlight'] = $q['highlight'];
    if (empty($q['parsed_ary'])) {
        return array();
    }
    // lookup all words found in the query
    $lookup = $Indexer->lookup($q['words']);
    // get all pages in this dokuwiki site (!: includes nonexistent pages)
    $pages_all = array();
    foreach ($Indexer->getPages() as $id) {
        $pages_all[$id] = 0;
        // base: 0 hit
    }
    // process the query
    $stack = array();
    foreach ($q['parsed_ary'] as $token) {
        switch (substr($token, 0, 3)) {
            case 'W+:':
            case 'W-:':
            case 'W_:':
                // word
                $word = substr($token, 3);
                $stack[] = (array) $lookup[$word];
                break;
            case 'P+:':
            case 'P-:':
                // phrase
                $phrase = substr($token, 3);
                // since phrases are always parsed as ((W1)(W2)...(P)),
                // the end($stack) always points the pages that contain
                // all words in this phrase
                $pages = end($stack);
                $pages_matched = array();
                foreach (array_keys($pages) as $id) {
                    $text = utf8_strtolower(rawWiki($id));
                    if (strpos($text, $phrase) !== false) {
                        $pages_matched[$id] = 0;
                        // phrase: always 0 hit
                    }
                }
                $stack[] = $pages_matched;
                break;
            case 'N+:':
            case 'N-:':
                // namespace
                $ns = substr($token, 3);
                $pages_matched = array();
                foreach (array_keys($pages_all) as $id) {
                    if (strpos($id, $ns) === 0) {
                        $pages_matched[$id] = 0;
                        // namespace: always 0 hit
                    }
                }
                $stack[] = $pages_matched;
                break;
            case 'AND':
                // and operation
                list($pages1, $pages2) = array_splice($stack, -2);
                $stack[] = ft_resultCombine(array($pages1, $pages2));
                break;
            case 'OR':
                // or operation
                list($pages1, $pages2) = array_splice($stack, -2);
                $stack[] = ft_resultUnite(array($pages1, $pages2));
                break;
            case 'NOT':
                // not operation (unary)
                $pages = array_pop($stack);
                $stack[] = ft_resultComplement(array($pages_all, $pages));
                break;
        }
    }
    $docs = array_pop($stack);
    if (empty($docs)) {
        return array();
    }
    // check: settings, acls, existence
    foreach (array_keys($docs) as $id) {
        if (isHiddenPage($id) || auth_quickaclcheck($id) < AUTH_READ || !page_exists($id, '', false)) {
            unset($docs[$id]);
        }
    }
    // sort docs by count
    arsort($docs);
    return $docs;
}
开发者ID:kosenconf,项目名称:kcweb,代码行数:96,代码来源:fulltext.php

示例7: _getUpdates

 /**
  * Returns update logs within the period
  */
 function _getUpdates($start, $end, $logfiles, $type)
 {
     $updates = array();
     // get update log entries within the target period
     foreach ($logfiles as $class => $logfile) {
         $updates = array_merge($updates, $this->_getLogEntries($start, $end, $logfile, $class));
     }
     // apply filter ('sub_selfmod' is applied later)
     switch ($type) {
         case 'admin':
             $updates_filtered = $updates;
             break;
         case 'subscribers':
             foreach ($updates as $entry) {
                 if (isset($this->_skip['sub_hidden']) && $entry['class'] === 'page' && isHiddenPage($entry['id']) || isset($this->_skip['sub_media']) && $entry['class'] === 'media' || isset($this->_skip['sub_minoredit']) && $entry['type'] === 'e') {
                     continue;
                     // skip hidden page, media file, minor edit
                 }
                 $updates_filtered[] = $entry;
             }
             break;
         case 'register':
             foreach ($updates as $entry) {
                 if (isset($this->_skip['reg_by_admin']) && $entry['extra'] === 'by-admin' || isset($this->_skip['reg_not_reg']) && $entry['type'] !== 'C') {
                     continue;
                     // skip usermods by admin, other than registration
                 }
                 $updates_filtered[] = $entry;
             }
             break;
     }
     $updates = is_null($updates_filtered) ? array() : $updates_filtered;
     // any updates?
     if (empty($updates)) {
         $this->_debug("No update has been made during this period ({$type})");
         $this->_debug('  ' . dformat($start) . ' - ' . dformat($end));
     } else {
         sort($updates);
     }
     return $updates;
 }
开发者ID:kazmiya,项目名称:dokuwiki-plugin-emaildigest,代码行数:44,代码来源:action.php

示例8: render

 /**
  * Create output
  */
 function render($format, &$R, $data)
 {
     global $conf;
     global $lang;
     global $ID;
     if ($format != 'xhtml') {
         return false;
     }
     $opts = array('depth' => $data['depth'], 'listfiles' => true, 'listdirs' => false, 'pagesonly' => true, 'firsthead' => true, 'meta' => true);
     if ($data['dirs']) {
         $opts['listdirs'] = true;
         if ($data['files']) {
             $opts['listfiles'] = true;
         } else {
             $opts['listfiles'] = false;
         }
     }
     // read the directory
     $result = array();
     search($result, $conf['datadir'], 'search_universal', $opts, $data['dir']);
     if ($data['fsort']) {
         usort($result, array($this, '_sort_file'));
     } elseif ($data['dsort']) {
         usort($result, array($this, '_sort_date'));
     } else {
         usort($result, array($this, '_sort_page'));
     }
     $start = cleanID($data['ns'] . ':' . $conf['start']);
     $R->listu_open();
     foreach ($result as $item) {
         $skip_it = false;
         if ($data['nostart'] and $item['file'] == $conf['start'] . '.txt') {
             $skip_it = true;
         } else {
             if (!$data['me'] and $item['id'] == $ID) {
                 $skip_it = true;
             } else {
                 if (isHiddenPage($item['id'])) {
                     $skip_it = true;
                 } else {
                     if ($item['type'] == 'd') {
                         $P = resolve_id($item['id'], $conf['start'], false);
                         if (!$data['any'] and !page_exists($P)) {
                             $skip_it = true;
                         }
                     } else {
                         $P = ':' . $item['id'];
                     }
                 }
             }
         }
         if (!$skip_it) {
             $R->listitem_open(1);
             $R->listcontent_open();
             $R->internallink($P);
             if ($data['date']) {
                 $R->cdata(' ' . dformat($item['mtime']));
             }
             $R->listcontent_close();
             $R->listitem_close();
         }
     }
     $R->listu_close();
     return true;
 }
开发者ID:TorMec,项目名称:pglist,代码行数:68,代码来源:syntax.php

示例9: _get_included_pages

    /**
     * Gives a list of pages for a given include statement
     *
     * @author Michael Hamann <michael@content-space.de>
     */
    function _get_included_pages($mode, $page, $sect, $parent_id, $flags) {
        global $conf;
        $pages = array();
        switch($mode) {
        case 'namespace':
            $page  = cleanID($page);
            $ns    = utf8_encodeFN(str_replace(':', '/', $page));
            // depth is absolute depth, not relative depth, but 0 has a special meaning.
            $depth = $flags['depth'] ? $flags['depth'] + substr_count($page, ':') + ($page ? 1 : 0) : 0;
            search($pagearrays, $conf['datadir'], 'search_allpages', array('depth' => $depth), $ns);
            if (is_array($pagearrays)) {
                foreach ($pagearrays as $pagearray) {
                    if (!isHiddenPage($pagearray['id'])) // skip hidden pages
                        $pages[] = $pagearray['id'];
                }
            }
            break;
        case 'tagtopic':
            if (!$this->taghelper)
                $this->taghelper =& plugin_load('helper', 'tag');
            if(!$this->taghelper) {
                msg('You have to install the tag plugin to use this functionality!', -1);
                return array();
            }
            $tag   = $page;
            $sect  = '';
            $pagearrays = $this->taghelper->getTopic('', null, $tag);
            foreach ($pagearrays as $pagearray) {
                $pages[] = $pagearray['id'];
            }
            break;
        default:
            $page = $this->_apply_macro($page);
            resolve_pageid(getNS($parent_id), $page, $exists); // resolve shortcuts and clean ID
            if (auth_quickaclcheck($page) >= AUTH_READ)
                $pages[] = $page;
        }

        if (count($pages) > 1) {
            if ($flags['order'] === 'id') {
                if ($flags['rsort']) {
                    usort($pages, array($this, '_r_strnatcasecmp'));
                } else {
                    natcasesort($pages);
                }
            } else {
                $ordered_pages = array();
                foreach ($pages as $page) {
                    $key = '';
                    switch ($flags['order']) {
                        case 'title':
                            $key = p_get_first_heading($page);
                            break;
                        case 'created':
                            $key = p_get_metadata($page, 'date created', METADATA_DONT_RENDER);
                            break;
                        case 'modified':
                            $key = p_get_metadata($page, 'date modified', METADATA_DONT_RENDER);
                            break;
                        case 'indexmenu':
                            $key = p_get_metadata($page, 'indexmenu_n', METADATA_RENDER_USING_SIMPLE_CACHE);
                            if ($key === null)
                                $key = '';
                            break;
                        case 'custom':
                            $key = p_get_metadata($page, 'include_n', METADATA_RENDER_USING_SIMPLE_CACHE);
                            if ($key === null)
                                $key = '';
                            break;
                    }
                    $key .= '_'.$page;
                    $ordered_pages[$key] = $page;
                }
                if ($flags['rsort']) {
                    uksort($ordered_pages, array($this, '_r_strnatcasecmp'));
                } else {
                    uksort($ordered_pages, 'strnatcasecmp');
                }
                $pages = $ordered_pages;
            }
        }

        $result = array();
        foreach ($pages as $page) {
            $exists = page_exists($page);
            $result[] = array('id' => $page, 'exists' => $exists, 'parent_id' => $parent_id);
        }
        return $result;
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:94,代码来源:helper.php

示例10: ft_backlinks

/**
 * Returns the backlinks for a given page
 *
 * Uses the metadata index.
 */
function ft_backlinks($id)
{
    $result = array();
    $result = idx_get_indexer()->lookupKey('relation_references', $id);
    if (!count($result)) {
        return $result;
    }
    // check ACL permissions and modify for !Researchr
    $remove_ns = '/^(kbib|abib|jbib|bib|start)/';
    $pattern = '/^(clip:|skimg:|kindle:|notes:)(.*)$/';
    foreach (array_keys($result) as $idx) {
        if (isHiddenPage($result[$idx]) || auth_quickaclcheck($result[$idx]) < AUTH_READ || !page_exists($result[$idx], '', false) || preg_match($remove_ns, $result[$idx])) {
            unset($result[$idx]);
        }
        // modify links !Researchr
        if (preg_match($pattern, $result[$idx], $matches)) {
            $result[] = "ref:" . $matches[2];
            unset($result[$idx]);
        }
    }
    sort($result);
    return $result;
}
开发者ID:houshuang,项目名称:folders2web,代码行数:28,代码来源:fulltext.php

示例11: page_lookup

 /**
  * A heavily customised version of _ft_pageLookup in inc/fulltext.php
  * no sorting!
  */
 function page_lookup($query, $fullregex, $incl_ns, $excl_ns)
 {
     global $conf;
     $query = trim($query);
     $pages = idx_get_indexer()->getPages();
     if (!$fullregex) {
         // first deal with excluded namespaces, then included, order matters!
         $pages = $this->_filter_ns($pages, $excl_ns, true);
         $pages = $this->_filter_ns($pages, $incl_ns, false);
     }
     $cnt = count($pages);
     for ($i = 0; $i < $cnt; $i++) {
         $page = $pages[$i];
         if (!page_exists($page) || isHiddenPage($page)) {
             unset($pages[$i]);
             continue;
         }
         if (!$fullregex) {
             $page = noNS($page);
         }
         /*
          * This is the actual "search" expression.
          * Note: preg_grep cannot be used because we need to
          *  allow for beginning of string "^" regex on normal page search
          *  and the page-exists check above
          * The @ prevents problems with invalid queries!
          */
         $matched = @preg_match('/' . $query . '/iS', $page);
         if ($matched === false) {
             return false;
         } elseif ($matched == 0) {
             unset($pages[$i]);
         }
     }
     if (count($pages) > 0) {
         return $pages;
     } else {
         // we always return an array type
         return array();
     }
 }
开发者ID:unfoldingWord-dev,项目名称:pagequery,代码行数:45,代码来源:pagequery.php

示例12: getBlog

 /**
  * Get blog entries from a given namespace
  */
 function getBlog($ns, $num = NULL)
 {
     global $conf;
     // add pages in given namespace
     $result = array();
     global $conf;
     require_once DOKU_INC . 'inc/search.php';
     $pages = array();
     $unique_keys_memoize = array();
     $dir = str_replace(':', '/', $ns);
     search($pages, $conf['datadir'], 'search_pagename', array('query' => '.txt'), $dir);
     foreach ($pages as $page) {
         $id = $page['id'];
         $file = wikiFN($id);
         // do some checks first
         if (isHiddenPage($id)) {
             continue;
         }
         // skip excluded pages
         $excluded_pages = $this->getConf('excluded_pages');
         if (strlen($excluded_pages) > 0 && preg_match($excluded_pages, $id)) {
             continue;
         }
         if ($ns && strpos($id, $ns . ':') !== 0) {
             continue;
         }
         // filter namespaces
         if (!@file_exists($file)) {
             continue;
         }
         // skip deleted
         $perm = auth_quickaclcheck($id);
         if ($perm < AUTH_READ) {
             continue;
         }
         // check ACL
         // skip drafts unless for users with create priviledge
         $meta = p_get_metadata($id, '', false);
         $draft = $meta['type'] == 'draft';
         if ($draft && $perm < AUTH_CREATE) {
             continue;
         }
         $date = $meta['date']['modified'];
         if (!$date) {
             $date = filemtime(wikiFN($id));
         }
         if ($this->sort != 'mdate') {
             $cdate = $meta['date']['created'];
             if (!$cdate) {
                 $cdate = filectime(wikiFN($id));
             }
             // prefer the date further in the past:
             $date = min($date, $cdate);
         }
         $title = $meta['title'];
         // determine the sort key
         if ($this->sort == 'id') {
             $key = $id;
         } elseif ($this->sort == 'pagename') {
             $key = noNS($id);
         } elseif ($this->sort == 'title') {
             $key = $title;
         } else {
             $key = $date;
         }
         // get a unique sortable key
         $key = $this->_uniqueKey($key, $unique_keys_memoize);
         $result[$key] = array('id' => $id, 'title' => $title, 'date' => $date, 'user' => $meta['creator'], 'desc' => $meta['description']['abstract'], 'exists' => true, 'perm' => $perm, 'draft' => $draft);
     }
     // finally sort by sort key
     if ($this->getConf('sortorder') == 'ascending') {
         ksort($result);
     } else {
         krsort($result);
     }
     if (is_numeric($num)) {
         $result = array_slice($result, 0, $num);
     }
     return $result;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:83,代码来源:helper.php

示例13: handleChangelogLine

 /**
  * Based on _handleRecent() from inc/changelog.php
  */
 function handleChangelogLine($line, $ns, $type, $user, &$seen)
 {
     // split the line into parts
     $change = parseChangelogLine($line);
     if ($change === false) {
         return false;
     }
     // skip seen ones
     if (isset($seen[$change['id']])) {
         return false;
     }
     // filter type
     if (!empty($type) && !in_array($change['type'], $type)) {
         return false;
     }
     // filter user
     if (!empty($user) && (empty($change['user']) || !in_array($change['user'], $user))) {
         return false;
     }
     // remember in seen to skip additional sights
     $seen[$change['id']] = 1;
     // check if it's a hidden page
     if (isHiddenPage($change['id'])) {
         return false;
     }
     // filter included namespaces
     if (isset($ns['include'])) {
         if (!$this->isInNamespace($ns['include'], $change['id'])) {
             return false;
         }
     }
     // filter excluded namespaces
     if (isset($ns['exclude'])) {
         if ($this->isInNamespace($ns['exclude'], $change['id'])) {
             return false;
         }
     }
     // check ACL
     $change['perms'] = auth_quickaclcheck($change['id']);
     if ($change['perms'] < AUTH_READ) {
         return false;
     }
     return $change;
 }
开发者ID:rauschen,项目名称:changes,代码行数:47,代码来源:syntax.php

示例14: _page_lookup

 /**
  * A heavily customised version of _ft_pageLookup in inc/fulltext.php
  * no sorting!
  */
 private function _page_lookup($query, $pageonly, $incl_ns, $excl_ns, $nostart = true, $maxns = 0)
 {
     global $conf;
     $queries = trim($query);
     $pages = file($conf['indexdir'] . '/page.idx');
     // first deal with excluded namespaces, then included
     $pages = $this->_filter_ns($pages, $excl_ns, true);
     // now include ONLY the selected namespaces if provided
     $pages = $this->_filter_ns($pages, $incl_ns, false);
     $cnt = count($pages);
     for ($i = 0; $i < $cnt; $i++) {
         $page = $pages[$i];
         if (!page_exists($page) || isHiddenPage($page)) {
             unset($pages[$i]);
             continue;
         }
         if ($pageonly) {
             $page = noNS($page);
         }
         /*
          * This is the actual "search" expression!
          * Note: preg_grep cannot be used because of the pageonly option above
          *       (needs to allow for "^" syntax)
          * The @ prevents problems with invalid queries!
          */
         if (@preg_match('/' . $query . '/i', $page) == 0) {
             unset($pages[$i]);
         }
     }
     if (!count($pages)) {
         return array();
     }
     $pages = array_map('trim', $pages);
     // check ACL permissions and remove any 'start' pages if req'd
     $start = $conf['start'];
     $pos = strlen($start);
     foreach ($pages as $idx => $name) {
         if ($nostart && substr($name, -$pos) == $start) {
             unset($pages[$idx]);
             // TODO: this function is one of slowest in the plugin; solutions?
         } elseif (auth_quickaclcheck($pages[$idx]) < AUTH_READ) {
             unset($pages[$idx]);
         } elseif ($maxns > 0 && substr_count($name, ':') + 1 > $maxns) {
             unset($pages[$idx]);
         }
     }
     return $pages;
 }
开发者ID:houshuang,项目名称:folders2web,代码行数:52,代码来源:syntax.php

示例15: _monthArchive

 /**
  * Return the monthly archive list
  */
 function _monthArchive($ns, $month, $year)
 {
     global $conf;
     // calculate start and end times
     $nextmonth = $month + 1;
     $year2 = $year;
     if ($nextmonth > 12) {
         $nextmonth = 1;
         $year2 = $year + 1;
     }
     $monthstart = mktime(0, 0, 0, $month, 1, $year);
     $monthend = mktime(0, 0, 0, $nextmonth, 1, $year2);
     // load page and creation date index
     $page_idx = file($conf['cachedir'] . '/page.idx');
     $cdate_idx = file($conf['cachedir'] . '/cdate.idx');
     // add pages in given namespace
     $result = array();
     $c = count($page_idx);
     for ($i = 0; $i < $c; $i++) {
         $id = substr($page_idx[$i], 0, -1);
         // do some checks first
         if (isHiddenPage($id)) {
             continue;
         }
         // skip excluded pages
         if ($ns && strpos($id, $ns . ':') !== 0) {
             continue;
         }
         // filter namespaces
         if (!@file_exists(wikiFN($id))) {
             continue;
         }
         // skip deleted
         $perm = auth_quickaclcheck($id);
         if ($perm < AUTH_READ) {
             continue;
         }
         // check ACL
         // in right date range?
         $cdate = substr($cdate_idx[$i], 0, -1);
         if (!$cdate) {
             $cdate = $this->_getCdate($id, $i, $cdate_idx);
         }
         if ($monthstart > $cdate || $cdate >= $monthend) {
             continue;
         }
         // okay, add the page
         $meta = p_get_metadata($id);
         $result[$cdate] = array('id' => $id, 'title' => $meta['title'], 'user' => $meta['creator'], 'date' => $cdate, 'exists' => true, 'perm' => $perm);
     }
     // finally sort by creation time
     krsort($result);
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:openaqua-svn,代码行数:57,代码来源:archive.php


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