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


PHP album类代码示例

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


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

示例1: insert

 function insert()
 {
     global $database_table_prefix;
     if (!empty($this->artist)) {
         $result = mysql_query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `" . $database_table_prefix . "artist`\n\t\t\t\tWHERE `name` = '" . addslashes($this->artist) . "'\n\t\t\t") or die(mysql_error());
         if (mysql_num_rows($result) == 0) {
             $artist = new artist();
             $artist->name = $this->artist;
             $artist->insert();
             $this->artist_id = $artist->id;
         } else {
             while ($data = mysql_fetch_object($result)) {
                 $this->artist_id = $data->id;
             }
         }
     }
     if (!empty($this->album)) {
         $result = mysql_query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `" . $database_table_prefix . "album`\n\t\t\t\tWHERE `name` = '" . addslashes($this->album) . "'\n\t\t\t\tAND `artist` = '" . addslashes($this->artist_id) . "'\n\t\t\t") or die(mysql_error());
         if (mysql_num_rows($result) == 0) {
             $album = new album();
             $album->name = $this->album;
             $album->artist = $this->artist_id;
             $album->insert();
             $this->album_id = $album->id;
         } else {
             while ($data = mysql_fetch_object($result)) {
                 $this->album_id = $data->id;
             }
         }
     }
     $result = mysql_query("\n\t\t\tINSERT \n\t\t\tINTO `" . $database_table_prefix . "song`\n\t\t\t( `name`\n\t\t\t, `rating`\n\t\t\t, `play_count`\n\t\t\t, `artist`\n\t\t\t, `album`\n\t\t\t)\n\t\t\tVALUES \n\t\t\t( '" . addslashes($this->name) . "'\n\t\t\t, '" . addslashes($this->rating) . "'\n\t\t\t, '" . addslashes($this->play_count) . "'\n\t\t\t, '" . addslashes($this->artist_id) . "'\n\t\t\t, '" . addslashes($this->album_id) . "'\n\t\t\t)\n\t\t") or die(mysql_error());
     $this->id = mysql_insert_id();
 }
开发者ID:bajmhunter,项目名称:iTunes-Stats,代码行数:33,代码来源:objects.inc.php

示例2: comGetImage

 function comGetImage()
 {
     if (isset($this->data['page']) && isset($this->data['count'])) {
         $listMedia = $this->album->getMedia($this->data['id'], null, $this->data['page'], $this->data['count']);
     } else {
         $listMedia = $this->album->getMedia($this->data['id']);
         $this->data['page'] = 1;
         $this->data['count'] = count($listMedia);
     }
     $xml = '<?xml version="1.0" encoding="UTF-8" ?>
   <RESPONSE>
     <INFO>
       <COMMAND>' . $this->command . '</COMMAND>
       <ID>' . $this->data['id'] . '</ID>
       <PAGE>' . $this->data['page'] . '</PAGE>
       <COUNT>' . $this->data['count'] . '</COUNT>
     </INFO>
     <DATA>';
     foreach ($listMedia as $value) {
         $mime = explode('/', $value['mime']);
         $xml .= '
     <IMAGE>
       <ID>' . $value['id'] . '</ID>
       <ALBUM>' . $value['aid'] . '</ALBUM>
       <TITLE>' . $value['title'] . '</TITLE>
       <DESCRIPTION>' . $value['desc'] . '</DESCRIPTION>
       <WIDTH>' . $value['width'] . '</WIDTH>
       <HEIGHT>' . $value['height'] . '</HEIGHT>
       <DURATION>' . $value['duration'] . '</DURATION>
       <SIZE>' . $value['size'] . '</SIZE>
       <DATE>' . $value['firstdate'] . '</DATE>
       <MIME>
         <GROUP>' . $mime[0] . '</GROUP>
         <TYPE>' . $mime[1] . '</TYPE>
       </MIME>
       <USER>
         <ID>' . $value['uid'] . '</ID>
         <NAME>' . $value['username'] . '</NAME>
         <FIRSTNAME></FIRSTNAME>
         <LASTNAME></LASTNAME>
       </USER>
     </IMAGE>
   ';
     }
     $xml .= '
     </DATA>
   </RESPONSE>';
     $xml = preg_replace('/(\\s*)(.*)\\n/', "\\2\n", $xml);
     $xml = preg_replace('/>(\\s*)\\n(\\s*)</', "><", $xml);
     $this->html = $xml;
 }
开发者ID:Ashaan,项目名称:phpgallery,代码行数:51,代码来源:ajax.php

