Example #1
0
                    $s = "";
                    foreach ($data as $k => $v) {
                        $s .= trim($v);
                        if ($c != $k) {
                            $s .= ",";
                        }
                    }
                    update_option("ace_categories_" . $key, $s);
                } else {
                    update_option("ace_categories_" . $key, '');
                }
                if ($key == $xsg_category) {
                    if (empty($data)) {
                        $data = array();
                    }
                    ace_xsg_update($data);
                }
                unset($data);
            }
        }
    }
}
if ($_POST['empty']) {
    foreach ($ace_targets as $key => $val) {
        update_option("ace_categories_" . $key, "");
    }
}
if (!function_exists('get_terms')) {
    if (get_option("default_link_category") != "") {
        $defaultLinkCat = get_option("default_link_category");
    }
$ace_help['ec3'] = __('If you select this, Event Calendars deafult category will be displayed at ACE Dashboard -> Categories subpage', 'ace');
$ace_help['exclude_method'] = __('Please choose an exclusion method for the widgets.', 'ace');
$ace_help['xsg_category'] = __('If you choose one of these sections, the categories selected for exclusion in that section, will be exported into <strong>XML Sitemap Generator</strong> settings. So those settings will directly affect your sitemap generating. This is handy for SEO.', 'ace');
if (!empty($_POST['settings']) && !empty($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'ace_settings')) {
    foreach ($ace_settings as $k => $v) {
        if (!empty($_POST[$k])) {
            switch ($k) {
                case "xsg_category":
                    $xsg_category = get_option("ace_settings_xsg_category");
                    $newvalue = mysql_real_escape_string($_POST[$k]);
                    update_option("ace_settings_" . $k, $newvalue);
                    /**
                     * If the section changed
                     */
                    if ($xsg_category != $newvalue) {
                        ace_xsg_update("", $newvalue);
                    }
                    break;
                case "exclude_method":
                    $newvalue = mysql_real_escape_string($_POST[$k]);
                    update_option("ace_settings_" . $k, $newvalue);
                    break;
                default:
                    update_option("ace_settings_" . $k, 1);
                    break;
            }
        } else {
            update_option("ace_settings_" . $k, '');
        }
    }
}