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


PHP Playlist::setPath方法代码示例

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


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

示例1: openPlaylist

 /**
  * Open playlist by full path, including filename.
  * @param String $fullPath
  * @return Playlist
  */
 private function openPlaylist($fullPath)
 {
     $playlist = new Playlist();
     if ($fullPath) {
         $xml = @simplexml_load_file($fullPath, 'SimpleXMLElement', LIBXML_NOCDATA);
         if (!$xml) {
             throw new Exception("Error loading Playlist on '" . $fullPath . "'.");
         }
         $attributes = $xml->attributes();
         $playlist->setFilename((string) basename($fullPath));
         $playlist->setPath((string) dirname($fullPath));
         if ($attributes['name']) {
             $playlist->setName((string) $attributes['name']);
         }
         if ($attributes['description']) {
             $playlist->setDescription((string) $attributes['description']);
         }
         //Get playlist links
         foreach ($xml->children() as $second_gen) {
             $playlistLink = new PlaylistLink();
             //Get node attributes
             $attributes = $second_gen->attributes();
             $playlistLink->setKey((string) $attributes['key']);
             if ($attributes['type']) {
                 $playlistLink->setType((string) $attributes['type']);
             }
             if ($attributes['thumbnail']) {
                 $playlistLink->setThumbnail((string) $attributes['thumbnail']);
             }
             //Get child nodes
             if ($second_gen->title) {
                 $playlistLink->setTitle((string) $second_gen->title);
             }
             if ($second_gen->description) {
                 $playlistLink->setDescription((string) $second_gen->description);
             }
             if ($second_gen->format) {
                 $playlistLink->setFormat((string) $second_gen->format);
             }
             if ($second_gen->filename) {
                 $playlistLink->setFilename((string) $second_gen->filename);
             }
             if ($second_gen->link) {
                 $playlistLink->setLink((string) $second_gen->link);
             }
             if ($second_gen->language) {
                 $playlistLink->setLanguage((string) $second_gen->language);
             }
             //Get ids
             $order = 1;
             $second_gen = $second_gen->part;
             foreach ($second_gen->children() as $third_gen) {
                 $attributes = $third_gen->attributes();
                 if ($attributes['order']) {
                     $playlistLink->addId((int) $attributes['order'], (string) $third_gen);
                 } else {
                     ++$order;
                     $playlistLink->addId((int) $order, (string) $third_gen);
                 }
             }
             //Add link to playlist
             $playlist->addPlaylistLink($playlistLink);
         }
     }
     return $playlist;
 }
开发者ID:johnymarek,项目名称:eboda-hd-for-all-500,代码行数:71,代码来源:ViewPlaylistPageAction.php


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