Completed
Push — develop ( 322e3f...d82e9f )
by Dylan
02:40
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 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -66,133 +66,133 @@
 block discarded – undo
66 66
     }
67 67
 
68 68
     function providePermissions() {
69
-       return array(
70
-         'AUTOMATEDLINK_VIEW'   => 'View Automated Links',
71
-         'AUTOMATEDLINK_EDIT'   => 'Edit Automated Links',
72
-         'AUTOMATEDLINK_DELETE' => 'Delete Automated Links',
73
-         'AUTOMATEDLINK_CREATE' => 'Create Automated Links',
74
-       );
75
-     }
76
-
77
-	public function requireDefaultRecords(){
78
-		parent::requireDefaultRecords();
79
-
80
-		// Update all links to redirector pages during dev/build
81
-		foreach( self::get() as $link ) {
82
-		    $link->CheckAndUpdateDestination( true );
83
-		}
84
-	}
85
-
86
-	/**
87
-	 * Returns the HTML Representation of this object
88
-	 *
69
+        return array(
70
+            'AUTOMATEDLINK_VIEW'   => 'View Automated Links',
71
+            'AUTOMATEDLINK_EDIT'   => 'Edit Automated Links',
72
+            'AUTOMATEDLINK_DELETE' => 'Delete Automated Links',
73
+            'AUTOMATEDLINK_CREATE' => 'Create Automated Links',
74
+        );
75
+        }
76
+
77
+    public function requireDefaultRecords(){
78
+        parent::requireDefaultRecords();
79
+
80
+        // Update all links to redirector pages during dev/build
81
+        foreach( self::get() as $link ) {
82
+            $link->CheckAndUpdateDestination( true );
83
+        }
84
+    }
85
+
86
+    /**
87
+     * Returns the HTML Representation of this object
88
+     *
89 89
      * @param  String $originalPhrase
90
-	 * @return String
91
-	 */
92
-	public function getHTML($originalPhrase = NULL) {
93
-		$link     = ($this->PageID) ? $this->Page()->Link() : '#';
94
-		$title    = ($this->TitleTag) ? "title='{$this->TitleTag}'" : '';
95
-		$nofollow = ($this->NoFollow) ? 'rel="nofollow"' : '';
96
-		$newtab   = ($this->NewWindow) ? 'target="_blank"' : '';
90
+     * @return String
91
+     */
92
+    public function getHTML($originalPhrase = NULL) {
93
+        $link     = ($this->PageID) ? $this->Page()->Link() : '#';
94
+        $title    = ($this->TitleTag) ? "title='{$this->TitleTag}'" : '';
95
+        $nofollow = ($this->NoFollow) ? 'rel="nofollow"' : '';
96
+        $newtab   = ($this->NewWindow) ? 'target="_blank"' : '';
97 97
         $anchor = ($originalPhrase) ? $originalPhrase : $this->Phrase;
98
-		$link     = ($this->AnchorTag) ? rtrim($link, '#').'#'.$this->AnchorTag : $link;
99
-		return "<a href=\"$link\" $title $nofollow $newtab data-id=\"{$this->ID}\">{$anchor}</a>";
100
-	}
101
-
102
-	public function getCMSFields() {
103
-		$fields = FieldList::create(TabSet::create('Root'));
104
-
105
-		$fields->addFieldsToTab('Root.LinkSettings', array(
106
-			TextField::create('Phrase', 'Phrase to search for', $this->Phrase, 255),
107
-			TextField::create('TitleTag', 'Title Tag', $this->TitleTag, 255),
108
-			TextField::create('AnchorTag', 'Anchor Tag(#)', $this->AnchorTag, 255),
109
-			FieldGroup::create(
110
-				CheckboxField::create('NoFollow'),
111
-				CheckboxField::create('NewWindow'),
112
-				CheckboxField::create('SelfLinking', 'Allow page to link to itself'),
113
-				CheckboxField::create('CaseSensitive', 'Match the case of the phrase')
114
-			),
115
-			NumericField::create('MaxLinksPerPage', 'Maximum amount of this link to be created on a single page( 0 = unlimited )'),
116
-			TreeDropdownField::create('PageID', 'Page to link to', 'SiteTree')
117
-		));
118
-
119
-		$settings = GlobalAutoLinkSettings::get_current();
120
-		if ($settings) {
121
-			$fields->addFieldsToTab('Root.Global', array(
122
-				NumericField::create(
123
-					'Global_MaxLinksPerPage',
124
-					'Maximum amount of links a single page can have ( 0 = unlimited )',
125
-					$settings->MaxLinksPerPage
126
-				),
127
-				TextField::create(
128
-					'Global_ExcludeTags',
129
-					'Do not include links into these HTML Tags ( comma seperated )',
130
-					$settings->ExcludeTags
131
-				),
132
-				TextField::create(
133
-				    'Global_AddTo',
134
-				    'Page types where links should be created in ( leave blank for all page types )',
135
-				    $settings->AddTo ),
136
-				TextField::create(
137
-					'Global_IncludeIn',
138
-					'Include Links into these fields ( comma seperated & field must support html injection )',
139
-					$settings->IncludeIn
140
-				)
141
-			));
142
-		}
143
-
144
-		return $fields;
145
-	}
98
+        $link     = ($this->AnchorTag) ? rtrim($link, '#').'#'.$this->AnchorTag : $link;
99
+        return "<a href=\"$link\" $title $nofollow $newtab data-id=\"{$this->ID}\">{$anchor}</a>";
100
+    }
101
+
102
+    public function getCMSFields() {
103
+        $fields = FieldList::create(TabSet::create('Root'));
104
+
105
+        $fields->addFieldsToTab('Root.LinkSettings', array(
106
+            TextField::create('Phrase', 'Phrase to search for', $this->Phrase, 255),
107
+            TextField::create('TitleTag', 'Title Tag', $this->TitleTag, 255),
108
+            TextField::create('AnchorTag', 'Anchor Tag(#)', $this->AnchorTag, 255),
109
+            FieldGroup::create(
110
+                CheckboxField::create('NoFollow'),
111
+                CheckboxField::create('NewWindow'),
112
+                CheckboxField::create('SelfLinking', 'Allow page to link to itself'),
113
+                CheckboxField::create('CaseSensitive', 'Match the case of the phrase')
114
+            ),
115
+            NumericField::create('MaxLinksPerPage', 'Maximum amount of this link to be created on a single page( 0 = unlimited )'),
116
+            TreeDropdownField::create('PageID', 'Page to link to', 'SiteTree')
117
+        ));
118
+
119
+        $settings = GlobalAutoLinkSettings::get_current();
120
+        if ($settings) {
121
+            $fields->addFieldsToTab('Root.Global', array(
122
+                NumericField::create(
123
+                    'Global_MaxLinksPerPage',
124
+                    'Maximum amount of links a single page can have ( 0 = unlimited )',
125
+                    $settings->MaxLinksPerPage
126
+                ),
127
+                TextField::create(
128
+                    'Global_ExcludeTags',
129
+                    'Do not include links into these HTML Tags ( comma seperated )',
130
+                    $settings->ExcludeTags
131
+                ),
132
+                TextField::create(
133
+                    'Global_AddTo',
134
+                    'Page types where links should be created in ( leave blank for all page types )',
135
+                    $settings->AddTo ),
136
+                TextField::create(
137
+                    'Global_IncludeIn',
138
+                    'Include Links into these fields ( comma seperated & field must support html injection )',
139
+                    $settings->IncludeIn
140
+                )
141
+            ));
142
+        }
143
+
144
+        return $fields;
145
+    }
146 146
 
