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


PHP Search::get_items方法代码示例

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


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

示例1: on_get

 private function on_get()
 {
     $response = [];
     foreach (['langs', 'options', 'types'] as $name) {
         if ($this->request->query_boolean($name, false)) {
             $methodname = 'get_' . $name;
             $response[$name] = $this->context->{$methodname}();
         }
     }
     if ($this->request->query_boolean('setup', false)) {
         $response['setup'] = $this->setup->to_jsono($this->context->is_admin());
     }
     if ($this->request->query_boolean('theme', false)) {
         $theme = new Theme($this->context);
         $response['theme'] = $theme->get_icons();
     }
     if ($this->request->query('items', false)) {
         $href = $this->request->query('items.href');
         $what = $this->request->query_numeric('items.what');
         $response['items'] = $this->context->get_items($href, $what);
     }
     if ($this->request->query('custom', false)) {
         Util::json_fail(Util::ERR_DISABLED, 'custom disabled', !$this->context->query_option('custom.enabled', false));
         $href = $this->request->query('custom');
         $custom = new Custom($this->context);
         $response['custom'] = $custom->get_customizations($href);
     }
     if ($this->request->query('l10n', false)) {
         Util::json_fail(Util::ERR_DISABLED, 'l10n disabled', !$this->context->query_option('l10n.enabled', false));
         $iso_codes = $this->request->query_array('l10n');
         $iso_codes = array_filter($iso_codes);
         $response['l10n'] = $this->context->get_l10n($iso_codes);
     }
     if ($this->request->query('search', false)) {
         Util::json_fail(Util::ERR_DISABLED, 'search disabled', !$this->context->query_option('search.enabled', false));
         $href = $this->request->query('search.href');
         $pattern = $this->request->query('search.pattern');
         $search = new Search($this->context);
         $response['search'] = $search->get_items($href, $pattern);
     }
     if ($this->request->query('thumbs', false)) {
         Util::json_fail(Util::ERR_DISABLED, 'thumbnails disabled', !$this->context->query_option('thumbnails.enabled', false));
         Util::json_fail(Util::ERR_UNSUPPORTED, 'thumbnails not supported', !$this->setup->get('HAS_PHP_JPEG'));
         $thumbs = $this->request->query_array('thumbs');
         $response['thumbs'] = $this->context->get_thumbs($thumbs);
     }
     Util::json_exit($response);
 }
开发者ID:Txuritan,项目名称:h5ai,代码行数:48,代码来源:class-api.php

示例2: foreach

         $songs = $album->get_songs();
         foreach ($songs as $song) {
             $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
         }
     }
     break;
 case 'playlist':
     $playlist = new Playlist($_REQUEST['playlist_id']);
     $songs = $playlist->get_songs();
     foreach ($songs as $song) {
         $media_ids[] = array('object_type' => 'song', 'object_id' => $song);
     }
     break;
 case 'smartplaylist':
     $playlist = new Search('song', $_REQUEST['playlist_id']);
     $items = $playlist->get_items();
     foreach ($items as $item) {
         $media_ids[] = array('object_type' => $item['object_type'], 'object_id' => $item['object_id']);
     }
     break;
 case 'playlist_random':
     $playlist = new Playlist($_REQUEST['playlist_id']);
     $media_ids = $playlist->get_random_items();
     break;
 case 'random':
     $matchlist = array();
     if ($_REQUEST['genre'][0] != '-1') {
         $matchlist['genre'] = $_REQUEST['genre'];
     }
     if ($_REQUEST['catalog'] != '-1') {
         $matchlist['catalog'] = $_REQUEST['catalog'];
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:stream.php

示例3: Search

        break;
    case 'delete_playlist':
        // If we made it here, we didn't have sufficient rights.
        UI::access_denied();
        break;
    case 'show_playlist':
        $playlist = new Search($_REQUEST['playlist_id'], 'song');
        $playlist->format();
        $object_ids = $playlist->get_items();
        require_once AmpConfig::get('prefix') . UI::find_template('show_search.inc.php');
        break;
    case 'update_playlist':
        $playlist = new Search($_REQUEST['playlist_id'], 'song');
        if ($playlist->has_access()) {
            $playlist->parse_rules(Search::clean_request($_REQUEST));
            $playlist->update();
            $playlist->format();
        } else {
            UI::access_denied();
            break;
        }
        $object_ids = $playlist->get_items();
        require_once AmpConfig::get('prefix') . UI::find_template('show_search.inc.php');
        break;
    default:
        $object_ids = $playlist->get_items();
        require_once AmpConfig::get('prefix') . UI::find_template('show_search.inc.php');
        break;
}
// switch on the action
UI::show_footer();
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:smartplaylist.php

