function wpcf7_get_contact_form_default_pack($args = '')
{
    global $l10n;
    $defaults = array('locale' => null, 'title' => '');
    $args = wp_parse_args($args, $defaults);
    $locale = $args['locale'];
    $title = $args['title'];
    if ($locale && $locale != get_locale()) {
        $mo_orig = $l10n['wpcf7'];
        unset($l10n['wpcf7']);
        if ('en_US' != $locale) {
            $mofile = wpcf7_plugin_path('languages/wpcf7-' . $locale . '.mo');
            if (!load_textdomain('wpcf7', $mofile)) {
                $l10n['wpcf7'] = $mo_orig;
                unset($mo_orig);
            }
        }
    }
    $contact_form = new WPCF7_ContactForm();
    $contact_form->initial = true;
    $contact_form->title = $title ? $title : __('Untitled', 'wpcf7');
    $props = $contact_form->get_properties();
    foreach ($props as $prop => $value) {
        $contact_form->{$prop} = wpcf7_get_default_template($prop);
    }
    if (isset($mo_orig)) {
        $l10n['wpcf7'] = $mo_orig;
    }
    $contact_form = apply_filters_ref_array('wpcf7_contact_form_default_pack', array(&$contact_form, $args));
    return $contact_form;
}
Exemple #2
0
function wpcf7_add_contact_page($page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '')
{
    add_submenu_page(wpcf7_plugin_path('admin/admin.php'), $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '');
}
Exemple #3
0
function wpcf7_get_contact_form_default_pack($args = '')
{
    global $l10n;
    $defaults = array('locale' => null, 'title' => '');
    $args = wp_parse_args($args, $defaults);
    $locale = $args['locale'];
    $title = $args['title'];
    if ($locale && $locale != get_locale()) {
        $mo_orig = $l10n['wpcf7'];
        unset($l10n['wpcf7']);
        if ('en_US' != $locale) {
            $mofile = wpcf7_plugin_path('languages/wpcf7-' . $locale . '.mo');
            if (!load_textdomain('wpcf7', $mofile)) {
                $l10n['wpcf7'] = $mo_orig;
                unset($mo_orig);
            }
        }
    }
    $contact_form = new WPCF7_ContactForm();
    $contact_form->initial = true;
    $contact_form->title = $title ? $title : __('Untitled', 'wpcf7');
    $contact_form->form = wpcf7_get_default_template('form');
    $contact_form->mail = wpcf7_get_default_template('mail');
    $contact_form->mail_2 = wpcf7_get_default_template('mail_2');
    $contact_form->messages = wpcf7_get_default_template('messages');
    $contact_form->additional_settings = wpcf7_get_default_template('additional_settings');
    if (isset($mo_orig)) {
        $l10n['wpcf7'] = $mo_orig;
    }
    $contact_form = apply_filters_ref_array('wpcf7_contact_form_default_pack', array(&$contact_form, $args));
    return $contact_form;
}
function wpcf7_contact_form_default_pack($locale = null)
{
    global $l10n;
    if ($locale && $locale != get_locale()) {
        $mo_orig = $l10n['wpcf7'];
        unset($l10n['wpcf7']);
        if ('en_US' != $locale) {
            $mofile = wpcf7_plugin_path('languages/wpcf7-' . $locale . '.mo');
            if (!load_textdomain('wpcf7', $mofile)) {
                $l10n['wpcf7'] = $mo_orig;
                unset($mo_orig);
            }
        }
    }
    $contact_form = new WPCF7_ContactForm();
    $contact_form->initial = true;
    $contact_form->title = __('Untitled', 'wpcf7');
    $contact_form->form = wpcf7_default_form_template();
    $contact_form->mail = wpcf7_default_mail_template();
    $contact_form->mail_2 = wpcf7_default_mail_2_template();
    $contact_form->messages = wpcf7_default_messages_template();
    if (isset($mo_orig)) {
        $l10n['wpcf7'] = $mo_orig;
    }
    return $contact_form;
}