147 147
     public function getCMSValidator() {
148 148
         return new RequiredFields(array('Phrase', 'PageID'));
149 149
     }
150 150
 
151
-	/**
152
-	 * Save the Global Settings into the
153
-	 * Global Auto Link Settings Object
154
-	 *
155
-	 * @return void
156
-	 */
157
-	public function onBeforeWrite() {
158
-		parent::onBeforeWrite();
159
-
160
-		$settings = GlobalAutoLinkSettings::get_current();
161
-		if ($settings) {
162
-
163
-			foreach ($this->getChangedFields() as $field => $value) {
164
-				if (strpos($field, 'Global_') === 0 && isset($value['after'])) {
165
-					$field = str_replace('Global_', '', $field);
166
-					$settings->$field = $value['after'];
167
-				}
168
-			}
169
-
170
-			$settings->write();
171
-		}
172
-
173
-		$this->CheckAndUpdateDestination();
174
-	}
175
-
176
-	/**
177
-	 * Checks if the destination is a redirector page if so
178
-	 * it updates it to the destination of the redirector page
179
-	 *
180
-	 * @Boolean $write - Write the changes if any
181
-	 * @return void
182
-	 */
183
-	public function CheckAndUpdateDestination( $write = false ){
184
-		$this->extend('beforeCheckAndUpdateDestination', $write);
185
-
186
-		if( $this->PageID && $this->Page() &&
187
-			$this->Page()->ClassName == 'RedirectorPage' &&
188
-			$this->Page()->LinkToID && $this->Page()->RedirectionType == 'Internal' )
189
-		{
190
-			$this->PageID = $this->Page()->LinkToID;
191
-			if( $write ) {
192
-			    $this->write();
193
-			}
194
-		}
195
-	}
151
+    /**
152
+     * Save the Global Settings into the
153
+     * Global Auto Link Settings Object
154
+     *
155
+     * @return void
156
+     */
157
+    public function onBeforeWrite() {
158
+        parent::onBeforeWrite();
159
+
160
+        $settings = GlobalAutoLinkSettings::get_current();
161
+        if ($settings) {
162
+
163
+            foreach ($this->getChangedFields() as $field => $value) {
164
+                if (strpos($field, 'Global_') === 0 && isset($value['after'])) {
165
+                    $field = str_replace('Global_', '', $field);
166
+                    $settings->$field = $value['after'];
167
+                }
168
+            }
169
+
170
+            $settings->write();
171
+        }
172
+
173
+        $this->CheckAndUpdateDestination();
174
+    }
175
+
176
+    /**
177
+     * Checks if the destination is a redirector page if so
178
+     * it updates it to the destination of the redirector page
179
+     *
180
+     * @Boolean $write - Write the changes if any
181
+     * @return void
182
+     */
183
+    public function CheckAndUpdateDestination( $write = false ){
184
+        $this->extend('beforeCheckAndUpdateDestination', $write);
185
+
186
+        if( $this->PageID && $this->Page() &&
187
+            $this->Page()->ClassName == 'RedirectorPage' &&
188
+            $this->Page()->LinkToID && $this->Page()->RedirectionType == 'Internal' )
189
+        {
190
+            $this->PageID = $this->Page()->LinkToID;
191
+            if( $write ) {
192
+                $this->write();
193
+            }
194
+        }
195
+    }
196 196
 
