| 1 | <?php |
||
| 11 | class ShortList extends DataObject |
||
|
1 ignored issue
–
show
|
|||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Fields. |
||
| 16 | */ |
||
| 17 | private static $db = array( |
||
| 18 | 'SessionID' => 'varchar(32)', |
||
| 19 | 'URL' => 'Varchar(100)', |
||
| 20 | 'UserAgent' => 'Varchar(512)' |
||
| 21 | ); |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Attaches to many items. |
||
| 25 | */ |
||
| 26 | private static $has_many = array( |
||
| 27 | 'ShortListItems' => 'ShortListItem' |
||
| 28 | ); |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Where the URL is unique. |
||
| 32 | */ |
||
| 33 | private static $indexes = array( |
||
| 34 | 'UniqueURL' => array( |
||
| 35 | 'type' => 'unique', |
||
| 36 | 'value' => 'URL' |
||
| 37 | ) |
||
| 38 | ); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Ensure we populate these fields before a save. |
||
| 42 | */ |
||
| 43 | public function onBeforeWrite() |
||
| 78 | |||
| 79 | /** |
||
| 80 | * All URLs are prefixed with URLSegment from config. |
||
| 81 | */ |
||
| 82 | public function Link($action = null) |
||
| 86 | |||
| 87 | /** |
||
| 88 | * A basic browser detection. |
||
| 89 | * * if a browser is not here - assume it's a crawler or a bot. In which case, it shouldn't create a shortlist. |
||
| 90 | * |
||
| 91 | * @see http://stackoverflow.com/a/1537636 |
||
| 92 | * */ |
||
| 93 | public static function isBrowser() |
||
| 102 | } |
||
| 103 |
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.