<form class="layui-form ct-form" table="replaces">
    <fieldset class="layui-elem-field layui-field-title"><legend>标题替换</legend></fieldset>
    <div class="layui-form-item">
        <code style="margin-left:15px;">PS: (例如, <b>关键词</b> : <i>Wordpress</i> &nbsp;&nbsp;<b>替换为</b> : <i>WP</i> )</code>
    </div>

    <div class="title-replace-list layui-hide"></div>
    <?php
        $replaces = CTspider_html('ctspider_task','replaces');
        if (!empty($replaces['title_replace']['keyword']) && !empty($replaces['title_replace']['value'])) :
        $title_replace = $replaces['title_replace'];
        foreach ($title_replace['keyword'] as $key => $value) :
    ?>
    <div class="layui-form-item title-replace-list" style="position: relative;">
        <div class="layui-input-inline" style="width: 45%;margin-left:15px;">
            <div class="layui-form-mid layui-word-aux">关键字：</div>
            <input type="text" value="<?php echo ctesc_html($value); ?>" ct-filter="title-replace-keyword" name="title_replace[a][keyword][<?php echo $key ?>]" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-input-inline" style="width: 45%;">
            <div class="layui-form-mid layui-word-aux">替换为：</div>
            <input type="text" value="<?php echo ctesc_html($title_replace['value'][$key]); ?>" ct-filter="title-replace-value" name="title_replace[a][value][<?php echo $key; ?>]" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-input-inline" style="position:absolute; bottom: 0px;">
            <button type="button" ct-reset="title_replace" 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-title-replace" title="">新增</a>
    </div>
    <br><br>


    <fieldset class="layui-elem-field layui-field-title"><legend>正文内容替换</legend></fieldset>
    <div class="layui-form-item">
        <code style="margin-left:15px;">PS: (例如, <b>关键词</b> : <i>wordpress</i> &nbsp;&nbsp;<b>替换为</b> : <i>&lt;a href="http://wordpress.org/"&gt;wordpress&lt;/a&gt;</i> )</code>
    </div>

    <div class="content-replace-list layui-hide"></div>
    <?php
        if (!empty($replaces['content_replace']['keyword']) && !empty($replaces['content_replace']['value'])) :
        $content_replace = $replaces['content_replace'];
        foreach ($content_replace['keyword'] as $key => $value) :
    ?>
            <?php //echo esc_html(stripslashes($content_replace['value'][$key]));; htmlspecialchars(stripslashes($content_replace['value'][$key])); ?>
    <div class="layui-form-item content-replace-list" style="position: relative;">
        <div class="layui-input-inline" style="width: 30%;margin-left:15px;">
            <div class="layui-form-mid layui-word-aux">关键字：</div>
            <input type="text" value="<?php echo ctesc_html($value); ?>" ct-filter="content-replace-keyword" name="content_replace[a][keyword][<?php echo $key; ?>]" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-input-inline" style="width: 60%;">
            <div class="layui-form-mid layui-word-aux">替换为：</div>
            <input type="text" value="<?php echo ctesc_html($content_replace['value'][$key]); ?>" ct-filter="content-replace-value" name="content_replace[a][value][<?php echo $key ?>]" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-input-inline" style="position:absolute; bottom: 0px;">
            <button type="button" ct-reset="content_replace" 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-replace" title="">新增</a>
    </div>
    <br><br>


    <fieldset class="layui-elem-field layui-field-title"><legend>内容插入</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">文章标题前：</label>
        <div class="layui-input-block" style="width: 42%;">
            <input type="text" value="<?php echo CTspider_html('ctspider_task','replaces','title_before') ?>" name="title_before" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">文章标题后：</label>
        <div class="layui-input-block" style="width: 42%;">
            <input type="text" value="<?php echo CTspider_html('ctspider_task','replaces','title_after') ?>" name="title_after" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">文章正文前：</label>
        <div class="layui-input-block" style="width: 42%;">
            <textarea name="content_before" class="layui-textarea"><?php echo ctesc_html(CTspider_html('ctspider_task','replaces','content_before')) ?></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">文章正文后：</label>
        <div class="layui-input-block" style="width: 42%;">
            <textarea name="content_after" class="layui-textarea"><?php echo ctesc_html(CTspider_html('ctspider_task','replaces','content_after')) ?></textarea>
        </div>
    </div>
    <br><br>
    <hr>


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