function wprssmi_ajax_process_request() { if ($_POST["restore_var"] == 1) { //echo $_POST["restore_var"]; restore_template(0); echo __("Your templates have been restored. Go back to the settings options tab and select your template.", 'wp-rss-multi-importer'); die; } else { if ($_POST["save_var"] == 2) { delete_option('rss_template_item'); save_template_function($_POST['post_var']); die; } else { if ($_POST["save_var"] == 3) { save_css(); die; } } } // first check if data is being sent and that it is the data we want if (!empty($_POST["post_var"]) && !empty($_POST["post_name"])) { $templateCSSname = 'templates.css'; $templatename = $_POST['post_var']; $newtemplatename = $_POST['post_name']; $templateCODE = file_get_contents(WP_RSS_MULTI_TEMPLATES . $templatename); $templateCSS = file_get_contents(WP_RSS_MULTI_TEMPLATES . $templateCSSname); $newtemplatename = str_replace(' ', '_', $newtemplatename) . '.php'; //now, put in DB $myTemplateOptions = array('template_name' => $newtemplatename, 'template_code' => $templateCODE, 'template_css' => $templateCSS); delete_option('rss_template_item'); add_option('rss_template_item', $myTemplateOptions); echo "<p>" . __("SUCCESS. YOUR TEMPLATE AND CSS FILE HAS BEEN STORED IN THE DATABASE AND WILL BE AUTOMATICALLY RESTORED AFTER UPDATES TO THE PLUGIN.</p><p>At any time you come back to this page, hit RESTORE, and you'll have access to the same template again.</p><p>If you make changes to your template, just return to this page and save it again. It's that simple.", 'wp-rss-multi-importer') . "</p>"; } else { save_css(); } die; }
function save_defs($base, $desgn, $defs, $defsb) { if ($_GET["save_img"]) { $defs = img_adder($defs); } if ($_POST["save"] == "save") { $defs = defs_compiler($defs, $defsb); } if ($_POST["save"] == "apply_widths") { $defs = defs_csswidths($defs); } if ($_POST["save"] == "save_fonts") { $defs = defs_fonts($defs); } if ($_POST["save"] == "save_clrst") { $defs = defs_clrst($defs); } if ($_POST["save"] == "save_css") { $defs = save_css($defs, $_GET['edit_css'], $_POST['free_css']); //obsolete if ($_POST['erase_' . $_GET['edit_css']] == "ok") { $relod = '/?admin=css'; } } if ($_POST["save"] == "add_css") { $defs = defs_adder($defs, $defsb); $relod = '/?admin=css&edit_css=' . $_POST['pos'] . '#' . $_POST['pos']; } if ($_POST["save"] == "Apply_font") { $defs = defs_face($defs); $relod = '/?admin=css&edit_css=' . $_POST['applyfont'] . '#' . $_POST['applyfont']; } save_vars($base, $desgn, $defs); if ($relod) { relod($relod); } return $defs; }