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


PHP Song::getId方法代码示例

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


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

示例1: addSong

 /**
  * Add a song to the library
  *
  * @param artist_id  int: the related artist primary key
  * @param album_id   int: the related album primary key
  * @param genre_id   int: the related genre primary key
  * @param song_array array: the array of song info
  * @return          int: the song insert id
  * @see apps/client/lib/MediaScan.class.php for information about the song_array
  */
 public function addSong($artist_id, $album_id, $last_scan_id, $song_array)
 {
     if (isset($song_array['filename']) && !empty($song_array['filename']) && isset($song_array['mtime']) && !empty($song_array['mtime']) && $last_scan_id) {
         $song = new Song();
         $song->unique_id = sha1(uniqid('', true) . mt_rand(1, 99999999));
         $song->artist_id = (int) $artist_id;
         $song->album_id = (int) $album_id;
         $song->scan_id = (int) $last_scan_id;
         $song->name = $song_array['song_name'];
         $song->length = $song_array['song_length'];
         $song->accurate_length = (int) $song_array['accurate_length'];
         $song->filesize = (int) $song_array['filesize'];
         $song->bitrate = (int) $song_array['bitrate'];
         $song->yearpublished = (int) $song_array['yearpublished'];
         $song->tracknumber = (int) $song_array['tracknumber'];
         $song->label = $song_array['label'];
         $song->mtime = (int) $song_array['mtime'];
         $song->atime = (int) $song_array['atime'];
         $song->filename = $song_array['filename'];
         $song->save();
         $id = $song->getId();
         $song->free();
         unset($song, $song_array);
         return $id;
     }
     return false;
 }
开发者ID:Alenpiera,项目名称:streeme,代码行数:37,代码来源:SongTable.class.php

示例2: addslashes

# Process sign in
if (isset($_POST['signin']) && empty($_POST['signin']) && !empty($_POST['username']) && !empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['password-confirm']) && $_POST['password'] === $_POST['password-confirm']) {
    $user = addslashes(htmlspecialchars($_POST['username']));
    $email = addslashes(htmlspecialchars($_POST['email']));
    $passwd = addslashes(htmlspecialchars($_POST['password']));
    User::create($user, $email, $passwd);
    $_SESSION['signedIn'] = true;
}
# Process comment
if (isset($_POST['comment']) && isset($_POST['song']) && is_numeric($_POST['song']) && isset($_POST['text']) && !empty($_POST['text']) && preg_match("/[a-zA-Z0-9]/", trim($_POST['text'])) && isset($_SESSION['online']) && $_SESSION['online']) {
    $db = $_SESSION['db'];
    $song = new Song($_POST['song']);
    $user_id = $_SESSION['user']->getId();
    $text = preg_replace("/_3/", "&hearts;", htmlspecialchars(trim(preg_replace("/<3/", "_3", $_POST['text']))));
    $stmt = $song->userHasCommented($user_id) ? $db->prepare("update comment set text = :text, date = unix_timestamp() where user = :user and song = :song;") : $db->prepare("insert into comment (user, song, text, date) values (:user, :song, :text, unix_timestamp());");
    $stmt->execute(array("user" => $user_id, "song" => $song->getId(), "text" => $text));
    $stmt->closeCursor();
    $_SESSION['commented'] = true;
}
# Process regular search
/**
 * @author Jérôme Boesch
 * 
 */
if (isset($_GET['q']) && !empty($_GET['q'])) {
    $db = $_SESSION['db'];
    $q = htmlspecialchars($_GET['q']);
    $search_songs = array();
    $search_albums = array();
    $search_artists = array();
    $search_users = array();
开发者ID:parmindersingh1,项目名称:musiclib,代码行数:31,代码来源:process.php


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