197 197
     /**
198 198
      * Checks if the field is parable
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@
 block discarded – undo
263 263
                 while($html5->length > 0) {
264 264
                     $dom->appendChild($html5->item(0));
265 265
                 }
266
-            }else{
266
+            } else{
267 267
                 $dom = $html5;
268 268
             }
269 269
         } else{
Please login to merge, or discard this patch.
code/dataobjects/AutomatedLinkPageResult.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public static function add_or_update(SiteTree $page) {
54 54
         $obj = self::get()->find('PageID', $page->ID);
55
-        if (!$obj) $obj = self::create(array('PageID' => $page->ID));
55
+        if (!$obj) {
56
+            $obj = self::create(array('PageID' => $page->ID));
57
+        }
56 58
 
57 59
         $obj->OriginalLinkCount = $page->OriginalLinkCount;
58 60
         $obj->LinksCreatedCount = $page->LinkCount;
@@ -68,6 +70,8 @@  discard block
 block discarded – undo
68 70
      * @return void
69 71
      */
70 72
     public static function remove_old_data() {
71
-        foreach (self::get() as $obj) if (!SiteTree::get()->byID($obj->PageID)) $obj->delete();
73
+        foreach (self::get() as $obj) {
74
+            if (!SiteTree::get()->byID($obj->PageID)) $obj->delete();
75
+        }
72 76
     }
73 77
 }
