function amrical_choose_fields()
{
    global $amr_options;
    //$nonce = wp_create_nonce('amr-ical-events-list'); /* used for security to verify that any action request comes from this plugin's forms */
    amrical_admin_heading(__('Choose event and calendar fields ', 'amr-ical-events-list'));
    $inuse = amr_whats_in_use();
    $desc = amr_set_helpful_descriptions();
    if (isset($_POST['action']) and $_POST['action'] == "save") {
        $nonce = $_REQUEST['_wpnonce'];
        if (!wp_verify_nonce($nonce, 'amr-ical-events-list')) {
            die("Cancelled due to failed security check");
        }
        /* Validate the input and save */
        if (isset($_POST['reset'])) {
            echo '<div class="updated"><p>';
            _e('Resetting....', 'amr-ical-events-list');
            delete_option('amr-event-fields-in-use');
            echo '</p></div>';
            $inuse = amr_whats_in_use();
        } else {
            $inuse = amr_ical_validate_fields($inuse);
        }
    }
    array_multisort(array_values($inuse), SORT_DESC, array_keys($inuse), SORT_ASC, $inuse);
    //$fields - an array of fields used in a column
    echo '<p>' . __('Choose a subset of fields to work with:') . '</p>';
    echo '<div style="columns: 300px 2;">';
    foreach ($inuse as $f => $bool) {
        echo '<p><lable><input type="checkbox" name="inuse[' . $f . ']" ';
        if ($bool) {
            echo ' checked="checked" >';
        } else {
            echo '>';
        }
        echo '<b>' . $f . '</b> (' . $bool . 'x)';
        if (!empty($desc[$f])) {
            echo ' - <em>' . $desc[$f] . '</em>';
        }
        echo '</lable></p>';
    }
    amr_ical_submit_buttons(__('Reset', 'amr-ical-events-list'));
    echo '</div></form></div>';
}
Example #2
0
function amrical_option_page()
{
    global $amr_options;
    //$nonce = wp_create_nonce('amr-ical-events-list'); /* used for security to verify that any action request comes from this plugin's forms */
    amrical_admin_heading(__('iCal Events List ', 'amr-ical-events-list'));
    if (isset($_REQUEST['uninstall']) or isset($_REQUEST['reallyuninstall'])) {
        /*  */
        amr_ical_check_uninstall();
        return;
    }
    if (isset($_POST['reset'])) {
        $amr_options = amr_getset_options(true);
    } else {
        $amr_options = amr_getset_options(false);
    }
    /* options will be set to defaults here if not already existing */
    if (!isset($_POST['reset']) and (isset($_POST['action']) and $_POST['action'] == "save")) {
        /* Validate the input and save */
        echo '<div class="updated"><p>';
        _e('Saving....', 'amr-ical-events-list');
        if (!isset($_REQUEST['list'])) {
            if (!amr_ical_validate_general_options()) {
                echo '<h2>Error validating general options</h2>';
            } else {
                _e('List saved', 'amr-ical-events-list');
            }
        }
        echo '</p></div>';
    }
    amr_request_acknowledgement();
    amr_ical_support_links();
    //amrical_mimic_meta_box('acknowledge', 'About', 'amr_request_acknowledgement' , true);
    //if (!(is_plugin_active('amr-events/amr-events.php'))) {amr_getting_started();}
    amr_ical_submit_buttons();
    amr_ical_general_form();
    echo '</form></div>';
}