示例4: _musicChilds


//.........这里部分代码省略.........
                     if ($album->id) {
                         $song_ids = $album->get_songs();
                         list($maxCount, $song_ids) = self::_slice($song_ids, $start, $count);
                         foreach ($song_ids as $song_id) {
                             $song = new Song($song_id);
                             $song->format();
                             $mediaItems[] = self::_itemSong($song, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'songs':
             switch (count($pathreq)) {
                 case 1:
                     // Get songs list
                     $catalogs = Catalog::get_catalogs();
                     foreach ($catalogs as $catalog_id) {
                         $catalog = Catalog::create_from_id($catalog_id);
                         $songs = $catalog->get_songs();
                         list($maxCount, $songs) = self::_slice($songs, $start, $count);
                         foreach ($songs as $song) {
                             $song->format();
                             $mediaItems[] = self::_itemSong($song, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'playlists':
             switch (count($pathreq)) {
                 case 1:
                     // Get playlists list
                     $pl_ids = Playlist::get_playlists();
                     list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
                     foreach ($pl_ids as $pl_id) {
                         $playlist = new Playlist($pl_id);
                         $playlist->format();
                         $mediaItems[] = self::_itemPlaylist($playlist, $parent);
                     }
                     break;
                 case 2:
                     // Get playlist's songs list
                     $playlist = new Playlist($pathreq[1]);
                     if ($playlist->id) {
                         $items = $playlist->get_items();
                         list($maxCount, $items) = self::_slice($items, $start, $count);
                         foreach ($items as $item) {
                             if ($item['object_type'] == 'song') {
                                 $song = new Song($item['object_id']);
                                 $song->format();
                                 $mediaItems[] = self::_itemSong($song, $parent);
                             }
                         }
                     }
                     break;
             }
             break;
         case 'smartplaylists':
             switch (count($pathreq)) {
                 case 1:
                     // Get playlists list
                     $pl_ids = Search::get_searches();
                     list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
                     foreach ($pl_ids as $pl_id) {
                         $playlist = new Search($pl_id, 'song');
                         $playlist->format();
                         $mediaItems[] = self::_itemPlaylist($playlist, $parent);
                     }
                     break;
                 case 2:
                     // Get playlist's songs list
                     $playlist = new Search($pathreq[1], 'song');
                     if ($playlist->id) {
                         $items = $playlist->get_items();
                         list($maxCount, $items) = self::_slice($items, $start, $count);
                         foreach ($items as $item) {
                             if ($item['object_type'] == 'song') {
                                 $song = new Song($item['object_id']);
                                 $song->format();
                                 $mediaItems[] = self::_itemSong($song, $parent);
                             }
                         }
                     }
                     break;
             }
             break;
         default:
             $mediaItems[] = self::_musicMetadata('artists');
             $mediaItems[] = self::_musicMetadata('albums');
             $mediaItems[] = self::_musicMetadata('songs');
             $mediaItems[] = self::_musicMetadata('playlists');
             $mediaItems[] = self::_musicMetadata('smartplaylists');
             break;
     }
     if ($maxCount == 0) {
         $maxCount = count($mediaItems);
     }
     return array($maxCount, $mediaItems);
 }
开发者ID:nioc,项目名称:ampache,代码行数:101,代码来源:upnp_api.class.php


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