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