element");
92 | }
93 |
94 | if (table.length > 1) {
95 | throw new Error("converting multiple table elements at once is not supported yet");
96 | }
97 |
98 | let csv;
99 |
100 | switch (action) {
101 | case "download":
102 | csv = convert(table);
103 | download(options.filename, csv);
104 | break;
105 | case "output":
106 | csv = convert(table);
107 | $(options.appendTo).append($("").text(csv));
108 | break;
109 | default:
110 | throw new Error("\"action\" argument must be one of the supported action strings");
111 | }
112 |
113 | return this;
114 | };
115 |
116 | }(jQuery));
117 |
--------------------------------------------------------------------------------
/styles/simple-grid.css:
--------------------------------------------------------------------------------
1 | /**
2 | *** SIMPLE GRID
3 | *** (C) ZACH COLE 2016
4 | **/
5 |
6 | /* UNIVERSAL */
7 |
8 | html,
9 | body {
10 | height: 100%;
11 | width: 100%;
12 | margin: 0;
13 | padding: 0;
14 | left: 0;
15 | top: 0;
16 | font-size: 100%;
17 | }
18 |
19 | /* ROOT FONT STYLES */
20 |
21 | * {
22 | font-family: monospace;
23 | color: #11AA11;
24 | line-height: 1.5;
25 | word-break: break-all;
26 | }
27 |
28 | /* POSITIONING */
29 |
30 | .left {
31 | text-align: left;
32 | }
33 |
34 | .right {
35 | text-align: right;
36 | }
37 |
38 | .center {
39 | text-align: center;
40 | margin-left: auto;
41 | margin-right: auto;
42 | }
43 |
44 | .justify {
45 | text-align: justify;
46 | }
47 |
48 | /* ==== GRID SYSTEM ==== */
49 |
50 | .container {
51 | width: 90%;
52 | margin-left: auto;
53 | margin-right: auto;
54 | }
55 |
56 | .row {
57 | position: relative;
58 | width: 100%;
59 | }
60 |
61 | .row [class^="col"] {
62 | float: left;
63 | margin: 0.5rem 2%;
64 | min-height: 0.125rem;
65 | }
66 |
67 | .col-1,
68 | .col-2,
69 | .col-3,
70 | .col-4,
71 | .col-5,
72 | .col-6,
73 | .col-7,
74 | .col-8,
75 | .col-9,
76 | .col-10,
77 | .col-11,
78 | .col-12 {
79 | width: 96%;
80 | }
81 |
82 | .col-1-sm {
83 | width: 4.33%;
84 | }
85 |
86 | .col-2-sm {
87 | width: 12.66%;
88 | }
89 |
90 | .col-3-sm {
91 | width: 21%;
92 | }
93 |
94 | .col-4-sm {
95 | width: 29.33%;
96 | }
97 |
98 | .col-5-sm {
99 | width: 37.66%;
100 | }
101 |
102 | .col-6-sm {
103 | width: 46%;
104 | }
105 |
106 | .col-7-sm {
107 | width: 54.33%;
108 | }
109 |
110 | .col-8-sm {
111 | width: 62.66%;
112 | }
113 |
114 | .col-9-sm {
115 | width: 71%;
116 | }
117 |
118 | .col-10-sm {
119 | width: 79.33%;
120 | }
121 |
122 | .col-11-sm {
123 | width: 87.66%;
124 | }
125 |
126 | .col-12-sm {
127 | width: 96%;
128 | }
129 |
130 | .row::after {
131 | content: "";
132 | display: table;
133 | clear: both;
134 | }
135 |
136 | .hidden-sm {
137 | display: none;
138 | }
139 |
140 | @media only screen and (min-width: 33.75em) { /* 540px */
141 | .container {
142 | width: 80%;
143 | }
144 | }
145 |
146 | @media only screen and (min-width: 45em) { /* 720px */
147 | .col-1 {
148 | width: 4.33%;
149 | }
150 |
151 | .col-2 {
152 | width: 12.66%;
153 | }
154 |
155 | .col-3 {
156 | width: 21%;
157 | }
158 |
159 | .col-4 {
160 | width: 29.33%;
161 | }
162 |
163 | .col-5 {
164 | width: 37.66%;
165 | }
166 |
167 | .col-6 {
168 | width: 46%;
169 | }
170 |
171 | .col-7 {
172 | width: 54.33%;
173 | }
174 |
175 | .col-8 {
176 | width: 62.66%;
177 | }
178 |
179 | .col-9 {
180 | width: 71%;
181 | }
182 |
183 | .col-10 {
184 | width: 79.33%;
185 | }
186 |
187 | .col-11 {
188 | width: 87.66%;
189 | }
190 |
191 | .col-12 {
192 | width: 96%;
193 | }
194 |
195 | .hidden-sm {
196 | display: block;
197 | }
198 | }
199 |
200 | @media only screen and (min-width: 60em) { /* 960px */
201 | .container {
202 | width: 75%;
203 | max-width: 80rem;
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/styles/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | color: #11AA11 !important;
3 | background-color: #111111;
4 | font-family: monospace;
5 | }
6 |
7 | .hidden { display: none; }
8 | .hidden-opacity { opacity: 0; }
9 |
10 | a:hover {
11 | color: #11EE11 !important;
12 | }
13 |
14 | h1 {
15 | font-size: 15px;
16 | font-family: monospace;
17 | }
18 |
19 | h2 {
20 | font-size: 14px;
21 | font-family: monospace;
22 | }
23 |
24 | h3 {
25 | font-size: 13px;
26 | font-family: monospace;
27 | }
28 |
29 | h4 {
30 | font-size: 12px;
31 | font-family: monospace;
32 | }
33 |
34 | h5 {
35 | font-size: 11px;
36 | font-family: monospace;
37 | }
38 |
39 | .clearfix::after{
40 | display:block;clear:both;content:""
41 | }
42 |
43 | .success {
44 | color: #11AA11 !important;
45 | }
46 |
47 | button.success {
48 | border: 1px solid #11AA11;
49 | }
50 |
51 | .warning {
52 | color: #AAAA11 !important;
53 | }
54 |
55 | button.warning {
56 | border: 1px solid #AAAA11;
57 | }
58 |
59 | .error {
60 | color: #AA1111 !important;
61 | }
62 |
63 | button.error {
64 | border: 1px solid #AA1111;
65 | }
66 |
67 | label,
68 | option,
69 | input[type=checkbox] {
70 | cursor: pointer;
71 | word-break: break-word;
72 | }
73 |
74 | header {
75 | margin-bottom: 20px;
76 | border-bottom: 1px solid #11AA11;
77 | }
78 |
79 | header h1 {
80 | text-align: center;
81 | }
82 |
83 | button {
84 | background-color: #111111;
85 | border: 1px solid #11AA11;
86 | cursor: pointer;
87 | }
88 |
89 | button:focus {
90 | outline: none !important;
91 | border: 1px solid #11EE11;
92 | box-shadow: 0 0 2px #11EE11;
93 | }
94 |
95 | textarea,
96 | select,
97 | input[type="text"],
98 | input[type="number"] {
99 | width: 100%;
100 | color: #11AA11;
101 | height: 200px;
102 | background-color: #111111;
103 | border: 1px solid #11AA11;
104 | resize: vertical;
105 | padding: 10px;
106 | }
107 |
108 | textarea:focus,
109 | select:focus,
110 | input[type="text"]:focus,
111 | input[type="number"]:focus {
112 | outline: none !important;
113 | border: 1px solid #11EE11;
114 | box-shadow: 0 0 2px #11EE11;
115 | }
116 |
117 | select {
118 | height: 220px;
119 | resize: none;
120 | }
121 |
122 | input[type="text"],
123 | input[type="number"] {
124 | height: 10px;
125 | }
126 |
127 | select option:checked {
128 | background: #11AA11 -webkit-linear-gradient(bottom, #11AA11 0%, #11AA11 100%);
129 | }
130 |
131 | .result-title {
132 | margin-top: 35px;
133 | }
134 |
135 | .result-title h2 {
136 | padding-bottom: 5px;
137 | border-bottom: 1px solid #11AA11;
138 | }
139 |
140 | .result h5,
141 | .result h5 span {
142 | line-height: 0.1;
143 | }
144 |
145 | .result h5 {
146 | display: inline;
147 | }
148 |
149 | .result table {
150 | border: 1px solid #11AA11;
151 | background-color: #111111;
152 | width: 100%;
153 | text-align: left;
154 | border-collapse: collapse;
155 | }
156 |
157 | .result table td, .result table th {
158 | border: 1px solid #11AA11;
159 | padding: 3px 5px;
160 | }
161 |
162 | .result table tbody td {
163 | font-size: 13px;
164 | }
165 |
166 | .result table tr:nth-child(even) {
167 | background: #112211;
168 | }
169 |
170 | .result table thead {
171 | background: #11AA11;
172 | background: -moz-linear-gradient(top, #11AA11 0%, #11BB11 66%, #11CC11 100%);
173 | background: -webkit-linear-gradient(top, #11AA11 0%, #11BB11 66%, #11CC11 100%);
174 | background: linear-gradient(to bottom, #11AA11 0%, #11BB11 66%, #11CC11 100%);
175 | border-bottom: 2px solid #11AA11;
176 | }
177 |
178 | .result table thead th {
179 | font-size: 14px;
180 | font-weight: bold;
181 | color: #EEEEEE;
182 | border-left: 2px solid #11AA11;
183 | }
184 |
185 | .result table thead th:first-child {
186 | border-left: none;
187 | }
188 |
189 | .result table tr.error td {
190 | color: #AA1111;
191 | }
192 |
193 | .result table tr.error:nth-child(even) td {
194 | background: #221111;
195 | }
196 |
197 | .result table tr.error td a {
198 | color: #AA1111;
199 | }
200 |
201 | .result table tr.error td a:hover {
202 | color: #EE1111 !important;
203 | }
204 |
205 | footer {
206 | margin: 25px 0 10px 0;
207 | padding-top: 10px;
208 | border-top: 1px solid #11AA11;
209 | }
210 |
--------------------------------------------------------------------------------
/vendor/autoload.php:
--------------------------------------------------------------------------------
1 |
7 | * Jordi Boggiano
8 | *
9 | * For the full copyright and license information, please view the LICENSE
10 | * file that was distributed with this source code.
11 | */
12 |
13 | namespace Composer\Autoload;
14 |
15 | /**
16 | * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17 | *
18 | * $loader = new \Composer\Autoload\ClassLoader();
19 | *
20 | * // register classes with namespaces
21 | * $loader->add('Symfony\Component', __DIR__.'/component');
22 | * $loader->add('Symfony', __DIR__.'/framework');
23 | *
24 | * // activate the autoloader
25 | * $loader->register();
26 | *
27 | * // to enable searching the include path (eg. for PEAR packages)
28 | * $loader->setUseIncludePath(true);
29 | *
30 | * In this example, if you try to use a class in the Symfony\Component
31 | * namespace or one of its children (Symfony\Component\Console for instance),
32 | * the autoloader will first look for the class under the component/
33 | * directory, and it will then fallback to the framework/ directory if not
34 | * found before giving up.
35 | *
36 | * This class is loosely based on the Symfony UniversalClassLoader.
37 | *
38 | * @author Fabien Potencier
39 | * @author Jordi Boggiano
40 | * @see http://www.php-fig.org/psr/psr-0/
41 | * @see http://www.php-fig.org/psr/psr-4/
42 | */
43 | class ClassLoader
44 | {
45 | // PSR-4
46 | private $prefixLengthsPsr4 = array();
47 | private $prefixDirsPsr4 = array();
48 | private $fallbackDirsPsr4 = array();
49 |
50 | // PSR-0
51 | private $prefixesPsr0 = array();
52 | private $fallbackDirsPsr0 = array();
53 |
54 | private $useIncludePath = false;
55 | private $classMap = array();
56 | private $classMapAuthoritative = false;
57 | private $missingClasses = array();
58 | private $apcuPrefix;
59 |
60 | public function getPrefixes()
61 | {
62 | if (!empty($this->prefixesPsr0)) {
63 | return call_user_func_array('array_merge', $this->prefixesPsr0);
64 | }
65 |
66 | return array();
67 | }
68 |
69 | public function getPrefixesPsr4()
70 | {
71 | return $this->prefixDirsPsr4;
72 | }
73 |
74 | public function getFallbackDirs()
75 | {
76 | return $this->fallbackDirsPsr0;
77 | }
78 |
79 | public function getFallbackDirsPsr4()
80 | {
81 | return $this->fallbackDirsPsr4;
82 | }
83 |
84 | public function getClassMap()
85 | {
86 | return $this->classMap;
87 | }
88 |
89 | /**
90 | * @param array $classMap Class to filename map
91 | */
92 | public function addClassMap(array $classMap)
93 | {
94 | if ($this->classMap) {
95 | $this->classMap = array_merge($this->classMap, $classMap);
96 | } else {
97 | $this->classMap = $classMap;
98 | }
99 | }
100 |
101 | /**
102 | * Registers a set of PSR-0 directories for a given prefix, either
103 | * appending or prepending to the ones previously set for this prefix.
104 | *
105 | * @param string $prefix The prefix
106 | * @param array|string $paths The PSR-0 root directories
107 | * @param bool $prepend Whether to prepend the directories
108 | */
109 | public function add($prefix, $paths, $prepend = false)
110 | {
111 | if (!$prefix) {
112 | if ($prepend) {
113 | $this->fallbackDirsPsr0 = array_merge(
114 | (array) $paths,
115 | $this->fallbackDirsPsr0
116 | );
117 | } else {
118 | $this->fallbackDirsPsr0 = array_merge(
119 | $this->fallbackDirsPsr0,
120 | (array) $paths
121 | );
122 | }
123 |
124 | return;
125 | }
126 |
127 | $first = $prefix[0];
128 | if (!isset($this->prefixesPsr0[$first][$prefix])) {
129 | $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130 |
131 | return;
132 | }
133 | if ($prepend) {
134 | $this->prefixesPsr0[$first][$prefix] = array_merge(
135 | (array) $paths,
136 | $this->prefixesPsr0[$first][$prefix]
137 | );
138 | } else {
139 | $this->prefixesPsr0[$first][$prefix] = array_merge(
140 | $this->prefixesPsr0[$first][$prefix],
141 | (array) $paths
142 | );
143 | }
144 | }
145 |
146 | /**
147 | * Registers a set of PSR-4 directories for a given namespace, either
148 | * appending or prepending to the ones previously set for this namespace.
149 | *
150 | * @param string $prefix The prefix/namespace, with trailing '\\'
151 | * @param array|string $paths The PSR-4 base directories
152 | * @param bool $prepend Whether to prepend the directories
153 | *
154 | * @throws \InvalidArgumentException
155 | */
156 | public function addPsr4($prefix, $paths, $prepend = false)
157 | {
158 | if (!$prefix) {
159 | // Register directories for the root namespace.
160 | if ($prepend) {
161 | $this->fallbackDirsPsr4 = array_merge(
162 | (array) $paths,
163 | $this->fallbackDirsPsr4
164 | );
165 | } else {
166 | $this->fallbackDirsPsr4 = array_merge(
167 | $this->fallbackDirsPsr4,
168 | (array) $paths
169 | );
170 | }
171 | } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172 | // Register directories for a new namespace.
173 | $length = strlen($prefix);
174 | if ('\\' !== $prefix[$length - 1]) {
175 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176 | }
177 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
179 | } elseif ($prepend) {
180 | // Prepend directories for an already registered namespace.
181 | $this->prefixDirsPsr4[$prefix] = array_merge(
182 | (array) $paths,
183 | $this->prefixDirsPsr4[$prefix]
184 | );
185 | } else {
186 | // Append directories for an already registered namespace.
187 | $this->prefixDirsPsr4[$prefix] = array_merge(
188 | $this->prefixDirsPsr4[$prefix],
189 | (array) $paths
190 | );
191 | }
192 | }
193 |
194 | /**
195 | * Registers a set of PSR-0 directories for a given prefix,
196 | * replacing any others previously set for this prefix.
197 | *
198 | * @param string $prefix The prefix
199 | * @param array|string $paths The PSR-0 base directories
200 | */
201 | public function set($prefix, $paths)
202 | {
203 | if (!$prefix) {
204 | $this->fallbackDirsPsr0 = (array) $paths;
205 | } else {
206 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207 | }
208 | }
209 |
210 | /**
211 | * Registers a set of PSR-4 directories for a given namespace,
212 | * replacing any others previously set for this namespace.
213 | *
214 | * @param string $prefix The prefix/namespace, with trailing '\\'
215 | * @param array|string $paths The PSR-4 base directories
216 | *
217 | * @throws \InvalidArgumentException
218 | */
219 | public function setPsr4($prefix, $paths)
220 | {
221 | if (!$prefix) {
222 | $this->fallbackDirsPsr4 = (array) $paths;
223 | } else {
224 | $length = strlen($prefix);
225 | if ('\\' !== $prefix[$length - 1]) {
226 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227 | }
228 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229 | $this->prefixDirsPsr4[$prefix] = (array) $paths;
230 | }
231 | }
232 |
233 | /**
234 | * Turns on searching the include path for class files.
235 | *
236 | * @param bool $useIncludePath
237 | */
238 | public function setUseIncludePath($useIncludePath)
239 | {
240 | $this->useIncludePath = $useIncludePath;
241 | }
242 |
243 | /**
244 | * Can be used to check if the autoloader uses the include path to check
245 | * for classes.
246 | *
247 | * @return bool
248 | */
249 | public function getUseIncludePath()
250 | {
251 | return $this->useIncludePath;
252 | }
253 |
254 | /**
255 | * Turns off searching the prefix and fallback directories for classes
256 | * that have not been registered with the class map.
257 | *
258 | * @param bool $classMapAuthoritative
259 | */
260 | public function setClassMapAuthoritative($classMapAuthoritative)
261 | {
262 | $this->classMapAuthoritative = $classMapAuthoritative;
263 | }
264 |
265 | /**
266 | * Should class lookup fail if not found in the current class map?
267 | *
268 | * @return bool
269 | */
270 | public function isClassMapAuthoritative()
271 | {
272 | return $this->classMapAuthoritative;
273 | }
274 |
275 | /**
276 | * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277 | *
278 | * @param string|null $apcuPrefix
279 | */
280 | public function setApcuPrefix($apcuPrefix)
281 | {
282 | $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283 | }
284 |
285 | /**
286 | * The APCu prefix in use, or null if APCu caching is not enabled.
287 | *
288 | * @return string|null
289 | */
290 | public function getApcuPrefix()
291 | {
292 | return $this->apcuPrefix;
293 | }
294 |
295 | /**
296 | * Registers this instance as an autoloader.
297 | *
298 | * @param bool $prepend Whether to prepend the autoloader or not
299 | */
300 | public function register($prepend = false)
301 | {
302 | spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303 | }
304 |
305 | /**
306 | * Unregisters this instance as an autoloader.
307 | */
308 | public function unregister()
309 | {
310 | spl_autoload_unregister(array($this, 'loadClass'));
311 | }
312 |
313 | /**
314 | * Loads the given class or interface.
315 | *
316 | * @param string $class The name of the class
317 | * @return bool|null True if loaded, null otherwise
318 | */
319 | public function loadClass($class)
320 | {
321 | if ($file = $this->findFile($class)) {
322 | includeFile($file);
323 |
324 | return true;
325 | }
326 | }
327 |
328 | /**
329 | * Finds the path to the file where the class is defined.
330 | *
331 | * @param string $class The name of the class
332 | *
333 | * @return string|false The path if found, false otherwise
334 | */
335 | public function findFile($class)
336 | {
337 | // class map lookup
338 | if (isset($this->classMap[$class])) {
339 | return $this->classMap[$class];
340 | }
341 | if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342 | return false;
343 | }
344 | if (null !== $this->apcuPrefix) {
345 | $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346 | if ($hit) {
347 | return $file;
348 | }
349 | }
350 |
351 | $file = $this->findFileWithExtension($class, '.php');
352 |
353 | // Search for Hack files if we are running on HHVM
354 | if (false === $file && defined('HHVM_VERSION')) {
355 | $file = $this->findFileWithExtension($class, '.hh');
356 | }
357 |
358 | if (null !== $this->apcuPrefix) {
359 | apcu_add($this->apcuPrefix.$class, $file);
360 | }
361 |
362 | if (false === $file) {
363 | // Remember that this class does not exist.
364 | $this->missingClasses[$class] = true;
365 | }
366 |
367 | return $file;
368 | }
369 |
370 | private function findFileWithExtension($class, $ext)
371 | {
372 | // PSR-4 lookup
373 | $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374 |
375 | $first = $class[0];
376 | if (isset($this->prefixLengthsPsr4[$first])) {
377 | $subPath = $class;
378 | while (false !== $lastPos = strrpos($subPath, '\\')) {
379 | $subPath = substr($subPath, 0, $lastPos);
380 | $search = $subPath . '\\';
381 | if (isset($this->prefixDirsPsr4[$search])) {
382 | $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383 | foreach ($this->prefixDirsPsr4[$search] as $dir) {
384 | if (file_exists($file = $dir . $pathEnd)) {
385 | return $file;
386 | }
387 | }
388 | }
389 | }
390 | }
391 |
392 | // PSR-4 fallback dirs
393 | foreach ($this->fallbackDirsPsr4 as $dir) {
394 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395 | return $file;
396 | }
397 | }
398 |
399 | // PSR-0 lookup
400 | if (false !== $pos = strrpos($class, '\\')) {
401 | // namespaced class name
402 | $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404 | } else {
405 | // PEAR-like class name
406 | $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407 | }
408 |
409 | if (isset($this->prefixesPsr0[$first])) {
410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411 | if (0 === strpos($class, $prefix)) {
412 | foreach ($dirs as $dir) {
413 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414 | return $file;
415 | }
416 | }
417 | }
418 | }
419 | }
420 |
421 | // PSR-0 fallback dirs
422 | foreach ($this->fallbackDirsPsr0 as $dir) {
423 | if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424 | return $file;
425 | }
426 | }
427 |
428 | // PSR-0 include paths.
429 | if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430 | return $file;
431 | }
432 |
433 | return false;
434 | }
435 | }
436 |
437 | /**
438 | * Scope isolated include.
439 | *
440 | * Prevents access to $this/self from included files.
441 | */
442 | function includeFile($file)
443 | {
444 | include $file;
445 | }
446 |
--------------------------------------------------------------------------------
/vendor/composer/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) Nils Adermann, Jordi Boggiano
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is furnished
9 | to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 |
22 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_classmap.php:
--------------------------------------------------------------------------------
1 | $vendorDir . '/jeremykendall/php-domain-parser/src/pdp-parse-url.php',
10 | );
11 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_namespaces.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/jeremykendall/php-domain-parser/src'),
10 | );
11 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_psr4.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/helgesverre/domain-availability/src/Service'),
10 | 'Helge\\Loader\\' => array($vendorDir . '/helgesverre/domain-availability/src/Loader'),
11 | 'Helge\\Client\\' => array($vendorDir . '/helgesverre/domain-availability/src/Client'),
12 | );
13 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27 | if ($useStaticLoader) {
28 | require_once __DIR__ . '/autoload_static.php';
29 |
30 | call_user_func(\Composer\Autoload\ComposerStaticInit208051ab01df724a15988de404668a33::getInitializer($loader));
31 | } else {
32 | $map = require __DIR__ . '/autoload_namespaces.php';
33 | foreach ($map as $namespace => $path) {
34 | $loader->set($namespace, $path);
35 | }
36 |
37 | $map = require __DIR__ . '/autoload_psr4.php';
38 | foreach ($map as $namespace => $path) {
39 | $loader->setPsr4($namespace, $path);
40 | }
41 |
42 | $classMap = require __DIR__ . '/autoload_classmap.php';
43 | if ($classMap) {
44 | $loader->addClassMap($classMap);
45 | }
46 | }
47 |
48 | $loader->register(true);
49 |
50 | if ($useStaticLoader) {
51 | $includeFiles = Composer\Autoload\ComposerStaticInit208051ab01df724a15988de404668a33::$files;
52 | } else {
53 | $includeFiles = require __DIR__ . '/autoload_files.php';
54 | }
55 | foreach ($includeFiles as $fileIdentifier => $file) {
56 | composerRequire208051ab01df724a15988de404668a33($fileIdentifier, $file);
57 | }
58 |
59 | return $loader;
60 | }
61 | }
62 |
63 | function composerRequire208051ab01df724a15988de404668a33($fileIdentifier, $file)
64 | {
65 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66 | require $file;
67 |
68 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/vendor/composer/autoload_static.php:
--------------------------------------------------------------------------------
1 | __DIR__ . '/..' . '/jeremykendall/php-domain-parser/src/pdp-parse-url.php',
11 | );
12 |
13 | public static $prefixLengthsPsr4 = array (
14 | 'H' =>
15 | array (
16 | 'Helge\\Service\\' => 14,
17 | 'Helge\\Loader\\' => 13,
18 | 'Helge\\Client\\' => 13,
19 | ),
20 | );
21 |
22 | public static $prefixDirsPsr4 = array (
23 | 'Helge\\Service\\' =>
24 | array (
25 | 0 => __DIR__ . '/..' . '/helgesverre/domain-availability/src/Service',
26 | ),
27 | 'Helge\\Loader\\' =>
28 | array (
29 | 0 => __DIR__ . '/..' . '/helgesverre/domain-availability/src/Loader',
30 | ),
31 | 'Helge\\Client\\' =>
32 | array (
33 | 0 => __DIR__ . '/..' . '/helgesverre/domain-availability/src/Client',
34 | ),
35 | );
36 |
37 | public static $prefixesPsr0 = array (
38 | 'P' =>
39 | array (
40 | 'Pdp\\' =>
41 | array (
42 | 0 => __DIR__ . '/..' . '/jeremykendall/php-domain-parser/src',
43 | ),
44 | ),
45 | );
46 |
47 | public static function getInitializer(ClassLoader $loader)
48 | {
49 | return \Closure::bind(function () use ($loader) {
50 | $loader->prefixLengthsPsr4 = ComposerStaticInit208051ab01df724a15988de404668a33::$prefixLengthsPsr4;
51 | $loader->prefixDirsPsr4 = ComposerStaticInit208051ab01df724a15988de404668a33::$prefixDirsPsr4;
52 | $loader->prefixesPsr0 = ComposerStaticInit208051ab01df724a15988de404668a33::$prefixesPsr0;
53 |
54 | }, null, ClassLoader::class);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "helgesverre/domain-availability",
4 | "version": "0.2.3",
5 | "version_normalized": "0.2.3.0",
6 | "source": {
7 | "type": "git",
8 | "url": "https://github.com/HelgeSverre/Domain-Availability.git",
9 | "reference": "f69f8dfc28959f744de371b626e5c6d7d316ef93"
10 | },
11 | "dist": {
12 | "type": "zip",
13 | "url": "https://api.github.com/repos/HelgeSverre/Domain-Availability/zipball/f69f8dfc28959f744de371b626e5c6d7d316ef93",
14 | "reference": "f69f8dfc28959f744de371b626e5c6d7d316ef93",
15 | "shasum": ""
16 | },
17 | "require": {
18 | "jeremykendall/php-domain-parser": "^3.0",
19 | "php": ">=5.3"
20 | },
21 | "require-dev": {
22 | "phpunit/phpunit": "5.0.*"
23 | },
24 | "time": "2015-10-23T00:00:00+00:00",
25 | "type": "library",
26 | "installation-source": "dist",
27 | "autoload": {
28 | "psr-4": {
29 | "Helge\\Service\\": "src/Service",
30 | "Helge\\Loader\\": "src/Loader",
31 | "Helge\\Client\\": "src/Client"
32 | }
33 | },
34 | "notification-url": "https://packagist.org/downloads/",
35 | "license": [
36 | "MIT"
37 | ],
38 | "authors": [
39 | {
40 | "name": "Helge Sverre",
41 | "email": "email@helgesverre.com",
42 | "homepage": "https://www.helgesverre.com",
43 | "role": "developer"
44 | }
45 | ],
46 | "description": "A PHP library for checking if a domain name is registered or not",
47 | "homepage": "https://helgesverre.com/products/domain-availability",
48 | "keywords": [
49 | "domain"
50 | ]
51 | },
52 | {
53 | "name": "jeremykendall/php-domain-parser",
54 | "version": "3.0.0",
55 | "version_normalized": "3.0.0.0",
56 | "source": {
57 | "type": "git",
58 | "url": "https://github.com/jeremykendall/php-domain-parser.git",
59 | "reference": "896e7e70f02bd4fd77190052799bc61e4d779672"
60 | },
61 | "dist": {
62 | "type": "zip",
63 | "url": "https://api.github.com/repos/jeremykendall/php-domain-parser/zipball/896e7e70f02bd4fd77190052799bc61e4d779672",
64 | "reference": "896e7e70f02bd4fd77190052799bc61e4d779672",
65 | "shasum": ""
66 | },
67 | "require": {
68 | "ext-curl": "*",
69 | "ext-intl": "*",
70 | "ext-mbstring": "*",
71 | "php": ">=5.3.0"
72 | },
73 | "require-dev": {
74 | "jeremykendall/debug-die": "0.0.1.*",
75 | "mikey179/vfsstream": "~1.4",
76 | "phpunit/phpunit": "~4.4"
77 | },
78 | "time": "2015-03-30T12:49:45+00:00",
79 | "bin": [
80 | "bin/parse",
81 | "bin/update-psl"
82 | ],
83 | "type": "library",
84 | "installation-source": "dist",
85 | "autoload": {
86 | "psr-0": {
87 | "Pdp\\": "src/"
88 | },
89 | "files": [
90 | "src/pdp-parse-url.php"
91 | ]
92 | },
93 | "notification-url": "https://packagist.org/downloads/",
94 | "license": [
95 | "MIT"
96 | ],
97 | "authors": [
98 | {
99 | "name": "Jeremy Kendall",
100 | "homepage": "http://about.me/jeremykendall",
101 | "role": "Developer"
102 | },
103 | {
104 | "name": "Contributors",
105 | "homepage": "https://github.com/jeremykendall/php-domain-parser/graphs/contributors"
106 | }
107 | ],
108 | "description": "Public Suffix List based URL parsing implemented in PHP.",
109 | "homepage": "https://github.com/jeremykendall/php-domain-parser",
110 | "keywords": [
111 | "Public Suffix List",
112 | "domain parsing",
113 | "url parsing"
114 | ]
115 | }
116 | ]
117 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/.gitignore:
--------------------------------------------------------------------------------
1 | vendor
2 | .idea
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | php:
3 | - 5.4
4 | - 5.5
5 | - 5.6
6 | - hhvm
7 | - nightly
8 |
9 | script:
10 | - phpunit tests/DomainAvailabilityTest.php
11 | - phpunit tests/JsonLoaderTest.php
12 | - phpunit tests/SimpleWhoisClientTest.php
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/LICENSE.md:
--------------------------------------------------------------------------------
1 | # The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Helge Sverre
4 |
5 | > Permission is hereby granted, free of charge, to any person obtaining a copy
6 | > of this software and associated documentation files (the "Software"), to deal
7 | > in the Software without restriction, including without limitation the rights
8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | > copies of the Software, and to permit persons to whom the Software is
10 | > furnished to do so, subject to the following conditions:
11 | >
12 | > The above copyright notice and this permission notice shall be included in
13 | > all copies or substantial portions of the Software.
14 | >
15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | > THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/README.md:
--------------------------------------------------------------------------------
1 | # Domain Availability
2 | [![Latest Version on Packagist][ico-version]][link-packagist]
3 | [![Software License][ico-license]](LICENSE.md)
4 | [![Total Downloads][ico-downloads]][link-downloads]
5 |
6 | A PHP library used to check domain name availability.
7 |
8 |
9 | ##  READ THIS, SERIOUSLY:
10 |
11 | This is not a reliable way to check for domain availability on a large or even a medium scale, this will not handle your "webhosting business" or anything that requires a high level of data accuracy, if you need something like that, please use [WhoAPI](https://whoapi.com/documentation/api/domain-availability) or [Namecheap's API](https://www.namecheap.com/support/api/intro.aspx).
12 |
13 | And no, I did **not build nor do i support** the WordPress plugin that is being sold on CodeCanyon which uses this package under the hood.
14 |
15 |
16 |
17 | ## Install
18 | ```bash
19 | $ composer require --dev helgesverre/domain-availability
20 | ```
21 | or
22 |
23 | ```
24 | {
25 | "require": {
26 | "helgesverre/domain-availability": "~0.2.0"
27 | }
28 | }
29 | ```
30 |
31 |
32 | ## Usage
33 |
34 | ```php
35 | isAvailable("helgesverre.com")) {
49 | echo "Domain is available";
50 | } else {
51 | echo "Domain is already taken!";
52 | }
53 |
54 |
55 | ```
56 |
57 | or look at example.php for a more real world example.
58 |
59 |
60 | ## Notes
61 | The WHOIS server list is incomplete and some data is missing. The most popular
62 | TLDs are working, though, and I will update these as I can. I suggest making your
63 | own list of whois servers and their "not found"-responses so you know which TLD is available. For a
64 | full list of TLDs and WHOIS servers please go to the [IANA website](http://www.iana.org/domains/root/db).
65 |
66 | To check what they return when a domain is not found, you simply have to manually query the servers and check.
67 |
68 | ## Supported Domain Extensions
69 | These are the domain extensions that are supported by this script.
70 |
71 | ```
72 | .com, .net, .org, .co.uk, .io, .computer, .ac, .academy, .actor, .ae, .aero, .af, .ag,
73 | .agency, .ai, .am, .archi, .arpa, .as, .asia, .associates, .at, .au, .aw, .ax, .az, .bar,
74 | .bargains, .bayern, .be, .berlin, .bg, .bi, .bike, .biz, .bj, .blackfriday, .bn, .boutique, .build,
75 | .builders, .bw, .by, .ca, .cab, .camera, .camp, .capital, .cards, .careers, .cat, .catering,
76 | .cc, .center, .ceo, .cf, .ch, .cheap, .christmas, .ci, .cl, .cleaning, .clothing, .club,
77 | .cn, .co, .codes, .coffee, .college, .cologne, .community, .company, .construction,
78 | .contractors, .cooking, .cool, .coop, .country, .cruises, .cx, .cz, .dating, .de,
79 | .democrat, .desi, .diamonds, .directory, .dk, .dm, .domains, .dz, .ec, .edu, .education,
80 | .ee, .email, .engineering, .enterprises, .equipment, .es, .estate, .eu, .eus, .events,
81 | .expert, .exposed, .farm, .feedback, .fi, .fish, .fishing, .flights, .florist, .fo,
82 | .foo, .foundation, .fr, .frogans, .futbol, .ga, .gal, .gd, .gg, .gi, .gift, .gl, .glass,
83 | .gop, .gov, .graphics, .gripe, .gs, .guitars, .guru, .gy, .haus, .hk, .hn, .holiday,
84 | .horse, .house, .hr, .ht, .hu, .id, .ie, .il, .im, .immobilien, .in, .industries,
85 | .institute, .int, .international, .iq, .ir, .is, .it, .je, .jobs, .jp, .kaufen, .ke,
86 | .kg, .ki, .kitchen, .kiwi, .koeln, .kr, .kz, .la, .land, .lease, .li, .lighting, .limo,
87 | .link, .london, .lt, .lu, .luxury, .lv, .ly, .ma, .management, .mango, .marketing, .md,
88 | .me, .media, .menu, .mg, .miami, .mk, .ml, .mn, .mo, .mobi, .moda, .monash, .mp, .ms,
89 | .mu, .museum, .mx, .my, .na, .name, .nc, .nf, .ng, .ninja, .nl, .no, .nu, .nz, .om,
90 | .onl, .paris, .partners, .parts, .pe, .pf, .photo, .photography, .photos, .pics,
91 | .pictures, .pl, .plumbing, .pm, .post, .pr, .pro, .productions, .properties, .pt,
92 | .pub, .pw, .qa, .quebec, .re, .recipes, .reisen, .rentals, .repair, .report, .rest,
93 | .reviews, .rich, .ro, .rocks, .rodeo, .rs, .ru, .ruhr, .sa, .saarland, .sb, .sc, .se,
94 | .services, .sexy, .sg, .sh, .shoes, .si, .singles, .sk, .sm, .sn, .so, .social, .solar,
95 | .solutions, .soy, .st, .su, .supplies, .supply, .support, .sx, .sy, .systems, .tattoo,
96 | .tc, .technology, .tel, .tf, .th, .tienda, .tips, .tk, .tl, .tm, .tn, .to, .today,
97 | .tools, .town, .toys, .tr, .training, .travel, .tv, .tw, .tz, .ua, .ug, .uk, .university,
98 | .us, .uy, .black, .blue, .info, .kim, .pink, .red, .shiksha, .uz, .vacations, .vc, .ve,
99 | .vegas, .ventures, .vg, .viajes, .villas, .vision, .vodka, .voting, .voyage, .vu, .wang,
100 | .watch, .wed, .wf, .wien, .wiki, .works, .ws, .xxx, .xyz, .yt, .za, .zm, .zone,
101 | ```
102 |
103 | ## Unsupported Domain Extensions
104 |
105 | Due to the fact that a lot of the domain extensions listed on the IANA website
106 | do not contain any information on which WHOIS server to use when querying for
107 | the domain information, the following domain extensions are not available (yet):
108 |
109 | ```
110 | .dj, .do, .eg, .eh, .er, .et, .fj, .fk, .fm, .gallery, .gb, .ge, .gf, .gh, .gm, .gn, .gp,
111 | .gq, .gr, .gt, .gu, .gw, .hm, .jetzt, .jm, .jo, .kh, .km, .kn, .kp, .kred, .kw, .ky, .lb,
112 | .lk, .lr, .ls, .mc, .mf, .mh, .mil, .mm, .moe, .mq, .mr, .mt, .mv, .mw, .mz, .nagoya, .ne,
113 | .neustar, .ni, .np, .nr, .nyc, .okinawa, .pa, .pg, .ph, .pk, .pn, .ps, .py, .qpon, .ren,
114 | .rw, .sd, .sj, .sl, .sohu, .sr, .ss, .sv, .sz, .td, .tg, .tj, .tokyo, .tp, .trade, .tt,
115 | .um, .uno, .va, .vi, .vi, .vn, .webcam, .ye, .yokohoma, .ryukyu, .meet, .vote, .lc,
116 | .voto, .wed, .zw
117 | ```
118 | If you know the whois server for any of these please feel free to create an issue with an update.
119 |
120 |
121 | ## Custom Integration Service!
122 |
123 | If you need to integrate this script into your website, but don't have the knowledge to do so,
124 | I offer an integration service. Email me at [email@helgesverre.com](mailto:email@helgesverre.com)
125 | (or use my [contact form](https://helgesverre.com/contact)) with a description of what
126 | you need to integrate with and I will give you a quote for my time.
127 |
128 |
129 | # Credits
130 |
131 | - Research and code by [Helge Sverre](https://helgesverre.com)
132 | - Domain Parser by [Jeremy Kendall](https://github.com/jeremykendall)
133 |
134 | ## Notes
135 |
136 | If you are getting the error:
137 | ```
138 | Fatal error: Call to undefined function Pdp\idn_to_ascii()
139 | ```
140 | Be sure to enable the php extension called ```intl``` as the domain parsing extension requires it!
141 |
142 | If certain domain extensions are always or very often returning an unexpected value, please create an issue instead of emailing me in broken english. In your issue provide me with the following:
143 |
144 | - Your webhost
145 | - Link to your website where the error is happening
146 | - The extension and domain you are trying to check availability for
147 |
148 | Keep in mind that this library queries the WHOIS servers directly and if you "spam" them with requests, you **will** get temporary banned and that will cause the library to say the domain always is taken.
149 |
150 |
151 | ## License
152 |
153 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
154 |
155 | [ico-version]: https://img.shields.io/packagist/v/helgesverre/domain-availability.svg?style=flat-square
156 | [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
157 | [ico-downloads]: https://img.shields.io/packagist/dt/helgesverre/domain-availability.svg?style=flat-square
158 |
159 | [link-packagist]: https://packagist.org/packages/helgesverre/domain-availability
160 | [link-downloads]: https://packagist.org/packages/helgesverre/domain-availability
161 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "helgesverre/domain-availability",
3 | "homepage": "https://helgesverre.com/products/domain-availability",
4 | "time": "2015-10-23",
5 | "description": "A PHP library for checking if a domain name is registered or not",
6 | "keywords": [
7 | "domain"
8 | ],
9 | "type": "library",
10 | "license": "MIT",
11 | "authors": [
12 | {
13 | "name": "Helge Sverre",
14 | "email": "email@helgesverre.com",
15 | "homepage": "https://www.helgesverre.com",
16 | "role": "developer"
17 | }
18 | ],
19 | "support": {
20 | "email": "email@helgesverre.com",
21 | "issues": "https://github.com/HelgeSverre/Domain-Availability/issues"
22 | },
23 | "require": {
24 | "php": ">=5.3",
25 | "jeremykendall/php-domain-parser": "^3.0"
26 | },
27 | "require-dev": {
28 | "phpunit/phpunit": "5.0.*"
29 | },
30 | "autoload": {
31 | "psr-4": {
32 | "Helge\\Service\\": "src/Service",
33 | "Helge\\Loader\\": "src/Loader",
34 | "Helge\\Client\\": "src/Client"
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/example.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Domain Availability Checker
5 |
6 |
7 |
20 |
21 |
22 |
27 |
28 |
32 |
33 |
34 |
35 | supportedTlds() as $tld) : ?>
36 | - = $tld; ?>
37 |
38 |
39 |
40 |
41 |
42 |
43 | Status |
44 |
45 | isAvailable($_GET["domain"])) {
50 | echo "Available";
51 | } else {
52 | echo "Unavailable";
53 | }
54 | }
55 | } catch (\Exception $e) {
56 | echo $e->getMessage();
57 | }
58 | ?>
59 | |
60 |
61 |
62 | WHOIS Server |
63 | = $whoisClient->getServer() ?> |
64 |
65 |
66 | Server Port |
67 | = $whoisClient->getPort() ?> |
68 |
69 |
70 |
71 | = $whoisClient->getResponse(); ?>
72 | |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/src/Client/SimpleWhoisClient.php:
--------------------------------------------------------------------------------
1 | server = $server;
22 | if ($port) $this->port = $port;
23 | }
24 |
25 | /**
26 | * @param string $domain the domain name to get whois data for
27 | */
28 | public function query($domain)
29 | {
30 | // Initialize the response to null
31 | $response = null;
32 |
33 | // Get the filePointer to the socket connection
34 | $filePointer = @fsockopen($this->server, $this->port); // Suppress warnings
35 |
36 | // Check if we have a file pointer
37 | if ($filePointer) {
38 |
39 | // Send our query to the file pointer
40 | fwrite($filePointer, self::formatQueryString($domain));
41 |
42 | // Append the response from the server to the response variable until end of file is reached
43 | while (!feof($filePointer)) {
44 | $response .= fgets($filePointer, 128);
45 | }
46 |
47 | // Close the file pointer
48 | fclose($filePointer);
49 | } else {
50 | return false;
51 | }
52 |
53 | // return the response, even if we never sent a request
54 | $this->response = $response;
55 |
56 | return true;
57 | }
58 |
59 | private static function formatQueryString($queryString)
60 | {
61 | $temp = strtolower($queryString);
62 | $temp = trim($temp);
63 |
64 | // Format the domain query according to RFC3912
65 | return $temp . "\r\n";
66 | }
67 |
68 | /**
69 | * @return mixed
70 | */
71 | public function getResponse()
72 | {
73 | return $this->response;
74 | }
75 |
76 | /**
77 | * @return string the whois server
78 | */
79 | public function getServer()
80 | {
81 | return $this->server;
82 | }
83 |
84 | /**
85 | * @param mixed $server
86 | */
87 | public function setServer($server)
88 | {
89 | $this->server = $server;
90 | }
91 |
92 | /**
93 | * @return mixed
94 | */
95 | public function getPort()
96 | {
97 | return $this->port;
98 | }
99 |
100 | /**
101 | * @param mixed $port
102 | */
103 | public function setPort($port)
104 | {
105 | $this->port = $port;
106 | }
107 |
108 |
109 | }
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/src/Client/WhoisClientInterface.php:
--------------------------------------------------------------------------------
1 | path = $path;
20 | }
21 |
22 | public function load()
23 | {
24 | if ($this->path) {
25 | if (file_exists($this->path)) {
26 |
27 | $contents = file_get_contents($this->path);
28 | return json_decode($contents, true);
29 | }
30 | }
31 |
32 | return false;
33 | }
34 |
35 | /**
36 | * @return mixed
37 | */
38 | public function getPath()
39 | {
40 | return $this->path;
41 | }
42 |
43 | /**
44 | * @param mixed $path
45 | */
46 | public function setPath($path)
47 | {
48 | $this->path = $path;
49 | return $this;
50 | }
51 | }
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/src/Loader/LoaderInterface.php:
--------------------------------------------------------------------------------
1 | whoisClient = $whoisClient;
21 | $this->loader = $loader;
22 | $this->servers = $loader->load();
23 | }
24 |
25 |
26 | public function isAvailable($domain, $quick = false)
27 | {
28 |
29 | /**
30 | * If the response from gethostbyname() is anything else than the domain you
31 | * passed to the function, it means the domain is registered.
32 | *
33 | * This is useful for quickly checking if a domain is taken, although its not a reliable check to see if a domain is
34 | * so we do only rely on this to check if a domain is NOT available,
35 | * then do a more reliable check later, to bypass this pass false as
36 | * the second param to this function
37 | *
38 | */
39 | if ($quick) {
40 | if (gethostbyname($domain) !== $domain) {
41 | // The domain is taken
42 | return false;
43 | }
44 | }
45 |
46 |
47 | $domainInfo = $this->parse($domain);
48 |
49 | if (!isset($this->servers[$domainInfo["tld"]])) {
50 | throw new \Exception("No WHOIS entry was found for that TLD");
51 | }
52 |
53 | $whoisServerInfo = $this->servers[$domainInfo["tld"]];
54 |
55 |
56 | /**
57 | * If for some reason you've added a WHOIS server running
58 | * on a non-standard port, this will make sure we specify that
59 | */
60 | if (isset($whoisServerInfo["port"])) {
61 | $this->whoisClient->setPort($whoisServerInfo["port"]);
62 | }
63 |
64 | // Fetch the WHOIS server from the serverlist
65 | $this->whoisClient->setServer($whoisServerInfo["server"]);
66 |
67 | // If the query fails, it returns false
68 | if (!$this->whoisClient->query($domainInfo["domain"])) {
69 | throw new \Exception("WHOIS Query failed");
70 | }
71 |
72 | // Fetch the response from the WHOIS server.
73 | $whoisData = $this->whoisClient->getResponse();
74 |
75 | // Check if the WHOIS data contains the "not found"-string
76 | if (strpos($whoisData, $whoisServerInfo["not_found"]) !== false) {
77 | // The domain is available
78 | return true;
79 | }
80 |
81 | // If we've come this far, the domain is not available.
82 | return false;
83 | }
84 |
85 |
86 |
87 | /**
88 | * Returns an array of all TLDs supported by the service.
89 | */
90 | public function supportedTlds()
91 | {
92 | return array_keys($this->servers);
93 | }
94 |
95 |
96 |
97 | /**
98 | * Wrapper around Jeremy Kendall's PHP Domain Parser that parses the
99 | * domain/url passed to the function and returns the Tld and Valid domain
100 | * @param $domain
101 | * @throws \InvalidArgumentException when the tld is not valid
102 | * @return array returns an associative array with the domain and tld
103 | */
104 | private function parse($domain)
105 | {
106 | $pslManager = new PublicSuffixListManager();
107 | $parser = new Parser($pslManager->getList());
108 |
109 | // First check if the suffix is actually valid
110 | if (!$parser->isSuffixValid($domain)) {
111 | throw new \InvalidArgumentException("Invalid TLD");
112 | }
113 |
114 | $components = [];
115 | $components["tld"] = $parser->getPublicSuffix($domain);
116 | $components["domain"] = $parser->getRegisterableDomain($domain);
117 |
118 | return $components;
119 | }
120 |
121 | }
122 |
123 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/tests/DomainAvailabilityTest.php:
--------------------------------------------------------------------------------
1 | service = new DomainAvailability($whoisClient, $dataLoader);
25 |
26 |
27 | }
28 |
29 |
30 | // TODO(22 okt 2015) ~ Helge: Write tests
31 | }
32 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/tests/JsonLoaderTest.php:
--------------------------------------------------------------------------------
1 | jsonLoader = new JsonLoader();
21 |
22 |
23 | }
24 |
25 |
26 | // TODO(22 okt 2015) ~ Helge: Write tests
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/vendor/helgesverre/domain-availability/tests/SimpleWhoisClientTest.php:
--------------------------------------------------------------------------------
1 | whoisClient = new SimpleWhoisClient();
21 |
22 |
23 | }
24 |
25 |
26 | // TODO(22 okt 2015) ~ Helge: Write tests
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/.gitignore:
--------------------------------------------------------------------------------
1 | tags
2 | data/*.txt
3 | composer.lock
4 | vendor
5 | *.swp
6 | docs
7 | *~
8 | build
9 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/.php_cs:
--------------------------------------------------------------------------------
1 | in('src/')
7 | ->in('tests/');
8 |
9 | return \Symfony\CS\Config\Config::create()
10 | ->setUsingCache(true)
11 | ->fixers([
12 | '-concat_without_spaces',
13 | 'concat_with_spaces',
14 | 'ordered_use',
15 | ])
16 | ->finder($finder);
17 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | php:
4 | - 5.3
5 | - 5.4
6 | - 5.5
7 | - 5.6
8 | - hhvm
9 |
10 | script: phpunit
11 |
12 | before_script:
13 | - composer install
14 | - ./bin/update-psl
15 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/ASF-LICENSE-2.0:
--------------------------------------------------------------------------------
1 | This license is included in this distribution to satisfy the ASF License 2.0.
2 | Certain clearly marked portions of this project are derivative works of the
3 | registered-domain-libs project, which can be found here:
4 | https://github.com/usrflo/registered-domain-libs
5 |
6 | License text begins below
7 |
8 | Licensed to the Apache Software Foundation (ASF) under one or more
9 | contributor license agreements. See the NOTICE file distributed with
10 | this work for additional information regarding copyright ownership.
11 | The ASF licenses this file to you under the Apache License, Version 2.0
12 | (the "License"); you may not use this file except in compliance with
13 | the License. You may obtain a copy of the License at:
14 |
15 | http://www.apache.org/licenses/LICENSE-2.0
16 |
17 | Unless required by applicable law or agreed to in writing, software
18 | distributed under the License is distributed on an "AS IS" BASIS,
19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
20 | implied.
21 | See the License for the specific language governing permissions
22 | and
23 | limitations under the License.
24 |
25 | Florian Sager, 25.07.2008, sager@agitos.de,
26 | http://www.agitos.de
27 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | ## Pull Requests
4 |
5 | 1. Create your own [fork](https://help.github.com/articles/fork-a-repo) of this repo
6 | 2. Create a new branch for each feature or improvement
7 | 3. Send a pull request from each feature branch to the **develop** branch
8 |
9 | It is very important to separate new features or improvements into separate
10 | feature branches, and to send a pull request for each branch. This allows me to
11 | review and pull in new features or improvements individually.
12 |
13 | ## Style Guide
14 |
15 | All pull requests must adhere to the [PSR-2 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).
16 |
17 | ## Unit Testing
18 |
19 | All pull requests must be accompanied by passing PHPUnit unit tests and
20 | complete code coverage.
21 |
22 | [Learn about PHPUnit](https://github.com/sebastianbergmann/phpunit/)
23 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2013-2014 Jeremy Kendall, http://about.me/jeremykendall
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/README.md:
--------------------------------------------------------------------------------
1 | # PHP Domain Parser
2 |
3 | **PHP Domain Parser** is a [Public Suffix List](http://publicsuffix.org/) based
4 | domain parser implemented in PHP.
5 |
6 | [](https://travis-ci.org/jeremykendall/php-domain-parser)
7 | [](https://packagist.org/packages/jeremykendall/php-domain-parser)
8 | [](https://packagist.org/packages/jeremykendall/php-domain-parser)
9 |
10 | ## Motivation
11 |
12 | While there are plenty of excellent URL parsers and builders available, there
13 | are very few projects that can accurately parse a url into its component
14 | subdomain, registerable domain, and public suffix parts.
15 |
16 | Consider the domain www.pref.okinawa.jp. In this domain, the
17 | *public suffix* portion is **okinawa.jp**, the *registerable domain* is
18 | **pref.okinawa.jp**, and the *subdomain* is **www**. You can't regex that.
19 |
20 | Other similar libraries focus primarily on URL building, parsing, and
21 | manipulation and additionally include public suffix domain parsing. PHP Domain
22 | Parser was built around accurate Public Suffix List based parsing from the very
23 | beginning, adding a URL object simply for the sake of completeness.
24 |
25 | ## Installation
26 |
27 | The only (currently) supported method of installation is via
28 | [Composer](http://getcomposer.org).
29 |
30 | Create a `composer.json` file in the root of your project:
31 |
32 | ``` json
33 | {
34 | "require": {
35 | "jeremykendall/php-domain-parser": "~2.0"
36 | }
37 | }
38 | ```
39 |
40 | And then run: `composer install`
41 |
42 | Add the autoloader to your project:
43 |
44 | ``` php
45 | getList());
65 | $host = 'http://user:pass@www.pref.okinawa.jp:8080/path/to/page.html?query=string#fragment';
66 | $url = $parser->parseUrl($host);
67 | var_dump($url);
68 | ```
69 |
70 | The above will output:
71 |
72 | ```
73 | class Pdp\Uri\Url#6 (8) {
74 | private $scheme =>
75 | string(4) "http"
76 | private $host =>
77 | class Pdp\Uri\Url\Host#5 (3) {
78 | private $subdomain =>
79 | string(3) "www"
80 | private $registerableDomain =>
81 | string(15) "pref.okinawa.jp"
82 | private $publicSuffix =>
83 | string(10) "okinawa.jp"
84 | }
85 | private $port =>
86 | int(8080)
87 | private $user =>
88 | string(4) "user"
89 | private $pass =>
90 | string(4) "pass"
91 | private $path =>
92 | string(18) "/path/to/page.html"
93 | private $query =>
94 | string(12) "query=string"
95 | private $fragment =>
96 | string(8) "fragment"
97 | }
98 | ```
99 |
100 | ### Convenience Methods
101 |
102 | A magic [`__get()`](http://php.net/manual/en/language.oop5.overloading.php#object.get)
103 | method is provided to access the above object properties. Obtaining the public
104 | suffix for a parsed domain is as simple as:
105 |
106 | ``` php
107 | parseUrl($host);
111 | $publicSuffix = $url->host->publicSuffix;
112 |
113 | // $publicSuffix = 'com.au'
114 | ```
115 |
116 | ### IDNA Support
117 |
118 | [IDN (Internationalized Domain Name)](http://en.wikipedia.org/wiki/Internationalized_domain_name)
119 | support was added in version `1.4.0`. Both unicode domains and their ASCII
120 | equivalents are supported.
121 |
122 | **IMPORTANT**:
123 |
124 | * PHP's [intl](http://php.net/manual/en/book.intl.php) extension is
125 | required for the [IDN functions](http://php.net/manual/en/ref.intl.idn.php).
126 | * PHP's [mb_string](http://php.net/manual/en/book.mbstring.php) extension is
127 | required for [mb_strtolower](http://php.net/manual/en/function.mb-strtolower.php).
128 |
129 | #### Unicode
130 |
131 | Parsing IDNA hosts is no different that parsing standard hosts. Setting `$host
132 | = 'Яндекс.РФ';` (Russian-Cyrillic) in the *Parsing URLs* example would return:
133 |
134 | ```
135 | class Pdp\Uri\Url#6 (8) {
136 | private $scheme =>
137 | string(0) ""
138 | private $host =>
139 | class Pdp\Uri\Url\Host#5 (4) {
140 | private $subdomain =>
141 | NULL
142 | private $registerableDomain =>
143 | string(17) "яндекс.рф"
144 | private $publicSuffix =>
145 | string(4) "рф"
146 | private $host =>
147 | string(17) "яндекс.рф"
148 | }
149 | private $port =>
150 | NULL
151 | private $user =>
152 | NULL
153 | private $pass =>
154 | NULL
155 | private $path =>
156 | NULL
157 | private $query =>
158 | NULL
159 | private $fragment =>
160 | NULL
161 | }
162 | ```
163 |
164 | #### ASCII (Punycode)
165 |
166 | If you choose to provide the ASCII equivalent of the unicode domain name
167 | (`$host = 'http://xn--d1acpjx3f.xn--p1ai';` in the case of the *Parsing URLs* example),
168 | the ASCII equivalent will be returned by the parser:
169 |
170 | ```
171 | class Pdp\Uri\Url#6 (8) {
172 | private $scheme =>
173 | string(4) "http"
174 | private $host =>
175 | class Pdp\Uri\Url\Host#5 (4) {
176 | private $subdomain =>
177 | NULL
178 | private $registerableDomain =>
179 | string(22) "xn--d1acpjx3f.xn--p1ai"
180 | private $publicSuffix =>
181 | string(8) "xn--p1ai"
182 | private $host =>
183 | string(22) "xn--d1acpjx3f.xn--p1ai"
184 | }
185 | private $port =>
186 | NULL
187 | private $user =>
188 | NULL
189 | private $pass =>
190 | NULL
191 | private $path =>
192 | NULL
193 | private $query =>
194 | NULL
195 | private $fragment =>
196 | NULL
197 | }
198 | ```
199 |
200 | ### IPv6 Support
201 |
202 | Parsing IPv6 hosts is no different that parsing standard hosts. Setting `$host
203 | = 'http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]:8080/';`
204 | in the *Parsing URLs* example would return:
205 |
206 | ```
207 | class Pdp\Uri\Url#6 (8) {
208 | private $scheme =>
209 | string(4) "http"
210 | private $host =>
211 | class Pdp\Uri\Url\Host#5 (4) {
212 | private $subdomain =>
213 | NULL
214 | private $registerableDomain =>
215 | NULL
216 | private $publicSuffix =>
217 | NULL
218 | private $host =>
219 | string(38) "[2001:db8:85a3:8d3:1319:8a2e:370:7348]"
220 | }
221 | private $port =>
222 | string(4) "8080"
223 | private $user =>
224 | NULL
225 | private $pass =>
226 | NULL
227 | private $path =>
228 | string(1) "/"
229 | private $query =>
230 | NULL
231 | private $fragment =>
232 | NULL
233 | }
234 | ```
235 |
236 | **IMPORTANT**: IPv6 url host names *must* be enclosed in square brackets. They
237 | will not be parsed properly otherwise.
238 |
239 | > Hat tip to [@geekwright](https://github.com/geekwright) for adding IPv6 support in a
240 | > [bugfix pull request](https://github.com/jeremykendall/php-domain-parser/pull/35).
241 |
242 | ### Parsing Domains
243 |
244 | If you'd like to parse the domain (or host) portion only, you can use
245 | `Parser::parseHost()`.
246 |
247 | ```php
248 | parseHost('a.b.c.cy');
251 | var_dump($host);
252 | ```
253 |
254 | The above will output:
255 |
256 | ```
257 | class Pdp\Uri\Url\Host#7 (3) {
258 | private $subdomain =>
259 | string(1) "a"
260 | private $registerableDomain =>
261 | string(6) "b.c.cy"
262 | private $publicSuffix =>
263 | string(4) "c.cy"
264 | }
265 | ```
266 |
267 | ### Validation of Public Suffixes
268 |
269 | Public Suffix validation is available by calling `Parser::isSuffixValid()`:
270 |
271 | ```
272 | var_dump($parser->isSuffixValid('www.example.faketld');
273 | // false
274 |
275 | var_dump($parser->isSuffixValid('www.example.com.au');
276 | // true
277 | ```
278 |
279 | A suffix is considered invalid if it is not contained in the
280 | [Public Suffix List](http://publicsuffix.org/).
281 |
282 | > Huge thanks to [@SmellyFish](https://github.com/SmellyFish) for submitting
283 | > [Add a way to validate TLDs](https://github.com/jeremykendall/php-domain-parser/pull/36)
284 | > to add public suffix validation to the project.
285 |
286 | ### Retrieving Domain Components Only ###
287 |
288 | If you're only interested in a domain component, you can use the parser to
289 | retrieve only the component you're interested in
290 |
291 | ```php
292 | getSubdomain('www.scottwills.co.uk'));
295 | var_dump($parser->getRegisterableDomain('www.scottwills.co.uk'));
296 | var_dump($parser->getPublicSuffix('www.scottwills.co.uk'));
297 | ```
298 |
299 | The above will output:
300 |
301 | ```
302 | string(3) "www"
303 | string(16) "scottwills.co.uk"
304 | string(5) "co.uk"
305 | ```
306 |
307 | ### Sanity Check
308 |
309 | You can quickly parse a url from the command line with the provided `parse`
310 | vendor binary. From the root of your project, simply call:
311 |
312 | ``` bash
313 | $ ./vendor/bin/parse
314 | ```
315 |
316 | If you pass a url to `parse`, that url will be parsed and the output printed
317 | to screen.
318 |
319 | If you do not pass a url, `http://user:pass@www.pref.okinawa.jp:8080/path/to/page.html?query=string#fragment`
320 | will be parsed and the output printed to screen.
321 |
322 | Example:
323 |
324 | ``` bash
325 | $ ./vendor/bin/parse http://www.waxaudio.com.au/
326 |
327 | Array
328 | (
329 | [scheme] => http
330 | [user] =>
331 | [pass] =>
332 | [host] => www.waxaudio.com.au
333 | [subdomain] => www
334 | [registerableDomain] => waxaudio.com.au
335 | [publicSuffix] => com.au
336 | [port] =>
337 | [path] => /
338 | [query] =>
339 | [fragment] =>
340 | )
341 | Host: http://www.waxaudio.com.au/
342 | ```
343 |
344 | ### Example Script
345 |
346 | For more information on using the PHP Domain Parser, please see the provided
347 | [example script](https://github.com/jeremykendall/php-domain-parser/blob/master/example.php).
348 |
349 | ### Refreshing the Public Suffix List
350 |
351 | While a cached PHP copy of the Public Suffix List is provided for you in the
352 | `data` directory, that copy may or may not be up to date (Mozilla provides an
353 | [Atom change feed](http://hg.mozilla.org/mozilla-central/atom-log/default/netwerk/dns/effective_tld_names.dat)
354 | to keep up with changes to the list). Please use the provided vendor binary to
355 | refresh your cached copy of the Public Suffix List.
356 |
357 | From the root of your project, simply call:
358 |
359 | ``` bash
360 | $ ./vendor/bin/update-psl
361 | ```
362 |
363 | You may verify the update by checking the timestamp on the files located in the
364 | `data` directory.
365 |
366 | **Important**: The vendor binary `update-psl` depends on an internet connection to
367 | update the cached Public Suffix List.
368 |
369 | ## Possible Unexpected Behavior
370 |
371 | PHP Domain Parser is built around PHP's
372 | [`parse_url()`](http://php.net/parse_url) function and, as such, exhibits most
373 | of the same behaviors of that function. Just like `parse_url()`, this library
374 | is not meant to validate URLs, but rather to break a URL into its component
375 | parts.
376 |
377 | One specific, counterintuitive behavior is that PHP Domain Parser will happily
378 | parse a URL with [spaces in the host part](https://github.com/jeremykendall/php-domain-parser/issues/45).
379 |
380 | ## Contributing
381 |
382 | Pull requests are *always* welcome! Please review the CONTRIBUTING.md document before
383 | submitting pull requests.
384 |
385 | ## Heads up: BC Break In All 1.4 Versions
386 |
387 | The 1.4 series introduced a backwards incompatible change by adding PHP's `ext-mbstring`
388 | and `ext-intl` as dependencies. This should have resulted in a major version
389 | bump. Instead I bumped the minor version from 1.3.1 to 1.4.
390 |
391 | I highly recommend reverting to 1.3.1 if you're running into extension issues and
392 | do not want to or cannot install `ext-mbstring` and `ext-intl`. You will lose
393 | IDNA and IPv6 support, however. Those are only available in versions >= 1.4.
394 |
395 | I apologize for any issues you may have encountered due my
396 | [semver](http://semver.org/) error.
397 |
398 | ## Attribution
399 |
400 | The HTTP adapter interface and the cURL HTTP adapter were inspired by (er,
401 | lifted from) Will Durand's excellent
402 | [Geocoder](https://github.com/willdurand/Geocoder) project. His MIT license and
403 | copyright notice are below.
404 |
405 | ```
406 | Copyright (c) 2011-2013 William Durand
407 |
408 | Permission is hereby granted, free of charge, to any person obtaining a copy
409 | of this software and associated documentation files (the "Software"), to deal
410 | in the Software without restriction, including without limitation the rights
411 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
412 | copies of the Software, and to permit persons to whom the Software is furnished
413 | to do so, subject to the following conditions:
414 |
415 | The above copyright notice and this permission notice shall be included in all
416 | copies or substantial portions of the Software.
417 |
418 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
419 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
420 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
421 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
422 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
423 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
424 | THE SOFTWARE.
425 | ```
426 |
427 | Portions of the PublicSuffixListManager and the DomainParser are derivative
428 | works of the PHP
429 | [registered-domain-libs](https://github.com/usrflo/registered-domain-libs).
430 | Those parts of this codebase are heavily commented, and I've included a copy of
431 | the Apache Software Foundation License 2.0 in this project.
432 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/bin/parse:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | getList());
25 | $url = $parser->parseUrl($domain);
26 | $suffixValid = ($parser->isSuffixValid((string) $url->host)) ? 'IS' : 'IS NOT';
27 |
28 | print_r($url->toArray());
29 | echo sprintf('Host: %s', $url) . PHP_EOL;
30 | echo sprintf(
31 | "'%s' %s a valid public suffix.",
32 | $url->host->publicSuffix,
33 | $suffixValid
34 | ) . PHP_EOL;
35 | } catch (\Exception $e) {
36 | die($e->getMessage() . PHP_EOL);
37 | }
38 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/bin/update-psl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | refreshPublicSuffixList();
26 | echo 'Update complete.' . PHP_EOL;
27 | exit(0);
28 | } catch (\Exception $e) {
29 | echo 'An error occurred while updating the Public Suffix List.' . PHP_EOL;
30 | echo $e->getMessage() . PHP_EOL;
31 | exit(1);
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/build.properties:
--------------------------------------------------------------------------------
1 | project.basedir = .
2 | passthru = true
3 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jeremykendall/php-domain-parser",
3 | "description": "Public Suffix List based URL parsing implemented in PHP.",
4 | "homepage": "https://github.com/jeremykendall/php-domain-parser",
5 | "support": {
6 | "issues": "https://github.com/jeremykendall/php-domain-parser/issues",
7 | "source": "https://github.com/jeremykendall/php-domain-parser"
8 | },
9 | "license": "MIT",
10 | "authors": [
11 | {
12 | "name": "Jeremy Kendall",
13 | "homepage": "http://about.me/jeremykendall",
14 | "role": "Developer"
15 | },
16 | {
17 | "name": "Contributors",
18 | "homepage": "https://github.com/jeremykendall/php-domain-parser/graphs/contributors"
19 | }
20 | ],
21 | "bin": [
22 | "bin/parse",
23 | "bin/update-psl"
24 | ],
25 | "keywords": [
26 | "Public Suffix List",
27 | "domain parsing",
28 | "url parsing"
29 | ],
30 | "require": {
31 | "php": ">=5.3.0",
32 | "ext-curl": "*",
33 | "ext-intl": "*",
34 | "ext-mbstring": "*"
35 | },
36 | "require-dev": {
37 | "mikey179/vfsStream": "~1.4",
38 | "phpunit/phpunit": "~4.4",
39 | "jeremykendall/debug-die": "0.0.1.*"
40 | },
41 | "autoload": {
42 | "psr-0": {
43 | "Pdp\\": "src/"
44 | },
45 | "files": [
46 | "src/pdp-parse-url.php"
47 | ]
48 | },
49 | "scripts": {
50 | "post-install-cmd": "php bin/update-psl"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/example.php:
--------------------------------------------------------------------------------
1 | getList());
11 |
12 | // Parse a URL
13 | $url = $parser->parseUrl('http://user:pass@www.pref.okinawa.jp:8080/path/to/page.html?query=string#fragment');
14 |
15 | // Accessing elements of the URL
16 | var_dump($url);
17 | var_dump($url->__toString());
18 | var_dump($url->path);
19 | var_dump($url->fragment);
20 |
21 | // Getting the Host object from the URL
22 | $host = $url->host;
23 |
24 | // Accessing elements of the Host
25 | var_dump($host);
26 | var_dump($host->__toString());
27 | var_dump($host->subdomain);
28 | var_dump($host->registerableDomain);
29 | var_dump($host->publicSuffix);
30 |
31 | // It's possible to parse a host only, if you prefer
32 | $host = $parser->parseHost('a.b.c.cy');
33 |
34 | // Accessing elements of the Host
35 | var_dump($host);
36 | var_dump($host->__toString());
37 | var_dump($host->subdomain);
38 | var_dump($host->registerableDomain);
39 | var_dump($host->publicSuffix);
40 |
41 | // If you just need to know subdomain/registerable domain/public suffix info
42 | // about a host, there are public methods available for that in the Parser
43 | var_dump($parser->getSubdomain('www.scottwills.co.uk'));
44 | var_dump($parser->getRegisterableDomain('www.scottwills.co.uk'));
45 | var_dump($parser->getPublicSuffix('www.scottwills.co.uk'));
46 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | tests/src
10 |
11 |
12 |
13 |
14 | ./src
15 |
16 |
17 |
18 |
19 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/Pdp/HttpAdapter/CurlHttpAdapter.php:
--------------------------------------------------------------------------------
1 |
23 | * @author Jeremy Kendall
24 | */
25 | class CurlHttpAdapter implements HttpAdapterInterface
26 | {
27 | /**
28 | * {@inheritdoc}
29 | */
30 | public function getContent($url)
31 | {
32 | $ch = curl_init();
33 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
34 | curl_setopt($ch, CURLOPT_URL, $url);
35 | $content = curl_exec($ch);
36 | curl_close($ch);
37 |
38 | return $content;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/Pdp/HttpAdapter/HttpAdapterInterface.php:
--------------------------------------------------------------------------------
1 |
23 | * @author Jeremy Kendall
24 | */
25 | interface HttpAdapterInterface
26 | {
27 | /**
28 | * Returns the content fetched from a given URL.
29 | *
30 | * @param string $url
31 | *
32 | * @return string Retrieved content
33 | */
34 | public function getContent($url);
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/Pdp/Parser.php:
--------------------------------------------------------------------------------
1 | publicSuffixList = $publicSuffixList;
56 | }
57 |
58 | /**
59 | * Parses url.
60 | *
61 | * @param string $url Url to parse
62 | *
63 | * @return Url Object representation of url
64 | */
65 | public function parseUrl($url)
66 | {
67 | $elem = array(
68 | 'scheme' => null,
69 | 'user' => null,
70 | 'pass' => null,
71 | 'host' => null,
72 | 'port' => null,
73 | 'path' => null,
74 | 'query' => null,
75 | 'fragment' => null,
76 | );
77 |
78 | if (preg_match(self::SCHEME_PATTERN, $url) === 0) {
79 | // Wacky scheme required to overcome parse_url behavior in PHP lt 5.4.7
80 | // See https://github.com/jeremykendall/php-domain-parser/issues/49
81 | $url = 'php-lt-5.4.7-hack://' . preg_replace('#^//#', '', $url, 1);
82 | }
83 |
84 | $parts = pdp_parse_url($url);
85 |
86 | if ($parts === false) {
87 | throw new \InvalidArgumentException(sprintf('Invalid url %s', $url));
88 | }
89 |
90 | if ($parts['scheme'] === 'php-lt-5.4.7-hack') {
91 | // Remove wacky scheme required to overcome parse_url behavior in PHP lt 5.4.7
92 | // See https://github.com/jeremykendall/php-domain-parser/issues/49
93 | $parts['scheme'] = null;
94 | }
95 |
96 | $elem = (array) $parts + $elem;
97 |
98 | $host = $this->parseHost($parts['host']);
99 |
100 | return new Url(
101 | $elem['scheme'],
102 | $elem['user'],
103 | $elem['pass'],
104 | $host,
105 | $elem['port'],
106 | $elem['path'],
107 | $elem['query'],
108 | $elem['fragment']
109 | );
110 | }
111 |
112 | /**
113 | * Parses host part of url.
114 | *
115 | * @param string $host Host part of url
116 | *
117 | * @return Host Object representation of host portion of url
118 | */
119 | public function parseHost($host)
120 | {
121 | $host = mb_strtolower($host, 'UTF-8');
122 |
123 | $subdomain = null;
124 | $registerableDomain = null;
125 | $publicSuffix = null;
126 |
127 | // Fixes #22: Single label domains are set as Host::$host and all other
128 | // properties are null.
129 | // Fixes #43: Ip Addresses should not be parsed
130 | if ($this->isMutliLabelDomain($host) || !$this->isIpv4Address($host)) {
131 | $subdomain = $this->getSubdomain($host);
132 | $registerableDomain = $this->getRegisterableDomain($host);
133 | $publicSuffix = $this->getPublicSuffix($host);
134 | }
135 |
136 | return new Host(
137 | $subdomain,
138 | $registerableDomain,
139 | $publicSuffix,
140 | $host
141 | );
142 | }
143 |
144 | /**
145 | * Get the raw public suffix based on the cached public suffix list file.
146 | * Return false if the provided suffix is not included in the PSL.
147 | *
148 | * @param string $host The host to process
149 | *
150 | * @return string|false The suffix or false if suffix not included in the PSL
151 | */
152 | protected function getRawPublicSuffix($host)
153 | {
154 | $host = $this->normalize($host);
155 |
156 | $parts = array_reverse(explode('.', $host));
157 | $publicSuffix = array();
158 | $publicSuffixList = $this->publicSuffixList;
159 |
160 | foreach ($parts as $part) {
161 | if (array_key_exists($part, $publicSuffixList)
162 | && array_key_exists('!', $publicSuffixList[$part])) {
163 | break;
164 | }
165 |
166 | if (array_key_exists($part, $publicSuffixList)) {
167 | array_unshift($publicSuffix, $part);
168 | $publicSuffixList = $publicSuffixList[$part];
169 | continue;
170 | }
171 |
172 | if (array_key_exists('*', $publicSuffixList)) {
173 | array_unshift($publicSuffix, $part);
174 | $publicSuffixList = $publicSuffixList['*'];
175 | continue;
176 | }
177 |
178 | // Avoids improper parsing when $host's subdomain + public suffix ===
179 | // a valid public suffix (e.g. host 'us.example.com' and public suffix 'us.com')
180 | //
181 | // Added by @goodhabit in https://github.com/jeremykendall/php-domain-parser/pull/15
182 | // Resolves https://github.com/jeremykendall/php-domain-parser/issues/16
183 | break;
184 | }
185 |
186 | // If empty, then the suffix is not included in the PSL and is
187 | // considered "invalid". This also triggers algorithm rule #2: If no
188 | // rules match, the prevailing rule is "*".
189 | if (empty($publicSuffix)) {
190 | return false;
191 | }
192 |
193 | $suffix = implode('.', array_filter($publicSuffix, 'strlen'));
194 |
195 | return $this->denormalize($suffix);
196 | }
197 |
198 | /**
199 | * Returns the public suffix portion of provided host.
200 | *
201 | * @param string $host host
202 | *
203 | * @return string|null public suffix or null if host does not contain a public suffix
204 | */
205 | public function getPublicSuffix($host)
206 | {
207 | if (strpos($host, '.') === 0) {
208 | return;
209 | }
210 |
211 | // Fixes #22: If a single label domain makes it this far (e.g.,
212 | // localhost, foo, etc.), this stops it from incorrectly being set as
213 | // the public suffix.
214 | if (!$this->isMutliLabelDomain($host)) {
215 | return;
216 | }
217 |
218 | // Fixes #43
219 | if ($this->isIpv4Address($host)) {
220 | return;
221 | }
222 |
223 | $suffix = $this->getRawPublicSuffix($host);
224 |
225 | // Apply algorithm rule #2: If no rules match, the prevailing rule is "*".
226 | if (false === $suffix) {
227 | $parts = array_reverse(explode('.', $host));
228 | $suffix = array_shift($parts);
229 | }
230 |
231 | return $suffix;
232 | }
233 |
234 | /**
235 | * Is suffix valid?
236 | *
237 | * Validity determined by whether or not the suffix is included in the PSL.
238 | *
239 | * @param string $host Host part
240 | *
241 | * @return bool True is suffix is valid, false otherwise
242 | */
243 | public function isSuffixValid($host)
244 | {
245 | return $this->getRawPublicSuffix($host) !== false;
246 | }
247 |
248 | /**
249 | * Returns registerable domain portion of provided host.
250 | *
251 | * Per the test cases provided by Mozilla
252 | * (http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1),
253 | * this method should return null if the domain provided is a public suffix.
254 | *
255 | * @param string $host host
256 | *
257 | * @return string registerable domain
258 | */
259 | public function getRegisterableDomain($host)
260 | {
261 | if (strpos($host, '.') === false) {
262 | return;
263 | }
264 |
265 | $publicSuffix = $this->getPublicSuffix($host);
266 |
267 | if ($publicSuffix === null || $host == $publicSuffix) {
268 | return;
269 | }
270 |
271 | $publicSuffixParts = array_reverse(explode('.', $publicSuffix));
272 | $hostParts = array_reverse(explode('.', $host));
273 | $registerableDomainParts = $publicSuffixParts + array_slice($hostParts, 0, count($publicSuffixParts) + 1);
274 |
275 | return implode('.', array_reverse($registerableDomainParts));
276 | }
277 |
278 | /**
279 | * Returns the subdomain portion of provided host.
280 | *
281 | * @param string $host host
282 | *
283 | * @return string subdomain
284 | */
285 | public function getSubdomain($host)
286 | {
287 | $registerableDomain = $this->getRegisterableDomain($host);
288 |
289 | if ($registerableDomain === null || $host === $registerableDomain) {
290 | return;
291 | }
292 |
293 | $registerableDomainParts = array_reverse(explode('.', $registerableDomain));
294 |
295 | $host = $this->normalize($host);
296 |
297 | $hostParts = array_reverse(explode('.', $host));
298 | $subdomainParts = array_slice($hostParts, count($registerableDomainParts));
299 |
300 | $subdomain = implode('.', array_reverse($subdomainParts));
301 |
302 | return $this->denormalize($subdomain);
303 | }
304 |
305 | /**
306 | * If a URL is not punycoded, then it may be an IDNA URL, so it must be
307 | * converted to ASCII. Performs conversion and sets flag.
308 | *
309 | * @param string $part Host part
310 | *
311 | * @return string Host part, transformed if not punycoded
312 | */
313 | protected function normalize($part)
314 | {
315 | $punycoded = (strpos($part, 'xn--') !== false);
316 |
317 | if ($punycoded === false) {
318 | $part = idn_to_ascii($part);
319 | $this->isNormalized = true;
320 | }
321 |
322 | return strtolower($part);
323 | }
324 |
325 | /**
326 | * Converts any normalized part back to IDNA. Performs conversion and
327 | * resets flag.
328 | *
329 | * @param string $part Host part
330 | *
331 | * @return string Denormalized host part
332 | */
333 | protected function denormalize($part)
334 | {
335 | if ($this->isNormalized === true) {
336 | $part = idn_to_utf8($part);
337 | $this->isNormalized = false;
338 | }
339 |
340 | return $part;
341 | }
342 |
343 | /**
344 | * Tests host for presence of '.'.
345 | *
346 | * Related to #22
347 | *
348 | * @param string $host Host part of url
349 | *
350 | * @return bool True if multi-label domain, false otherwise
351 | */
352 | protected function isMutliLabelDomain($host)
353 | {
354 | return strpos($host, '.') !== false;
355 | }
356 |
357 | /**
358 | * Tests host to determine if it is an IP address.
359 | *
360 | * Related to #43
361 | *
362 | * @param string $host Host part of url
363 | *
364 | * @return bool True if host is an ip address, false otherwise
365 | */
366 | protected function isIpv4Address($host)
367 | {
368 | return preg_match(self::IP_ADDRESS_PATTERN, $host) === 1;
369 | }
370 | }
371 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/Pdp/PublicSuffixList.php:
--------------------------------------------------------------------------------
1 | cacheDir = $cacheDir;
60 | }
61 |
62 | /**
63 | * Downloads Public Suffix List and writes text cache and PHP cache. If these files
64 | * already exist, they will be overwritten.
65 | */
66 | public function refreshPublicSuffixList()
67 | {
68 | $this->fetchListFromSource();
69 | $publicSuffixListArray = $this->parseListToArray(
70 | $this->cacheDir . '/' . self::PDP_PSL_TEXT_FILE
71 | );
72 | $this->writePhpCache($publicSuffixListArray);
73 | }
74 |
75 | /**
76 | * Obtain Public Suffix List from its online source and write to cache dir.
77 | *
78 | * @return int Number of bytes that were written to the file
79 | */
80 | public function fetchListFromSource()
81 | {
82 | $publicSuffixList = $this->getHttpAdapter()
83 | ->getContent($this->publicSuffixListUrl);
84 |
85 | return $this->write(self::PDP_PSL_TEXT_FILE, $publicSuffixList);
86 | }
87 |
88 | /**
89 | * Parses text representation of list to associative, multidimensional array.
90 | *
91 | * This method is based heavily on the code found in generateEffectiveTLDs.php
92 | *
93 | * @link https://github.com/usrflo/registered-domain-libs/blob/master/generateEffectiveTLDs.php
94 | * A copy of the Apache License, Version 2.0, is provided with this
95 | * distribution
96 | *
97 | * @param string $textFile Public Suffix List text filename
98 | *
99 | * @return array Associative, multidimensional array representation of the
100 | * public suffx list
101 | */
102 | public function parseListToArray($textFile)
103 | {
104 | $data = file(
105 | $textFile,
106 | FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
107 | );
108 |
109 | $data = array_filter($data, function ($line) {
110 | return strstr($line, '//') === false;
111 | });
112 |
113 | $publicSuffixListArray = array();
114 |
115 | foreach ($data as $line) {
116 | $ruleParts = explode('.', $line);
117 | $this->buildArray($publicSuffixListArray, $ruleParts);
118 | }
119 |
120 | return $publicSuffixListArray;
121 | }
122 |
123 | /**
124 | * Recursive method to build the array representation of the Public Suffix List.
125 | *
126 | * This method is based heavily on the code found in generateEffectiveTLDs.php
127 | *
128 | * @link https://github.com/usrflo/registered-domain-libs/blob/master/generateEffectiveTLDs.php
129 | * A copy of the Apache License, Version 2.0, is provided with this
130 | * distribution
131 | *
132 | * @param array $publicSuffixListArray Initially an empty array, this eventually
133 | * becomes the array representation of the Public Suffix List
134 | * @param array $ruleParts One line (rule) from the Public Suffix List
135 | * exploded on '.', or the remaining portion of that array during recursion
136 | */
137 | public function buildArray(array &$publicSuffixListArray, array $ruleParts)
138 | {
139 | $isDomain = true;
140 |
141 | $part = array_pop($ruleParts);
142 |
143 | // Adheres to canonicalization rule from the "Formal Algorithm" section
144 | // of https://publicsuffix.org/list/
145 | // "The domain and all rules must be canonicalized in the normal way
146 | // for hostnames - lower-case, Punycode (RFC 3492)."
147 | $part = idn_to_ascii($part);
148 |
149 | if (strpos($part, '!') === 0) {
150 | $part = substr($part, 1);
151 | $isDomain = false;
152 | }
153 |
154 | if (!array_key_exists($part, $publicSuffixListArray)) {
155 | if ($isDomain) {
156 | $publicSuffixListArray[$part] = array();
157 | } else {
158 | $publicSuffixListArray[$part] = array('!' => '');
159 | }
160 | }
161 |
162 | if ($isDomain && count($ruleParts) > 0) {
163 | $this->buildArray($publicSuffixListArray[$part], $ruleParts);
164 | }
165 | }
166 |
167 | /**
168 | * Writes php array representation of the Public Suffix List to disk.
169 | *
170 | * @param array $publicSuffixList Array representation of the Public Suffix List
171 | *
172 | * @return int Number of bytes that were written to the file
173 | */
174 | public function writePhpCache(array $publicSuffixList)
175 | {
176 | $data = 'write(self::PDP_PSL_PHP_FILE, $data);
179 | }
180 |
181 | /**
182 | * Gets Public Suffix List.
183 | *
184 | * @return PublicSuffixList Instance of Public Suffix List
185 | */
186 | public function getList()
187 | {
188 | if (!file_exists($this->cacheDir . '/' . self::PDP_PSL_PHP_FILE)) {
189 | $this->refreshPublicSuffixList();
190 | }
191 |
192 | $this->list = new PublicSuffixList(
193 | include $this->cacheDir . '/' . self::PDP_PSL_PHP_FILE
194 | );
195 |
196 | return $this->list;
197 | }
198 |
199 | /**
200 | * Writes to file.
201 | *
202 | * @param string $filename Filename in cache dir where data will be written
203 | * @param mixed $data Data to write
204 | *
205 | * @return int Number of bytes that were written to the file
206 | *
207 | * @throws \Exception Throws \Exception if unable to write file
208 | */
209 | protected function write($filename, $data)
210 | {
211 | $result = @file_put_contents($this->cacheDir . '/' . $filename, $data);
212 |
213 | if ($result === false) {
214 | throw new \Exception("Cannot write '" . $this->cacheDir . '/' . "$filename'");
215 | }
216 |
217 | return $result;
218 | }
219 |
220 | /**
221 | * Returns http adapter. Returns default http adapter if one is not set.
222 | *
223 | * @return \Pdp\HttpAdapter\HttpAdapterInterface Http adapter
224 | */
225 | public function getHttpAdapter()
226 | {
227 | if ($this->httpAdapter === null) {
228 | $this->httpAdapter = new HttpAdapter\CurlHttpAdapter();
229 | }
230 |
231 | return $this->httpAdapter;
232 | }
233 |
234 | /**
235 | * Sets http adapter.
236 | *
237 | * @param \Pdp\HttpAdapter\HttpAdapterInterface $httpAdapter
238 | */
239 | public function setHttpAdapter(HttpAdapter\HttpAdapterInterface $httpAdapter)
240 | {
241 | $this->httpAdapter = $httpAdapter;
242 | }
243 | }
244 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/Pdp/Uri/Url.php:
--------------------------------------------------------------------------------
1 | scheme = mb_strtolower($scheme, 'UTF-8');
85 | $this->user = $user;
86 | $this->pass = $pass;
87 | $this->host = $host;
88 | $this->port = $port;
89 | $this->path = $path;
90 | $this->query = $query;
91 | $this->fragment = $fragment;
92 | }
93 |
94 | /**
95 | * Magic getter.
96 | *
97 | * @param mixed $name Property name to get
98 | */
99 | public function __get($name)
100 | {
101 | return $this->$name;
102 | }
103 |
104 | /**
105 | * Gets schemeless url.
106 | *
107 | * @return string Url without scheme
108 | */
109 | public function getSchemeless()
110 | {
111 | return preg_replace(Parser::SCHEME_PATTERN, '//', $this->__toString(), 1);
112 | }
113 |
114 | /**
115 | * Converts the URI object to a string and returns it.
116 | *
117 | * @return string The full URI this object represents.
118 | */
119 | public function __toString()
120 | {
121 | $url = null;
122 |
123 | if ($this->scheme) {
124 | $url .= $this->scheme . '://';
125 | }
126 |
127 | if ($this->user) {
128 | $url .= urlencode($this->user);
129 | if ($this->pass) {
130 | $url .= ':' . urlencode($this->pass);
131 | }
132 | $url .= '@';
133 | }
134 |
135 | $host = $this->host->__toString();
136 |
137 | if ($host) {
138 | $url .= $host;
139 | }
140 |
141 | if ($this->port) {
142 | $url .= ':' . (int) $this->port;
143 | }
144 |
145 | if ($this->path) {
146 | $url .= $this->path;
147 | }
148 |
149 | if ($this->query) {
150 | $url .= '?' . $this->query;
151 | }
152 |
153 | if ($this->fragment) {
154 | $url .= '#' . urlencode($this->fragment);
155 | }
156 |
157 | return $url;
158 | }
159 |
160 | /**
161 | * Converts the URI object to an array and returns it.
162 | *
163 | * @return array Array of URI component parts
164 | */
165 | public function toArray()
166 | {
167 | return array(
168 | 'scheme' => $this->scheme,
169 | 'user' => $this->user,
170 | 'pass' => $this->pass,
171 | 'host' => $this->host->__toString(),
172 | 'subdomain' => $this->host->subdomain,
173 | 'registerableDomain' => $this->host->registerableDomain,
174 | 'publicSuffix' => $this->host->publicSuffix,
175 | 'port' => $this->port,
176 | 'path' => $this->path,
177 | 'query' => $this->query,
178 | 'fragment' => $this->fragment,
179 | );
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/Pdp/Uri/Url/Host.php:
--------------------------------------------------------------------------------
1 | subdomain = $subdomain;
50 | $this->registerableDomain = $registerableDomain;
51 | $this->publicSuffix = $publicSuffix;
52 | $this->host = $host;
53 | }
54 |
55 | /**
56 | * Get string representation of host.
57 | *
58 | * @return string String representation of host
59 | */
60 | public function __toString()
61 | {
62 | if ($this->host !== null) {
63 | return $this->host;
64 | }
65 |
66 | // retain only the elements that are not empty
67 | $str = array_filter(
68 | array($this->subdomain, $this->registerableDomain),
69 | 'strlen'
70 | );
71 |
72 | return implode('.', $str);
73 | }
74 |
75 | /**
76 | * Get array representation of host.
77 | *
78 | * @return array Array representation of host
79 | */
80 | public function toArray()
81 | {
82 | return array(
83 | 'subdomain' => $this->subdomain,
84 | 'registerableDomain' => $this->registerableDomain,
85 | 'publicSuffix' => $this->publicSuffix,
86 | 'host' => $this->host,
87 | );
88 | }
89 |
90 | /**
91 | * Get property.
92 | *
93 | * @param string $name Property to get
94 | *
95 | * @return string|null Property requested if exists and is set, null otherwise
96 | */
97 | public function __get($name)
98 | {
99 | return $this->$name;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/src/pdp-parse-url.php:
--------------------------------------------------------------------------------
1 | $value) {
50 | if ($name === 'scheme') {
51 | continue;
52 | }
53 |
54 | $parts[$name] = urldecode($value);
55 | }
56 | } else {
57 | $parts = urldecode($parts);
58 | }
59 |
60 | return $parts;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/tests/bootstrap.php:
--------------------------------------------------------------------------------
1 | parser = new Parser(new PublicSuffixList($file));
20 | }
21 |
22 | protected function tearDown()
23 | {
24 | $this->parser = null;
25 | }
26 |
27 | public function testPublicSuffixSpec()
28 | {
29 | // Test data from Rob Stradling at Comodo
30 | // http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1
31 | // Any copyright is dedicated to the Public Domain.
32 | // http://creativecommons.org/publicdomain/zero/1.0/
33 |
34 | // null input.
35 | $this->checkPublicSuffix(null, null);
36 | // Mixed case.
37 | $this->checkPublicSuffix('COM', null);
38 | $this->checkPublicSuffix('example.COM', 'example.com');
39 | $this->checkPublicSuffix('WwW.example.COM', 'example.com');
40 | // Leading dot.
41 | $this->checkPublicSuffix('.com', null);
42 | $this->checkPublicSuffix('.example', null);
43 | $this->checkPublicSuffix('.example.com', null);
44 | $this->checkPublicSuffix('.example.example', null);
45 | // Unlisted TLD.
46 | // Addresses algorithm rule #2: If no rules match, the prevailing rule is "*".
47 | $this->checkPublicSuffix('example', null);
48 | $this->checkPublicSuffix('example.example', 'example.example');
49 | $this->checkPublicSuffix('b.example.example', 'example.example');
50 | $this->checkPublicSuffix('a.b.example.example', 'example.example');
51 | // TLD with only 1 rule.
52 | $this->checkPublicSuffix('biz', null);
53 | $this->checkPublicSuffix('domain.biz', 'domain.biz');
54 | $this->checkPublicSuffix('b.domain.biz', 'domain.biz');
55 | $this->checkPublicSuffix('a.b.domain.biz', 'domain.biz');
56 | // TLD with some 2-level rules.
57 | $this->checkPublicSuffix('com', null);
58 | $this->checkPublicSuffix('example.com', 'example.com');
59 | $this->checkPublicSuffix('b.example.com', 'example.com');
60 | $this->checkPublicSuffix('a.b.example.com', 'example.com');
61 | $this->checkPublicSuffix('uk.com', null);
62 | $this->checkPublicSuffix('example.uk.com', 'example.uk.com');
63 | $this->checkPublicSuffix('b.example.uk.com', 'example.uk.com');
64 | $this->checkPublicSuffix('a.b.example.uk.com', 'example.uk.com');
65 | $this->checkPublicSuffix('test.ac', 'test.ac');
66 | // TLD with only 1 (wildcard) rule.
67 | $this->checkPublicSuffix('cy', null);
68 | $this->checkPublicSuffix('c.cy', null);
69 | $this->checkPublicSuffix('b.c.cy', 'b.c.cy');
70 | $this->checkPublicSuffix('a.b.c.cy', 'b.c.cy');
71 | // More complex TLD.
72 | $this->checkPublicSuffix('jp', null);
73 | $this->checkPublicSuffix('test.jp', 'test.jp');
74 | $this->checkPublicSuffix('www.test.jp', 'test.jp');
75 | $this->checkPublicSuffix('ac.jp', null);
76 | $this->checkPublicSuffix('test.ac.jp', 'test.ac.jp');
77 | $this->checkPublicSuffix('www.test.ac.jp', 'test.ac.jp');
78 | $this->checkPublicSuffix('kyoto.jp', null);
79 | $this->checkPublicSuffix('test.kyoto.jp', 'test.kyoto.jp');
80 | $this->checkPublicSuffix('ide.kyoto.jp', null);
81 | $this->checkPublicSuffix('b.ide.kyoto.jp', 'b.ide.kyoto.jp');
82 | $this->checkPublicSuffix('a.b.ide.kyoto.jp', 'b.ide.kyoto.jp');
83 | $this->checkPublicSuffix('c.kobe.jp', null);
84 | $this->checkPublicSuffix('b.c.kobe.jp', 'b.c.kobe.jp');
85 | $this->checkPublicSuffix('a.b.c.kobe.jp', 'b.c.kobe.jp');
86 | $this->checkPublicSuffix('city.kobe.jp', 'city.kobe.jp');
87 | $this->checkPublicSuffix('www.city.kobe.jp', 'city.kobe.jp');
88 | // TLD with a wildcard rule and exceptions.
89 | $this->checkPublicSuffix('ck', null);
90 | $this->checkPublicSuffix('test.ck', null);
91 | $this->checkPublicSuffix('b.test.ck', 'b.test.ck');
92 | $this->checkPublicSuffix('a.b.test.ck', 'b.test.ck');
93 | $this->checkPublicSuffix('www.ck', 'www.ck');
94 | $this->checkPublicSuffix('www.www.ck', 'www.ck');
95 | // US K12.
96 | $this->checkPublicSuffix('us', null);
97 | $this->checkPublicSuffix('test.us', 'test.us');
98 | $this->checkPublicSuffix('www.test.us', 'test.us');
99 | $this->checkPublicSuffix('ak.us', null);
100 | $this->checkPublicSuffix('test.ak.us', 'test.ak.us');
101 | $this->checkPublicSuffix('www.test.ak.us', 'test.ak.us');
102 | $this->checkPublicSuffix('k12.ak.us', null);
103 | $this->checkPublicSuffix('test.k12.ak.us', 'test.k12.ak.us');
104 | $this->checkPublicSuffix('www.test.k12.ak.us', 'test.k12.ak.us');
105 | // IDN labels.
106 | $this->checkPublicSuffix('食狮.com.cn', '食狮.com.cn');
107 | $this->checkPublicSuffix('食狮.公司.cn', '食狮.公司.cn');
108 | $this->checkPublicSuffix('www.食狮.公司.cn', '食狮.公司.cn');
109 | $this->checkPublicSuffix('shishi.公司.cn', 'shishi.公司.cn');
110 | $this->checkPublicSuffix('公司.cn', null);
111 | $this->checkPublicSuffix('食狮.中国', '食狮.中国');
112 | $this->checkPublicSuffix('www.食狮.中国', '食狮.中国');
113 | $this->checkPublicSuffix('shishi.中国', 'shishi.中国');
114 | $this->checkPublicSuffix('中国', null);
115 | // Same as above, but punycoded.
116 | $this->checkPublicSuffix('xn--85x722f.com.cn', 'xn--85x722f.com.cn');
117 | $this->checkPublicSuffix('xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn');
118 | $this->checkPublicSuffix('www.xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn');
119 | $this->checkPublicSuffix('shishi.xn--55qx5d.cn', 'shishi.xn--55qx5d.cn');
120 | $this->checkPublicSuffix('xn--55qx5d.cn', null);
121 | $this->checkPublicSuffix('xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s');
122 | $this->checkPublicSuffix('www.xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s');
123 | $this->checkPublicSuffix('shishi.xn--fiqs8s', 'shishi.xn--fiqs8s');
124 | $this->checkPublicSuffix('xn--fiqs8s', null);
125 | }
126 |
127 | /**
128 | * This is my version of the checkPublicSuffix function referred to in the
129 | * test instructions at the Public Suffix List project.
130 | *
131 | * "You will need to define a checkPublicSuffix() function which takes as a
132 | * parameter a domain name and the public suffix, runs your implementation
133 | * on the domain name and checks the result is the public suffix expected."
134 | *
135 | * @link http://publicsuffix.org/list/
136 | *
137 | * @param string $input Domain and public suffix
138 | * @param string $expected Expected result
139 | */
140 | public function checkPublicSuffix($input, $expected)
141 | {
142 | $this->assertSame($expected, $this->parser->getRegisterableDomain($input));
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/tests/src/Pdp/HttpAdapter/CurlHttpAdapterTest.php:
--------------------------------------------------------------------------------
1 | markTestSkipped('cURL has to be enabled.');
19 | }
20 |
21 | $this->adapter = new CurlHttpAdapter();
22 | }
23 |
24 | protected function tearDown()
25 | {
26 | $this->adapter = null;
27 | }
28 |
29 | public function testGetContent()
30 | {
31 | $content = $this->adapter->getContent('http://www.google.com');
32 | $this->assertNotNull($content);
33 | $this->assertContains('google', $content);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/tests/src/Pdp/ParserTest.php:
--------------------------------------------------------------------------------
1 | parser = new Parser(
14 | new PublicSuffixList($file)
15 | );
16 | }
17 |
18 | protected function tearDown()
19 | {
20 | $this->parser = null;
21 | parent::tearDown();
22 | }
23 |
24 | /**
25 | * @covers Pdp\Parser::isSuffixValid()
26 | */
27 | public function testIsSuffixValidFalse()
28 | {
29 | $this->assertFalse($this->parser->isSuffixValid('www.example.faketld'));
30 | $this->assertFalse($this->parser->isSuffixValid('example.example'));
31 | }
32 |
33 | /**
34 | * @covers Pdp\Parser::isSuffixValid()
35 | */
36 | public function testIsSuffixValidTrue()
37 | {
38 | $this->assertTrue($this->parser->isSuffixValid('www.example.com'));
39 | $this->assertTrue($this->parser->isSuffixValid('www.example.co.uk'));
40 | $this->assertTrue($this->parser->isSuffixValid('www.example.рф'));
41 | $this->assertTrue($this->parser->isSuffixValid('example.com.au'));
42 | }
43 |
44 | /**
45 | * @covers Pdp\Parser::parseUrl()
46 | * @covers ::pdp_parse_url
47 | */
48 | public function testParseBadUrlThrowsInvalidArgumentException()
49 | {
50 | $this->setExpectedException(
51 | '\InvalidArgumentException',
52 | 'Invalid url http:///example.com'
53 | );
54 |
55 | $this->parser->parseUrl('http:///example.com');
56 | }
57 |
58 | /**
59 | * @covers Pdp\Parser::parseUrl()
60 | * @dataProvider parseDataProvider
61 | */
62 | public function testParseUrl($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart)
63 | {
64 | $pdpUrl = $this->parser->parseUrl($url);
65 | $this->assertInstanceOf('\Pdp\Uri\Url', $pdpUrl);
66 | }
67 |
68 | /**
69 | * @covers Pdp\Parser::parseUrl()
70 | * @covers Pdp\Parser::parseHost()
71 | * @dataProvider parseDataProvider
72 | */
73 | public function testParseHost($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart)
74 | {
75 | $pdpUrl = $this->parser->parseUrl($url);
76 | $this->assertEquals($hostPart, $pdpUrl->host);
77 |
78 | $pdpHost = $this->parser->parseHost($hostPart);
79 | $this->assertInstanceOf('\Pdp\Uri\Url\Host', $pdpHost);
80 | $this->assertEquals($hostPart, $pdpHost->__toString());
81 | }
82 |
83 | /**
84 | * @covers Pdp\Parser::parseUrl()
85 | * @covers Pdp\Parser::getPublicSuffix()
86 | * @dataProvider parseDataProvider
87 | */
88 | public function testGetPublicSuffix($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart)
89 | {
90 | $pdpUrl = $this->parser->parseUrl($url);
91 | $this->assertSame($publicSuffix, $pdpUrl->host->publicSuffix);
92 | $this->assertSame($publicSuffix, $this->parser->getPublicSuffix($hostPart));
93 | }
94 |
95 | /**
96 | * @covers Pdp\Parser::getPublicSuffix()
97 | */
98 | public function testGetPublicSuffixHandlesWrongCaseProperly()
99 | {
100 | $publicSuffix = 'рф';
101 | $hostPart = 'Яндекс.РФ';
102 |
103 | $this->assertSame($publicSuffix, $this->parser->getPublicSuffix($hostPart));
104 | }
105 |
106 | /**
107 | * @covers Pdp\Parser::parseUrl()
108 | * @covers Pdp\Parser::getRegisterableDomain()
109 | * @dataProvider parseDataProvider
110 | */
111 | public function testGetRegisterableDomain($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart)
112 | {
113 | $pdpUrl = $this->parser->parseUrl($url);
114 | $this->assertSame($registerableDomain, $pdpUrl->host->registerableDomain);
115 | $this->assertSame($registerableDomain, $this->parser->getRegisterableDomain($hostPart));
116 | }
117 |
118 | /**
119 | * @covers Pdp\Parser::parseUrl()
120 | * @covers Pdp\Parser::getSubdomain()
121 | * @dataProvider parseDataProvider
122 | */
123 | public function testGetSubdomain($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart)
124 | {
125 | $pdpUrl = $this->parser->parseUrl($url);
126 | $this->assertSame($subdomain, $pdpUrl->host->subdomain);
127 | $this->assertSame($subdomain, $this->parser->getSubdomain($hostPart));
128 | }
129 |
130 | /**
131 | * @covers Pdp\Parser::getSubdomain()
132 | */
133 | public function testGetSubdomainHandlesWrongCaseProperly()
134 | {
135 | $url = 'http://WWW.example.COM';
136 | $hostPart = 'WWW.example.com';
137 | $subdomain = 'www';
138 | $pdpUrl = $this->parser->parseUrl($url);
139 |
140 | $this->assertSame($subdomain, $pdpUrl->host->subdomain);
141 | $this->assertSame($subdomain, $this->parser->getSubdomain($hostPart));
142 | }
143 |
144 | /**
145 | * @dataProvider parseDataProvider
146 | * @covers ::pdp_parse_url
147 | */
148 | public function testpdp_parse_urlCanReturnCorrectHost($url, $publicSuffix, $registerableDomain, $subdomain, $hostPart)
149 | {
150 | $this->assertEquals(
151 | $hostPart,
152 | pdp_parse_url('http://' . $hostPart, PHP_URL_HOST)
153 | );
154 | }
155 |
156 | /**
157 | * @group issue46
158 | * @group issue49
159 | *
160 | * Don't add a scheme to schemeless URLs
161 | *
162 | * @see https://github.com/jeremykendall/php-domain-parser/issues/46
163 | * @see https://github.com/jeremykendall/php-domain-parser/issues/49
164 | */
165 | public function testDoNotPrependSchemeToSchemelessUrls()
166 | {
167 | $schemeless = 'www.graphstory.com';
168 | $expected = 'www.graphstory.com';
169 | $url = $this->parser->parseUrl($schemeless);
170 | $actual = $url->__toString();
171 |
172 | $this->assertEquals($expected, $actual);
173 |
174 | $schemeless = '//www.graphstory.com';
175 | $expected = 'www.graphstory.com';
176 | $url = $this->parser->parseUrl($schemeless);
177 | $actual = $url->__toString();
178 |
179 | $this->assertEquals($expected, $actual);
180 | }
181 |
182 | public function parseDataProvider()
183 | {
184 | return array(
185 | // url, public suffix, registerable domain, subdomain, host part
186 | array('http://www.waxaudio.com.au/audio/albums/the_mashening', 'com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'),
187 | array('example.COM', 'com', 'example.com', null, 'example.com'),
188 | array('giant.yyyy', 'yyyy', 'giant.yyyy', null, 'giant.yyyy'),
189 | array('cea-law.co.il', 'co.il', 'cea-law.co.il', null, 'cea-law.co.il'),
190 | array('http://edition.cnn.com/WORLD/', 'com', 'cnn.com', 'edition', 'edition.cnn.com'),
191 | array('http://en.wikipedia.org/', 'org', 'wikipedia.org', 'en', 'en.wikipedia.org'),
192 | array('a.b.c.cy', 'c.cy', 'b.c.cy', 'a', 'a.b.c.cy'),
193 | array('https://test.k12.ak.us', 'k12.ak.us', 'test.k12.ak.us', null, 'test.k12.ak.us'),
194 | array('www.scottwills.co.uk', 'co.uk', 'scottwills.co.uk', 'www', 'www.scottwills.co.uk'),
195 | array('b.ide.kyoto.jp', 'ide.kyoto.jp', 'b.ide.kyoto.jp', null, 'b.ide.kyoto.jp'),
196 | array('a.b.example.uk.com', 'uk.com', 'example.uk.com', 'a.b', 'a.b.example.uk.com'),
197 | array('test.nic.ar', 'ar', 'nic.ar', 'test', 'test.nic.ar'),
198 | array('a.b.test.ck', 'test.ck', 'b.test.ck', 'a', 'a.b.test.ck'),
199 | array('baez.songfest.om', 'om', 'songfest.om', 'baez', 'baez.songfest.om'),
200 | array('politics.news.omanpost.om', 'om', 'omanpost.om', 'politics.news', 'politics.news.omanpost.om'),
201 | // BEGIN https://github.com/jeremykendall/php-domain-parser/issues/16
202 | array('us.example.com', 'com', 'example.com', 'us', 'us.example.com'),
203 | array('us.example.na', 'na', 'example.na', 'us', 'us.example.na'),
204 | array('www.example.us.na', 'us.na', 'example.us.na', 'www', 'www.example.us.na'),
205 | array('us.example.org', 'org', 'example.org', 'us', 'us.example.org'),
206 | array('webhop.broken.biz', 'biz', 'broken.biz', 'webhop', 'webhop.broken.biz'),
207 | array('www.broken.webhop.biz', 'webhop.biz', 'broken.webhop.biz', 'www', 'www.broken.webhop.biz'),
208 | // END https://github.com/jeremykendall/php-domain-parser/issues/16
209 | // Test schemeless url
210 | array('//www.broken.webhop.biz', 'webhop.biz', 'broken.webhop.biz', 'www', 'www.broken.webhop.biz'),
211 | // Test ftp support - https://github.com/jeremykendall/php-domain-parser/issues/18
212 | array('ftp://www.waxaudio.com.au/audio/albums/the_mashening', 'com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'),
213 | array('ftps://test.k12.ak.us', 'k12.ak.us', 'test.k12.ak.us', null, 'test.k12.ak.us'),
214 | // Test support for RFC 3986 compliant schemes
215 | // https://github.com/jeremykendall/php-domain-parser/issues/46
216 | array('fake-scheme+RFC-3986.compliant://example.com', 'com', 'example.com', null, 'example.com'),
217 | array('http://localhost', null, null, null, 'localhost'),
218 | array('test.museum', 'museum', 'test.museum', null, 'test.museum'),
219 | array('bob.smith.name', 'name', 'smith.name', 'bob', 'bob.smith.name'),
220 | array('tons.of.info', 'info', 'of.info', 'tons', 'tons.of.info'),
221 | // Test IDN parsing
222 | // BEGIN https://github.com/jeremykendall/php-domain-parser/issues/29
223 | array('http://Яндекс.РФ', 'рф', 'яндекс.рф', null, 'яндекс.рф'),
224 | // END https://github.com/jeremykendall/php-domain-parser/issues/29
225 | array('www.食狮.中国', '中国', '食狮.中国', 'www', 'www.食狮.中国'),
226 | array('食狮.com.cn', 'com.cn', '食狮.com.cn', null, '食狮.com.cn'),
227 | // Test punycode URLs
228 | array('www.xn--85x722f.xn--fiqs8s', 'xn--fiqs8s', 'xn--85x722f.xn--fiqs8s', 'www', 'www.xn--85x722f.xn--fiqs8s'),
229 | array('xn--85x722f.com.cn', 'com.cn', 'xn--85x722f.com.cn', null, 'xn--85x722f.com.cn'),
230 | // Test ipv6 URL
231 | array('http://[::1]/', null, null, null, '[::1]'),
232 | array('http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]/', null, null, null, '[2001:db8:85a3:8d3:1319:8a2e:370:7348]'),
233 | array('https://[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443/', null, null, null, '[2001:db8:85a3:8d3:1319:8a2e:370:7348]'),
234 | // Test IP address: Fixes #43
235 | array('http://192.168.1.2/', null, null, null, '192.168.1.2'),
236 | array('http://127.0.0.1:443', null, null, null, '127.0.0.1'),
237 | array('http://67.196.2.34/whois-archive/latest.php?page=2479', null, null, null, '67.196.2.34'),
238 | // Link-local addresses and zone indices
239 | array('http://[fe80::3%25eth0]', null, null, null, '[fe80::3%25eth0]'),
240 | array('http://[fe80::1%2511]', null, null, null, '[fe80::1%2511]'),
241 | array('http://www.example.dev', 'dev', 'example.dev', 'www', 'www.example.dev'),
242 | array('http://example.faketld', 'faketld', 'example.faketld', null, 'example.faketld'),
243 | // url, public suffix, registerable domain, subdomain, host part
244 | );
245 | }
246 | }
247 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/tests/src/Pdp/PublicSuffixListManagerTest.php:
--------------------------------------------------------------------------------
1 | dataDir = realpath(dirname(__DIR__) . '/../../data');
54 |
55 | $this->root = vfsStream::setup('pdp');
56 | vfsStream::create(array('cache' => array()), $this->root);
57 | $this->cacheDir = vfsStream::url('pdp/cache');
58 |
59 | $this->listManager = new PublicSuffixListManager($this->cacheDir);
60 |
61 | $this->httpAdapter = $this->getMock('\Pdp\HttpAdapter\HttpAdapterInterface');
62 | $this->listManager->setHttpAdapter($this->httpAdapter);
63 | }
64 |
65 | protected function tearDown()
66 | {
67 | $this->cacheDir = null;
68 | $this->root = null;
69 | $this->httpAdapter = null;
70 | $this->listManager = null;
71 |
72 | parent::tearDown();
73 | }
74 |
75 | public function testRefreshPublicSuffixList()
76 | {
77 | $content = file_get_contents(
78 | $this->dataDir . '/' . PublicSuffixListManager::PDP_PSL_TEXT_FILE
79 | );
80 |
81 | $this->httpAdapter->expects($this->once())
82 | ->method('getContent')
83 | ->with($this->publicSuffixListUrl)
84 | ->will($this->returnValue($content));
85 |
86 | $this->assertFileNotExists(
87 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_TEXT_FILE
88 | );
89 | $this->assertFileNotExists(
90 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
91 | );
92 |
93 | $this->listManager->refreshPublicSuffixList();
94 |
95 | $this->assertFileExists(
96 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_TEXT_FILE
97 | );
98 | $this->assertFileExists(
99 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
100 | );
101 | }
102 |
103 | public function testFetchListFromSource()
104 | {
105 | $content = file_get_contents(
106 | $this->dataDir . '/' . PublicSuffixListManager::PDP_PSL_TEXT_FILE
107 | );
108 |
109 | $this->httpAdapter->expects($this->once())
110 | ->method('getContent')
111 | ->with($this->publicSuffixListUrl)
112 | ->will($this->returnValue($content));
113 |
114 | $publicSuffixList = $this->listManager->fetchListFromSource();
115 | $this->assertGreaterThanOrEqual(100000, $publicSuffixList);
116 | }
117 |
118 | public function testGetHttpAdapterReturnsDefaultCurlAdapterIfAdapterNotSet()
119 | {
120 | $listManager = new PublicSuffixListManager($this->cacheDir);
121 | $this->assertInstanceOf(
122 | '\Pdp\HttpAdapter\CurlHttpAdapter',
123 | $listManager->getHttpAdapter()
124 | );
125 | }
126 |
127 | public function testWritePhpCache()
128 | {
129 | $this->assertFileNotExists(
130 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
131 | );
132 | $array = $this->listManager->parseListToArray(
133 | $this->dataDir . '/' . PublicSuffixListManager::PDP_PSL_TEXT_FILE
134 | );
135 | $this->assertGreaterThanOrEqual(230000, $this->listManager->writePhpCache($array));
136 | $this->assertFileExists(
137 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
138 | );
139 | $publicSuffixList = include $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE;
140 | $this->assertInternalType('array', $publicSuffixList);
141 | $this->assertGreaterThanOrEqual(300, count($publicSuffixList));
142 | $this->assertTrue(array_key_exists('stuff-4-sale', $publicSuffixList['org']) !== false);
143 | $this->assertTrue(array_key_exists('net', $publicSuffixList['ac']) !== false);
144 | }
145 |
146 | public function testWriteThrowsExceptionIfCanNotWrite()
147 | {
148 | $this->setExpectedException('\Exception', "Cannot write '/does/not/exist/public-suffix-list.php'");
149 | $manager = new PublicSuffixListManager('/does/not/exist');
150 | $manager->writePhpCache(array());
151 | }
152 |
153 | public function testParseListToArray()
154 | {
155 | $publicSuffixList = $this->listManager->parseListToArray(
156 | $this->dataDir . '/' . PublicSuffixListManager::PDP_PSL_TEXT_FILE
157 | );
158 | $this->assertInternalType('array', $publicSuffixList);
159 | }
160 |
161 | public function testGetList()
162 | {
163 | copy(
164 | $this->dataDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE,
165 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
166 | );
167 | $this->assertFileExists(
168 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
169 | );
170 | $publicSuffixList = $this->listManager->getList();
171 | $this->assertInstanceOf('\Pdp\PublicSuffixList', $publicSuffixList);
172 | $this->assertGreaterThanOrEqual(300, count($publicSuffixList));
173 | $this->assertTrue(array_key_exists('stuff-4-sale', $publicSuffixList['org']) !== false);
174 | $this->assertTrue(array_key_exists('net', $publicSuffixList['ac']) !== false);
175 | }
176 |
177 | public function testGetListWithoutCache()
178 | {
179 | $this->assertFileNotExists(
180 | $this->cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
181 | );
182 |
183 | $listManager = $this->getMock(
184 | '\Pdp\PublicSuffixListManager',
185 | array('refreshPublicSuffixList'),
186 | array($this->cacheDir)
187 | );
188 |
189 | $dataDir = $this->dataDir;
190 | $cacheDir = $this->cacheDir;
191 |
192 | $listManager->expects($this->once())
193 | ->method('refreshPublicSuffixList')
194 | ->will($this->returnCallback(function () use ($dataDir, $cacheDir) {
195 | copy(
196 | $dataDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE,
197 | $cacheDir . '/' . PublicSuffixListManager::PDP_PSL_PHP_FILE
198 | );
199 | }));
200 |
201 | $publicSuffixList = $listManager->getList();
202 | $this->assertInstanceOf('\Pdp\PublicSuffixList', $publicSuffixList);
203 | }
204 |
205 | public function testGetProvidedListFromDefaultCacheDir()
206 | {
207 | // By not providing cache I'm forcing use of default cache dir
208 | $listManager = new PublicSuffixListManager();
209 | $publicSuffixList = $listManager->getList();
210 | $this->assertInstanceOf('\Pdp\PublicSuffixList', $publicSuffixList);
211 | $this->assertGreaterThanOrEqual(300, count($publicSuffixList));
212 | $this->assertTrue(array_key_exists('stuff-4-sale', $publicSuffixList['org']) !== false);
213 | $this->assertTrue(array_key_exists('net', $publicSuffixList['ac']) !== false);
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/tests/src/Pdp/Uri/Url/HostTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($hostPart, $host->__toString());
20 | }
21 |
22 | public function test__toStringWhenHostPartIsNull()
23 | {
24 | $host = new Host(
25 | 'www',
26 | 'example.com',
27 | 'com'
28 | );
29 |
30 | $this->assertEquals('www.example.com', $host->__toString());
31 | }
32 |
33 | /**
34 | * @dataProvider hostDataProvider
35 | */
36 | public function test__get($publicSuffix, $registerableDomain, $subdomain, $hostPart)
37 | {
38 | $parts = array(
39 | 'subdomain' => $subdomain,
40 | 'registerableDomain' => $registerableDomain,
41 | 'publicSuffix' => $publicSuffix,
42 | 'host' => $hostPart,
43 | );
44 |
45 | $host = new Host(
46 | $parts['subdomain'],
47 | $parts['registerableDomain'],
48 | $parts['publicSuffix'],
49 | $parts['host']
50 | );
51 |
52 | $this->assertSame($hostPart, $host->host);
53 | $this->assertSame($parts['subdomain'], $host->subdomain);
54 | $this->assertEquals($parts['registerableDomain'], $host->registerableDomain);
55 | $this->assertEquals($parts['publicSuffix'], $host->publicSuffix);
56 | }
57 |
58 | /**
59 | * @dataProvider hostDataProvider
60 | */
61 | public function testToArray($publicSuffix, $registerableDomain, $subdomain, $hostPart)
62 | {
63 | $parts = array(
64 | 'subdomain' => $subdomain,
65 | 'registerableDomain' => $registerableDomain,
66 | 'publicSuffix' => $publicSuffix,
67 | 'host' => $hostPart,
68 | );
69 |
70 | $host = new Host(
71 | $parts['subdomain'],
72 | $parts['registerableDomain'],
73 | $parts['publicSuffix'],
74 | $parts['host']
75 | );
76 |
77 | $this->assertEquals($parts, $host->toArray());
78 | }
79 |
80 | public function hostDataProvider()
81 | {
82 | // $publicSuffix, $registerableDomain, $subdomain, $hostPart
83 | return array(
84 | array('com.au', 'waxaudio.com.au', 'www', 'www.waxaudio.com.au'),
85 | array('com', 'example.com', null, 'example.com'),
86 | array('com', 'cnn.com', 'edition', 'edition.cnn.com'),
87 | array('org', 'wikipedia.org', 'en', 'en.wikipedia.org'),
88 | array('uk.com', 'example.uk.com', 'a.b', 'a.b.example.uk.com'),
89 | array(null, null, null, 'localhost'),
90 | );
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/vendor/jeremykendall/php-domain-parser/tests/src/Pdp/Uri/UrlTest.php:
--------------------------------------------------------------------------------
1 | parser = new Parser($psl);
38 | $this->url = $this->parser->parseUrl($this->spec);
39 | }
40 |
41 | protected function tearDown()
42 | {
43 | parent::tearDown();
44 | }
45 |
46 | public function test__construct()
47 | {
48 | $url = new Url(
49 | 'http',
50 | 'anonymous',
51 | 'guest',
52 | new Host(
53 | null,
54 | 'example.com',
55 | 'com'
56 | ),
57 | null,
58 | '/path/to/index.php/foo/bar.xml',
59 | 'baz=dib',
60 | 'anchor'
61 | );
62 |
63 | $this->assertInstanceOf('Pdp\Uri\Url', $url);
64 | }
65 |
66 | public function test__toString()
67 | {
68 | $this->assertEquals($this->spec, $this->url->__toString());
69 | }
70 |
71 | public function testGetSchemeless()
72 | {
73 | $schemeless = substr_replace($this->spec, '', 0, 5);
74 | $this->assertEquals($schemeless, $this->url->getSchemeless());
75 | }
76 |
77 | public function test__getProperties()
78 | {
79 | $expected = array(
80 | 'scheme' => 'http',
81 | 'user' => 'anonymous',
82 | 'pass' => 'guest',
83 | 'host' => 'example.com',
84 | 'port' => 8080,
85 | 'path' => '/path/to/index.php/foo/bar.xml',
86 | 'query' => 'baz=dib',
87 | 'fragment' => 'anchor',
88 | );
89 |
90 | $this->assertEquals($expected['scheme'], $this->url->scheme);
91 | $this->assertEquals($expected['user'], $this->url->user);
92 | $this->assertEquals($expected['pass'], $this->url->pass);
93 | $this->assertEquals($expected['host'], $this->url->host->__toString());
94 | $this->assertEquals($expected['port'], $this->url->port);
95 | $this->assertEquals($expected['path'], $this->url->path);
96 | $this->assertEquals($expected['query'], $this->url->query);
97 | $this->assertEquals($expected['fragment'], $this->url->fragment);
98 | }
99 |
100 | public function testToArray()
101 | {
102 | $expected = array(
103 | 'scheme' => 'http',
104 | 'user' => 'anonymous',
105 | 'pass' => 'guest',
106 | 'host' => 'example.com',
107 | 'subdomain' => null,
108 | 'registerableDomain' => 'example.com',
109 | 'publicSuffix' => 'com',
110 | 'port' => 8080,
111 | 'path' => '/path/to/index.php/foo/bar.xml',
112 | 'query' => 'baz=dib',
113 | 'fragment' => 'anchor',
114 | );
115 |
116 | $this->assertEquals($expected, $this->url->toArray());
117 | }
118 |
119 | /**
120 | * @group issue18
121 | *
122 | * @see https://github.com/jeremykendall/php-domain-parser/issues/18
123 | */
124 | public function testFtpUrlToString()
125 | {
126 | $ftpUrl = 'ftp://ftp.somewhere.com';
127 | $url = $this->parser->parseUrl($ftpUrl);
128 | $this->assertEquals($ftpUrl, $url->__toString());
129 | }
130 |
131 | /**
132 | * This test fixes #29. It has been updated due to a change suggested in #46.
133 | * The original $expected value was 'http://яндекс.рф', as parsing would add
134 | * 'http://' to URLs that did not have a scheme. That behavior has been removed.
135 | * The new $expected result is 'яндекс.рф'.
136 | *
137 | * @group issue29
138 | * @group issue46
139 | *
140 | * @see https://github.com/jeremykendall/php-domain-parser/issues/29
141 | * @see https://github.com/jeremykendall/php-domain-parser/issues/46
142 | */
143 | public function testIdnToAscii()
144 | {
145 | $idn = 'Яндекс.РФ';
146 | $expected = 'яндекс.рф';
147 | $url = $this->parser->parseUrl($idn);
148 | $actual = $url->__toString();
149 |
150 | $this->assertEquals($expected, $actual);
151 | }
152 |
153 | /**
154 | * Scheme should not be URL encoded
155 | *
156 | * @group issue46
157 | * @group issue51
158 | *
159 | * @see https://tools.ietf.org/html/rfc3986#section-3.1
160 | */
161 | public function test__toStringDoesNotUrlEncodeScheme()
162 | {
163 | // The '+' should not be URL encoded when output to string
164 | $spec = 'fake-scheme+RFC-3986.compliant://www.graphstory.com';
165 | $expected = 'fake-scheme+rfc-3986.compliant://www.graphstory.com';
166 | $url = $this->parser->parseUrl($spec);
167 | $this->assertEquals($expected, $url->__toString());
168 | }
169 |
170 | /**
171 | * Scheme should be output in lowercase regardless of case of original arg
172 | *
173 | * @group issue51
174 | *
175 | * @see https://tools.ietf.org/html/rfc3986#section-3.1
176 | */
177 | public function testSchemeAlwaysConvertedToLowerCasePerRFC3986()
178 | {
179 | $spec = 'HttPS://www.google.com';
180 | $expected = 'https://www.google.com';
181 | $url = $this->parser->parseUrl($spec);
182 | $this->assertEquals($expected, $url->__toString());
183 | }
184 | }
185 |
--------------------------------------------------------------------------------