示例3: initialize

 protected function initialize()
 {
     $this->album = album::getInstance();
     if ($this->data['id'] == '-1') {
         $this->imageinfo = array('name' => 'album.png');
         $session = session::getInstance();
         $this->pathname = LOCAL_PATH . LOCAL_DIR . 'theme/' . $session->getData('theme') . '/image/';
     } else {
         $this->imageinfo = $this->album->getMediaInfo($this->data['id']);
         $this->pathname = LOCAL_PATH . LOCAL_DIR . 'data/' . $this->imageinfo['path'] . '/';
     }
     if (!$this->imageinfo) {
         $this->error('4', 'album inexistant');
     }
     $this->width = isset($this->data['w']) ? $this->data['w'] : false;
     $this->height = isset($this->data['h']) ? $this->data['h'] : false;
     $this->mask = isset($this->data['m']) ? $this->data['m'] : false;
     $this->trans = isset($this->data['t']) ? $this->data['t'] : false;
     $this->pathcache = LOCAL_PATH . LOCAL_DIR . 'cache/';
     $this->filecache = $this->getCacheName();
     $this->filename = $this->imageinfo['name'];
     $mime = parse_ini_file('include/mime.ini');
     $this->mime = $mime[strtolower(substr($this->imageinfo['name'], strrpos($this->imageinfo['name'], '.') + 1, strlen($this->imageinfo['name'])))];
     if (!$this->mime) {
         return false;
     }
     $this->type = explode('/', $this->mime);
 }
开发者ID:Ashaan,项目名称:phpgallery,代码行数:28,代码来源:image.php

示例4: getInstance

 public static function getInstance()
 {
     if (is_null(album::$instance)) {
         album::$instance = new album();
     }
     return album::$instance;
 }
开发者ID:Ashaan,项目名称:phpgallery,代码行数:7,代码来源:album.php

