function saveChanges() { global $fyb_notice, $fyb_path, $fyb_funnybranding_settings; if (!empty($_POST['funnybranding'])) { $fyb_post_val = $_POST['funnybranding']; if (isset($fyb_post_val['translate'])) { foreach ($fyb_post_val['translate']['trans'] as $key => $val) { if (empty($fyb_post_val['translate']['trans'][$key]['key'])) { unset($fyb_post_val['translate']['trans'][$key]); } } } $fyb_Array = call_user_func_array('array_merge', $fyb_post_val); if (is_array($fyb_funnybranding_settings)) { $fyb_result = wp_parse_args($fyb_Array, $fyb_funnybranding_settings[0]); update_option('funnybranding_settings', json_encode($fyb_result)); } else { $fyb_result = $fyb_Array; update_option('funnybranding_settings', json_encode($fyb_result)); } $fyb_notice .= '<div class="alert alert-success"> <a class="close" data-dismiss="alert">×</a> <strong>Settings Updated : </strong> Your changes updated successfully </div>'; get_exValues(); } }
Author: Varun Sridharan Author URI: http://varunsridharan.in/ License: GPL2 */ defined('ABSPATH') or die("No script kiddies please!"); register_activation_hook(__FILE__, 'funny_brands_activate'); $fyb_plug_url = plugins_url('', __FILE__) . '/'; $fyb_path = plugin_dir_path(__FILE__); $fyb_page_title = 'Funny Brands Settings'; $fyb_postTypes = ''; # Register Plugin require $fyb_path . 'register.php'; # Load Required Core Function require $fyb_path . 'functions.php'; # Get Existing DB Values get_exValues(); # Save New Values IF Exist if (isset($_POST['save_changes'])) { saveChanges(); } if (isset($_REQUEST['fyb_cfld_show'])) { require $fyb_path . 'ajax_customFileds.php'; # Plugin Ajax File exit; } if (isset($_REQUEST['fyb_cfld_edit'])) { require $fyb_path . 'ajax_customFieldEdit.php'; # Plugin Ajax File exit; } if (isset($_REQUEST['fyb_cfld_edited'])) {