Changeset 2380
- Timestamp:
- 06/21/10 13:34:53 (13 years ago)
- Location:
- plugins/dotajax
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dotajax/_define.php
r1946 r2380 26 26 /* Description*/ "Ajax/JSON interface for Dotclear2", 27 27 /* Author */ "Bruno Hondelatte", 28 /* Version */ '1. 0.1',28 /* Version */ '1.1', 29 29 /* Permissions */ 'usage,contentadmin', 30 30 /* Priority */ 500 31 31 ); 32 32 33 /* URL Handlers for REST API */34 $GLOBALS['core']->url->register('rest','rest','^rest/(.+)$',array('urlRest','rest'));35 33 36 34 ?> -
plugins/dotajax/_public.php
r1679 r2380 23 23 require dirname(__FILE__).'/class.blogrest.php'; 24 24 25 /* URL Handlers for REST API */ 26 $GLOBALS['core']->url->register('rest','rest','^rest/(.+)$',array('urlRest','rest')); 27 25 28 $GLOBALS['core']->pubrest->register('blog','blogRest'); 26 29 -
plugins/dotajax/class.blogrest.php
r1946 r2380 203 203 } 204 204 205 206 public static function getPostMedia($core,$get) 207 { 208 if (!isset($get['post_id'])) 209 throw new Exception ('No post ID specified'); 210 211 $post_id = (integer) $get['post_id']; 212 $media_id=isset($get['media_id'])?(integer)$get['media_id']:null; 213 214 $rs = $core->media->getPostMedia($post_id,$media_id); 215 216 $rsp = array(); 217 foreach ($rs as $m) 218 { 219 $media=array( 220 'url'=> $m->file_url, 221 'id'=> $m->media_id, 222 'title'=> $m->media_title, 223 'dt' => $m->media_dt, 224 'thumbs' => $m->media_thumb); 225 226 $rsp[]=$media; 227 } 228 return $rsp; 229 } 230 231 public static function getMedia($core,$get) 232 { 233 if (!isset($get['media_id'])) 234 throw new Exception ('No media ID specified'); 235 236 $media_id = (integer) $get['media_id']; 237 $media_id=isset($get['media_id'])?(integer)$get['media_id']:null; 238 239 $m = $core->media->getFile($media_id); 240 if ($m == null) 241 throw new Exception ('Media not found'); 242 $rsp=array( 243 'url'=> $m->file_url, 244 'id'=> $m->media_id, 245 'title'=> $m->media_title, 246 'dt' => $m->media_dt, 247 'thumbs' => $m->media_thumb); 248 249 return $rsp; 250 } 205 251 } 206 252 ?>
Note: See TracChangeset
for help on using the changeset viewer.