Please login to merge, or discard this patch.
code/dataobjects/GlobalAutoLinkSettings.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class GlobalAutoLinkSettings extends DataObject{
12 12
 
13
-	public static $enabled  = true;
13
+    public static $enabled  = true;
14 14
     public static $encoding = 'UTF-8';
15 15
 
16
-	private static $db = array(
17
-		'MaxLinksPerPage' => 'INT',
18
-		'ExcludeTags'	  => 'VARCHAR(255)',
19
-		'IncludeIn'		  => 'Text',
20
-		'AddTo'           => 'Text',
16
+    private static $db = array(
17
+        'MaxLinksPerPage' => 'INT',
18
+        'ExcludeTags'	  => 'VARCHAR(255)',
19
+        'IncludeIn'		  => 'Text',
20
+        'AddTo'           => 'Text',
21 21
         'CrawlID'         => 'VARCHAR(15)'
22
-	);
22
+    );
23 23
 
24
-	private static $defaults = array(
25
-		'IncludeIn' => 'Content'
26
-	);
24
+    private static $defaults = array(
25
+        'IncludeIn' => 'Content'
26
+    );
27 27
 
28 28
     public static $default_create_config = array(
29 29
         'MaxLinksPerPage' => 0,
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
         'IncludeIn'		  => 'Content'
32 32
     );
33 33
 
34
-	public function ExcludeTags(){
35
-		return array_unique( explode( ',', str_replace( ' ', '', $this->ExcludeTags ).',a,img,iframe,video,object' ) );
36
-	}
34
+    public function ExcludeTags(){
35
+        return array_unique( explode( ',', str_replace( ' ', '', $this->ExcludeTags ).',a,img,iframe,video,object' ) );
36
+    }
37 37
 
38
-	public function IncludeInFields(){
39
-		return explode( ',', str_replace( ' ', '', $this->IncludeIn ) );
40
-	}
38
+    public function IncludeInFields(){
39
+        return explode( ',', str_replace( ' ', '', $this->IncludeIn ) );
40
+    }
41 41
 
42 42
     public function requireDefaultRecords() {
43 43
         $hasData = self::get()->first();
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
         $alpha = 'abcdefghijklm[)0123456789(]nopqrstuvwxyz';
62 62
         $alpha_len = strlen($alpha);
63 63
 
64
-        while (strlen($ret) < 14)
65
-            $ret .= (rand(0, 1) == 0) ? strtoupper($alpha[rand(0, $alpha_len-1)]) : $alpha[rand(0, $alpha_len-1)];
64
+        while (strlen($ret) < 14) {
65
+                    $ret .= (rand(0, 1) == 0) ? strtoupper($alpha[rand(0, $alpha_len-1)]) : $alpha[rand(0, $alpha_len-1)];
66
+        }
66 67
 
67 68
         return $ret;
68 69
     }
@@ -77,7 +78,9 @@  discard block
 block discarded – undo
77 78
      */
78 79
         public function AllowedIn(){
79 80
         $classes = array_values( ClassInfo::subclassesFor( 'SiteTree' ) );
80
-        if( !$this->AddTo ) return $classes;
81
+        if( !$this->AddTo ) {
82
+            return $classes;
83
+        }
81 84
 
82 85
         $sanitized = explode( ',', str_replace( ' ', '', strtolower( $this->AddTo ) ) );
83 86
 
@@ -92,7 +95,9 @@  discard block
 block discarded – undo
92 95
                 }
93 96
             }
94 97
 
95
-            if( !$found ) unset( $sanitized[$x] );
98
+            if( !$found ) {
99
+                unset( $sanitized[$x] );
100
+            }
96 101
         }
97 102
 
98 103
         return (array) $sanitized;
Please login to merge, or discard this patch.
code/controllers/AutomatedLinkReportTask.php 1 patch
Braces   +36 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
     private static $exclude_classes = array('RedirectorPage', 'VirtualPage');
17 17
 