示例5: resize_url_test

 public function resize_url_test()
 {
     $rand = rand();
     $root = ORM::factory("item", 1);
     $album = album::create($root, $rand, $rand, $rand);
     $photo = photo::create($album, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
     $this->assert_equal("http://./var/resizes/{$rand}/{$rand}.jpg", $photo->resize_url());
 }
开发者ID:xafr,项目名称:gallery3,代码行数:8,代码来源:Photo_Helper_Test.php

示例6: create_photo_creates_reasonable_slug_test

 public function create_photo_creates_reasonable_slug_test()
 {
     $rand = rand();
     $root = ORM::factory("item", 1);
     $album = album::create($root, $rand, $rand, $rand);
     $photo = photo::create($album, MODPATH . "gallery/tests/test.jpg", "This (is) my file%name.jpg", $rand, $rand);
     $this->assert_equal("This-is-my-file-name", $photo->slug);
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:8,代码来源:Photo_Helper_Test.php

示例7: getAlbum

 /**
  **/
 function getAlbum($id)
 {
     $result = array();
     $sql = " SELECT SQL_NO_CACHE * FROM Album WHERE IDAlbum = :id ";
     $params = array(":id" => $id);
     $sth = $this->db->prepare($sql);
     $sth->execute($params);
     if ($sth->rowCount() == 1) {
         $response = $sth->fetch(PDO::FETCH_OBJ);
         $album = new album();
         //-----
         $album->init($response->IDAlbum, $response->Title, $response->Cover, $response->Artist);
         $album->setTracks($this->getAlbumTracks($response->IDAlbum));
         array_push($result, $album);
     }
     return $result;
 }
开发者ID:artz20,项目名称:playlists-par-deezer,代码行数:19,代码来源:WebPlayerDB.class.php

示例8: initialize

 public function initialize()
 {
     $this->template = template::getInstance();
     $this->session = session::getInstance();
     $this->album = album::getInstance();
     $this->template->add(array('album'));
     $this->id = $this->session->getData('album', 'id');
     $this->page = $this->session->getData('album', 'page');
 }
开发者ID:Ashaan,项目名称:phpgallery,代码行数:9,代码来源:album.php

示例9: deleting_an_item_deletes_its_comments_too_test

 public function deleting_an_item_deletes_its_comments_too_test()
 {
     $rand = rand();
     $album = album::create(ORM::factory("item", 1), "test_{$rand}", "test_{$rand}");
     $comment = comment::create($album, identity::guest(), "text_{$rand}", "name_{$rand}", "email_{$rand}", "url_{$rand}");
     $album->delete();
     $deleted_comment = ORM::factory("comment", $comment->id);
     $this->assert_false($deleted_comment->loaded);
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:9,代码来源:Comment_Event_Test.php

示例10: _get_form

 private function _get_form()
 {
     $form = new Forge("admin/default_sort", "", "post", array("id" => "g-admin-default_sort-form"));
     $group = $form->group("sort_order")->label(t("Sort Order"));
     $group->dropdown("sort_column")->id(t("sort_column"))->label(t("Sort by"))->options(array_merge(array("none" => t("None")), album::get_sort_order_options()))->selected(module::get_var("default_sort", "default_sort_column", "none"));
     $group->dropdown("sort_direction")->id(t("sort_direction"))->label(t("Sort by"))->options(array("none" => t("None"), "ASC" => t("Ascending"), "DESC" => t("Descending")))->selected(module::get_var("default_sort", "default_sort_direction", "none"));
     $form->submit("submit")->value(t("Save"));
     return $form;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:9,代码来源:admin_default_sort.php

示例11: add_from_server

 static function add_from_server($task)
 {
     $context = unserialize($task->context);
     try {
         $paths = array_keys(unserialize(module::get_var("server_add", "authorized_paths")));
         $path = $paths[$context["next_path"]];
         if (!empty($context["files"][$path])) {
             $file = $context["files"][$path][$context["position"]];
             $parent = ORM::factory("item", $file["parent_id"]);
             access::required("server_add", $parent);
             access::required("add", $parent);
             if (!$parent->is_album()) {
                 throw new Exception("@todo BAD_ALBUM");
             }
             $name = $file["name"];
             if ($file["type"] == "album") {
                 $album = ORM::factory("item")->where("name", $name)->where("parent_id", $parent->id)->find();
                 if (!$album->loaded) {
                     $album = album::create($parent, $name, $name, null, user::active()->id);
                 }
                 // Now that we have a new album. Go through the remaining files to import and change the
                 // parent_id of any file that has the same relative path as this album's path.
                 $album_path = "{$file['path']}/{$name}";
                 for ($idx = $context["position"] + 1; $idx < count($context["files"][$path]); $idx++) {
                     if (strpos($context["files"][$path][$idx]["path"], $album_path) === 0) {
                         $context["files"][$path][$idx]["parent_id"] = $album->id;
                     }
                 }
             } else {
                 $extension = strtolower(substr(strrchr($name, '.'), 1));
                 $source_path = "{$path}{$file['path']}/{$name}";
                 if (in_array($extension, array("flv", "mp4"))) {
                     $movie = movie::create($parent, $source_path, $name, $name, null, user::active()->id);
                 } else {
                     $photo = photo::create($parent, $source_path, $name, $name, null, user::active()->id);
                 }
             }
             $context["counter"]++;
             if (++$context["position"] >= count($context["files"][$path])) {
                 $context["next_path"]++;
                 $context["position"] = 0;
             }
         } else {
             $context["next_path"]++;
         }
     } catch (Exception $e) {
         $context["errors"][$path] = $e->getMessage();
     }
     $task->context = serialize($context);
     $task->state = "success";
     $task->percent_complete = $context["counter"] / (double) $context["total"] * 100;
     $task->done = $context["counter"] == (double) $context["total"];
 }
开发者ID:xafr,项目名称:gallery3,代码行数:53,代码来源:server_add_task.php

示例12: create_album_silently_trims_trailing_periods_test

 public function create_album_silently_trims_trailing_periods_test()
 {
     $rand = rand();
     $root = ORM::factory("item", 1);
     try {
         $album = album::create($root, $rand . "..", $rand, $rand);
     } catch (Exception $e) {
         $this->assert_equal("@todo NAME_CANNOT_END_IN_PERIOD", $e->getMessage());
         return;
     }
     $this->assert_true(false, "Shouldn't create an album with trailing . in the name");
 }
开发者ID:xafr,项目名称:gallery3,代码行数:12,代码来源:Album_Helper_Test.php

示例13: viewable_test

 public function viewable_test()
 {
     $root = ORM::factory("item", 1);
     $album = album::create($root, rand(), rand(), rand());
     $item = self::_create_random_item($album);
     identity::set_active_user(identity::guest());
     // We can see the item when permissions are granted
     access::allow(identity::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
     // We can't see the item when permissions are denied
     access::deny(identity::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", "=", $item->id)->count_all());
 }
开发者ID:viosca,项目名称:gallery3,代码行数:13,代码来源:Item_Helper_Test.php

示例14: cant_view_comments_for_unviewable_items_test

 public function cant_view_comments_for_unviewable_items_test()
 {
     $root = ORM::factory("item", 1);
     $album = album::create($root, rand(), rand(), rand());
     $comment = comment::create($album, user::guest(), "text", "name", "email", "url");
     user::set_active(user::guest());
     // We can see the comment when permissions are granted on the album
     access::allow(group::everybody(), "view", $album);
     $this->assert_equal(1, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
     // We can't see the comment when permissions are denied on the album
     access::deny(group::everybody(), "view", $album);
     $this->assert_equal(0, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all());
 }
开发者ID:Okat,项目名称:gallery3,代码行数:13,代码来源:Comment_Model_Test.php

示例15: setup

 public function setup()
 {
     $this->_server = $_SERVER;
     $root = ORM::factory("item", 1);
     $this->_album = album::create($root, rand(), "test album");
     access::deny(identity::everybody(), "view_full", $this->_album);
     access::deny(identity::registered_users(), "view_full", $this->_album);
     $rand = rand();
     $this->_item = photo::create($this->_album, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
     $this->_proxy = ORM::factory("digibug_proxy");
     $this->_proxy->uuid = md5(rand());
     $this->_proxy->item_id = $this->_item->id;
     $this->_proxy->save();
 }
开发者ID:viosca,项目名称:gallery3,代码行数:14,代码来源:Digibug_Controller_Test.php


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