本文整理汇总了PHP中wpcf7_load_textdomain函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_load_textdomain函数的具体用法?PHP wpcf7_load_textdomain怎么用?PHP wpcf7_load_textdomain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf7_load_textdomain函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_template
public static function get_template($args = '')
{
global $l10n;
$defaults = array('locale' => null, 'title' => '');
$args = wp_parse_args($args, $defaults);
$locale = $args['locale'];
$title = $args['title'];
if ($locale) {
$mo_orig = $l10n['contact-form-7'];
wpcf7_load_textdomain($locale);
}
self::$current = $contact_form = new self();
$contact_form->title = $title ? $title : __('Untitled', 'contact-form-7');
$contact_form->locale = $locale ? $locale : get_locale();
$properties = $contact_form->get_properties();
foreach ($properties as $key => $value) {
$properties[$key] = WPCF7_ContactFormTemplate::get_default($key);
}
$contact_form->properties = $properties;
$contact_form = apply_filters('wpcf7_contact_form_default_pack', $contact_form, $args);
if (isset($mo_orig)) {
$l10n['contact-form-7'] = $mo_orig;
}
return $contact_form;
}
示例2: wpcf7_install
function wpcf7_install()
{
if ($opt = get_option('wpcf7')) {
return;
}
wpcf7_load_textdomain();
wpcf7_register_post_types();
wpcf7_upgrade();
if (get_posts(array('post_type' => 'wpcf7_contact_form'))) {
return;
}
$contact_form = WPCF7_ContactForm::get_template(array('title' => sprintf(__('Contact form %d', 'contact-form-7'), 1)));
$contact_form->save();
}
示例3: generate_default_package
public static function generate_default_package($args = '')
{
global $l10n;
$defaults = array('locale' => null, 'title' => '');
$args = wp_parse_args($args, $defaults);
$locale = $args['locale'];
$title = $args['title'];
if ($locale) {
$mo_orig = $l10n['contact-form-7'];
wpcf7_load_textdomain($locale);
}
$contact_form = new self();
$contact_form->initial = true;
$contact_form->title = $title ? $title : __('Untitled', 'contact-form-7');
$contact_form->locale = $locale ? $locale : get_locale();
$props = $contact_form->get_properties();
foreach ($props as $prop => $value) {
$contact_form->{$prop} = wpcf7_get_default_template($prop);
}
$contact_form = apply_filters('wpcf7_contact_form_default_pack', $contact_form, $args);
if (isset($mo_orig)) {
$l10n['contact-form-7'] = $mo_orig;
}
return $contact_form;
}
示例4: wpcf7_install
function wpcf7_install()
{
if ($opt = get_option('wpcf7')) {
return;
}
wpcf7_load_textdomain();
wpcf7_register_post_types();
wpcf7_upgrade();
if (get_posts(array('post_type' => 'wpcf7_contact_form'))) {
return;
}
$contact_form = WPCF7_ContactForm::get_template(array('title' => sprintf(__('Contact form %d', 'contact-form-7'), 1)));
$contact_form->save();
WPCF7::update_option('bulk_validate', array('timestamp' => current_time('timestamp'), 'version' => WPCF7_VERSION, 'count_valid' => 1, 'count_invalid' => 0));
}
示例5: load_template
/**
* Load selected template and translate.
*
* @uses wpcf7_load_textdomain
* @since 0.0.1
*/
function load_template()
{
// Check the nonce and if not valid, just die.
if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'cf7s')) {
die;
}
// Get translation if locale is set and exists in the Contact Form 7 l10n
if (isset($_POST['locale']) && !empty($_POST['locale']) && array_key_exists($_POST['locale'], wpcf7_l10n())) {
wpcf7_load_textdomain($_POST['locale']);
}
// Get translation based on post ID
if (isset($_POST['post']) && !empty($_POST['post'])) {
$wpcf7 = wpcf7_contact_form((int) $_POST['post']);
// current CF7 form
wpcf7_load_textdomain($wpcf7->locale);
}
// Load selected template file
$templates = $this->cf7s_get_template_list();
$template = $templates[$_POST['template']];
require_once $template['path'] . trailingslashit($template['dir']) . $template['index'];
exit;
}