Exemple #1
0
function wpef7_admin_management_page()
{
    $contact_forms = wpef7_contact_forms();
    $unsaved = false;
    if (!isset($_GET['contactform'])) {
        $_GET['contactform'] = '';
    }
    if ('new' == $_GET['contactform']) {
        $unsaved = true;
        $current = -1;
        $cf = wpef7_contact_form_default_pack(isset($_GET['locale']) ? $_GET['locale'] : '');
    } elseif ($cf = wpef7_contact_form($_GET['contactform'])) {
        $current = (int) $_GET['contactform'];
    } else {
        $first = reset($contact_forms);
        // Returns first item
        $current = $first->id;
        $cf = wpef7_contact_form($current);
    }
    require_once WPEF7_PLUGIN_DIR . '/admin/edit.php';
}
Exemple #2
0
function wpef7_contact_form_tag_func($atts)
{
    global $wpef7, $wpef7_contact_form;
    if (is_feed()) {
        return '[eval-form]';
    }
    if (is_string($atts)) {
        $atts = explode(' ', $atts, 2);
    }
    $atts = (array) $atts;
    $id = (int) array_shift($atts);
    if (!($wpef7_contact_form = wpef7_contact_form($id))) {
        return '[eval-form 404 "Not Found"]';
    }
    if ($wpef7->processing_within) {
        // Inside post content or text widget
        $wpef7->unit_count += 1;
        $unit_count = $wpef7->unit_count;
        $processing_within = $wpef7->processing_within;
    } else {
        // Inside template
        if (!isset($wpef7->global_unit_count)) {
            $wpef7->global_unit_count = 0;
        }
        $wpef7->global_unit_count += 1;
        $unit_count = 1;
        $processing_within = 't' . $wpef7->global_unit_count;
    }
    $unit_tag = 'wpef7-f' . $id . '-' . $processing_within . '-o' . $unit_count;
    $wpef7_contact_form->unit_tag = $unit_tag;
    $form = $wpef7_contact_form->form_html();
    $wpef7_contact_form = null;
    return $form;
}