PageRenderTime 39ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/xampp/htdocs/magento/lib/Zend/Gdata/Photos/UserQuery.php

https://github.com/edmondscommerce/XAMPP-Magento-Demo-Site
PHP | 354 lines | 126 code | 29 blank | 199 comment | 18 complexity | e926a972ce03a1b87e0e656463700d92 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Photos
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_Gapps_Query
  23. */
  24. #require_once('Zend/Gdata/Gapps/Query.php');
  25. /**
  26. * Assists in constructing queries for user entries.
  27. * Instances of this class can be provided in many places where a URL is
  28. * required.
  29. *
  30. * For information on submitting queries to a server, see the
  31. * service class, Zend_Gdata_Photos.
  32. *
  33. * @category Zend
  34. * @package Zend_Gdata
  35. * @subpackage Photos
  36. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  37. * @license http://framework.zend.com/license/new-bsd New BSD License
  38. */
  39. class Zend_Gdata_Photos_UserQuery extends Zend_Gdata_Query
  40. {
  41. /**
  42. * Indicates the format of data returned in Atom feeds. Can be either
  43. * 'api' or 'base'. Default value is 'api'.
  44. *
  45. * @var string
  46. */
  47. protected $_projection = 'api';
  48. /**
  49. * Indicates whether to request a feed or entry in queries. Default
  50. * value is 'feed';
  51. *
  52. * @var string
  53. */
  54. protected $_type = 'feed';
  55. /**
  56. * A string which, if not null, indicates which user should
  57. * be retrieved by this query. If null, the default user will be used
  58. * instead.
  59. *
  60. * @var string
  61. */
  62. protected $_user = Zend_Gdata_Photos::DEFAULT_USER;
  63. /**
  64. * Create a new Query object with default values.
  65. */
  66. public function __construct()
  67. {
  68. parent::__construct();
  69. }
  70. /**
  71. * Set's the format of data returned in Atom feeds. Can be either
  72. * 'api' or 'base'. Normally, 'api' will be desired. Default is 'api'.
  73. *
  74. * @param string $value
  75. * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface
  76. */
  77. public function setProjection($value)
  78. {
  79. $this->_projection = $value;
  80. return $this;
  81. }
  82. /**
  83. * Gets the format of data in returned in Atom feeds.
  84. *
  85. * @see setProjection
  86. * @return string projection
  87. */
  88. public function getProjection()
  89. {
  90. return $this->_projection;
  91. }
  92. /**
  93. * Set's the type of data returned in queries. Can be either
  94. * 'feed' or 'entry'. Normally, 'feed' will be desired. Default is 'feed'.
  95. *
  96. * @param string $value
  97. * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface
  98. */
  99. public function setType($value)
  100. {
  101. $this->_type = $value;
  102. return $this;
  103. }
  104. /**
  105. * Gets the type of data in returned in queries.
  106. *
  107. * @see setType
  108. * @return string type
  109. */
  110. public function getType()
  111. {
  112. return $this->_type;
  113. }
  114. /**
  115. * Set the user to query for. When set, this user's feed will be
  116. * returned. If not set or null, the default user's feed will be returned
  117. * instead.
  118. *
  119. * @param string $value The user to retrieve, or null for the default
  120. * user.
  121. */
  122. public function setUser($value)
  123. {
  124. if ($value !== null) {
  125. $this->_user = $value;
  126. } else {
  127. $this->_user = Zend_Gdata_Photos::DEFAULT_USER;
  128. }
  129. }
  130. /**
  131. * Get the user which is to be returned.
  132. *
  133. * @see setUser
  134. * @return string The visibility to retrieve.
  135. */
  136. public function getUser()
  137. {
  138. return $this->_user;
  139. }
  140. /**
  141. * Set the visibility filter for entries returned. Only entries which
  142. * match this value will be returned. If null or unset, the default
  143. * value will be used instead.
  144. *
  145. * Valid values are 'all' (default), 'public', and 'private'.
  146. *
  147. * @param string $value The visibility to filter by, or null to use the
  148. * default value.
  149. */
  150. public function setAccess($value)
  151. {
  152. if ($value !== null) {
  153. $this->_params['access'] = $value;
  154. } else {
  155. unset($this->_params['access']);
  156. }
  157. }
  158. /**
  159. * Get the visibility filter for entries returned.
  160. *
  161. * @see setAccess
  162. * @return string The visibility to filter by, or null for the default
  163. * user.
  164. */
  165. public function getAccess()
  166. {
  167. return $this->_params['access'];
  168. }
  169. /**
  170. * Set the tag for entries that are returned. Only entries which
  171. * match this value will be returned. If null or unset, this filter will
  172. * not be applied.
  173. *
  174. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  175. * for a list of valid values.
  176. *
  177. * @param string $value The tag to filter by, or null if no
  178. * filter is to be applied.
  179. */
  180. public function setTag($value)
  181. {
  182. if ($value !== null) {
  183. $this->_params['tag'] = $value;
  184. } else {
  185. unset($this->_params['tag']);
  186. }
  187. }
  188. /**
  189. * Get the tag filter for entries returned.
  190. *
  191. * @see setTag
  192. * @return string The tag to filter by, or null if no filter
  193. * is to be applied.
  194. */
  195. public function getTag()
  196. {
  197. return $this->_params['tag'];
  198. }
  199. /**
  200. * Set the kind of entries that are returned. Only entries which
  201. * match this value will be returned. If null or unset, this filter will
  202. * not be applied.
  203. *
  204. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  205. * for a list of valid values.
  206. *
  207. * @param string $value The kind to filter by, or null if no
  208. * filter is to be applied.
  209. */
  210. public function setKind($value)
  211. {
  212. if ($value !== null) {
  213. $this->_params['kind'] = $value;
  214. } else {
  215. unset($this->_params['kind']);
  216. }
  217. }
  218. /**
  219. * Get the kind of entries to be returned.
  220. *
  221. * @see setKind
  222. * @return string The kind to filter by, or null if no filter
  223. * is to be applied.
  224. */
  225. public function getKind()
  226. {
  227. return $this->_params['kind'];
  228. }
  229. /**
  230. * Set the maximum image size for entries returned. Only entries which
  231. * match this value will be returned. If null or unset, this filter will
  232. * not be applied.
  233. *
  234. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  235. * for a list of valid values.
  236. *
  237. * @param string $value The image size to filter by, or null if no
  238. * filter is to be applied.
  239. */
  240. public function setImgMax($value)
  241. {
  242. if ($value !== null) {
  243. $this->_params['imgmax'] = $value;
  244. } else {
  245. unset($this->_params['imgmax']);
  246. }
  247. }
  248. /**
  249. * Get the maximum image size filter for entries returned.
  250. *
  251. * @see setImgMax
  252. * @return string The image size size to filter by, or null if no filter
  253. * is to be applied.
  254. */
  255. public function getImgMax()
  256. {
  257. return $this->_params['imgmax'];
  258. }
  259. /**
  260. * Set the thumbnail size filter for entries returned. Only entries which
  261. * match this value will be returned. If null or unset, this filter will
  262. * not be applied.
  263. *
  264. * See http://code.google.com/apis/picasaweb/reference.html#Parameters
  265. * for a list of valid values.
  266. *
  267. * @param string $value The thumbnail size to filter by, or null if no
  268. * filter is to be applied.
  269. */
  270. public function setThumbsize($value)
  271. {
  272. if ($value !== null) {
  273. $this->_params['thumbsize'] = $value;
  274. } else {
  275. unset($this->_params['thumbsize']);
  276. }
  277. }
  278. /**
  279. * Get the thumbnail size filter for entries returned.
  280. *
  281. * @see setThumbsize
  282. * @return string The thumbnail size to filter by, or null if no filter
  283. * is to be applied.
  284. */
  285. public function getThumbsize()
  286. {
  287. return $this->_params['thumbsize'];
  288. }
  289. /**
  290. * Returns the URL generated for this query, based on it's current
  291. * parameters.
  292. *
  293. * @return string A URL generated based on the state of this query.
  294. * @throws Zend_Gdata_App_InvalidArgumentException
  295. */
  296. public function getQueryUrl($incomingUri = null)
  297. {
  298. $uri = Zend_Gdata_Photos::PICASA_BASE_URI;
  299. if ($this->getType() !== null) {
  300. $uri .= '/' . $this->getType();
  301. } else {
  302. #require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  303. throw new Zend_Gdata_App_InvalidArgumentException(
  304. 'Type must be feed or entry, not null');
  305. }
  306. if ($this->getProjection() !== null) {
  307. $uri .= '/' . $this->getProjection();
  308. } else {
  309. #require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  310. throw new Zend_Gdata_App_InvalidArgumentException(
  311. 'Projection must not be null');
  312. }
  313. if ($this->getUser() !== null) {
  314. $uri .= '/user/' . $this->getUser();
  315. } else {
  316. // Should never occur due to setter behavior
  317. #require_once 'Zend/Gdata/App/InvalidArgumentException.php';
  318. throw new Zend_Gdata_App_InvalidArgumentException(
  319. 'User must not be null');
  320. }
  321. $uri .= $incomingUri;
  322. $uri .= $this->getQueryString();
  323. return $uri;
  324. }
  325. }