Merged revisions 51257 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq

........
  r51257 | ischommer | 2008-03-18 12:50:03 +1300 (Tue, 18 Mar 2008) | 2 lines
  
  ENHANCEMENT Deprecated Image->URL(), changed to Image->getURL() to be consistent with File class
  FEATURE File->getAbsoluteURL()
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@51251 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-03-17 23:50:18 +00:00
parent 1b5b3f8627
commit e7a683c0c4
2 changed files with 37 additions and 3 deletions

View File

@ -79,10 +79,14 @@ class Image extends File {
}
/**
* Get the URL for this Image.
* @return boolean
* Get the relative URL for this Image.
* Overwrites File->URL() which returns an absolute URL.
*
* @todo Refactor to return absolute URL like {@link File}
* @uses Director::baseURL()
* @return string
*/
function URL() {
function getURL() {
return Director::baseURL() . $this->Filename;
}
@ -364,6 +368,20 @@ class Image extends File {
function getHeight() {
return $this->getDimensions(1);
}
// ###################
// DEPRECATED
// ###################
/**
* @deprecated
*/
function URL() {
user_error('Image::URL() is deprecated, please use the attribute directly as $myImage->URL.', E_USER_NOTICE);
}
}
/**

View File

@ -480,6 +480,22 @@ class File extends DataObject {
return $this->getField('ParentID');
}
/**
* Gets the absolute URL accessible through the web.
*
* @uses Director::absoluteBaseURL()
* @return string
*/
function getAbsoluteURL() {
return Director::absoluteBaseURL() . $this->getFilename();
}
/**
* Gets the absolute URL accessible through the web.
*
* @uses Director::absoluteBaseURL()
* @return string
*/
function getURL() {
return Director::absoluteBaseURL() . $this->getFilename();
}