2019-12-16 23:17:47 +08:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* 定义输出格式
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2019-12-17 20:01:16 +08:00
|
|
|
|
!defined('ROOT_DIR') && die('Access Denied.');
|
2020-01-19 12:01:22 +08:00
|
|
|
|
|
2019-12-16 23:17:47 +08:00
|
|
|
|
class writerFormat{
|
|
|
|
|
/*dnsmasq支持格式的屏蔽广告列表*/
|
2019-12-17 20:01:16 +08:00
|
|
|
|
const DNSMASQ = array(
|
|
|
|
|
'format' => 'address=/{DOMAIN}/',
|
2020-02-13 10:58:34 +08:00
|
|
|
|
'header' => "#TITLE=anti-AD\n#VER={DATE}\n#URL={URL}\n#TOTAL_LINES={COUNT}\n",
|
2020-02-03 22:00:04 +08:00
|
|
|
|
'full_domain' => 0,
|
2019-12-17 20:01:16 +08:00
|
|
|
|
'name' => 'dnsmasq',
|
2020-07-26 17:12:19 +08:00
|
|
|
|
'filename' => '../adblock-for-dnsmasq.conf',
|
2020-02-10 17:33:13 +08:00
|
|
|
|
'whitelist_attached' => array(
|
|
|
|
|
'base-dead-hosts.txt' =>array(
|
|
|
|
|
'merge_mode' => 2, //0=单条,1=单条+子域名,2=根域名相当于1,非根域名相当于0
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-02-08 20:10:00 +08:00
|
|
|
|
'src' => array(
|
|
|
|
|
'base-src-easylist.txt' => array(
|
|
|
|
|
'type' => 'easylist',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-strict-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => true,
|
|
|
|
|
),
|
|
|
|
|
),
|
2019-12-17 20:01:16 +08:00
|
|
|
|
);
|
|
|
|
|
|
2019-12-16 23:17:47 +08:00
|
|
|
|
/*easylist 兼容格式的屏蔽广告列表*/
|
2019-12-17 20:01:16 +08:00
|
|
|
|
const EASYLIST = array(
|
|
|
|
|
'format' => '||{DOMAIN}^',
|
2020-10-14 23:37:55 +08:00
|
|
|
|
'header' => "!Title: anti-AD\n!Version: {DATE}\n!Homepage: {URL}\n!Total lines: 00000\n",
|
2020-02-03 22:00:04 +08:00
|
|
|
|
'full_domain' => 0,
|
2019-12-17 20:01:16 +08:00
|
|
|
|
'name' => 'easylist',
|
2020-07-26 17:12:19 +08:00
|
|
|
|
'filename' => '../anti-ad-easylist.txt',
|
2020-02-10 17:33:13 +08:00
|
|
|
|
'whitelist_attached' => array(
|
|
|
|
|
'base-dead-hosts.txt' =>array(
|
|
|
|
|
'merge_mode' => 2, //0=单条,1=单条+子域名,2=根域名相当于1,非根域名相当于0
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'src' => array(
|
|
|
|
|
'base-src-easylist.txt' => array(
|
|
|
|
|
'type' => 'easylist',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-strict-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => true,
|
|
|
|
|
),
|
|
|
|
|
),
|
2019-12-17 20:01:16 +08:00
|
|
|
|
);
|
|
|
|
|
|
2019-12-16 23:17:47 +08:00
|
|
|
|
/*Surge 兼容格式的屏蔽广告列表*/
|
2019-12-17 20:01:16 +08:00
|
|
|
|
const SURGE = array(
|
2020-02-03 12:54:45 +08:00
|
|
|
|
'format' => 'DOMAIN-SUFFIX,{DOMAIN}',
|
2020-02-13 10:58:34 +08:00
|
|
|
|
'header' => "#TITLE=anti-AD\n#VER={DATE}\n#URL={URL}\n#TOTAL_LINES={COUNT}\n",
|
2020-02-03 22:00:04 +08:00
|
|
|
|
'full_domain' => 0,
|
2019-12-17 20:01:16 +08:00
|
|
|
|
'name' => 'surge',
|
2020-07-26 17:12:19 +08:00
|
|
|
|
'filename' => '../anti-ad-surge.txt',
|
|
|
|
|
'whitelist_attached' => array(
|
|
|
|
|
'base-dead-hosts.txt' =>array(
|
|
|
|
|
'merge_mode' => 2, //0=单条,1=单条+子域名,2=根域名相当于1,非根域名相当于0
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'src' => array(
|
|
|
|
|
'base-src-easylist.txt' => array(
|
|
|
|
|
'type' => 'easylist',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-strict-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2020-08-22 23:54:56 +08:00
|
|
|
|
/*Surge DOMAIN-SET格式的屏蔽广告列表*/
|
|
|
|
|
const SURGE2 = array(
|
|
|
|
|
'format' => '.{DOMAIN}',
|
2020-08-22 23:58:29 +08:00
|
|
|
|
'header' => "#TITLE=anti-AD\n#VER={DATE}\n#URL={URL}\n#TOTAL_LINES={COUNT}\n\n#DOMAIN-SET,https://anti-ad.net/surge2.txt,REJECT\n",
|
2020-08-22 23:54:56 +08:00
|
|
|
|
'full_domain' => 0,
|
|
|
|
|
'name' => 'surge2',
|
|
|
|
|
'filename' => '../anti-ad-surge2.txt',
|
|
|
|
|
'whitelist_attached' => array(
|
|
|
|
|
'base-dead-hosts.txt' =>array(
|
|
|
|
|
'merge_mode' => 2, //0=单条,1=单条+子域名,2=根域名相当于1,非根域名相当于0
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'src' => array(
|
|
|
|
|
'base-src-easylist.txt' => array(
|
|
|
|
|
'type' => 'easylist',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-strict-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2020-02-03 12:54:45 +08:00
|
|
|
|
/*Domains 格式的屏蔽广告列表,用于支持pi-hole等*/
|
|
|
|
|
const DOMAINS = array(
|
|
|
|
|
'format' => '{DOMAIN}',
|
2020-02-13 10:58:34 +08:00
|
|
|
|
'header' => "#TITLE=anti-AD\n#VER={DATE}\n#URL={URL}\n#TOTAL_LINES={COUNT}\n",
|
2020-02-03 22:00:04 +08:00
|
|
|
|
'full_domain' => 1, //保留子域名,即使其上级域名
|
2020-02-03 13:31:17 +08:00
|
|
|
|
'name' => 'domains',
|
2020-07-26 17:12:19 +08:00
|
|
|
|
'filename' => '../anti-ad-domains.txt',
|
2020-02-10 17:33:13 +08:00
|
|
|
|
'whitelist_attached' => array(
|
|
|
|
|
'base-dead-hosts.txt' =>array(
|
|
|
|
|
'merge_mode' => 2, //0=单条,1=单条+子域名,2=根域名相当于1,非根域名相当于0
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'src' => array(
|
|
|
|
|
'base-src-easylist.txt' => array(
|
|
|
|
|
'type' => 'easylist',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-strict-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => true,
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-02-03 12:54:45 +08:00
|
|
|
|
);
|
|
|
|
|
|
2020-02-28 12:33:55 +08:00
|
|
|
|
/*smartdns支持格式的屏蔽广告列表*/
|
|
|
|
|
const SMARTDNS = array(
|
|
|
|
|
'format' => 'address /{DOMAIN}/#',
|
|
|
|
|
'header' => "#TITLE=anti-AD for SmartDNS\n#VER={DATE}\n#URL={URL}\n#TOTAL_LINES={COUNT}\n",
|
|
|
|
|
'full_domain' => 0,
|
|
|
|
|
'name' => 'dnsmasq',
|
2020-07-26 17:12:19 +08:00
|
|
|
|
'filename' => '../anti-ad-smartdns.conf',
|
2020-02-28 12:33:55 +08:00
|
|
|
|
'whitelist_attached' => array(
|
|
|
|
|
'base-dead-hosts.txt' =>array(
|
|
|
|
|
'merge_mode' => 2, //0=单条,1=单条+子域名,2=根域名相当于1,非根域名相当于0
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'src' => array(
|
|
|
|
|
'base-src-easylist.txt' => array(
|
|
|
|
|
'type' => 'easylist',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => false,
|
|
|
|
|
),
|
|
|
|
|
'base-src-strict-hosts.txt' => array(
|
|
|
|
|
'type' => 'hosts',
|
|
|
|
|
'strict_mode' => true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2019-12-16 23:17:47 +08:00
|
|
|
|
/*and etc...*/
|
|
|
|
|
|
|
|
|
|
}
|