<form class="layui-form ct-form" table="filter">
	<fieldset class="layui-elem-field layui-field-title"><legend>文章内容过滤</legend></fieldset>
	<div class="layui-form-item">
		<code style="margin-left:15px;">PS: 删除由CSS选择器所选择的内容, CSS选择器 (例如: #ad 或者 .ad)</code>
	</div>
	<div class="content-filter-list layui-hide"></div>
    <?php
    	$filter = CTspider_html('ctspider_task','filter','content_filter');
        if (!empty($filter) && !empty($filter['selector'])) :
            $content_filter = $filter;
        foreach ($content_filter['selector'] as $key=>$value):
    ?>
	<div class="layui-form-item content-filter-list">
		<label class="layui-form-label">CSS选择器</label>
		<div class="layui-input-block" style="width: 42%;">
			<input type="text" lay-verType="tips" lay-verify="required" ct-filter="content_filter" value="<?php echo $value; ?>" name="content_filter[a][selector][<?php echo $key ?>]" autocomplete="off" class="layui-input">
		</div>

		<div class="layui-form-mid ct-index-select">
			&nbsp;&nbsp;<span>索引</span><span> : <a ct-filter="index-help" ct-title=" 0 : [ 提取所有匹配的内容 ], 1 : [ 提取第1个匹配的内容 ], -1 : [ 提取最后1个匹配的内容 ]">[?]</a></span>
		</div>
		<div class="layui-input-inline ct-index-input" style="width: 3%;">
			<input type="text" value="<?php echo $content_filter['index'][$key] ?>" name="content_filter[a][index][<?php echo $key ?>]" ct-filter="content_filter_index" lay-verify="required|number" lay-verType="tips" autocomplete="off" class="layui-input">
		</div>
		<div class="layui-input-inline" style="width: 3%;">
			<button type="button" ct-reset="content_filter" class="layui-btn layui-btn-danger rule-delete">删除</button>
		</div>		
	</div>
    <?php endforeach; endif; ?>
	
	<div class="layui-form-item" style="padding-left:15px;">
		<a class="layui-btn layui-btn-sm layui-btn-warm add-content-filter" title="">新增</a>
	</div>
	<br>		

	<fieldset class="layui-elem-field layui-field-title"><legend>HTML标签过滤</legend></fieldset>
	<div class="layui-form-item">
		<p><code style="margin-left:15px;">PS: (例如, 如果需要过滤掉a标签，只需要填写a即可 ) </code></p>
		<p><code style="margin-left:15px;">PS: 如果 索引 是 0 为找到所有匹配的元素 ; 1 为找到第1个匹配的元素 ; -1 为找到最后1个匹配的元素. </code></p>
		<p><code style="margin-left:15px;">索引必须在【是否删除标签内容 选择 “是” 时有效】 [提示：a标签更改索引无效-默认为0无需更改] </code></p>
	</div>

    <div class="html-filter-list layui-hide"></div>
    <?php
    	$filter_html = CTspider_html('ctspider_task','filter');
        if (!empty($filter_html['html_tag_filter']) && !empty($filter_html['html_tag_filter_select']) && !empty($filter_html['html_tag_filter_index'])) :
        foreach ($filter_html['html_tag_filter'] as $key => $value) :
    ?>
	<div class="layui-form-item html-filter-list">
		<!-- <div class="layui-inline-block" style="width:100%;"> -->
			<label class="layui-form-label" style="width:auto;">HTML 标签</label>
			<div class="layui-input-inline" style="width: 200px;">
				<input type="text" value="<?php echo $value ?>" name="html_tag_filter[a][<?php echo $key ?>]" ct-filter="html-tag-filter-a" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input">
			</div>

			<div class="layui-form-mid">&nbsp;&nbsp;&nbsp;&nbsp;是否删除标签内容</div>
			<div class="layui-input-inline" style="width: 120px;">
				<select name="html_tag_filter_select[b][<?php echo $key ?>]" ct-filter="html-tag-filter-b" class="rule_select">
					<option value="0" <?php selected( 0,$filter_html['html_tag_filter_select'][$key] ); ?> >否</option>
					<option value="1" <?php selected( 1,$filter_html['html_tag_filter_select'][$key] ); ?> >是</option>
				</select>
			</div>
			<div class="layui-form-mid">&nbsp;&nbsp;&nbsp;&nbsp;索引</div>
			<div class="layui-input-inline" style="width: 50px;">
				<input type="text" value="<?php echo $filter_html['html_tag_filter_index'][$key] ?>" name="html_tag_filter_index[c][<?php echo $key ?>]" ct-filter="html-tag-filter-c" lay-verify="required|number" lay-verType="tips" autocomplete="off" class="layui-input">
			</div>	
			<div class="layui-input-inline">
				<button type="button" ct-reset="html_filter" class="layui-btn layui-btn-danger rule-delete">删除</button>
			</div>						
		<!-- </div> -->
	</div>
    <?php endforeach; endif; ?>
	<div class="layui-form-item" style="padding-left:15px;">
		<a class="layui-btn layui-btn-sm layui-btn-warm add-html-filter" title="">新增</a>
	</div>
    <br><br>


    <fieldset class="layui-elem-field layui-field-title"><legend>HTML属性过滤</legend></fieldset>
    <div class="layui-form-item">
        <code style="margin-left:15px;">PS: 过滤 HTML 标签的属性，更有效的净化标签。</code>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">自动删除HTML中 id 属性</label>
        <div class="layui-input-inline" style="width: 8%;">
            <select ct-filter="rule_select" name="html_filter_attr_id"  class="layui-input">
                <option value="0" <?php @selected( 0,$filter_html['html_filter_attr_id'] ); ?>>否</option>
                <option value="1" <?php @selected( 1,$filter_html['html_filter_attr_id'] ); ?>>是</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">( 例如 &lt;p id="auto"/&gt; 形式的html标签属性 )</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">自动删除HTML中 class 属性</label>
        <div class="layui-input-inline" style="width: 8%;">
            <select ct-filter="rule_select" name="html_filter_attr_class"  class="layui-input">
                <option value="0" <?php @selected( 0,$filter_html['html_filter_attr_class'] ); ?>>否</option>
                <option value="1" <?php @selected( 1,$filter_html['html_filter_attr_class'] ); ?>>是</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">( 例如 &lt;p class="auto"/&gt; 形式的html标签属性 )</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">自动删除HTML中 style 属性</label>
        <div class="layui-input-inline" style="width: 8%;">
            <select ct-filter="rule_select" name="html_filter_attr_style"  class="layui-input">
                <option value="0" <?php @selected( 0,$filter_html['html_filter_attr_style'] ); ?>>否</option>
                <option value="1" <?php @selected( 1,$filter_html['html_filter_attr_style'] ); ?>>是</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">( 例如 &lt;p style="color:red"/&gt; 形式的html标签属性 )</div>
    </div>


    <br>
    <fieldset class="layui-elem-field layui-field-title"><legend>HTML特例标签</legend></fieldset>
    <div class="layui-form-item">
        <P><code style="margin-left:15px;">PS: CTspider 默认会自动过滤一些不常用的标签。</code></P>
        <P><code style="margin-left:15px;">PS: 添加特例标签后会不自动过滤 (包括标签属性也会保留)。例如:iframe 多个请用|分隔</code></P>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">HTML特例标签：</label>
        <div class="layui-input-block" style="width: 42%;">
            <input type="text" value="<?php echo CTspider_html('ctspider_task','filter','special_tag') ?>" name="special_tag" autocomplete="off" class="layui-input">
        </div>
    </div>


    <br><br>
    <hr>
	<button type="button" class="layui-btn" lay-submit lay-filter="filter" >保存更改</button>
</form>
