sunnysideup /
silverstripe-imagegallery_basic
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | class ImageGalleryEntry extends DataObject |
||
|
0 ignored issues
–
show
|
|||
| 4 | { |
||
| 5 | private static $singular_name = "Image Gallery Picture"; |
||
|
0 ignored issues
–
show
|
|||
| 6 | |||
| 7 | private static $plural_name = "Image Gallery Pictures"; |
||
|
0 ignored issues
–
show
|
|||
| 8 | |||
| 9 | private static $db = array( |
||
|
0 ignored issues
–
show
|
|||
| 10 | "Title" => "Varchar(100)", |
||
| 11 | "Sort" => "Int" |
||
| 12 | ); |
||
| 13 | |||
| 14 | private static $has_one = array( |
||
|
0 ignored issues
–
show
|
|||
| 15 | "Parent" => "SiteTree", |
||
| 16 | "Image" => "Image" |
||
| 17 | ); |
||
| 18 | |||
| 19 | private static $searchable_fields = array( |
||
|
0 ignored issues
–
show
|
|||
| 20 | "Title" => "PartialMatchFilter" |
||
| 21 | ); |
||
| 22 | |||
| 23 | private static $summary_fields = array( |
||
|
0 ignored issues
–
show
|
|||
| 24 | "Image.CMSThumbNail" => "Image", |
||
| 25 | "Title" => "Title" |
||
| 26 | ); |
||
| 27 | |||
| 28 | private static $field_labels = array( |
||
|
0 ignored issues
–
show
|
|||
| 29 | "Sort" => "Sorting Index Number (lower numbers show first)" |
||
| 30 | ); |
||
| 31 | |||
| 32 | private static $casting = array( |
||
|
0 ignored issues
–
show
|
|||
| 33 | "BestTitle" => "Varchar" |
||
| 34 | ); |
||
| 35 | |||
| 36 | //CRUD settings |
||
| 37 | |||
| 38 | private static $default_sort = "Sort ASC, Title ASC"; |
||
|
0 ignored issues
–
show
|
|||
| 39 | |||
| 40 | private static $defaults = array( |
||
|
0 ignored issues
–
show
|
|||
| 41 | "Sort" => 100 |
||
| 42 | ); |
||
| 43 | |||
| 44 | public function getBestTitle() |
||
|
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a Loading history...
|
|||
| 45 | { |
||
| 46 | $image = $this->Image(); |
||
|
0 ignored issues
–
show
The method
Image does not exist on object<ImageGalleryEntry>? Since you implemented __call, maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
Loading history...
|
|||
| 47 | if ($image && $image->exists()) { |
||
| 48 | if ($image->Title) { |
||
| 49 | if ($this->Title !== $image->Title) { |
||
|
0 ignored issues
–
show
The property
Title does not exist on object<ImageGalleryEntry>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 50 | $this->Title = $image->Title; |
||
|
0 ignored issues
–
show
The property
Title does not exist on object<ImageGalleryEntry>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 51 | $this->write(); |
||
| 52 | } |
||
| 53 | return $image->Title; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | return $this->Title; |
||
|
0 ignored issues
–
show
The property
Title does not exist on object<ImageGalleryEntry>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 57 | } |
||
| 58 | |||
| 59 | public function populateDefaults() |
||
| 60 | { |
||
| 61 | parent::populateDefaults(); |
||
| 62 | $this->Sort = 100; |
||
|
0 ignored issues
–
show
The property
Sort does not exist on object<ImageGalleryEntry>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * CMS Fields |
||
| 67 | * @return FieldList |
||
| 68 | */ |
||
| 69 | public function getCMSFields() |
||
| 70 | { |
||
| 71 | $fields = parent::getCMSFields(); |
||
| 72 | $fields->removeFieldFromTab('Root.Main', 'Title'); |
||
| 73 | |||
| 74 | return $fields; |
||
| 75 | } |
||
| 76 | } |
||
| 77 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.