@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | * @property string AddTo |
| 15 | 15 | * @property string CrawlID |
| 16 | 16 | */ |
| 17 | -class GlobalAutoLinkSettings extends DataObject{ |
|
| 17 | +class GlobalAutoLinkSettings extends DataObject { |
|
| 18 | 18 | |
| 19 | - public static $enabled = true; |
|
| 19 | + public static $enabled = true; |
|
| 20 | 20 | public static $encoding = 'UTF-8'; |
| 21 | 21 | |
| 22 | 22 | private static $db = array( |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | - public function ExcludeTags(){ |
|
| 46 | - return array_unique( explode( ',', str_replace( ' ', '', $this->ExcludeTags ).',a,img,iframe,video,object' ) ); |
|
| 45 | + public function ExcludeTags() { |
|
| 46 | + return array_unique(explode(',', str_replace(' ', '', $this->ExcludeTags).',a,img,iframe,video,object')); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -51,19 +51,19 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return array |
| 53 | 53 | */ |
| 54 | - public function IncludeInFields(){ |
|
| 55 | - return explode( ',', str_replace( ' ', '', $this->IncludeIn ) ); |
|
| 54 | + public function IncludeInFields() { |
|
| 55 | + return explode(',', str_replace(' ', '', $this->IncludeIn)); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function requireDefaultRecords() { |
| 59 | 59 | $hasData = self::get()->first(); |
| 60 | - if(!$hasData) { |
|
| 60 | + if (!$hasData) { |
|
| 61 | 61 | $obj = self::create(self::$default_create_config); |
| 62 | 62 | $obj->CrawlID = $this->createCrawlID(); |
| 63 | 63 | $obj->write(); |
| 64 | - DB::alteration_message("Added default Global Auto Link Settings","created"); |
|
| 65 | - } else{ |
|
| 66 | - if(!$hasData->CrawlID){ |
|
| 64 | + DB::alteration_message("Added default Global Auto Link Settings", "created"); |
|
| 65 | + }else { |
|
| 66 | + if (!$hasData->CrawlID) { |
|
| 67 | 67 | $hasData->CrawlID = $this->createCrawlID(); |
| 68 | 68 | $hasData->write(); |
| 69 | 69 | } |
@@ -96,25 +96,25 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return array |
| 98 | 98 | */ |
| 99 | - public function AllowedIn(){ |
|
| 100 | - $classes = array_values( ClassInfo::subclassesFor( 'SiteTree' ) ); |
|
| 101 | - if( !$this->AddTo ) return $classes; |
|
| 99 | + public function AllowedIn() { |
|
| 100 | + $classes = array_values(ClassInfo::subclassesFor('SiteTree')); |
|
| 101 | + if (!$this->AddTo) return $classes; |
|
| 102 | 102 | |
| 103 | - $sanitized = explode( ',', str_replace( ' ', '', strtolower( $this->AddTo ) ) ); |
|
| 103 | + $sanitized = explode(',', str_replace(' ', '', strtolower($this->AddTo))); |
|
| 104 | 104 | $len = count($sanitized); |
| 105 | 105 | |
| 106 | - for( $x = 0; $x < $len; $x++ ){ |
|
| 106 | + for ($x = 0; $x < $len; $x++) { |
|
| 107 | 107 | $found = false; |
| 108 | 108 | |
| 109 | - foreach( $classes as $class ){ |
|
| 110 | - if( strtolower( $class ) === $sanitized[$x] ){ |
|
| 109 | + foreach ($classes as $class) { |
|
| 110 | + if (strtolower($class) === $sanitized[$x]) { |
|
| 111 | 111 | $sanitized[$x] = $class; |
| 112 | 112 | $found = true; |
| 113 | 113 | break 1; |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if( !$found ) unset( $sanitized[$x] ); |
|
| 117 | + if (!$found) unset($sanitized[$x]); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return (array) $sanitized; |