| | 128 | * Obtains configuration settings |
|---|
| | 129 | * |
|---|
| | 130 | * @return void |
|---|
| | 131 | */ |
|---|
| | 132 | public function onInit() |
|---|
| | 133 | { |
|---|
| | 134 | $this->updateSetting('base_format', 'baseFormat'); |
|---|
| | 135 | $this->updateSetting('message_format', 'messageFormat'); |
|---|
| | 136 | $this->updateSetting('merge_links', 'mergeLinks'); |
|---|
| | 137 | $this->updateSetting('title_length', 'titleLength', true); |
|---|
| | 138 | $this->updateSetting('show_errors', 'showErrors'); |
|---|
| | 139 | $this->updateSetting('detect_schemeless', 'detectSchemeless'); |
|---|
| | 140 | } |
|---|
| | 141 | |
|---|
| | 142 | /** |
|---|
| 155 | | if (preg_match_all('#((?:https?://(?:(?:[a-z0-9_-]+\.?)+\.[a-z0-9]{1,6} | |
|---|
| 156 | | ([0-9]{1,3}(?:\.[0-9]{1,3}){3})) | |
|---|
| 157 | | ([@/\\\])?(?:[a-z0-9_-]+\.?)+\.[a-z0-9]{1,6})[^\s]*)#xis', |
|---|
| | 177 | if (preg_match_all('#'.($this->detectSchemeless ? '' : 'https?://').'(?:([0-9]{1,3}(?:\.[0-9]{1,3}){3})(?![^/]) | |
|---|
| | 178 | ('.($this->detectSchemeless ? '(?<!http:/|https:/)[@/\\\]' : '').')?(?:(?:[a-z0-9_-]+\.?)+\.[a-z0-9]{1,6}))[^\s]*#xis', |
|---|
| 159 | | |
|---|
| 160 | | // Updates the URL settings against the ini settings |
|---|
| 161 | | $this->updateSetting('base_format', 'baseFormat'); |
|---|
| 162 | | $this->updateSetting('message_format', 'messageFormat'); |
|---|
| 163 | | $this->updateSetting('merge_links', 'mergeLinks'); |
|---|
| 164 | | $this->updateSetting('title_length', 'titleLength', true); |
|---|
| 165 | | $this->updateSetting('show_errors', 'showErrors'); |
|---|
| 189 | | // Get the TLD from the host |
|---|
| 190 | | $pos = strrpos($parsed['host'], '.'); |
|---|
| 191 | | $parsed['tld'] = ($pos !== false ? substr($parsed['host'], ($pos+1)) : ''); |
|---|
| 192 | | |
|---|
| 193 | | // Check to see if the URL has a valid TLD |
|---|
| 194 | | if (is_array($this->tldList) && !in_array(strtolower($parsed['tld']), $this->tldList)) { |
|---|
| 195 | | $this->debug('Invalid Url: ' . $parsed['tld'] . ' is not a supported TLD. (' . $url . ')'); |
|---|
| 196 | | continue; |
|---|
| | 203 | // Process TLD if it's not an IP |
|---|
| | 204 | if (empty($m[1])) { |
|---|
| | 205 | // Get the TLD from the host |
|---|
| | 206 | $pos = strrpos($parsed['host'], '.'); |
|---|
| | 207 | $parsed['tld'] = ($pos !== false ? substr($parsed['host'], ($pos+1)) : ''); |
|---|
| | 208 | |
|---|
| | 209 | // Check to see if the URL has a valid TLD |
|---|
| | 210 | if (is_array($this->tldList) && !in_array(strtolower($parsed['tld']), $this->tldList)) { |
|---|
| | 211 | $this->debug('Invalid Url: ' . $parsed['tld'] . ' is not a supported TLD. (' . $url . ')'); |
|---|
| | 212 | continue; |
|---|
| | 213 | } |
|---|
| 551 | | $regex = "(?:(?:(?:25[0-5]|2[0-4][0-9]|19[0-1]|19[3-9]|18[0-9]|17[0-1]|17[3-9]". |
|---|
| 552 | | "|1[3-6][0-9]|12[8-9]|12[0-9]|1[0-1][0-9]|1[1-9]|[2-9][0-9]|[0-9". |
|---|
| 553 | | "])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]))|(?:192\.(?:". |
|---|
| 554 | | "25[0-5]|2[0-4][0-9]|16[0-7]|169|1[0-5][0-9]|1[7-9][0-9]|[1-9][0". |
|---|
| 555 | | "-9]|[0-9]))|(?:172\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|1[0-5]|3[2-9". |
|---|
| 556 | | "]|[4-9][0-9]|[0-9])))\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0". |
|---|
| 557 | | "-9]|[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])"; |
|---|
| 558 | | |
|---|
| 559 | | if(preg_match('/' . $regex . '/im', $ip, $matches)) { |
|---|
| 560 | | return true; |
|---|
| 561 | | } |
|---|
| 562 | | |
|---|
| 563 | | return false; |
|---|
| | 568 | return long2ip(ip2long($ip)) === $ip; |
|---|