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

PHP ft_snippet函数代码示例

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

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



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

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


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


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


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ftell函数代码示例发布时间:2022-05-15
下一篇:
PHP ft_sanitize函数代码示例发布时间: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