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


PHP SearchEngine::getPages方法代码示例

本文整理汇总了PHP中SearchEngine::getPages方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::getPages方法的具体用法?PHP SearchEngine::getPages怎么用?PHP SearchEngine::getPages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchEngine的用法示例。


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

示例1: getRelatedItems

function getRelatedItems($type = 'news', $album = NULL)
{
    global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_page, $_zp_current_zenpage_news, $_zp_gallery_page;
    $tags = getTags();
    if (!empty($tags)) {
        // if there are tags at all
        $searchstring = '';
        $count = '';
        foreach ($tags as $tag) {
            $count++;
            if ($count == 1) {
                $bool = '';
            } else {
                $bool = '|';
                // connect tags by OR to get a wide range
            }
            $searchstring .= $bool . $tag;
        }
        $paramstr = urlencode('words') . '=' . $searchstring . '&searchfields=tags';
        if (!is_null($album)) {
            $paramstr = '&albumname=' . urlencode($album);
        }
        $search = new SearchEngine();
        switch ($type) {
            case 'albums':
                $paramstr .= '&inalbums=1';
                break;
            case 'images':
                $paramstr .= '&inimages=1';
                break;
            case 'news':
                $paramstr .= '&innews=1';
                break;
            case 'pages':
                $paramstr .= '&inpages=1';
                break;
            case 'all':
                $paramstr .= '&inalbums=1&inimages=1&innews=1&inpages=1';
                break;
        }
        $search->setSearchParams($paramstr);
        // get the results
        switch ($type) {
            case 'albums':
                $albumresult = $search->getAlbums(0, "date", "desc");
                $result = createRelatedItemsResultArray($albumresult, $type);
                break;
            case 'images':
                $imageresult = $search->getImages(0, 0, 'date', 'desc');
                $result = createRelatedItemsResultArray($imageresult, $type);
                break;
            case 'news':
                $newsresult = $search->getArticles(0, NULL, true, "date", "desc");
                $result = createRelatedItemsResultArray($newsresult, $type);
                break;
            case 'pages':
                $pageresult = $search->getPages();
                $result = createRelatedItemsResultArray($pageresult, $type);
                break;
            case 'all':
                $albumresult = $search->getAlbums(0, "date", "desc");
                $imageresult = $search->getImages(0, 0, 'date', 'desc');
                $newsresult = $search->getArticles(0, NULL, true, "date", "desc");
                $pageresult = $search->getPages();
                $result1 = createRelatedItemsResultArray($albumresult, 'albums');
                $result2 = createRelatedItemsResultArray($imageresult, 'images');
                $result3 = createRelatedItemsResultArray($newsresult, 'news');
                $result4 = createRelatedItemsResultArray($pageresult, 'pages');
                $result = array_merge($result1, $result2, $result3, $result4);
                $result = sortMultiArray($result, 'weight', true, true, false, false);
                // sort by search result weight
                break;
        }
        return $result;
    }
    return array();
}
开发者ID:rb26,项目名称:zenphoto,代码行数:77,代码来源:related_items.php

示例2: handleSearchParms

/**
 * recovers search parameters from stored cookie, clears the cookie
 *
 * @param string $what the page type
 * @param string $album Name of the album
 * @param string $image Name of the image
 */
function handleSearchParms($what, $album = NULL, $image = NULL)
{
    global $_zp_current_search, $zp_request, $_zp_last_album, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery, $_zp_loggedin;
    $_zp_last_album = zp_getCookie('zenphoto_last_album');
    if (is_object($zp_request) && get_class($zp_request) == 'SearchEngine') {
        //	we are are on a search
        return $zp_request->getAlbumList();
    }
    $params = zp_getCookie('zenphoto_search_params');
    if (!empty($params)) {
        $context = get_context();
        $_zp_current_search = new SearchEngine();
        $_zp_current_search->setSearchParams($params);
        // check to see if we are still "in the search context"
        if (!is_null($image)) {
            $dynamic_album = $_zp_current_search->getDynamicAlbum();
            if ($_zp_current_search->getImageIndex($album->name, $image->filename) !== false) {
                if ($dynamic_album) {
                    $_zp_current_album = $dynamic_album;
                }
                $context = $context | ZP_SEARCH_LINKED | ZP_IMAGE_LINKED;
            }
        }
        if (!is_null($album)) {
            $albumname = $album->name;
            zp_setCookie('zenphoto_last_album', $albumname);
            if (hasDynamicAlbumSuffix($albumname) && !is_dir(ALBUM_FOLDER_SERVERPATH . $albumname)) {
                $albumname = stripSuffix($albumname);
                // strip off the suffix as it will not be reflected in the search path
            }
            //	see if the album is within the search context. NB for these purposes we need to look at all albums!
            $save_logon = $_zp_loggedin;
            $_zp_loggedin = $_zp_loggedin | VIEW_ALL_RIGHTS;
            $search_album_list = $_zp_current_search->getAlbums(0);
            $_zp_loggedin = $save_logon;
            foreach ($search_album_list as $searchalbum) {
                if (strpos($albumname, $searchalbum) !== false) {
                    $context = $context | ZP_SEARCH_LINKED | ZP_ALBUM_LINKED;
                    break;
                }
            }
        } else {
            zp_clearCookie('zenphoto_last_album');
        }
        if (!is_null($_zp_current_zenpage_page)) {
            $pages = $_zp_current_search->getPages();
            if (!empty($pages)) {
                $tltlelink = $_zp_current_zenpage_page->getTitlelink();
                foreach ($pages as $apage) {
                    if ($apage == $tltlelink) {
                        $context = $context | ZP_SEARCH_LINKED;
                        break;
                    }
                }
            }
        }
        if (!is_null($_zp_current_zenpage_news)) {
            $news = $_zp_current_search->getArticles(0, NULL, true);
            if (!empty($news)) {
                $tltlelink = $_zp_current_zenpage_news->getTitlelink();
                foreach ($news as $anews) {
                    if ($anews['titlelink'] == $tltlelink) {
                        $context = $context | ZP_SEARCH_LINKED;
                        break;
                    }
                }
            }
        }
        if ($context & ZP_SEARCH_LINKED) {
            set_context($context);
        } else {
            // not an object in the current search path
            $_zp_current_search = null;
            rem_context(ZP_SEARCH);
            if (!isset($_REQUEST['preserve_serch_params'])) {
                zp_clearCookie("zenphoto_search_params");
            }
        }
    }
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:87,代码来源:functions.php

示例3: count

$imagechecked = !isset($_POST['XSRFToken']) || @$_POST['image_tag'];
$albumchecked = !isset($_POST['XSRFToken']) || @$_POST['album_tag'];
$articlechecked = !isset($_POST['XSRFToken']) || @$_POST['article_tag'];
$pagechecked = !isset($_POST['XSRFToken']) || @$_POST['page_tag'];
$images = $search->getImages(0);
$albums = $search->getAlbums(0);
$count = 0;
if ($imagechecked) {
    $count = $count + count($images);
}
if ($albumchecked) {
    $count = $count + count($albums);
}
if (extensionEnabled('zenpage')) {
    $articles = $search->getArticles();
    $pages = $search->getPages();
    if ($articlechecked) {
        $count = $count + count($articles);
    }
    if ($pagechecked) {
        $count = $count + count($pages);
    }
} else {
    $articles = $pages = array();
}
printAdminHeader('tags');
echo "\n</head>";
?>

<body>
	<?php 
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:tag.php


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