18 18
     public function index() {
19
-        if (!Director::is_cli()) return 'Please run this controller in CLI';
19
+        if (!Director::is_cli()) {
20
+            return 'Please run this controller in CLI';
21
+        }
20 22
 
21 23
         libxml_use_internal_errors(true);
22 24
         set_time_limit(600);
@@ -52,15 +54,23 @@  discard block
 block discarded – undo
52 54
         $exclude = Config::inst()->get($this->class, 'exclude_classes');
53 55
         $exclude = ($exclude) ? "'".implode("','", $exclude)."'" : '';
54 56
         foreach (SiteTree::get()->where("ClassName NOT IN($exclude)") as $page) {
55
-            if (!$this->checkForPossibleLinks($page, $includeInFields)) continue;
57
+            if (!$this->checkForPossibleLinks($page, $includeInFields)) {
58
+                continue;
59
+            }
56 60
             $page = $this->getLinkData($page, $includeInFields);
57
-            if (!$page) continue;
61
+            if (!$page) {
62
+                continue;
63
+            }
58 64
 
59
-            if (!$run_in_realtime) AutomatedLinkPageResult::add_or_update($page);
65
+            if (!$run_in_realtime) {
66
+                AutomatedLinkPageResult::add_or_update($page);
67
+            }
60 68
             $data->push($page);
61 69
         }
62 70
 
63
-        if (!$run_in_realtime) AutomatedLinkPageResult::remove_old_data();
71
+        if (!$run_in_realtime) {
72
+            AutomatedLinkPageResult::remove_old_data();
73
+        }
64 74
 
65 75
         return $data;
66 76
     }
@@ -78,15 +88,18 @@  discard block
 block discarded – undo
78 88
         // Set a list of all fields that can have autolinks created in them
79 89
         $page->AutomateableFields = ArrayList::create();
80 90
 
