mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged pre-2.3-oct08 into trunk
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66080 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0328ff5c9d
commit
8052c5dce4
@ -352,8 +352,8 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() {
|
||||
if($this->hasField('Title')) return $this->getField('Title');
|
||||
if($this->hasField('Name')) return $this->getField('Name');
|
||||
if($this->hasDatabaseField('Title')) return $this->getField('Title');
|
||||
if($this->hasDatabaseField('Name')) return $this->getField('Name');
|
||||
|
||||
return "#{$this->ID}";
|
||||
}
|
||||
@ -1723,7 +1723,7 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasDatabaseField($field) {
|
||||
return array_key_exists($field, $this->databaseFields());
|
||||
return array_key_exists($field, $this->inheritedDatabaseFields());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,14 +15,14 @@ class GD extends Object {
|
||||
if(ini_get("safe_mode") != "1") {
|
||||
set_time_limit(300);
|
||||
}
|
||||
|
||||
|
||||
if($filename) {
|
||||
// We use getimagesize instead of extension checking, because sometimes extensions are wrong.
|
||||
list($width, $height, $type, $attr) = getimagesize($filename);
|
||||
switch($type) {
|
||||
case 1: $this->setGD(imagecreatefromgif($filename)); break;
|
||||
case 2: $this->setGD(imagecreatefromjpeg($filename)); break;
|
||||
case 3: $this->setGD(imagecreatefrompng($filename)); break;
|
||||
case 1: if(function_exists('imagecreatefromgif')) $this->setGD(imagecreatefromgif($filename)); break;
|
||||
case 2: if(function_exists('imagecreatefromjpeg')) $this->setGD(imagecreatefromjpeg($filename)); break;
|
||||
case 3: if(function_exists('imagecreatefrompng')) $this->setGD(imagecreatefrompng($filename)); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,4 +408,4 @@ class GD extends Object {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -237,7 +237,7 @@ function HtmlEditorField_dataValue_processImage($parts) {
|
||||
$image = Image::find(urldecode($src));
|
||||
|
||||
// If we have an image, insert the resampled one into the src attribute; otherwise, leave the img src alone.
|
||||
if($image && $image->getWidth() != $width && $image->getHeight != $height) {
|
||||
if($image && $image->getWidth() != $width && $image->getHeight() != $height) {
|
||||
// If we have an image, generate the resized image.
|
||||
$resizedImage = $image->getFormattedImage('ResizedImage', $width, $height);
|
||||
if($resizedImage) $parts[$partSource['src="']] = $resizedImage->getRelativePath();
|
||||
|
@ -465,6 +465,7 @@ JS
|
||||
$query->orderby = $SQL_sort;
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
@ -1256,7 +1257,9 @@ class TableListField_Item extends ViewableData {
|
||||
|
||||
function Link() {
|
||||
if($this->parent->getForm()) {
|
||||
return Controller::join_links($this->parent->Link() . '/item/' . $this->item->ID);
|
||||
$parentUrlParts = parse_url($this->parent->Link());
|
||||
$queryPart = (isset($parentUrlParts['query'])) ? '?' . $parentUrlParts['query'] : null;
|
||||
return Controller::join_links($parentUrlParts['path'], 'item', $this->item->ID, $queryPart);
|
||||
} else {
|
||||
// allow for instanciation of this FormField outside of a controller/form
|
||||
// context (e.g. for unit tests)
|
||||
|
Loading…
x
Reference in New Issue
Block a user