Example #1
0
function icl_st_update_text_widgets_actions($old_options, $new_options)
{
    global $wpdb;
    // remove filter for showing permalinks instead of sticky links while saving
    $GLOBALS['__disable_absolute_links_permalink_filter'] = 1;
    $widget_text = get_option('widget_text');
    if (is_array($widget_text)) {
        foreach ($widget_text as $k => $w) {
            if (isset($old_options[$k]['text']) && trim($old_options[$k]['text']) && $old_options[$k]['text'] != $w['text']) {
                $old_md5 = md5($old_options[$k]['text']);
                $string = $wpdb->get_row($wpdb->prepare("SELECT id, value, status FROM {$wpdb->prefix}icl_strings WHERE context=%s AND name=%s", 'Widgets', 'widget body - ' . $old_md5));
                if ($string) {
                    icl_st_update_string_actions('Widgets', 'widget body - ' . $old_md5, $old_options[$k]['text'], $w['text']);
                } else {
                    icl_register_string('Widgets', 'widget body - ' . md5($w['text']), $w['text']);
                }
            } elseif (isset($new_options[$k]['text']) && $old_options[$k]['text'] != $new_options[$k]['text']) {
                icl_register_string('Widgets', 'widget body - ' . md5($new_options[$k]['text']), $new_options[$k]['text']);
            }
        }
    }
    // add back the filter for showing permalinks instead of sticky links after saving
    unset($GLOBALS['__disable_absolute_links_permalink_filter']);
}
Example #2
0
function icl_st_update_blogdescription_actions($old, $new)
{
    icl_st_update_string_actions('WP', 'Tagline', $old, $new, true);
}
Example #3
0
 function update($new_instance, $old_instance)
 {
     global $wpdb;
     $instance = $old_instance;
     $instance['title'] = strip_tags($new_instance['title']);
     if (current_user_can('unfiltered_html')) {
         $instance['text'] = $new_instance['text'];
     } else {
         $instance['text'] = stripslashes(wp_filter_post_kses(addslashes($new_instance['text'])));
     }
     // wp_filter_post_kses() expects slashed
     $instance['filter'] = isset($new_instance['filter']);
     if ($new_instance['icl_language'] == 'multilingual') {
         $string = $wpdb->get_row($wpdb->prepare("SELECT id, value, status FROM {$wpdb->prefix}icl_strings WHERE context=%s AND name=%s", 'Widgets', 'widget body - ' . $this->id));
         if ($string) {
             icl_st_update_string_actions('Widgets', 'widget body - ' . $this->id, $old_instance['text'], $instance['text']);
         } else {
             icl_register_string('Widgets', 'widget body - ' . $this->id, $instance['text']);
         }
     }
     $instance['icl_language'] = $new_instance['icl_language'];
     return $instance;
 }
function icl_st_update_text_widgets_actions($old_options, $new_options)
{
    global $sitepress_settings;
    // remove filter for showing permalinks instead of sticky links while saving
    $GLOBALS['__disable_absolute_links_permalink_filter'] = 1;
    $widget_text = get_option('widget_text');
    if (is_array($widget_text)) {
        foreach ($widget_text as $k => $w) {
            if (isset($old_options[$k]['text']) && trim($old_options[$k]['text']) && $old_options[$k]['text'] != $w['text']) {
                icl_st_update_string_actions('Widgets', 'widget body - ' . md5(apply_filters('widget_text', $old_options[$k]['text'])), apply_filters('widget_text', $old_options[$k]['text']), apply_filters('widget_text', $w['text']));
            } elseif ($new_options[$k]['text'] && $old_options[$k]['text'] != $new_options[$k]['text']) {
                icl_register_string('Widgets', 'widget body - ' . md5(apply_filters('widget_text', $new_options[$k]['text'])), apply_filters('widget_text', $new_options[$k]['text']));
            }
        }
    }
    // add back the filter for showing permalinks instead of sticky links after saving
    unset($GLOBALS['__disable_absolute_links_permalink_filter']);
}