$config['meta']['files'][$file_id]['dir_url'] = ConvertFileUrl($dir_url);
            $config['meta']['files'][$file_id]['filepath'] = ConvertDirectoryPath($movefile['file']);
            $config['meta']['files'][$file_id]['fileurl'] = ConvertFileUrl($movefile['url']);
            $config['meta']['files'][$file_id]['operator_value'] = trim($_POST['letters_operator_value'][$i]);
            $config['meta']['files'][$file_id]['form_field'] = trim($_POST['form_field'][$i]);
            $config['meta']['files'][$file_id]['operator_value_e'] = trim($_POST['letters_operator_value_e'][$i]);
            $config['meta']['files'][$file_id]['form_field_e'] = trim($_POST['form_field_e'][$i]);
            $config['meta']['files'][$file_id]['operator_value_f'] = trim($_POST['letters_operator_value_f'][$i]);
            $config['meta']['files'][$file_id]['form_field_f'] = trim($_POST['form_field_f'][$i]);
            $config['meta']['files'][$file_id]['enable'] = isset($_POST['letters_enable'][$i]) && $_POST['letters_enable'][$i] == 1 ? 1 : 1;
        }
        //$file_id++;
    }
    if (!empty($config['meta'])) {
        //printp($config['meta']);exit;
        $id = TemplateData::update_letters_data($id, $config["form_id"], $config["is_active"], $config["meta"]);
        ?>
                <div class="updated fade" style="padding:6px"><?php 
        echo sprintf(__("Feed Updated. %sback to list%s", "letters"), "<a href='?page=letters'>", "</a>");
        ?>
</div>
            <?php 
    } else {
        $is_validation_error = true;
    }
}
$total_files = 0;
if (isset($config['meta']['files'])) {
    $total_files = count($config['meta']['files']);
}
if ($total_files > 0) {
 public static function update_letters_active()
 {
     check_ajax_referer('letters_update_feed_active', 'letters_update_feed_active');
     $id = $_POST["id"];
     $feed = TemplateData::get_letters_feed($id);
     TemplateData::update_letters_data($id, $feed["form_id"], $_POST["is_active"], $feed["meta"]);
 }