| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function removealladvertisements($request) |
||
| 12 | { |
||
| 13 | $id = intval($request->param("ID"))-0; |
||
| 14 | $page = SiteTree::get()->byID($id); |
||
| 15 | if (!$page) { |
||
| 16 | return "this page does not exist"; |
||
| 17 | } |
||
| 18 | DB::query("DELETE FROM SiteTree_Advertisements WHERE SiteTreeID = ".$id); |
||
| 19 | DB::query("UPDATE SiteTree SET AdvertisementsFolderID = 0 WHERE SiteTree.ID = ".$id); |
||
| 20 | DB::query("UPDATE SiteTree_Live SET AdvertisementsFolderID = 0 WHERE SiteTree_Live.ID = ".$id); |
||
| 21 | return sprintf( |
||
| 22 | _t("AdvertisementController.REMOVEDALL", 'Removed all %1$s from this page, please reload page to see results.'), |
||
| 23 | Config::inst()->get("Advertisement", "plural_name") |
||
| 24 | ); |
||
| 25 | } |
||
| 26 | |||
| 36 |
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.