Subversion Repositories SmartDukaan

Rev

Rev 14434 | Rev 15378 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14434 Rev 14445
Line 88... Line 88...
88
			'counterQuery' => ''
88
			'counterQuery' => ''
89
		)
89
		)
90
	);
90
	);
91
 
91
 
92
	public function getByUrl($url) {
92
	public function getByUrl($url) {
93
		$url_parts = parse_url($url);
93
		$domain = $this->get_domain($url);
94
		$domain = str_replace('www.','',$url_parts['host']);
-
 
95
		$domain = str_replace('m.','',$url_parts['host']);
-
 
96
		$domain = str_replace('dl.','',$url_parts['host']);
-
 
97
		$this->recursive = -1;
94
		$this->recursive = -1;
98
		return $this->findByDomain($domain);
95
		return $this->findByDomain($domain);
99
	}
96
	}
-
 
97
 
-
 
98
	private function get_domain($url) {
-
 
99
		$pieces = parse_url($url);
-
 
100
		$domain = isset($pieces['host']) ? $pieces['host'] : '';
-
 
101
		if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
-
 
102
			return $regs['domain'];
-
 
103
		}
-
 
104
		return false;
-
 
105
	}
100
}
106
}