Changeset 400869
- Timestamp:
- 06/24/2011 03:11:30 PM (15 years ago)
- Location:
- html5avmanager
- Files:
-
- 79 added
- 6 edited
-
tags/0.1.12 (added)
-
tags/0.1.12/api.php (added)
-
tags/0.1.12/html5avmanager.php (added)
-
tags/0.1.12/lib (added)
-
tags/0.1.12/lib/blank.js (added)
-
tags/0.1.12/lib/dbal.php (added)
-
tags/0.1.12/lib/jquery.js (added)
-
tags/0.1.12/lib/mediaelement (added)
-
tags/0.1.12/lib/mediaelement/Thumbs.db (added)
-
tags/0.1.12/lib/mediaelement/background.png (added)
-
tags/0.1.12/lib/mediaelement/bigplay.png (added)
-
tags/0.1.12/lib/mediaelement/controls-ted.png (added)
-
tags/0.1.12/lib/mediaelement/controls-wmp-bg.png (added)
-
tags/0.1.12/lib/mediaelement/controls-wmp.png (added)
-
tags/0.1.12/lib/mediaelement/controls.png (added)
-
tags/0.1.12/lib/mediaelement/flashmediaelement.swf (added)
-
tags/0.1.12/lib/mediaelement/jquery.js (added)
-
tags/0.1.12/lib/mediaelement/loading.gif (added)
-
tags/0.1.12/lib/mediaelement/mediaelement-and-player.js (added)
-
tags/0.1.12/lib/mediaelement/mediaelement-and-player.min.js (added)
-
tags/0.1.12/lib/mediaelement/mediaelement.js (added)
-
tags/0.1.12/lib/mediaelement/mediaelement.min.js (added)
-
tags/0.1.12/lib/mediaelement/mediaelementplayer.css (added)
-
tags/0.1.12/lib/mediaelement/mediaelementplayer.js (added)
-
tags/0.1.12/lib/mediaelement/mediaelementplayer.min.css (added)
-
tags/0.1.12/lib/mediaelement/mediaelementplayer.min.js (added)
-
tags/0.1.12/lib/mediaelement/mejs-skins.css (added)
-
tags/0.1.12/lib/mediaelement/silverlightmediaelement.xap (added)
-
tags/0.1.12/lib/model (added)
-
tags/0.1.12/lib/model/html5av_audio_video.php (added)
-
tags/0.1.12/lib/model/html5av_source.php (added)
-
tags/0.1.12/lib/model/html5av_track.php (added)
-
tags/0.1.12/lib/time.php (added)
-
tags/0.1.12/lib/uploadify (added)
-
tags/0.1.12/lib/uploadify/cancel.png (added)
-
tags/0.1.12/lib/uploadify/check.php (added)
-
tags/0.1.12/lib/uploadify/custom.php (added)
-
tags/0.1.12/lib/uploadify/expressInstall.swf (added)
-
tags/0.1.12/lib/uploadify/jquery.uploadify.js (added)
-
tags/0.1.12/lib/uploadify/uploadify.allglyphs.swf (added)
-
tags/0.1.12/lib/uploadify/uploadify.css (added)
-
tags/0.1.12/lib/uploadify/uploadify.fla (added)
-
tags/0.1.12/lib/uploadify/uploadify.swf (added)
-
tags/0.1.12/license.txt (added)
-
tags/0.1.12/readme.txt (added)
-
tags/0.1.12/screenshot-1.png (added)
-
tags/0.1.12/screenshot-2.png (added)
-
tags/0.1.12/screenshot-3.png (added)
-
tags/0.1.12/screenshot-4.png (added)
-
tags/0.1.12/screenshot-5.png (added)
-
tags/0.1.12/screenshot-6.png (added)
-
tags/0.1.12/screenshot-7.png (added)
-
tags/0.1.12/screenshot-8.png (added)
-
tags/0.1.12/sql (added)
-
tags/0.1.12/sql/main.sql (added)
-
tags/0.1.12/sql/update (added)
-
tags/0.1.12/sql/update/2.sql (added)
-
tags/0.1.12/view (added)
-
tags/0.1.12/view/admin (added)
-
tags/0.1.12/view/admin/audio-add-panel.php (added)
-
tags/0.1.12/view/admin/audio-edit-panel.php (added)
-
tags/0.1.12/view/admin/no-av.php (added)
-
tags/0.1.12/view/admin/settings-panel.php (added)
-
tags/0.1.12/view/admin/source-external-panel.php (added)
-
tags/0.1.12/view/admin/source-panel.php (added)
-
tags/0.1.12/view/admin/track-external-panel.php (added)
-
tags/0.1.12/view/admin/track-panel.php (added)
-
tags/0.1.12/view/admin/video-add-panel.php (added)
-
tags/0.1.12/view/admin/video-audio-manager-page.php (added)
-
tags/0.1.12/view/admin/video-audio-manager-pagenation.php (added)
-
tags/0.1.12/view/admin/video-audio-manager-panel.php (added)
-
tags/0.1.12/view/admin/video-edit-panel.php (added)
-
tags/0.1.12/view/admin/widget.php (added)
-
tags/0.1.12/view/videoaudio (added)
-
tags/0.1.12/view/videoaudio/audio-default.php (added)
-
tags/0.1.12/view/videoaudio/audio-xml.php (added)
-
tags/0.1.12/view/videoaudio/setting.php (added)
-
tags/0.1.12/view/videoaudio/video-default.php (added)
-
tags/0.1.12/view/videoaudio/video-xml.php (added)
-
trunk/html5avmanager.php (modified) (1 diff)
-
trunk/lib/dbal.php (modified) (5 diffs)
-
trunk/lib/model/html5av_audio_video.php (modified) (4 diffs)
-
trunk/lib/model/html5av_source.php (modified) (2 diffs)
-
trunk/lib/model/html5av_track.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
html5avmanager/trunk/html5avmanager.php
r399441 r400869 5 5 Plugin URI: http://cj-jackson.com/ 6 6 Description: A video manager with a Modal-View-Controller and video uploader. 7 Version: 0.1.1 17 Version: 0.1.12 8 8 Author: Christopher John Jackson 9 9 Author URI: http://cj-jackson.com/ -
html5avmanager/trunk/lib/dbal.php
r398851 r400869 27 27 $this->DB_PREFIX = $table_prefix . 'html5av_'; 28 28 $tempHost = explode(':', $this->DB_HOST); 29 if (isset($tempHost[1])) {29 if (isset($tempHost[1])) { 30 30 $port = $tempHost[1]; 31 31 } else { … … 34 34 unset($tempHost); 35 35 if (!is_numeric($port)) { 36 $host = "unix_socket=" . end(explode(':', $this->DB_HOST));36 $host = "unix_socket=" . end(explode(':', $this->DB_HOST)); 37 37 } else { 38 38 $array = explode(':', $this->DB_HOST); … … 43 43 unset($array); 44 44 } 45 parent::__construct('mysql:' . $host . ';dbname=' . $this->DB_NAME, 46 $this->DB_USER, $this->DB_PASSWD); 45 parent::__construct('mysql:' . $host . ';dbname=' . $this->DB_NAME, $this->DB_USER, $this->DB_PASSWD); 47 46 } 48 47 … … 69 68 70 69 public function updateTables() { 71 $curRev = (int) get_option('html5av_manager_dbrev');70 $curRev = (int) get_option('html5av_manager_dbrev'); 72 71 if ($curRev == self::DBRev) { 73 72 return; 74 73 } 75 76 if ($curRev < 2) {74 75 if ($curRev < 2) { 77 76 $this->execFile('update/2.sql'); 78 77 } 79 78 80 79 update_option('html5av_manager_dbrev', self::DBRev); 81 80 } … … 90 89 } 91 90 91 public function save($id, $attr, $table, $idname = 'ID') { 92 if ($id) { 93 $param = array(); 94 $names = array(); 95 foreach ($attr as $key => $value) { 96 $param[] = $value; 97 $names[] = '`' . $key . '`' . "=?"; 98 } 99 $names = implode(', ', $names); 100 $sql = "UPDATE `" . $this->getPrefix() . $table . "` 101 SET $names 102 WHERE `$idname`=?;"; 103 $prepare = $this->prepare($sql); 104 $param[] = $id; 105 $prepare->execute($param); 106 } else { 107 $param = array(); 108 $names = array(); 109 $values = array(); 110 foreach ($attr as $key => $value) { 111 $param[':param_' . $key] = $value; 112 $names[] = '`' . $key . '`'; 113 $values[] = ':param_' . $key; 114 } 115 $names = implode(', ', $names); 116 $values = implode(', ', $values); 117 $sql = "INSERT INTO `" . $this->getPrefix() . $table . "` ($names) 118 VALUES ($values);"; 119 $prepare = $this->prepare($sql); 120 $prepare->execute($param); 121 $id = $this->lastInsertId(); 122 } 123 if ($prepare->errorCode() != 00000) { 124 print_r($prepare->errorInfo()); 125 } 126 return $id; 127 } 128 129 public function delete($id, $table, $idname = 'ID') { 130 if ($id) { 131 $sql = "DELETE FROM `" . $this->getPrefix() . $table . "` WHERE `$idname`=?;"; 132 $prepare = $this->prepare($sql); 133 $prepare->execute(array($id)); 134 if ($prepare->errorCode() != 00000) { 135 print_r($prepare->errorInfo()); 136 } 137 return false; 138 } 139 return $id; 140 } 141 142 static public function toArray($objects, $name) { 143 $objects = (array) $objects; 144 $startPosition = strlen($name) + 1; 145 array_shift($objects); 146 $array = array(); 147 foreach ($objects as $property => $value) { 148 $array[(string) trim(substr($property, $startPosition))] = $value; 149 } 150 return $array; 151 } 152 92 153 } -
html5avmanager/trunk/lib/model/html5av_audio_video.php
r399441 r400869 3 3 class html5av_audio_video { 4 4 5 private $ID ;5 private $ID = false; 6 6 private $type; 7 7 private $poster_path; … … 17 17 18 18 public function getID() { 19 return $this->ID;19 return (int) $this->ID; 20 20 } 21 21 … … 139 139 140 140 public function save() { 141 $db = new html5av_dbal(); 142 $StartParam = array( 143 'type' => $this->type, 144 'poster_path' => $this->poster_path, 145 'poster_filename' => $this->poster_filename, 146 'width' => $this->width, 147 'height' => $this->height, 148 'view' => $this->view, 149 'title' => $this->title, 150 'alt' => $this->alt, 151 'author_id' => $this->author_id, 152 'created_on' => $this->created_on, 153 'modified' => $this->modified, 154 ); 155 if (isset($this->ID)) { 156 $param = array(); 157 $names = array(); 158 foreach ($StartParam as $key => $value) { 159 $param[] = $value; 160 $names[] = $key . "=?"; 161 } 162 $names = implode(', ', $names); 163 $sql = "UPDATE `" . $db->getPrefix() . "audio_video` 164 SET $names 165 WHERE ID=?;"; 166 $prepare = $db->prepare($sql); 167 $param[] = $this->ID; 168 $prepare->execute($param); 169 } else { 170 $param = array(); 171 $names = array(); 172 $values = array(); 173 foreach ($StartParam as $key => $value) { 174 $param[':' . $key] = $value; 175 $names[] = $key; 176 $values[] = ':' . $key; 177 } 178 $names = implode(', ', $names); 179 $values = implode(', ', $values); 180 $sql = "INSERT INTO `" . $db->getPrefix() . "audio_video` ($names) 181 VALUES ($values);"; 182 $prepare = $db->prepare($sql); 183 $prepare->execute($param); 184 $this->ID = $db->lastInsertId(); 185 } 141 $attr = html5av_dbal::toArray($this, __CLASS__); 142 $db = new html5av_dbal(); 143 $this->ID = $db->save($this->ID, $attr, 'audio_video'); 186 144 } 187 145 188 146 public function delete() { 189 if ( isset($this->ID)) {147 if ($this->ID) { 190 148 $sources = $this->getSources(true); 191 149 $tracks = $this->getTracks(true); … … 198 156 unlink($this->getPoster()); 199 157 $db = new html5av_dbal(); 200 $sql = "DELETE FROM `" . $db->getPrefix() . "audio_video` WHERE ID=?;"; 201 $prepare = $db->prepare($sql); 202 $prepare->execute(array($this->ID)); 203 unset($this->ID); 158 $this->ID = $db->delete($this->ID, 'audio_video'); 204 159 } 205 160 } -
html5avmanager/trunk/lib/model/html5av_source.php
r399441 r400869 3 3 class html5av_source { 4 4 5 private $ID ;5 private $ID = false; 6 6 private $order_no; 7 7 private $type; … … 116 116 117 117 public function save() { 118 $attr = html5av_dbal::toArray($this, __CLASS__); 118 119 $db = new html5av_dbal(); 119 $StartParam = array( 120 'order_no' => $this->order_no, 121 'type' => $this->type, 122 'external_mode' => $this->external_mode, 123 'external_url' => $this->external_url, 124 'upload_path' => $this->upload_path, 125 'upload_filename' => $this->upload_filename, 126 'disabled' => $this->disabled, 127 'audio_video_id' => $this->audio_video_id 128 ); 129 if (isset($this->ID)) { 130 $param = array(); 131 $names = array(); 132 foreach ($StartParam as $key => $value) { 133 $param[] = $value; 134 $names[] = $key . "=?"; 135 } 136 $names = implode(', ', $names); 137 $sql = "UPDATE `" . $db->getPrefix() . "source` 138 SET $names 139 WHERE ID=?;"; 140 $prepare = $db->prepare($sql); 141 $param[] = $this->ID; 142 $prepare->execute($param); 143 } else { 144 $param = array(); 145 $names = array(); 146 $values = array(); 147 foreach ($StartParam as $key => $value) { 148 $param[':' . $key] = $value; 149 $names[] = $key; 150 $values[] = ':' . $key; 151 } 152 $names = implode(', ', $names); 153 $values = implode(', ', $values); 154 $sql = "INSERT INTO `" . $db->getPrefix() . "source` ($names) 155 VALUES ($values);"; 156 $prepare = $db->prepare($sql); 157 $prepare->execute($param); 158 $this->ID = $db->lastInsertId(); 159 } 120 $this->ID = $db->save($this->ID, $attr, 'source'); 160 121 } 161 122 162 123 public function delete() { 163 if ( isset($this->ID)) {124 if ($this->ID) { 164 125 if (!$this->getExternalMode()) { 165 126 unlink($this->getSrc()); 166 127 } 167 128 $db = new html5av_dbal(); 168 $sql = "DELETE FROM `" . $db->getPrefix() . "source` WHERE ID=?;"; 169 $prepare = $db->prepare($sql); 170 $prepare->execute(array($this->ID)); 171 unset($this->ID); 129 $this->ID = $db->delete($this->ID, 'source'); 172 130 } 173 131 } -
html5avmanager/trunk/lib/model/html5av_track.php
r399441 r400869 3 3 class html5av_track { 4 4 5 private $ID ;5 private $ID = false; 6 6 private $order_no; 7 7 private $kind; … … 134 134 135 135 public function save() { 136 $attr = html5av_dbal::toArray($this, __CLASS__); 136 137 $db = new html5av_dbal(); 137 $StartParam = array( 138 'order_no' => $this->order_no, 139 'kind' => $this->kind, 140 'external_mode' => $this->external_mode, 141 'external_url' => $this->external_url, 142 'upload_path' => $this->upload_path, 143 'upload_filename' => $this->upload_filename, 144 'srclang' => $this->srclang, 145 'label' => $this->label, 146 'disabled' => $this->disabled, 147 'audio_video_id' => $this->audio_video_id 148 ); 149 if (isset($this->ID)) { 150 $param = array(); 151 $names = array(); 152 foreach ($StartParam as $key => $value) { 153 $param[] = $value; 154 $names[] = $key . "=?"; 155 } 156 $names = implode(', ', $names); 157 $sql = "UPDATE `" . $db->getPrefix() . "track` 158 SET $names 159 WHERE ID=?;"; 160 $prepare = $db->prepare($sql); 161 $param[] = $this->ID; 162 $prepare->execute($param); 163 } else { 164 $param = array(); 165 $names = array(); 166 $values = array(); 167 foreach ($StartParam as $key => $value) { 168 $param[':' . $key] = $value; 169 $names[] = $key; 170 $values[] = ':' . $key; 171 } 172 $names = implode(', ', $names); 173 $values = implode(', ', $values); 174 $sql = "INSERT INTO `" . $db->getPrefix() . "track` ($names) 175 VALUES ($values);"; 176 $prepare = $db->prepare($sql); 177 $prepare->execute($param); 178 $this->ID = $db->lastInsertId(); 179 } 138 $this->ID = $db->save($this->ID, $attr, 'track'); 180 139 } 181 140 182 141 public function delete() { 183 if ( isset($this->ID)) {142 if ($this->ID) { 184 143 if (!$this->getExternalMode()) { 185 144 unlink($this->getSrc()); 186 145 } 187 146 $db = new html5av_dbal(); 188 $sql = "DELETE FROM `" . $db->getPrefix() . "track` WHERE ID=?;"; 189 $prepare = $db->prepare($sql); 190 $prepare->execute(array($this->ID)); 191 unset($this->ID); 147 $this->ID = $db->delete($this->ID, 'track'); 192 148 } 193 149 } -
html5avmanager/trunk/readme.txt
r399441 r400869 5 5 Requires at least: 2.7 6 6 Tested up to: 3.2 7 Stable tag: 0.1.1 17 Stable tag: 0.1.12 8 8 9 9 A HTML5 Audio and Video manager that take full advantage of … … 62 62 == Changelog == 63 63 64 = 0.1.12 = 65 * Improved Save and Delete Method in each ORM, now reuses the same code. 66 64 67 = 0.1.11 = 65 68 * Unquoted magic quotes that WordPress loves to use, Thank you WordPress!
Note: See TracChangeset
for help on using the changeset viewer.