@@ -73,12 +73,16 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -113,8 +113,9 @@ |
||
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 |