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


PHP SearchEngine::getAlbums方法代码示例

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


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

示例1: Gallery

    echo "</div>\n";
}
$gallery = new Gallery();
$albumlist = array();
genAlbumUploadList($albumlist);
$params = trim(zp_getCookie('zenphoto_image_search_params'));
$search->setSearchParams($params);
$fields = $search->fields;
$words = trim($search->words);
$images = $search->getImages(0);
foreach ($images as $image) {
    $folder = $image['folder'];
    $filename = $image['filename'];
    $imagelist[] = '/' . $folder . '/' . $filename;
}
$subalbums = $search->getAlbums(0);
foreach ($subalbums as $folder) {
    getSubalbumImages($folder);
}
$albumname = trim($words);
$albumname = str_replace('!', ' NOT ', $albumname);
$albumname = str_replace('&', ' AND ', $albumname);
$albumname = str_replace('|', ' OR ', $albumname);
$albumname = sanitize_path($albumname);
$albumname = seoFriendlyURL($albumname);
$old = '';
while ($old != $albumname) {
    $old = $albumname;
    $albumname = str_replace('--', '-', $albumname);
}
?>
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:admin-dynamic-album.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: 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;
    $cookiepath = WEBPATH;
    if (WEBPATH == '') {
        $cookiepath = '/';
    }
    if (is_null($album)) {
        if (is_object($zp_request)) {
            $reset = get_class($zp_request) != 'SearchEngine';
        } else {
            $reset = $zp_request;
        }
        if ($reset) {
            // clear the cookie if no album and not a search
            if (!isset($_REQUEST['preserve_serch_params'])) {
                zp_setcookie("zenphoto_image_search_params", "", time() - 368000, $cookiepath);
            }
            return;
        }
    }
    $context = get_context();
    $params = zp_getCookie('zenphoto_image_search_params');
    if (!empty($params)) {
        $_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)) {
            if ($_zp_current_search->getImageIndex($album->name, $image->filename) !== false) {
                $context = $context | ZP_SEARCH_LINKED | ZP_IMAGE_LINKED;
            }
        }
        if (!is_null($album)) {
            $albumname = $album->name;
            $albumlist = $_zp_current_search->getAlbums(0);
            foreach ($albumlist as $searchalbum) {
                if (strpos($albumname, $searchalbum) !== false) {
                    $context = $context | ZP_SEARCH_LINKED | ZP_ALBUM_LINKED;
                    break;
                }
            }
        }
        if ($context & ZP_SEARCH_LINKED) {
            set_context($context);
        } else {
            $_zp_current_search = null;
        }
    }
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:56,代码来源:functions.php

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

示例5: printAlbumEditForm


//.........这里部分代码省略.........
        echo $_thumb_field_text[getOption('AlbumThumbSelectField')];
        ?>
							</option>
							<option <?php 
        if ($showThumb) {
            ?>
class="thumboption" style="background-color:#B1F7B6" <?php 
        }
        ?>
								<?php 
        if (empty($thumb) && $thumb !== '1') {
            ?>
 selected="selected" <?php 
        }
        ?>
									value=""><?php 
        echo gettext('randomly selected');
        ?>
							</option>
							<?php 
        if ($album->isDynamic()) {
            $params = $album->getSearchParams();
            $search = new SearchEngine(true);
            $search->setSearchParams($params);
            $images = $search->getImages(0);
            $thumb = $album->get('thumb');
            $imagelist = array();
            foreach ($images as $imagerow) {
                $folder = $imagerow['folder'];
                $filename = $imagerow['filename'];
                $imagelist[] = '/' . $folder . '/' . $filename;
            }
            if (count($imagelist) == 0) {
                $subalbums = $search->getAlbums(0);
                foreach ($subalbums as $folder) {
                    $newalbum = new Album($gallery, $folder);
                    if (!$newalbum->isDynamic()) {
                        $images = $newalbum->getImages(0);
                        foreach ($images as $filename) {
                            $imagelist[] = '/' . $folder . '/' . $filename;
                        }
                    }
                }
            }
            foreach ($imagelist as $imagepath) {
                $list = explode('/', $imagepath);
                $filename = $list[count($list) - 1];
                unset($list[count($list) - 1]);
                $folder = implode('/', $list);
                $albumx = new Album($gallery, $folder);
                $image = newImage($albumx, $filename);
                $selected = $imagepath == $thumb;
                echo "\n<option";
                if ($showThumb) {
                    echo " class=\"thumboption\"";
                    echo " style=\"background-image: url(" . html_encode($image->getSizedImage(80)) . "); background-repeat: no-repeat;\"";
                }
                echo " value=\"" . $imagepath . "\"";
                if ($selected) {
                    echo " selected=\"selected\"";
                }
                echo ">" . $image->getTitle();
                echo " ({$imagepath})";
                echo "</option>";
            }
        } else {
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:67,代码来源:admin-functions.php

示例6: printAlbumEditForm


//.........这里部分代码省略.........
    echo " name=\"" . $prefix . "thumb\">";
    $thumb = $album->get('thumb');
    echo "\n<option";
    if ($showThumb) {
        echo " class=\"thumboption\" value=\"\" style=\"background-color:#B1F7B6\"";
    }
    if ($thumb === '1') {
        echo " selected=\"selected\"";
    }
    echo ' value="1">' . gettext('most recent');
    echo '</option>';
    echo "\n<option";
    if ($showThumb) {
        echo " class=\"thumboption\" value=\"\" style=\"background-color:#B1F7B6\"";
    }
    if (empty($thumb) && $thumb !== '1') {
        echo " selected=\"selected\"";
    }
    echo ' value="">' . gettext('randomly selected');
    echo '</option>';
    if ($album->isDynamic()) {
        $params = $album->getSearchParams();
        $search = new SearchEngine();
        $search->setSearchParams($params);
        $images = $search->getImages(0);
        $thumb = $album->get('thumb');
        $imagelist = array();
        foreach ($images as $imagerow) {
            $folder = $imagerow['folder'];
            $filename = $imagerow['filename'];
            $imagelist[] = '/' . $folder . '/' . $filename;
        }
        if (count($imagelist) == 0) {
            $subalbums = $search->getAlbums(0);
            foreach ($subalbums as $folder) {
                $newalbum = new Album($gallery, $folder);
                if (!$newalbum->isDynamic()) {
                    $images = $newalbum->getImages(0);
                    foreach ($images as $filename) {
                        $imagelist[] = '/' . $folder . '/' . $filename;
                    }
                }
            }
        }
        foreach ($imagelist as $imagepath) {
            $list = explode('/', $imagepath);
            $filename = $list[count($list) - 1];
            unset($list[count($list) - 1]);
            $folder = implode('/', $list);
            $albumx = new Album($gallery, $folder);
            $image = newImage($albumx, $filename);
            $selected = $imagepath == $thumb;
            echo "\n<option";
            if ($showThumb) {
                echo " class=\"thumboption\"";
                echo " style=\"background-image: url(" . $image->getThumb() . "); background-repeat: no-repeat;\"";
            }
            echo " value=\"" . $imagepath . "\"";
            if ($selected) {
                echo " selected=\"selected\"";
            }
            echo ">" . $image->getTitle();
            echo " ({$imagepath})";
            echo "</option>";
        }
    } else {
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:67,代码来源:admin-functions.php


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