本文整理汇总了PHP中icl_unregister_string函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_unregister_string函数的具体用法?PHP icl_unregister_string怎么用?PHP icl_unregister_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icl_unregister_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: icl_register_admin_options
function icl_register_admin_options($array, $key = "", $option = array())
{
foreach ($array as $k => $v) {
if (is_array($v)) {
array_push($option, $k);
$this->icl_register_admin_options($v, $key . '[' . $k . ']', $option);
array_pop($option);
} else {
$context = $this->get_context($key, $k);
if ($v === '') {
icl_unregister_string($context, $key . $k);
} else {
icl_register_string($context, $key . $k, $v);
$vals = array($k => 1);
if (count($option)) {
for ($i = count($option) - 1; $i >= 0; $i--) {
$vals = array($option[$i] => $vals);
}
}
$_icl_admin_option_names = get_option('_icl_admin_option_names');
$_icl_admin_option_names = array_merge_recursive((array) $_icl_admin_option_names, $vals);
update_option('_icl_admin_option_names', $_icl_admin_option_names);
}
}
}
}
示例2: icl_register_admin_options
function icl_register_admin_options($array, $key = "", $option = array())
{
if (is_object($option)) {
$option = object_to_array($option);
}
foreach ($array as $k => $v) {
$option = $key === '' ? array($k => maybe_unserialize($this->get_option_without_filtering($k))) : $option;
if (is_array($v)) {
$this->icl_register_admin_options($v, $key . '[' . $k . ']', $option[$k]);
} else {
$context = $this->get_context($key, $k);
if ($v === '') {
icl_unregister_string($context, $key . $k);
} elseif (isset($option[$k]) && ($key === '' || preg_match_all('#\\[([^\\]]+)\\]#', (string) $key, $opt_key_matches) > 0)) {
icl_register_string($context, $key . $k, $option[$k]);
$vals = array($k => 1);
$opt_keys = isset($opt_key_matches) ? array_reverse($opt_key_matches[1]) : array();
foreach ($opt_keys as $opt) {
$vals = array($opt => $vals);
}
update_option('_icl_admin_option_names', array_merge_recursive((array) get_option('_icl_admin_option_names'), $vals));
}
}
}
}
示例3: deregister_string
/**
* Unregister multilanguage string, Polylang missing support of this feature
*
* @since 1.0.0
*
* @param string $plugin_name_human_format The Plugin name.
* @param string $string_name The name of the string.
*/
function deregister_string($plugin_name_human_format, $string_name)
{
if (function_exists('icl_unregister_string')) {
icl_unregister_string($plugin_name_human_format, $string_name);
} elseif (has_filter('cml_my_translations')) {
$plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format);
CMLTranslations::delete($plugin_name_human_format_replaced);
}
}
示例4: unregister_petition
/**
* Deletes custom petition form strings that are registered with WPML
*
* @param int $id value of the petition's 'id' field in the database
*/
public function unregister_petition($id)
{
if (function_exists('icl_unregister_string')) {
$context = 'Petition ' . $id;
icl_unregister_string($context, 'petition title');
icl_unregister_string($context, 'email subject');
icl_unregister_string($context, 'greeting');
icl_unregister_string($context, 'petition message');
icl_unregister_string($context, 'custom field label');
icl_unregister_string($context, 'twitter message');
icl_unregister_string($context, 'optin label');
}
}
示例5: pc_cat_wpml_del_name
function pc_cat_wpml_del_name($cat_id)
{
if (function_exists('icl_unregister_string')) {
icl_unregister_string('PrivateContent Categories', $cat_id);
}
}
示例6: update_wpml_strings
/**
* WPML support: Update strings that need translation.
*
* @param array $old_menu The old custom menu, if any.
* @param array $custom_menu The new custom menu.
*/
private function update_wpml_strings($old_menu, $custom_menu)
{
if (!function_exists('icl_register_string')) {
return;
}
$previous_strings = $this->get_wpml_strings($old_menu);
$new_strings = $this->get_wpml_strings($custom_menu);
//Delete strings that are no longer valid.
if (function_exists('icl_unregister_string')) {
$removed_strings = array_diff_key($previous_strings, $new_strings);
foreach ($removed_strings as $name => $value) {
icl_unregister_string(self::WPML_CONTEXT, $name);
}
}
//Register/update the new menu strings.
foreach ($new_strings as $name => $value) {
icl_register_string(self::WPML_CONTEXT, $name, $value);
}
}
示例7: languages_page
//.........这里部分代码省略.........
case 'delete':
check_admin_referer('delete-lang');
if (!empty($_GET['lang'])) {
$this->model->delete_language((int) $_GET['lang']);
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'edit':
if (!empty($_GET['lang'])) {
$edit_lang = $this->model->get_language((int) $_GET['lang']);
}
break;
case 'update':
check_admin_referer('add-lang', '_wpnonce_add-lang');
$error = $this->model->update_language($_POST);
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'default-lang':
check_admin_referer('default-lang');
if ($lang = $this->model->get_language((int) $_GET['lang'])) {
$this->model->update_default_lang($lang->slug);
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'content-default-lang':
check_admin_referer('content-default-lang');
if ($nolang = $this->model->get_objects_with_no_lang()) {
if (!empty($nolang['posts'])) {
$this->model->set_language_in_mass('post', $nolang['posts'], $this->options['default_lang']);
}
if (!empty($nolang['terms'])) {
$this->model->set_language_in_mass('term', $nolang['terms'], $this->options['default_lang']);
}
}
self::redirect();
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
break;
case 'string-translation':
if (!empty($_POST['submit'])) {
check_admin_referer('string-translation', '_wpnonce_string-translation');
$strings = PLL_Admin_Strings::get_strings();
foreach ($this->model->get_languages_list() as $language) {
if (empty($_POST['translation'][$language->slug])) {
// in case the language filter is active ( thanks to John P. Bloch )
continue;
}
$mo = new PLL_MO();
$mo->import_from_db($language);
foreach ($_POST['translation'][$language->slug] as $key => $translation) {
$translation = apply_filters('pll_sanitize_string_translation', $translation, $strings[$key]['name'], $strings[$key]['context']);
$mo->add_entry($mo->make_entry($strings[$key]['string'], $translation));
}
// clean database ( removes all strings which were registered some day but are no more )
if (!empty($_POST['clean'])) {
$new_mo = new PLL_MO();
foreach ($strings as $string) {
$new_mo->add_entry($mo->make_entry($string['string'], $mo->translate($string['string'])));
}
}
isset($new_mo) ? $new_mo->export_to_db($language) : $mo->export_to_db($language);
}
add_settings_error('general', 'pll_strings_translations_updated', __('Translations updated.', 'polylang'), 'updated');
do_action('pll_save_strings_translations');
}
// unregisters strings registered through WPML API
if ($string_table->current_action() == 'delete' && !empty($_POST['strings']) && function_exists('icl_unregister_string')) {
check_admin_referer('string-translation', '_wpnonce_string-translation');
$strings = PLL_Admin_Strings::get_strings();
foreach ($_POST['strings'] as $key) {
icl_unregister_string($strings[$key]['context'], $strings[$key]['name']);
}
}
// to refresh the page ( possible thanks to the $_GET['noheader']=true )
$args = array_intersect_key($_REQUEST, array_flip(array('s', 'paged', 'group')));
if (!empty($args['s'])) {
$args['s'] = urlencode($args['s']);
// searched string needs to be encoded as it comes from $_POST
}
self::redirect($args);
break;
case 'activate':
check_admin_referer('pll_activate');
$this->modules[$_GET['module']]->activate();
self::redirect();
break;
case 'deactivate':
check_admin_referer('pll_deactivate');
$this->modules[$_GET['module']]->deactivate();
self::redirect();
break;
default:
do_action("mlang_action_{$action}");
break;
}
// displays the page
include PLL_SETTINGS_INC . '/view-languages.php';
}
示例8: get_theme_mod
}
}
}
/*Contact*/
$parallax_one_contact_pl = get_theme_mod('parallax_one_contact_info_content');
if (!empty($parallax_one_contact_pl)) {
$parallax_one_contact_pl_decoded = json_decode($parallax_one_contact_pl);
foreach ($parallax_one_contact_pl_decoded as $parallax_one_contact_box) {
$text = $parallax_one_contact_box->text;
$id = esc_attr($parallax_one_contact_box->id);
if (!empty($id)) {
if (!empty($text)) {
icl_unregister_string('Contact', $id . '_contact');
icl_register_string('Contact', $id . '_contact', $title);
} else {
icl_unregister_string('Contact', $id . '_contact');
}
}
}
}
}
/*Check if Repeater is empty*/
function parallax_one_general_repeater_is_empty($parallax_one_arr)
{
$parallax_one_services_decoded = json_decode($parallax_one_arr);
foreach ($parallax_one_services_decoded as $parallax_box) {
if (!empty($parallax_box->choice) && $parallax_box->choice == 'parallax_none') {
$parallax_box->icon_value = '';
$parallax_box->image_url = '';
}
foreach ($parallax_box as $key => $value) {
示例9: ot_wpml_unregister_string
/**
* Helper function to unregister a WPML string
*
* @access public
* @since 2.1
*/
function ot_wpml_unregister_string($id)
{
if (function_exists('icl_unregister_string')) {
icl_unregister_string('Opções do Tema', $id);
}
}
示例10: fp_rac_delete_email_template
public static function fp_rac_delete_email_template()
{
if (isset($_POST['row_id'])) {
global $wpdb;
$row_id = $_POST['row_id'];
$table_name_email = $wpdb->prefix . 'rac_templates_email';
$wpdb->delete($table_name_email, array('id' => $row_id));
//removing registered WPML strings
if (function_exists('icl_unregister_string')) {
icl_unregister_string('RAC', 'rac_template_' . $row_id . '_message');
icl_unregister_string('RAC', 'rac_template_' . $row_id . '_subject');
}
}
exit;
}
示例11: tg_unregister_string_wpml
/**
* Asks WPML to forget about $name
*
* @param stirn $name
*/
function tg_unregister_string_wpml($name)
{
if (function_exists('icl_unregister_string')) {
icl_unregister_string('tag-groups', $name);
}
}
示例12: mg_options_wpml_sync
function mg_options_wpml_sync()
{
if (!function_exists('icl_register_string')) {
die('error');
}
require_once MG_DIR . '/functions.php';
$already_saved = get_option('mg_wpml_synced_opts');
$to_save = array();
foreach (mg_main_types() as $type => $name) {
$type_opts = get_option('mg_' . $type . '_opt');
$typename = $type == 'img_gallery' ? 'Image Gallery' : ucfirst($type);
if (is_array($type_opts) && count($type_opts) > 0) {
foreach ($type_opts as $opt) {
$index = $typename . ' Options - ' . $opt;
$to_save[$index] = $index;
icl_register_string('Media Grid - Item Options', $index, $opt);
if (isset($already_saved[$index])) {
unset($already_saved[$index]);
}
}
}
}
if (is_array($already_saved) && count($already_saved) > 0) {
foreach ($already_saved as $opt) {
icl_unregister_string('Media Grid - Item Options', $opt);
}
}
if (!get_option('mg_wpml_synced_opts')) {
add_option('mg_wpml_synced_opts', '255', '', 'yes');
}
update_option('mg_wpml_synced_opts', $to_save);
die('success');
}
示例13: foreach
$sql_signatures_table = "DROP TABLE {$db_signatures}";
$wpdb->query($sql_signatures_table);
// delete WPML strings
if (function_exists('icl_unregister_string')) {
// delete petition strings in WPML
foreach ($petitions as $petition) {
$context = 'Petition ' . $petition->id;
icl_unregister_string($context, 'petition title');
icl_unregister_string($context, 'email subject');
icl_unregister_string($context, 'greeting');
icl_unregister_string($context, 'petition message');
icl_unregister_string($context, 'custom field label');
icl_unregister_string($context, 'twitter message');
icl_unregister_string($context, 'optin label');
}
// delete widget strings in WPML
foreach ($petitions as $petition) {
$context = 'Petition ' . $petition->id;
icl_unregister_string($context, 'widget title');
icl_unregister_string($context, 'widget call to action');
}
// delete options strings in WPML
icl_unregister_string('Petition', 'submit button text');
icl_unregister_string('Petition', 'success message');
icl_unregister_string('Petition', 'share message');
icl_unregister_string('Petition', 'expiration message');
icl_unregister_string('Petition', 'already signed message');
icl_unregister_string('Petition', 'signaturelist title');
icl_unregister_string('Petition', 'confirmation email subject');
icl_unregister_string('Petition', 'confirmation email message');
}
示例14: icl_register_admin_options
function icl_register_admin_options($array, $key = "")
{
foreach ($array as $k => $v) {
if (is_array($v)) {
icl_register_admin_options($v, $key . '[' . $k . ']');
} else {
if ($v === '') {
icl_unregister_string('admin_options_' . get_option('template'), $key . $k);
} else {
icl_register_string('admin_options_' . get_option('template'), $key . $k, $v);
}
}
}
}
示例15: languages_page
//.........这里部分代码省略.........
if (!empty($_GET['lang'])) {
$edit_lang = $this->model->get_language((int) $_GET['lang']);
}
break;
case 'update':
check_admin_referer('add-lang', '_wpnonce_add-lang');
$error = $this->model->update_language($_POST);
wp_redirect('admin.php?page=mlang' . ($error ? '&error=' . $error : ''));
// to refresh the page (possible thanks to the $_GET['noheader']=true)
exit;
break;
case 'string-translation':
if (!empty($_REQUEST['submit'])) {
check_admin_referer('string-translation', '_wpnonce_string-translation');
$strings = $this->get_strings();
foreach ($this->model->get_languages_list() as $language) {
if (empty($_POST['translation'][$language->name])) {
// in case the language filter is active (thanks to John P. Bloch)
continue;
}
$mo = new PLL_MO();
$mo->import_from_db($language);
foreach ($_POST['translation'][$language->name] as $key => $translation) {
$mo->add_entry($mo->make_entry($strings[$key]['string'], stripslashes($translation)));
}
// clean database (removes all strings which were registered some day but are no more)
if (!empty($_POST['clean'])) {
$new_mo = new PLL_MO();
foreach ($strings as $string) {
$new_mo->add_entry($mo->make_entry($string['string'], $mo->translate($string['string'])));
}
}
isset($new_mo) ? $new_mo->export_to_db($language) : $mo->export_to_db($language);
}
}
do_action('pll_save_strings_translations');
// unregisters strings registered through WPML API
if ($string_table->current_action() == 'delete' && !empty($_REQUEST['strings']) && function_exists('icl_unregister_string')) {
check_admin_referer('string-translation', '_wpnonce_string-translation');
$strings = $this->get_strings();
foreach ($_REQUEST['strings'] as $key) {
icl_unregister_string($strings[$key]['context'], $strings[$key]['name']);
}
}
// to refresh the page (possible thanks to the $_GET['noheader']=true)
$url = 'admin.php?page=mlang&tab=strings';
foreach (array('s', 'paged', 'group') as $qv) {
$url = empty($_REQUEST[$qv]) ? $url : $url . '&' . $qv . '=' . $_REQUEST[$qv];
}
wp_redirect($url);
exit;
break;
case 'options':
check_admin_referer('options-lang', '_wpnonce_options-lang');
$this->options['default_lang'] = sanitize_title($_POST['default_lang']);
// we have slug as value
foreach (array('force_lang', 'rewrite') as $key) {
$this->options[$key] = isset($_POST[$key]) ? (int) $_POST[$key] : 0;
}
// FIXME : TODO error message if not a valid url
if (3 == $this->options['force_lang'] && isset($_POST['domains']) && is_array($_POST['domains'])) {
foreach ($_POST['domains'] as $key => $domain) {
$this->options['domains'][$key] = esc_url_raw(trim($domain));
}
$this->options['domains'][$this->options['default_lang']] = get_option('home');
}
foreach (array('browser', 'hide_default', 'redirect_lang', 'media_support') as $key) {
$this->options[$key] = isset($_POST[$key]) ? 1 : 0;
}
if (3 == $this->options['force_lang']) {
$this->options['browser'] = $this->options['hide_default'] = 0;
}
foreach (array('sync', 'post_types', 'taxonomies') as $key) {
$this->options[$key] = empty($_POST[$key]) ? array() : array_keys($_POST[$key], 1);
}
update_option('polylang', $this->options);
// refresh rewrite rules in case rewrite, hide_default, post types or taxonomies options have been modified
// it seems useless to refresh permastruct here
flush_rewrite_rules();
// refresh language cache in case home urls have been modified
$this->model->clean_languages_cache();
// fills existing posts & terms with default language
if (isset($_POST['fill_languages']) && ($nolang = $this->model->get_objects_with_no_lang())) {
if (!empty($nolang['posts'])) {
$this->model->set_language_in_mass('post', $nolang['posts'], $this->options['default_lang']);
}
if (!empty($nolang['terms'])) {
$this->model->set_language_in_mass('term', $nolang['terms'], $this->options['default_lang']);
}
}
wp_redirect('admin.php?page=mlang&tab=settings&updated=true');
// updated=true interpreted by WP
exit;
break;
default:
break;
}
// displays the page
include PLL_ADMIN_INC . '/view-languages.php';
}