@@ -18,67 +18,67 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class BrokenExternalLink extends DataObject |
| 20 | 20 | { |
| 21 | - private static $table_name = 'BrokenExternalLink'; |
|
| 21 | + private static $table_name = 'BrokenExternalLink'; |
|
| 22 | 22 | |
| 23 | - private static $db = array( |
|
| 24 | - 'Link' => 'Varchar(2083)', // 2083 is the maximum length of a URL in Internet Explorer. |
|
| 25 | - 'HTTPCode' =>'Int' |
|
| 26 | - ); |
|
| 23 | + private static $db = array( |
|
| 24 | + 'Link' => 'Varchar(2083)', // 2083 is the maximum length of a URL in Internet Explorer. |
|
| 25 | + 'HTTPCode' =>'Int' |
|
| 26 | + ); |
|
| 27 | 27 | |
| 28 | - private static $has_one = array( |
|
| 29 | - 'Track' => BrokenExternalPageTrack::class, |
|
| 30 | - 'Status' => BrokenExternalPageTrackStatus::class |
|
| 31 | - ); |
|
| 28 | + private static $has_one = array( |
|
| 29 | + 'Track' => BrokenExternalPageTrack::class, |
|
| 30 | + 'Status' => BrokenExternalPageTrackStatus::class |
|
| 31 | + ); |
|
| 32 | 32 | |
| 33 | - private static $summary_fields = array( |
|
| 34 | - 'Created' => 'Checked', |
|
| 35 | - 'Link' => 'External Link', |
|
| 36 | - 'HTTPCodeDescription' => 'HTTP Error Code', |
|
| 37 | - 'Page.Title' => 'Page link is on' |
|
| 38 | - ); |
|
| 33 | + private static $summary_fields = array( |
|
| 34 | + 'Created' => 'Checked', |
|
| 35 | + 'Link' => 'External Link', |
|
| 36 | + 'HTTPCodeDescription' => 'HTTP Error Code', |
|
| 37 | + 'Page.Title' => 'Page link is on' |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | - private static $searchable_fields = array( |
|
| 41 | - 'HTTPCode' => array('title' => 'HTTP Code') |
|
| 42 | - ); |
|
| 40 | + private static $searchable_fields = array( |
|
| 41 | + 'HTTPCode' => array('title' => 'HTTP Code') |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @return SiteTree |
|
| 46 | - */ |
|
| 47 | - public function Page() |
|
| 48 | - { |
|
| 49 | - return $this->Track()->Page(); |
|
| 50 | - } |
|
| 44 | + /** |
|
| 45 | + * @return SiteTree |
|
| 46 | + */ |
|
| 47 | + public function Page() |
|
| 48 | + { |
|
| 49 | + return $this->Track()->Page(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function canEdit($member = false) |
|
| 53 | - { |
|
| 54 | - return false; |
|
| 55 | - } |
|
| 52 | + public function canEdit($member = false) |
|
| 53 | + { |
|
| 54 | + return false; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - public function canView($member = false) |
|
| 58 | - { |
|
| 59 | - $member = $member ? $member : Member::currentUser(); |
|
| 60 | - $codes = array('content-authors', 'administrators'); |
|
| 61 | - return Permission::checkMember($member, $codes); |
|
| 62 | - } |
|
| 57 | + public function canView($member = false) |
|
| 58 | + { |
|
| 59 | + $member = $member ? $member : Member::currentUser(); |
|
| 60 | + $codes = array('content-authors', 'administrators'); |
|
| 61 | + return Permission::checkMember($member, $codes); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Retrieve a human readable description of a response code |
|
| 66 | - * |
|
| 67 | - * @return string |
|
| 68 | - */ |
|
| 69 | - public function getHTTPCodeDescription() |
|
| 70 | - { |
|
| 71 | - $code = $this->HTTPCode; |
|
| 72 | - if (empty($code)) { |
|
| 73 | - // Assume that $code = 0 means there was no response |
|
| 74 | - $description = _t(__CLASS__ . '.NOTAVAILABLE', 'Server Not Available'); |
|
| 75 | - } elseif (($descriptions = Config::inst()->get(HTTPResponse::class, 'status_codes')) |
|
| 76 | - && isset($descriptions[$code]) |
|
| 77 | - ) { |
|
| 78 | - $description = $descriptions[$code]; |
|
| 79 | - } else { |
|
| 80 | - $description = _t(__CLASS__ . '.UNKNOWNRESPONSE', 'Unknown Response Code'); |
|
| 81 | - } |
|
| 82 | - return sprintf("%d (%s)", $code, $description); |
|
| 83 | - } |
|
| 64 | + /** |
|
| 65 | + * Retrieve a human readable description of a response code |
|
| 66 | + * |
|
| 67 | + * @return string |
|
| 68 | + */ |
|
| 69 | + public function getHTTPCodeDescription() |
|
| 70 | + { |
|
| 71 | + $code = $this->HTTPCode; |
|
| 72 | + if (empty($code)) { |
|
| 73 | + // Assume that $code = 0 means there was no response |
|
| 74 | + $description = _t(__CLASS__ . '.NOTAVAILABLE', 'Server Not Available'); |
|
| 75 | + } elseif (($descriptions = Config::inst()->get(HTTPResponse::class, 'status_codes')) |
|
| 76 | + && isset($descriptions[$code]) |
|
| 77 | + ) { |
|
| 78 | + $description = $descriptions[$code]; |
|
| 79 | + } else { |
|
| 80 | + $description = _t(__CLASS__ . '.UNKNOWNRESPONSE', 'Unknown Response Code'); |
|
| 81 | + } |
|
| 82 | + return sprintf("%d (%s)", $code, $description); |
|
| 83 | + } |
|
| 84 | 84 | } |
@@ -71,13 +71,13 @@ |
||
| 71 | 71 | $code = $this->HTTPCode; |
| 72 | 72 | if (empty($code)) { |
| 73 | 73 | // Assume that $code = 0 means there was no response |
| 74 | - $description = _t(__CLASS__ . '.NOTAVAILABLE', 'Server Not Available'); |
|
| 74 | + $description = _t(__CLASS__.'.NOTAVAILABLE', 'Server Not Available'); |
|
| 75 | 75 | } elseif (($descriptions = Config::inst()->get(HTTPResponse::class, 'status_codes')) |
| 76 | 76 | && isset($descriptions[$code]) |
| 77 | 77 | ) { |
| 78 | 78 | $description = $descriptions[$code]; |
| 79 | 79 | } else { |
| 80 | - $description = _t(__CLASS__ . '.UNKNOWNRESPONSE', 'Unknown Response Code'); |
|
| 80 | + $description = _t(__CLASS__.'.UNKNOWNRESPONSE', 'Unknown Response Code'); |
|
| 81 | 81 | } |
| 82 | 82 | return sprintf("%d (%s)", $code, $description); |
| 83 | 83 | } |