81
-        foreach (AutomatedLink::getAllDatabaseFields($page->class) as $field => $type)
82
-            if (in_array($field, $includeIn) &&
91
+        foreach (AutomatedLink::getAllDatabaseFields($page->class) as $field => $type) {
92
+                    if (in_array($field, $includeIn) &&
83 93
                 !$page->AutomateableFields->find('DataField', $field) &&
84 94
                 AutomatedLink::isFieldParsable($page, $field)
85 95
             ) $page->AutomateableFields->push(DataObject::create(array('DataField' => $field)));
96
+        }
86 97
 
87 98
         // Get data Pre-Automated Links creation
88 99
         $withLinks = $this->getPageDOM($page);
89
-        if (!$withLinks) return false;
100
+        if (!$withLinks) {
101
+            return false;
102
+        }
90 103
 
91 104
         $links = $withLinks->getElementsByTagName('a');
92 105
 
@@ -96,10 +109,11 @@  discard block
 block discarded – undo
96 109
 
97 110
         // List all automated links that were created in this $page
98 111
         $linksUsed = array();
99
-        foreach ($this->Links as $autolink)
100
-            foreach ($links as $link) {
112
+        foreach ($this->Links as $autolink) {
113
+                    foreach ($links as $link) {
101 114
                 if ($link->getAttribute('data-id') == $autolink->ID) {
102 115
                     $linksUsed[$autolink->ID] = $autolink->Phrase;
116
+        }
103 117
                     $page->OriginalLinkCount--;
104 118
                     $page->LinkCount++;
105 119
                 }
@@ -107,7 +121,9 @@  discard block
 block discarded – undo
107 121
 
108 122
         $page->Links = implode(', ', $linksUsed);
109 123
 
110
-        if ($page->LinkCount < 1) return false;
124
+        if ($page->LinkCount < 1) {
125
+            return false;
126
+        }
111 127
 
112 128
         return $page;
113 129
     }
@@ -122,8 +138,12 @@  discard block
 block discarded – undo
122 138
      */
123 139
     private function getPageDOM(SiteTree $page) {
124 140
         $controllerClass = $page->class.'_Controller';
125
-        if (!class_exists($controllerClass))  $controllerClass = $page->class.'Controller';
126
-        if (!class_exists($controllerClass)) return false;
141
+        if (!class_exists($controllerClass)) {
142
+            $controllerClass = $page->class.'Controller';
143
+        }
144
+        if (!class_exists($controllerClass)) {
145
+            return false;
146
+        }
127 147
 
128 148
         $controller = $controllerClass::create($page);
129 149
         $controller->invokeWithExtensions('addAutomatedLinks');
@@ -154,9 +174,10 @@  discard block
 block discarded – undo
154 174
      * @return Boolean
155 175
      */
156 176
     private function checkForPossibleLinks(SiteTree $page, array $includeIn) {
157
-        foreach ($this->Links as $link)
158
-            foreach ($includeIn as $possibleField)
177
+        foreach ($this->Links as $link) {
178
+                    foreach ($includeIn as $possibleField)
159 179
                 if (isset($page->$possibleField) && preg_match("/\b{$link->Phrase}\b/i", $page->$possibleField)) return true;
180
+        }
160 181
 
161 182
         return false;
162 183
     }
Please login to merge, or discard this patch.
code/extenstions/SEOToolboxControllerExtension.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,12 +73,16 @@  discard block
 block discarded – undo
73 73
     private function getSettings() {
74 74
         if ($this->settings === null) {
75 75
             $this->settings = GlobalAutoLinkSettings::get_current();
76
-            if (!$this->settings) return $this->addLinks = false;
76
+            if (!$this->settings) {
77
+                return $this->addLinks = false;
78
+            }
77 79
 
78 80
             $this->excludeTags = (array) $this->settings->ExcludeTags();
79 81
             $this->maxLinks = (int) ($this->settings->MaxLinksPerPage) ? $this->settings->MaxLinksPerPage : PHP_INT_MAX;
80 82
 
81
-            if (!in_array($this->owner->ClassName, $this->settings->AllowedIn())) $this->addLinks = false;
83
+            if (!in_array($this->owner->ClassName, $this->settings->AllowedIn())) {
84
+                $this->addLinks = false;
85
+            }
82 86
         }
83 87
 
84 88
         return $this->settings;
@@ -134,7 +138,9 @@  discard block
 block discarded – undo
134 138
         $excluded = array();
135 139
         foreach( $hash_tags as $eTag ){
136 140
             while( $tags = $html->getElementsByTagName( $eTag ) ){
137
-                if( !$tags->length ) break 1;
141
+                if( !$tags->length ) {
142
+                    break 1;
143
+                }
138 144
                 $tag	= $tags->item(0);
139 145
                 $value  = $html->saveHTML( $tag );
140 146
                 $key    = (string) crc32( $value );
@@ -166,7 +172,9 @@  discard block
 block discarded – undo
166 172
         // Count the matches
167 173
         preg_match_all( $regex, $content, $count );
168 174
         $count = ( is_array( $count ) && isset( $count[0] ) ) ? count( $count[0] ) : 0;
169
-        if( $count < 1 ) $links;
175
+        if( $count < 1 ) {
176
+            $links;
177
+        }
170 178
 
171 179
         if( isset( $this->maxLinksPerPage[ $link->ID ] ) ) {
172 180
             $max -= $this->maxLinksPerPage[$link->ID];
@@ -176,13 +184,19 @@  discard block
 block discarded – undo
176 184
 
177 185
         for( $x = 0; $x < $count; $x++ ){
178 186
             // Stop adding links if we reached the link or page limit
179
-            if( $x >= $max || $this->linkCount >= $this->maxLinks ) break;
187
+            if( $x >= $max || $this->linkCount >= $this->maxLinks ) {
188
+                break;
189
+            }
180 190
 
181 191
             // Check if there is anything else to replace else stop
182 192
             preg_match( $regex, $content, $match );
183
-            if( !is_array( $match ) || !count( $match ) ) break;
193
+            if( !is_array( $match ) || !count( $match ) ) {
194
+                break;
195
+            }
184 196
 
185
-            if( !$html = (string) $link->getHTML( $match[0] ) ) continue;
197
+            if( !$html = (string) $link->getHTML( $match[0] ) ) {
198
+                continue;
199
+            }
186 200
             $key            = (string) crc32( $html );
187 201
             $links[ $key ]  = (string) $html;
188 202
 
Please login to merge, or discard this patch.
code/controllers/SEOTestSiteTreeController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,8 +113,9 @@
 block discarded – undo
113 113
                 $phrases = array_merge($phrases, $matches[$commands['find_pos']]);
114 114
             }
115 115
 
116
-            if (isset($commands['replace']))
117
-                $html = preg_replace($commands['replace'], ' ', $html);
116
+            if (isset($commands['replace'])) {
117
+                            $html = preg_replace($commands['replace'], ' ', $html);
118
+            }
118 119
         }
119 120
 
120 121
         // Remove the empty elements
Please login to merge, or discard this patch.