Skip to content

Commit 3f224df

Browse files
committed
Merge branch 'master' of git://github.com/AllenJB/DomainParser
2 parents d7846e5 + 76e2300 commit 3f224df

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

Additional.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@
5252
'qc.com', 'ru.com', 'sa.com', 'se.com', 'se.net', 'uk.com', 'uk.net', 'us.com',
5353
'us.org', 'uy.com', 'za.com', 'com.de'), 'de.vu' => array('de.vu'),
5454
'co.cc' => array(), 'com.cc' => array('com.cc'), 'org.cc' => array('org.cc'),
55-
'edu.cc' => array('edu.cc'), 'net.cc' => array('net.cc'));
55+
'edu.cc' => array('edu.cc'), 'net.cc' => array('net.cc'),
56+
'venez' => array(
57+
'0rg.fr', '1s.fr', 'ass0.fr', 'be.ma', 'c0m.at', 'c4.fr', 'ch.ma', 'fr.ht', 'fr.mu',
58+
'gaming.cx', 'ht.cx', 'lachezvos.com', 'laschezvoscoms.com', 'no-ip.be', 'no-ip.fr',
59+
'qc.cx', 'sarl.tk', 'venez.fr', 'viens.la', 'vu.cx', 'x-plosif.com', 'xl.cx', 'ze.tc', 'zik.dj',
60+
),
61+
);

Parser.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,25 @@ class Parser
127127
*/
128128
protected $path;
129129

130+
131+
/**
132+
* Custom list of additional domain groups / tlds
133+
*
134+
* @var array
135+
*/
136+
protected $customDomains = array();
137+
138+
130139
/**
131140
* Creates a DomainParser object
132141
*
133142
* @param string $format
134143
* @return void
135144
*/
136-
public function __construct($format = 'object')
145+
public function __construct($format = 'object', $path = null)
137146
{
138147
$this->setFormat($format);
139-
$this->setCachePath();
148+
$this->setCachePath($path);
140149
}
141150

142151
/**
@@ -312,6 +321,7 @@ private function load()
312321

313322
fclose($file);
314323
}
324+
$this->tldList['content'] = array_merge_recursive($this->tldList['content'], $this->customDomains);
315325

316326
$this->loaded = true;
317327
}
@@ -466,4 +476,28 @@ public function cacheTime($cacheTime = 432000)
466476
{
467477
$this->cacheTime = filter_var($cacheTime, FILTER_VALIDATE_INT);
468478
}
479+
480+
481+
/**
482+
* Add a custom domain group. This will override the built-in domain groups.
483+
*
484+
* @param string $groupName
485+
* @param array $tldList
486+
*/
487+
public function addCustomDomainGroup($groupName, array $tldList)
488+
{
489+
$this->customDomains[$groupName] = $tldList;
490+
}
491+
492+
493+
/**
494+
* Set the custom domain groups. The array should be in the same format as in Additional.php.
495+
* These will override the built-in domain groups
496+
*
497+
* @param array $domainGroups Array of domain groups and their tld lists
498+
*/
499+
public function setCustomDomainGroups(array $domainGroups)
500+
{
501+
$this->customDomains = $domainGroups;
502+
}
469503
}

0 commit comments

Comments
 (0)