• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ft_pageSearch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: search

 /**
  * List all pages in the given namespace (and below)
  */
 function search($query)
 {
     $regex = '';
     $data = ft_pageSearch($query, $regex);
     $pages = array();
     // prepare additional data
     $idx = 0;
     foreach ($data as $id => $score) {
         $file = wikiFN($id);
         if ($idx < FT_SNIPPET_NUMBER) {
             $snippet = ft_snippet($id, $regex);
             $idx++;
         } else {
             $snippet = '';
         }
         $pages[] = array('id' => $id, 'score' => intval($score), 'rev' => filemtime($file), 'mtime' => filemtime($file), 'size' => filesize($file), 'snippet' => $snippet, 'title' => useHeading('navigation') ? p_get_first_heading($id) : $id);
     }
     return $pages;
 }
开发者ID:neosunchess,项目名称:dokuwiki,代码行数:22,代码来源:RemoteAPICore.php


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


示例3: rssSearch

/**
 * Add the result of a full text search to the feed object
 *
 * @author Andreas Gohr <[email protected]>
 */
function rssSearch($opt)
{
    if (!$opt['search_query']) {
        return;
    }
    require_once DOKU_INC . 'inc/fulltext.php';
    $data = array();
    $data = ft_pageSearch($opt['search_query'], $poswords);
    $data = array_keys($data);
    return $data;
}
开发者ID:Harvie,项目名称:dokuwiki,代码行数:16,代码来源:feed.php


示例4: page_search

 /**
  * Just a wrapper around the Dokuwiki pageSearch function.
  *
  * @param $query
  * @return mixed
  */
 function page_search($query)
 {
     $result = array_keys(ft_pageSearch($query, $highlight));
     return $result;
 }
开发者ID:unfoldingWord-dev,项目名称:pagequery,代码行数:11,代码来源:pagequery.php


示例5: search

 /**
  * List all pages in the given namespace (and below)
  */
 function search($query)
 {
     require_once DOKU_INC . 'inc/fulltext.php';
     $regex = '';
     $data = ft_pageSearch($query, $regex);
     $pages = array();
     // prepare additional data
     $idx = 0;
     foreach ($data as $id => $score) {
         $file = wikiFN($id);
         if ($idx < FT_SNIPPET_NUMBER) {
             $snippet = ft_snippet($id, $regex);
             $idx++;
         } else {
             $snippet = '';
         }
         $pages[] = array('id' => $id, 'score' => $score, 'rev' => filemtime($file), 'mtime' => filemtime($file), 'size' => filesize($file), 'snippet' => $snippet);
     }
     return $pages;
 }
开发者ID:ryankask,项目名称:dokuwiki,代码行数:23,代码来源:xmlrpc.php


示例6: html_search

/**
 * Run a search and display the result
 *
 * @author Andreas Gohr <[email protected]>
 */
function html_search()
{
    require_once DOKU_INC . 'inc/search.php';
    require_once DOKU_INC . 'inc/fulltext.php';
    global $conf;
    global $QUERY;
    global $ID;
    global $lang;
    print p_locale_xhtml('searchpage');
    flush();
    //check if search is restricted to namespace
    if (preg_match('/([^@]*)@([^@]*)/', $QUERY, $match)) {
        $id = cleanID($match[1]);
        if (empty($id)) {
            print '<div class="nothing">' . $lang['nothingfound'] . '</div>';
            flush();
            return;
        }
    } else {
        $id = cleanID($QUERY);
    }
    //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($id);
    if (count($data)) {
        print '<div class="search_quickresult">';
        print '<h3>' . $lang['quickhits'] . ':</h3>';
        print '<ul class="search_quickhits">';
        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> ';
        //clear float (see http://www.complexspiral.com/publications/containing-floats/)
        print '<div class="clearer">&nbsp;</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);
            print ': <span class="search_cnt">' . $cnt . ' ' . $lang['hits'] . '</span><br />';
            if ($num < 15) {
                // create snippets for the first number of matches only #FIXME add to conf ?
                print '<div class="search_snippet">' . ft_snippet($id, $regex) . '</div>';
            }
            print '</div>';
            flush();
            $num++;
        }
    } 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:jalemanyf,项目名称:wsnlocalizationscala,代码行数:82,代码来源:html.php


