1 | <?php |
||
37 | class FacebookFeed_Item extends DataObject |
||
38 | { |
||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private static $table_name = 'FacebookFeed_Item'; |
||
|
|||
43 | |||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | private static $db = [ |
||
48 | "Title" => "Varchar(255)", |
||
49 | "KeepOnTop" => "Boolean", |
||
50 | "Hide" => "Boolean", |
||
51 | "UID" => "Varchar(32)", |
||
52 | "Author" => "Varchar(244)", |
||
53 | "Description" => "HTMLText", |
||
54 | "DescriptionWithShortLink" => "HTMLText", |
||
55 | "Link" => "Varchar(244)", |
||
56 | "PictureLink" => "Text" |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * @var array |
||
61 | */ |
||
62 | private static $summary_fields = [ |
||
63 | "Created.Nice" => "Created", |
||
64 | "FacebookFeed_Page.Title" => "Feed", |
||
65 | "Title" => "Title", |
||
66 | "KeepOnTopNice" => "Keep on top", |
||
67 | "HideNice" => "Hide", |
||
68 | ]; |
||
69 | |||
70 | /** |
||
71 | * @var array |
||
72 | */ |
||
73 | private static $has_one = [ |
||
74 | "FacebookFeed_Page" => FacebookFeed_Page::class |
||
75 | ]; |
||
76 | |||
77 | /** |
||
78 | * @var array |
||
79 | */ |
||
80 | private static $indexes = [ |
||
81 | "UID" => true |
||
82 | ]; |
||
83 | |||
84 | /** |
||
85 | * @var array |
||
86 | */ |
||
87 | private static $casting = [ |
||
88 | 'KeepOnTopNice' => 'Varchar', |
||
89 | 'HideNice' => 'Varchar', |
||
90 | 'FacebookPostLink' => 'Varchar' |
||
91 | ]; |
||
92 | |||
93 | /** |
||
94 | * @var array |
||
95 | */ |
||
96 | private static $searchable_fields = [ |
||
97 | 'Title' => PartialMatchFilter::class, |
||
98 | 'Author' => PartialMatchFilter::class, |
||
99 | 'Description' => PartialMatchFilter::class |
||
100 | ]; |
||
101 | |||
102 | /** |
||
103 | * @var string |
||
104 | */ |
||
105 | private static $singular_name = "Facebook Item"; |
||
106 | |||
107 | /** |
||
108 | * @var string |
||
109 | */ |
||
110 | private static $plural_name = "Facebook Items"; |
||
111 | |||
112 | /** |
||
113 | * @var string |
||
114 | */ |
||
115 | private static $default_sort = "\"Created\" DESC"; |
||
116 | |||
117 | /** |
||
118 | * @return boolean |
||
119 | */ |
||
120 | public function canCreate($member = null, $context = []) |
||
124 | |||
125 | /** |
||
126 | * @return boolean |
||
127 | */ |
||
128 | public function canView($member = null) |
||
132 | |||
133 | /** |
||
134 | * @return boolean |
||
135 | */ |
||
136 | public function canEdit($member = null) |
||
140 | |||
141 | /** |
||
142 | * @return boolean |
||
143 | */ |
||
144 | public function canDelete($member = null) |
||
148 | |||
149 | /** |
||
150 | * @return string |
||
151 | */ |
||
152 | public function i18n_singular_name() |
||
156 | |||
157 | /** |
||
158 | * @return string |
||
159 | */ |
||
160 | public function i18n_plural_name() |
||
164 | |||
165 | /** |
||
166 | * @return void |
||
167 | */ |
||
168 | public function onBeforeWrite() |
||
173 | |||
174 | /** |
||
175 | * @return void |
||
176 | */ |
||
177 | protected function createDescriptionWithShortLinks() |
||
193 | |||
194 | /** |
||
195 | * @param string |
||
196 | * |
||
197 | * @return string |
||
198 | */ |
||
199 | protected function replaceLinksWithProperOnes($text) |
||
242 | |||
243 | /** |
||
244 | * @return FieldList $fields |
||
245 | */ |
||
246 | public function getCMSFields() |
||
270 | |||
271 | /** |
||
272 | * KeepOnTopNice |
||
273 | */ |
||
274 | public function KeepOnTopNice() |
||
278 | |||
279 | /** |
||
280 | * HideNice |
||
281 | */ |
||
282 | public function HideNice() |
||
286 | |||
287 | /** |
||
288 | * @return string |
||
289 | */ |
||
290 | public function getFacebookPostLink() |
||
294 | |||
295 | /** |
||
296 | * is the link attached to the FB post a link back to this site? |
||
297 | * |
||
298 | * @return bool |
||
299 | */ |
||
300 | public function IsLinkBackToSite() |
||
308 | |||
309 | /** |
||
310 | * returns a link back to the same site if that is what the FB post links to |
||
311 | * or a link to FB if it ultimately links to third-party site. |
||
312 | * |
||
313 | * @return strring |
||
314 | */ |
||
315 | public function SmartLink() |
||
323 | |||
324 | /** |
||
325 | * Check whether Facebook post exists |
||
326 | */ |
||
327 | public function fbpostExists() |
||
346 | |||
347 | /** |
||
348 | * @return boolean |
||
349 | */ |
||
350 | public function canRemove() |
||
354 | |||
355 | /** |
||
356 | * Remove the link |
||
357 | * |
||
358 | * @return string |
||
359 | */ |
||
360 | public function RemoveLink() |
||
366 | } |
||
367 |