PageRenderTime 103ms CodeModel.GetById 61ms app.highlight 7ms RepoModel.GetById 33ms app.codeStats 0ms

/src/plugins/wordpress-web-service/includes/wpws-valueobjects.php

http://wordpress-web-service.googlecode.com/
PHP | 159 lines | 136 code | 9 blank | 14 comment | 2 complexity | 4424507f06e7712fd6f0a5198cd3b883 MD5 | raw file
  1<?php
  2
  3/* SOAP compatible Post definition */
  4class wpws_Post {
  5	public $id;
  6	public $author;
  7	public $date;
  8	public $dateGmt;
  9	public $content;
 10	public $title;
 11	public $excerpt;
 12	public $status;
 13	public $commentStatus;
 14	public $pingStatus;
 15	public $password;
 16	public $name;
 17	public $toPing;
 18	public $pinged;
 19	public $modified;
 20	public $modifiedGmt;
 21	public $contentFiltered;
 22	public $parentId;
 23	public $guid;
 24	public $menuOrder;
 25	public $type;
 26	public $mimeType;
 27	public $commentCount;
 28	public $filter;
 29 
 30	function __construct($id, $author, $date, $dateGmt,
 31						 $content, $title, $excerpt,
 32						 $status, $commentStatus, $pingStatus,
 33						 $password, $name, $toPing, $pinged,
 34						 $modified, $modifiedGmt, $contentFiltered,
 35						 $parentId, $guid, $menuOrder, $type, $mimeType,
 36						 $commentCount, $filter) {
 37		$this->id = $id;
 38		$this->author = $author;
 39		$this->date = $date;
 40		$this->dateGmt = $dateGmt;
 41		$this->content = $content;
 42		$this->title = $title;
 43		$this->excerpt = $excerpt;
 44		$this->status = $status;
 45		$this->commentStatus = $commentStatus;
 46		$this->pingStatus = $pingStatus;
 47		$this->password = $password;
 48		$this->name = $name;
 49		$this->toPing = $toPing;
 50		$this->pinged = $pinged;
 51		$this->modified = $modified;
 52		$this->modifiedGmt = $modifiedGmt;
 53		$this->contentFiltered = $contentFiltered;
 54		$this->parentId = $parentId;
 55		$this->guid = $guid;
 56		$this->menuOrder = $menuOrder;
 57		$this->type = $type;
 58		$this->mimeType = $mimeType;
 59		$this->commentCount = $commentCount;
 60		$this->filter = $filter;
 61	}
 62	
 63	/**
 64	 * Converts a post retrieved trough the WordPress method get_post
 65	 * to a wpws_Post object.
 66	 * @return wpws_Post
 67	 */
 68	function convert($post) {
 69		if(!$post) return null;
 70		else {
 71			$wpws_post = new wpws_Post(
 72					intval($post->ID),
 73					$post->post_author,
 74					$post->post_date,
 75					$post->post_date_gmt,
 76					$post->post_content,
 77					$post->post_title,
 78					$post->post_excerpt,
 79					$post->post_status,
 80					$post->comment_status,
 81					$post->ping_status,
 82					$post->post_password,
 83					$post->post_name,
 84					$post->to_ping,
 85					$post->pinged,
 86					$post->post_modified,
 87					$post->post_modified_gmt,
 88					$post->post_content_filtered,
 89					intval($post->post_parent),
 90					$post->guid,
 91					intval($post->menu_order),
 92					$post->post_type,
 93					$post->post_mime_type,
 94					$post->comment_count,
 95					$post->filter);
 96			return $wpws_post;
 97		}
 98	}
 99}
100
101/* SOAP compatible Page definition */
102class wpws_Page extends wpws_Post {
103	/**
104	 * Converts a page retrieved trough the WordPress method get_page
105	 * to a wpws_Page object.
106	 * @return wpws_Page
107	 */
108	function convert($page) {
109		return parent::convert($page);
110	}
111}
112
113/* SOAP compatible Gallery definition */
114class wpws_Gallery {
115	public $id;
116	public $parentId;
117	public $title;
118	public $description;
119	public $mainImage;
120	public $images;
121	public $subGalleries;
122	
123	function __construct($id, $parentId, $title, $description, $mainImage, $images, $subGalleries) {
124		$this->id = $id;
125		$this->parentId = $parentId;
126		$this->title = $title;
127		$this->description = $description;
128		$this->mainImage = $mainImage;		
129		$this->images = $images;
130		$this->subGalleries = $subGalleries;
131	}
132}
133
134/* SOAP compatible Image definition */
135class wpws_Image {
136	public $parentId;
137	public $url;
138	public $width;
139	public $height;
140	public $resizeableUrl;
141	public $maxResizeableWidth;
142	public $maxResizeableHeight;
143	public $title;
144	public $description;
145	
146	function __construct($parentId, $url, $width, $height, $resizeableUrl, $maxResizeableWidth, $maxResizeableHeight, $title, $description) {
147		$this->parentId = $parentId;
148		$this->url = $url;
149		$this->width = $width;
150		$this->height = $height;
151		$this->resizeableUrl = $resizeableUrl;
152		$this->maxResizeableWidth = $maxResizeableWidth;
153		$this->maxResizeableHeight = $maxResizeableHeight;
154		$this->title = $title;
155		$this->description = $description;
156	}
157}
158
159?>