diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Gdata/App/BaseMediaSource.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Gdata/App/BaseMediaSource.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,179 @@ +_contentType; + } + + /** + * Set the content type for the file attached (example image/png) + * + * @param string $value The content type + * @return Zend_Gdata_App_MediaFileSource Provides a fluent interface + */ + public function setContentType($value) + { + $this->_contentType = $value; + return $this; + } + + /** + * Returns the Slug header value. Used by some services to determine the + * title for the uploaded file. Returns null if no slug should be used. + * + * @return string + */ + public function getSlug(){ + return $this->_slug; + } + + /** + * Sets the Slug header value. Used by some services to determine the + * title for the uploaded file. A null value indicates no slug header. + * + * @var string The slug value + * @return Zend_Gdata_App_MediaSource Provides a fluent interface + */ + public function setSlug($value){ + $this->_slug = $value; + return $this; + } + + + /** + * Magic getter to allow acces like $source->foo to call $source->getFoo() + * Alternatively, if no getFoo() is defined, but a $_foo protected variable + * is defined, this is returned. + * + * TODO Remove ability to bypass getFoo() methods?? + * + * @param string $name The variable name sought + */ + public function __get($name) + { + $method = 'get'.ucfirst($name); + if (method_exists($this, $method)) { + return call_user_func(array(&$this, $method)); + } else if (property_exists($this, "_${name}")) { + return $this->{'_' . $name}; + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Property ' . $name . ' does not exist'); + } + } + + /** + * Magic setter to allow acces like $source->foo='bar' to call + * $source->setFoo('bar') automatically. + * + * Alternatively, if no setFoo() is defined, but a $_foo protected variable + * is defined, this is returned. + * + * @param string $name + * @param string $value + */ + public function __set($name, $val) + { + $method = 'set'.ucfirst($name); + if (method_exists($this, $method)) { + return call_user_func(array(&$this, $method), $val); + } else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) { + $this->{'_' . $name} = $val; + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Property ' . $name . ' does not exist'); + } + } + + /** + * Magic __isset method + * + * @param string $name + */ + public function __isset($name) + { + $rc = new ReflectionClass(get_class($this)); + $privName = '_' . $name; + if (!($rc->hasProperty($privName))) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Property ' . $name . ' does not exist'); + } else { + if (isset($this->{$privName})) { + if (is_array($this->{$privName})) { + if (count($this->{$privName}) > 0) { + return true; + } else { + return false; + } + } else { + return true; + } + } else { + return false; + } + } + } + +}