本文整理汇总了PHP中pll_register_string函数的典型用法代码示例。如果您正苦于以下问题:PHP pll_register_string函数的具体用法?PHP pll_register_string怎么用?PHP pll_register_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pll_register_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_to_polylang_register
/**
* Add strings to polylang register.
*/
protected function add_to_polylang_register($strings, $context)
{
if (!empty($strings)) {
foreach ($strings as $string) {
pll_register_string($string, $string, __('TTfP:', 'polylang-tt') . ' ' . $context);
}
}
}
开发者ID:marcinkazmierski,项目名称:Polylang---theme-translation,代码行数:11,代码来源:polylang-theme-translation.php
示例2: register_strings
/**
* Registers theme_mod strings into Polylang
*
* @since 1.6.0
*/
public function register_strings()
{
if (function_exists('pll_register_string') && ($strings = wpex_register_theme_mod_strings())) {
foreach ($strings as $string => $default) {
pll_register_string($string, get_theme_mod($string, $default), 'Theme Mod', true);
}
}
}
示例3: register_string
public function register_string($string)
{
if (function_exists('pll_register_string')) {
pll_register_string($string, $string, 'WP Libre Form');
} else {
// Don't kill anything.
}
}
示例4: register_string
/**
* Add registration for multilanguage string (contain hook)
*
* @since 1.0.0
*
* @param string $plugin_name_human_format The Plugin name
* @param string $string_name The name of the string
* @param string $value The value
*/
function register_string($plugin_name_human_format, $string_name, $value)
{
if (function_exists('icl_register_string')) {
icl_register_string($plugin_name_human_format, $string_name, $value);
} elseif (has_filter('cml_my_translations')) {
add_filter('cml_my_translations', create_function("{$groups}, {$plugin_name_human_format}", "\n {$plugin_name_human_format_replaced} = str_replace( ' ', '-', {$plugin_name_human_format} );\n CMLTranslations:add( {$string_name}, {$value}, {$plugin_name_human_format} );\n {$groups[$plugin_name_human_format_replaced]} = {$plugin_name_human_format};\n return {$groups};"));
} elseif (function_exists('pll_register_string')) {
$plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format);
pll_register_string($plugin_name_human_format_replaced, $string_name);
}
}
示例5: register_translations
/**
* Register translations.
*
* @param array $groups
* @param bool $multiline
*
* @throws \BadFunctionCallException
*
* @return void
*/
function register_translations(array $groups, $multiline = false)
{
if (!function_exists('pll_register_string')) {
throw new BadFunctionCallException('Please active the Polylang plugin.');
}
foreach ($groups as $group => $translations) {
foreach ($translations as $key => $description) {
pll_register_string($description, $key, $group, $multiline);
}
}
}
示例6: register_string
/**
* Add registration for multilanguage string (contain hook)
*
* @since 1.0.0
*
* @param string $plugin_name_human_format The Plugin name .
* @param string $string_name The name of the string.
* @param string $value The value.
*/
function register_string($plugin_name_human_format, $string_name, $value)
{
if (function_exists('icl_register_string')) {
icl_register_string($plugin_name_human_format, $string_name, $value);
} elseif (has_filter('cml_my_translations')) {
CMLTranslations::add($string_name, $value, str_replace(' ', '-', $plugin_name_human_format));
} elseif (function_exists('pll_register_string')) {
$plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format);
pll_register_string($plugin_name_human_format_replaced, $string_name);
}
}
示例7: manageAttrLablesTranslation
/**
* Make all attributes lables managed by polylang string translation
*
* @global \Polylang $polylang
* @global \WooCommerce $woocommerce
*
* @return boolean false if polylang or woocommerce can not be found
*/
public function manageAttrLablesTranslation()
{
global $polylang, $woocommerce;
if (!$polylang || !$woocommerce) {
return false;
}
$attrs = wc_get_attribute_taxonomies();
$section = __('Woocommerce Attributes', 'woo-poly-integration');
foreach ($attrs as $attr) {
pll_register_string($attr->attribute_label, $attr->attribute_label, $section);
}
}
示例8: ci_register_string_translation
/**
* Registers a string for translation. Needs a supported translation plugin active.
* Parameters should be identical to respective calls of ci_get_string_translation()
*
* @param string $name A description of the value, e.g. 'Booking - Button Text'
* @param string $value The text to be registered for translation, e.g. 'Book Now'
* @param string $context A context for grouping and disambiguation of the value, e.g. 'Widgets'
* @return string The string $value passed.
*/
function ci_register_string_translation($name, $value, $context)
{
// WPML support
if (function_exists('icl_register_string')) {
icl_register_string($context, $name . ' - ' . md5($value), $value);
} elseif (function_exists('pll_register_string')) {
// Must be run in every pageload.
pll_register_string($context . ' - ' . $name, $value);
}
// qTranslate seems to be working out of the box.
// Return the $value so that the function can be used in nested calls.
// E.g.: $value = ci_register_string_translation( $name, sanitize_text_field($value), $context );
return $value;
}
示例9: register_strings
public function register_strings()
{
if (!class_exists('GFAPI') || !function_exists('pll_register_string')) {
return;
}
$forms = GFAPI::get_forms();
foreach ($forms as $form) {
$this->form = $form;
$this->iterate_form($form, function ($value, $key) {
$name = '';
// todo: suitable naming
$group = "Form #{$this->form['id']}: {$this->form['title']}";
pll_register_string($name, $value, $group);
$this->registered_strings[] = $value;
});
}
}
示例10: bookingwp_email_strings
function bookingwp_email_strings()
{
$name = 'bookingwp-quoted-subject';
$string = booking_get_option('bookingwp_quoted_email_subject');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-quoted';
$string = booking_get_option('bookingwp_quoted_email');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-refused-subject';
$string = booking_get_option('bookingwp_refused_email_subject');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-refused';
$string = booking_get_option('bookingwp_refused_email');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-confirmed-email-subject';
$string = booking_get_option('bookingwp_confirmed_email_subject');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-confirmed';
$string = booking_get_option('bookingwp_confirmed_email');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-confirm-button';
$string = booking_get_option('bookingwp_confirm_button');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
$name = 'bookingwp-cancellation-policy';
$string = booking_get_option('bookingwp_cancellation_policy');
$group = 'bookingwp';
$multiline = true;
pll_register_string($name, $string, $group, $multiline);
}
示例11: tc_pll_strings_setup
function tc_pll_strings_setup()
{
// grab theme options
$tc_options = tc__f('__options');
// grab settings map, useful for some options labels
$tc_settings_map = TC_utils_settings_map::$instance->tc_get_customizer_map($get_default = true);
$tc_controls_map = $tc_settings_map['add_setting_control'];
// set $polylang_group;
$polylang_group = 'customizr-pro' == TC___::$theme_name ? 'Customizr-Pro' : 'Customizr';
//get options to translate
$tc_translatable_raw_options = TC_plugins_compat::$instance->tc_get_string_options_to_translate();
$tc_pll_options = array();
//build array if option => array( label (gettext-ed), option )
foreach ($tc_translatable_raw_options as $tc_translatable_option) {
if (isset($tc_options[$tc_translatable_option])) {
switch ($tc_translatable_option) {
case 'tc_front_slider':
$label = __('Front page slider name', 'customizr');
break;
case 'tc_posts_slider_button_text':
$label = __('Posts slider button text', 'customizr');
break;
default:
$label = $tc_controls_map[$tc_translatable_option]['label'];
break;
}
//endswitch
$tc_pll_options[$tc_translatable_option] = array('label' => $label, 'value' => $tc_options[$tc_translatable_option]);
}
}
//register the strings to translate
foreach ($tc_pll_options as $tc_pll_option) {
pll_register_string($tc_pll_option['label'], $tc_pll_option['value'], $polylang_group);
}
}
示例12: sydney_polylang
function sydney_polylang()
{
for ($i = 1; $i <= 5; $i++) {
pll_register_string('Slide title ' . $i, get_theme_mod('slider_title_' . $i), 'Sydney');
pll_register_string('Slide subtitle ' . $i, get_theme_mod('slider_subtitle_' . $i), 'Sydney');
}
pll_register_string('Slider button text', get_theme_mod('slider_button_text'), 'Sydney');
pll_register_string('Slider button URL', get_theme_mod('slider_button_url'), 'Sydney');
}
示例13: registerStrings
function registerStrings()
{
pll_register_string('Lithuanian films', 'Pasirinkite');
pll_register_string('Lithuanian films', 'Ilgametražis');
pll_register_string('Lithuanian films', 'Trumpametražis');
pll_register_string('Lithuanian films', 'Spalvotas');
pll_register_string('Lithuanian films', 'Nespalvotas');
pll_register_string('Lithuanian films', 'Gaminamas');
pll_register_string('Lithuanian films', 'Pagamintas');
pll_register_string('Lithuanian films', 'Paieškos forma');
pll_register_string('Lithuanian films', 'Filtruoti');
pll_register_string('Lithuanian films', 'nuo');
pll_register_string('Lithuanian films', 'iki');
pll_register_string('Lithuanian films', 'Pagal pasirinktus paieškos kriterijus filmų nerasta');
pll_register_string('Lithuanian films', 'Rasta filmų');
foreach ($this->fields as $key => $val) {
pll_register_string('Lithuanian films', $val['label']);
}
}
示例14: registerGatewayStringsForTranslation
/**
* Register Woocommerce Payment Gateway custom titles, descriptions and
* instructions in Polylang's Strings translations table.
*/
public function registerGatewayStringsForTranslation()
{
if (function_exists('pll_register_string') && !empty($this->enabledGateways)) {
foreach ($this->enabledGateways as $gateway) {
$settings = get_option($gateway->plugin_id . $gateway->id . '_settings');
if (!empty($settings)) {
if (isset($settings['title'])) {
pll_register_string($gateway->plugin_id . $gateway->id . '_gateway_title', $settings['title'], __('Woocommerce Payment Gateways', 'woo-poly-integration'));
}
if (isset($settings['description'])) {
pll_register_string($gateway->plugin_id . $gateway->id . '_gateway_description', $settings['description'], __('Woocommerce Payment Gateways', 'woo-poly-integration'));
}
if (isset($settings['instructions'])) {
pll_register_string($gateway->plugin_id . $gateway->id . '_gateway_instructions', $settings['instructions'], __('Woocommerce Payment Gateways', 'woo-poly-integration'));
}
}
}
}
}
示例15: registerString
/**
* Register email subjects and headings strings for translation in Polylang
* Strings Translations table.
*
* Note: This function uses get_option to retrive the subject and heading
* string from the WooCommerce Admin Settings page. get_option will return false
* if the Admin user has not changed (nor saved) the default settings.
*
* @param string $email_type Email type
* @param string $sufix Additional string variation, e.g. invoice paid vs invoice
*/
public function registerString($email_type, $sufix = '')
{
if (function_exists('pll_register_string')) {
$settings = get_option('woocommerce_' . $email_type . '_settings');
if ($settings) {
if (isset($settings['subject' . $sufix]) && isset($settings['heading' . $sufix])) {
pll_register_string('woocommerce_' . $email_type . '_subject' . $sufix, $settings['subject' . $sufix], __('Woocommerce Emails', 'woo-poly-integration'));
pll_register_string('woocommerce_' . $email_type . '_heading' . $sufix, $settings['heading' . $sufix], __('Woocommerce Emails', 'woo-poly-integration'));
}
}
}
}