forked from vezaynk/Sitemap-Generator-Crawler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sitemap.php
executable file
·72 lines (60 loc) · 1.89 KB
/
sitemap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/***************************\
* |***DO NOT EDIT THIS FILE***|
* |**EDIT sitemap.config.php**|
* \***************************/
error_reporting(E_ALL);
//Read global variables from config file
$config_from_file = require_once('sitemap.config.php');
// Include Class
require_once('SitemapCrawler.php');
$crawler = new \knyzorg\sitemap\SitemapCrawler();
$config_from_args = [];
// Add PHP CLI support
if (php_sapi_name() === 'cli') {
parse_str(implode('&', array_slice($_SERVER['argv'], 1)), $args);
$config_from_args['color'] = true;
} else {
//Default html header makes browsers ignore \n
header("Content-Type: text/plain");
}
//Allow variable overloading with CLI
if (isset($args['file'])) {
$config_from_args['file'] = $args['file'];
}
if (isset($args['site'])) {
$config_from_args['site'] = $args['site'];
}
if (isset($args['max_depth'])) {
$config_from_args['max_depth'] = $args['max_depth'];
}
if (isset($args['enable_frequency'])) {
$config_from_args['enable_frequency'] = $args['enable_frequency'];
}
if (isset($args['enable_priority'])) {
$config_from_args['enable_priority'] = $args['enable_priority'];
}
if (isset($args['enable_modified'])) {
$config_from_args['enable_modified'] = $args['enable_modified'];
}
if (isset($args['freq'])) {
$config_from_args['freq'] = $args['freq'];
}
if (isset($args['priority'])) {
$config_from_args['priority'] = $args['priority'];
}
if (isset($args['blacklist'])) {
$config_from_args['blacklist'] = $args['blacklist'];
}
if (isset($args['debug'])) {
$config_from_args['debug'] = $args['debug'];
}
if (isset($args['ignore_arguments'])) {
$config_from_args['ignore_arguments'] = !!$args['ignore_arguments'];
}
if (isset($args['pdf_index'])) {
$config_from_args['pdf_index'] = $args['pdf_index'];
}
$config = array_merge($config_from_file, $config_from_args);
$crawler->loadConfig($config);
$crawler->start();