示例7: render

 function render($mode, &$renderer, $data)
 {
     $sortkeys = array();
     $incl_ns = array();
     $excl_ns = array();
     list($query, $fulltext, $sort, $group, $limit, $maxns, $proper, $cols, $inwords, $border, $fullregex, $nostart, $title, $snippet, $case, $natsort, $underline) = $data;
     if ($mode == 'xhtml') {
         // first get a raw list of matching results
         if ($fulltext) {
             // full text (Dokuwiki style) searching
             $results = array_keys(ft_pageSearch($query, $highlight));
         } else {
             // by page id only (
             if ($fullregex) {
                 // allow for raw regex mode, for power users, this searches the full page id
                 $pageonly = false;
             } else {
                 list($query, $incl_ns, $excl_ns) = $this->_parse_ns_query($query);
                 $pageonly = true;
             }
             if ($query == '*') {
                 $query = '.*';
             }
             // a lazy man's option!
             $results = $this->_page_lookup($query, $pageonly, $incl_ns, $excl_ns, $nostart, $maxns);
         }
         if (!empty($results)) {
             // this section is where the essential pagequery functionality happens...
             // prepare the necessary sorting arrays, as per users options
             $get_abstract = $snippet[0] != 'none';
             list($sort_array, $sort_opts, $group_opts) = $this->_build_sorting_array($results, $sort, $title, $proper, $inwords, $case, $natsort, $get_abstract);
             // now do the sorting (inc/msort.php)
             msort($sort_array, $sort_opts);
             // limit the result list length if required; this can only be done after sorting!
             $sort_array = $limit > 0 ? array_slice($sort_array, 0, $limit) : $sort_array;
             // and finally the grouping
             if ($group) {
                 $keys = array(NAME_KEY, ID_KEY, ABST_KEY);
                 $sorted_results = mgroup($sort_array, $keys, $group_opts);
             } else {
                 foreach ($sort_array as $row) {
                     $sorted_results[] = array(0, $row[NAME_KEY], $row[ID_KEY], $row[ABST_KEY]);
                 }
             }
             $renderer->doc .= $this->_render_list($sorted_results, $cols, $proper, $snippet, $border, $underline);
         } else {
             $renderer->doc .= $this->_render_no_list($query);
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:houshuang,项目名称:folders2web,代码行数:53,代码来源:syntax.php


示例8: _fulltext_search

 /**
  * Search for query in given namespace and give results list as array.
  */
 function _fulltext_search($QUERY, $namespace)
 {
     $results = array();
     $data = ft_pageSearch($QUERY, $QUERY);
     if (count($data)) {
         foreach ($data as $id => $cnt) {
             $pieces = explode(":", $id);
             list($ns, $id2) = $pieces;
             if ($ns == $namespace) {
                 array_push($results, $id);
             }
         }
     } else {
     }
     return $results;
 }
开发者ID:k4m1,项目名称:master-thesis,代码行数:19,代码来源:syntax.php


示例9: 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;
    print '<div class="toc">
<div class="tocheader toctoggle" id="toc__header">Table of Contents</div>
<div id="toc__inside">

<ul class="toc">
<li class="level1"><div class="li"><span class="li"><a href="#pages" class="toc">Pagenames</a></span></div></li>
<li class="level1"><div class="li"><span class="li"><a href="#authors" class="toc">Authors</a></span></div>
<li class="level1"><div class="li"><span class="li"><a href="#tools" class="toc">Tools</a></span></div></li>
<li class="level1"><div class="li"><span class="li"><a href="#articles" class="toc">Articles</a></span></div></li>
<li class="level1"><div class="li"><span class="li"><a href="#conferences" class="toc">Conferences</a></span></div></li>
<li class="level1"><div class="li"><span class="li"><a href="#other" class="toc">Other pages</a></span></div>
</ul>
</div>
</div>';
    $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;
    print '<h1>Search: ' . $QUERY . '</h1>';
    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();
    $articles = '/^(clip|kindle|notes)\\:/';
    $avoid = '/((^(ref|kbib|abib|jbib|bib|t|clip|kindle|notes|skimg|conf)\\:)|^start$)/';
    // add more conference namespaces at the end of $avoid and in $conferences, if you use first level namespaces
    // for this, for example I have aera11: cscl11: etc.
    $conferences = '/^(conf)\\:/';
    $tool = '/^t\\:/';
    $author = '/^a\\:/';
    //do quick pagesearch
    $data = array();
    $data = ft_pageLookup($QUERY, true, useHeading('navigation'));
    $out = '';
    foreach ($data as $id => $title) {
        if (!preg_match($avoid, $id) || preg_match('/^abib:/', $id)) {
            $out = $out . '<li> ';
            if (useHeading('navigation')) {
                $name = $title;
            } else {
                $ns = getNS($id);
                if ($ns) {
                    $name = shorten(noNS($id), ' (' . $ns . ')', 30);
                } else {
                    $name = $id;
                }
            }
            $out = $out . html_wikilink(':' . $id, $name);
            $out = $out . '</li> ';
        }
    }
    if ($out != '') {
        print '<h2 name=pages id=pages>Page titles</h2>';
        print '<ul class="search_quickhits">';
        print $out;
        print "</ul>";
        print '<div class="clearer"></div>';
        flush();
    }
    $data = ft_pageSearch($QUERY, $regexp);
    ///////////////////////////////////////////////////////////////////////////
    // authors
    $out = '';
    foreach ($data as $id => $cnt) {
        if (preg_match($author, $id)) {
            $out = $out . '<li>' . html_wikilink(':' . $id, useHeading('navigation') ? null : $id, $regexp) . '</li>';
        }
    }
    if ($out != '') {
        print '<br><h2 name=authors id=authors>Authors</h2>';
        print '<ul class="search_quickhits">';
        print $out;
        print "</ul>";
        print '<div class="clearer"></div>';
    }
    ///////////////////////////////////////////////////////////////////////////
    // tools
    $out = '';
    foreach ($data as $id => $cnt) {
        if (preg_match($tool, $id)) {
            $out = $out . '<li>' . html_wikilink(':' . $id, useHeading('navigation') ? null : $id, $regexp) . '</li>';
        }
    }
    if ($out != '') {
        print '<br><h2 name=tools id=tools>Tool results</h2>';
//.........这里部分代码省略.........
开发者ID:houshuang,项目名称:folders2web,代码行数:101,代码来源:html.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ft_sanitize函数代码示例发布时间:2022-05-15
下一篇:
PHP ft_pageLookup函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap