Test Setup Failed
Branch master (ff33da)
by Dylan
14:59
created
code/admin/SEOToolboxAdmin.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
  */
12 12
 class SEOToolboxAdmin extends ModelAdmin{
13 13
 	
14
-	private static $menu_title      = 'SEO Tool box';
15
-	private static $url_segment     = 'seo-tool-box';
16
-	private static $managed_models  = array( 'AutomatedLink' );
14
+    private static $menu_title      = 'SEO Tool box';
15
+    private static $url_segment     = 'seo-tool-box';
16
+    private static $managed_models  = array( 'AutomatedLink' );
17 17
     private static $menu_priority   = 10;
18 18
 
19 19
 
20
-	public function getEditForm($id = null, $fields = null) {
21
-		$form = parent::getEditForm( $id, $fields );
22
-		$class = $this->sanitiseClassName($this->modelClass);
23
-		$grid   = $form->Fields()->fieldByName($class);
24
-		$grid->getConfig()->addComponent( new GridFieldSortableRows( 'Priority' ) );
20
+    public function getEditForm($id = null, $fields = null) {
21
+        $form = parent::getEditForm( $id, $fields );
22
+        $class = $this->sanitiseClassName($this->modelClass);
23
+        $grid   = $form->Fields()->fieldByName($class);
24
+        $grid->getConfig()->addComponent( new GridFieldSortableRows( 'Priority' ) );
25 25
 		
26
-		return $form;
27
-	}
26
+        return $form;
27
+    }
28 28
 }
Please login to merge, or discard this patch.
code/dataobjects/AutomatedLink.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -93,133 +93,133 @@
 block discarded – undo
93 93
     }
94 94
 
95 95
     public function providePermissions() {
96
-       return array(
97
-         'AUTOMATEDLINK_VIEW'   => 'View Automated Links',
98
-         'AUTOMATEDLINK_EDIT'   => 'Edit Automated Links',
99
-         'AUTOMATEDLINK_DELETE' => 'Delete Automated Links',
100
-         'AUTOMATEDLINK_CREATE' => 'Create Automated Links',
101
-       );
102
-     }
103
-
104
-	public function requireDefaultRecords(){
105
-		parent::requireDefaultRecords();
106
-
107
-		// Update all links to redirector pages during dev/build
108
-		foreach( self::get() as $link ) {
109
-		    $link->CheckAndUpdateDestination( true );
110
-		}
111
-	}
112
-
113
-	/**
114
-	 * Returns the HTML Representation of this object
115
-	 *
96
+        return array(
97
+            'AUTOMATEDLINK_VIEW'   => 'View Automated Links',
98
+            'AUTOMATEDLINK_EDIT'   => 'Edit Automated Links',
99
+            'AUTOMATEDLINK_DELETE' => 'Delete Automated Links',
100
+            'AUTOMATEDLINK_CREATE' => 'Create Automated Links',
101
+        );
102
+        }
103
+
104
+    public function requireDefaultRecords(){
105
+        parent::requireDefaultRecords();
106
+
107
+        // Update all links to redirector pages during dev/build
108
+        foreach( self::get() as $link ) {
109
+            $link->CheckAndUpdateDestination( true );
110
+        }
111
+    }
112
+
113
+    /**
114
+     * Returns the HTML Representation of this object
115
+     *
116 116
      * @param  String $originalPhrase
117
-	 * @return String
118
-	 */
119
-	public function getHTML($originalPhrase = NULL) {
120
-		$link     = ($this->PageID) ? $this->Page()->Link() : '#';
121
-		$title    = ($this->TitleTag) ? "title='{$this->TitleTag}'" : '';
122
-		$nofollow = ($this->NoFollow) ? 'rel="nofollow"' : '';
123
-		$newtab   = ($this->NewWindow) ? 'target="_blank"' : '';
117
+     * @return String
118
+     */
119
+    public function getHTML($originalPhrase = NULL) {
120
+        $link     = ($this->PageID) ? $this->Page()->Link() : '#';
121
+        $title    = ($this->TitleTag) ? "title='{$this->TitleTag}'" : '';
122
+        $nofollow = ($this->NoFollow) ? 'rel="nofollow"' : '';
123
+        $newtab   = ($this->NewWindow) ? 'target="_blank"' : '';
124 124
         $anchor = ($originalPhrase) ? $originalPhrase : $this->Phrase;
125
-		$link     = ($this->AnchorTag) ? rtrim($link, '#').'#'.$this->AnchorTag : $link;
126
-		return "<a href=\"$link\" $title $nofollow $newtab data-id=\"{$this->ID}\">{$anchor}</a>";
127
-	}
128
-
129
-	public function getCMSFields() {
130
-		$fields = FieldList::create(TabSet::create('Root'));
131
-
132
-		$fields->addFieldsToTab('Root.LinkSettings', array(
133
-			TextField::create('Phrase', 'Phrase to search for', $this->Phrase, 255),
134
-			TextField::create('TitleTag', 'Title Tag', $this->TitleTag, 255),
135
-			TextField::create('AnchorTag', 'Anchor Tag(#)', $this->AnchorTag, 255),
136
-			FieldGroup::create(
137
-				CheckboxField::create('NoFollow'),
138
-				CheckboxField::create('NewWindow'),
139
-				CheckboxField::create('SelfLinking', 'Allow page to link to itself'),
140
-				CheckboxField::create('CaseSensitive', 'Match the case of the phrase')
141
-			),
142
-			NumericField::create('MaxLinksPerPage', 'Maximum amount of this link to be created on a single page( 0 = unlimited )'),
143
-			TreeDropdownField::create('PageID', 'Page to link to', 'SiteTree')
144
-		));
145
-
146
-		$settings = GlobalAutoLinkSettings::get_current();
147
-		if ($settings) {
148
-			$fields->addFieldsToTab('Root.Global', array(
149
-				NumericField::create(
150
-					'Global_MaxLinksPerPage',
151
-					'Maximum amount of links a single page can have ( 0 = unlimited )',
152
-					$settings->MaxLinksPerPage
153
-				),
154
-				TextField::create(
155
-					'Global_ExcludeTags',
156
-					'Do not include links into these HTML Tags ( comma seperated )',
157
-					$settings->ExcludeTags
158
-				),
159
-				TextField::create(
160
-				    'Global_AddTo',
161
-				    'Page types where links should be created in ( leave blank for all page types )',
162
-				    $settings->AddTo ),
163
-				TextField::create(
164
-					'Global_IncludeIn',
165
-					'Include Links into these fields ( comma seperated & field must support html injection )',
166
-					$settings->IncludeIn
167
-				)
168
-			));
169
-		}
170
-
171
-		return $fields;
172
-	}
125
+        $link     = ($this->AnchorTag) ? rtrim($link, '#').'#'.$this->AnchorTag : $link;
126
+        return "<a href=\"$link\" $title $nofollow $newtab data-id=\"{$this->ID}\">{$anchor}</a>";
127
+    }
128
+
129
+    public function getCMSFields() {
130
+        $fields = FieldList::create(TabSet::create('Root'));
131
+
132
+        $fields->addFieldsToTab('Root.LinkSettings', array(
133
+            TextField::create('Phrase', 'Phrase to search for', $this->Phrase, 255),
134
+            TextField::create('TitleTag', 'Title Tag', $this->TitleTag, 255),
135
+            TextField::create('AnchorTag', 'Anchor Tag(#)', $this->AnchorTag, 255),
136
+            FieldGroup::create(
137
+                CheckboxField::create('NoFollow'),
138
+                CheckboxField::create('NewWindow'),
139
+                CheckboxField::create('SelfLinking', 'Allow page to link to itself'),
140
+                CheckboxField::create('CaseSensitive', 'Match the case of the phrase')
141
+            ),
142
+            NumericField::create('MaxLinksPerPage', 'Maximum amount of this link to be created on a single page( 0 = unlimited )'),
143
+            TreeDropdownField::create('PageID', 'Page to link to', 'SiteTree')
144
+        ));
145
+
146
+        $settings = GlobalAutoLinkSettings::get_current();
147
+        if ($settings) {
148
+            $fields->addFieldsToTab('Root.Global', array(
149
+                NumericField::create(
150
+                    'Global_MaxLinksPerPage',
151
+                    'Maximum amount of links a single page can have ( 0 = unlimited )',
152
+                    $settings->MaxLinksPerPage
153
+                ),
154
+                TextField::create(
155
+                    'Global_ExcludeTags',
156
+                    'Do not include links into these HTML Tags ( comma seperated )',
157
+                    $settings->ExcludeTags
158
+                ),
159
+                TextField::create(
160
+                    'Global_AddTo',
161
+                    'Page types where links should be created in ( leave blank for all page types )',
162
+                    $settings->AddTo ),
163
+                TextField::create(
164
+                    'Global_IncludeIn',
165
+                    'Include Links into these fields ( comma seperated & field must support html injection )',
166
+                    $settings->IncludeIn
167
+                )
168
+            ));
169
+        }
170
+
171
+        return $fields;
172
+    }
173 173
 
174 174
     public function getCMSValidator() {
175 175
         return new RequiredFields(array('Phrase', 'PageID'));
176 176
     }
177 177
 
178
-	/**
179
-	 * Save the Global Settings into the
180
-	 * Global Auto Link Settings Object
181
-	 *
182
-	 * @return void
183
-	 */
184
-	public function onBeforeWrite() {
185
-		parent::onBeforeWrite();
186
-
187
-		$settings = GlobalAutoLinkSettings::get_current();
188
-		if ($settings) {
189
-
190
-			foreach ($this->getChangedFields() as $field => $value) {
191
-				if (strpos($field, 'Global_') === 0 && isset($value['after'])) {
192
-					$field = str_replace('Global_', '', $field);
193
-					$settings->$field = $value['after'];
194
-				}
195
-			}
196
-
197
-			$settings->write();
198
-		}
199
-
200
-		$this->CheckAndUpdateDestination();
201
-	}
202
-
203
-	/**
204
-	 * Checks if the destination is a redirector page if so
205
-	 * it updates it to the destination of the redirector page
206
-	 *
207
-	 * @Boolean $write - Write the changes if any
208
-	 * @return void
209
-	 */
210
-	public function CheckAndUpdateDestination( $write = false ){
211
-		$this->extend('beforeCheckAndUpdateDestination', $write);
212
-
213
-		if( $this->PageID && $this->Page() &&
214
-			$this->Page()->ClassName == 'RedirectorPage' &&
215
-			$this->Page()->LinkToID && $this->Page()->RedirectionType == 'Internal' )
216
-		{
217
-			$this->PageID = $this->Page()->LinkToID;
218
-			if( $write ) {
219
-			    $this->write();
220
-			}
221
-		}
222
-	}
178
+    /**
179
+     * Save the Global Settings into the
180
+     * Global Auto Link Settings Object
181
+     *
182
+     * @return void
183
+     */
184
+    public function onBeforeWrite() {
185
+        parent::onBeforeWrite();
186
+
187
+        $settings = GlobalAutoLinkSettings::get_current();
188
+        if ($settings) {
189
+
190
+            foreach ($this->getChangedFields() as $field => $value) {
191
+                if (strpos($field, 'Global_') === 0 && isset($value['after'])) {
192
+                    $field = str_replace('Global_', '', $field);
193
+                    $settings->$field = $value['after'];
194
+                }
195
+            }
196
+
197
+            $settings->write();
198
+        }
199
+
200
+        $this->CheckAndUpdateDestination();
201
+    }
202
+
203
+    /**
204
+     * Checks if the destination is a redirector page if so
205
+     * it updates it to the destination of the redirector page
206
+     *
207
+     * @Boolean $write - Write the changes if any
208
+     * @return void
209
+     */
210
+    public function CheckAndUpdateDestination( $write = false ){
211
+        $this->extend('beforeCheckAndUpdateDestination', $write);
212
+
213
+        if( $this->PageID && $this->Page() &&
214
+            $this->Page()->ClassName == 'RedirectorPage' &&
215
+            $this->Page()->LinkToID && $this->Page()->RedirectionType == 'Internal' )
216
+        {
217
+            $this->PageID = $this->Page()->LinkToID;
218
+            if( $write ) {
219
+                $this->write();
220
+            }
221
+        }
222
+    }
223 223
 
224 224
     /**
225 225
      * Checks if the field is parable
Please login to merge, or discard this patch.
code/dataobjects/GlobalAutoLinkSettings.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
  */
17 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
-	private static $db = array(
23
-		'MaxLinksPerPage' => 'INT',
24
-		'ExcludeTags'	  => 'VARCHAR(255)',
25
-		'IncludeIn'		  => 'Text',
26
-		'AddTo'           => 'Text',
22
+    private static $db = array(
23
+        'MaxLinksPerPage' => 'INT',
24
+        'ExcludeTags'	  => 'VARCHAR(255)',
25
+        'IncludeIn'		  => 'Text',
26
+        'AddTo'           => 'Text',
27 27
         'CrawlID'         => 'VARCHAR(15)'
28
-	);
28
+    );
29 29
 
30
-	private static $defaults = array(
31
-		'IncludeIn' => 'Content'
32
-	);
30
+    private static $defaults = array(
31
+        'IncludeIn' => 'Content'
32
+    );
33 33
 
34 34
     public static $default_create_config = array(
35 35
         'MaxLinksPerPage' => 0,
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
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' ) );
47
-	}
45
+    public function ExcludeTags(){
46
+        return array_unique( explode( ',', str_replace( ' ', '', $this->ExcludeTags ).',a,img,iframe,video,object' ) );
47
+    }
48 48
 
49 49
     /**
50 50
      * Return an array of where automated links can be created
51 51
      *
52 52
      * @return array
53 53
      */
54
-	public function IncludeInFields(){
55
-		return explode( ',', str_replace( ' ', '', $this->IncludeIn ) );
56
-	}
54
+    public function IncludeInFields(){
55
+        return explode( ',', str_replace( ' ', '', $this->IncludeIn ) );
56
+    }
57 57
 
58 58
     public function requireDefaultRecords() {
59 59
         $hasData = self::get()->first();
Please login to merge, or discard this patch.