WordPress.org

Plugin Directory

Changeset 820502


Ignore:
Timestamp:
12/12/13 23:17:51 (21 months ago)
Author:
aaroncampbell
Message:

Tag version 1.1.1 to rescue lost widgets

Location:
better-text-widget
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • better-text-widget/tags/1.1.1/better-text-widget.php

    r819367 r820502  
    44 * Plugin URI: http://ran.ge/wordpress-plugin/better-text-widget/ 
    55 * Description: Improves text widget by adding a class to each instance based off title 
    6  * Version: 1.1.0 
     6 * Version: 1.1.1 
    77 * Author: Aaron D. Campbell 
    88 * Author URI: http://ran.ge/ 
     
    2323} 
    2424add_action( 'widgets_init', 'better_text_widget_widgets_init' ); 
     25 
     26/** 
     27 * Convert existing Better Text Widgets to regular text widgets 
     28 */ 
     29function better_text_widgets_convert_widgets() { 
     30    $better_text_widget = get_option( 'better_text_widget' ); 
     31    if ( ! empty( $better_text_widget ) ) { 
     32        $replace_array = array(); 
     33        $widget_text = get_option( 'widget_text' ); 
     34 
     35        $id = max( array_keys( $widget_text ) ); 
     36 
     37        foreach ( $better_text_widget as $btw_id => $btw ) { 
     38            $widget_text[++$id] = $btw; 
     39            $replace_array['better-text-' . $btw_id] = 'text-' . $id; 
     40        } 
     41 
     42        $sidebars_widgets = get_option( 'sidebars_widgets' ); 
     43        foreach ( $sidebars_widgets as $sidebar => &$widgets ) { 
     44            if ( is_array( $widgets ) ) { 
     45                foreach ( $widgets as &$w ) { 
     46                    $w = str_replace( array_keys( $replace_array ), $replace_array, $w ); 
     47                } 
     48            } 
     49        } 
     50        update_option( 'sidebars_widgets', $sidebars_widgets ); 
     51        update_option( 'widget_text', $widget_text ); 
     52        update_option( 'better_text_widget', '' ); 
     53    } 
     54} 
     55add_action( 'init', 'better_text_widgets_convert_widgets' ); 
  • better-text-widget/tags/1.1.1/readme.txt

    r819924 r820502  
    55Requires at least: 3.5 
    66Tested up to: 3.8 
    7 Stable tag: 1.1.0 
     7Stable tag: 1.1.1 
    88 
    99A widget improves upon the built-in text widget by adding a class to each instance of the widget, based on the title. 
     
    1919== Upgrade Notice == 
    2020 
     21= 1.1.1 = 
     22Fixes an issue with the 1.1.0 release where some widgets were getting lost, and rescues those lost widgets if possible. 
     23 
    2124= 1.1.0 = 
    2225More efficient and based off the new text widget code 
     
    2730== Changelog == 
    2831 
     32= 1.1.1 = 
     33* Convert old Better Text Widget widgets to regular Text widgets 
     34 
    2935= 1.1.0 = 
    3036* Now extends the existing text widget and simply replaces it's class 
  • better-text-widget/trunk/better-text-widget.php

    r819367 r820502  
    44 * Plugin URI: http://ran.ge/wordpress-plugin/better-text-widget/ 
    55 * Description: Improves text widget by adding a class to each instance based off title 
    6  * Version: 1.1.0 
     6 * Version: 1.1.1 
    77 * Author: Aaron D. Campbell 
    88 * Author URI: http://ran.ge/ 
     
    2323} 
    2424add_action( 'widgets_init', 'better_text_widget_widgets_init' ); 
     25 
     26/** 
     27 * Convert existing Better Text Widgets to regular text widgets 
     28 */ 
     29function better_text_widgets_convert_widgets() { 
     30    $better_text_widget = get_option( 'better_text_widget' ); 
     31    if ( ! empty( $better_text_widget ) ) { 
     32        $replace_array = array(); 
     33        $widget_text = get_option( 'widget_text' ); 
     34 
     35        $id = max( array_keys( $widget_text ) ); 
     36 
     37        foreach ( $better_text_widget as $btw_id => $btw ) { 
     38            $widget_text[++$id] = $btw; 
     39            $replace_array['better-text-' . $btw_id] = 'text-' . $id; 
     40        } 
     41 
     42        $sidebars_widgets = get_option( 'sidebars_widgets' ); 
     43        foreach ( $sidebars_widgets as $sidebar => &$widgets ) { 
     44            if ( is_array( $widgets ) ) { 
     45                foreach ( $widgets as &$w ) { 
     46                    $w = str_replace( array_keys( $replace_array ), $replace_array, $w ); 
     47                } 
     48            } 
     49        } 
     50        update_option( 'sidebars_widgets', $sidebars_widgets ); 
     51        update_option( 'widget_text', $widget_text ); 
     52        update_option( 'better_text_widget', '' ); 
     53    } 
     54} 
     55add_action( 'init', 'better_text_widgets_convert_widgets' ); 
  • better-text-widget/trunk/readme.txt

    r819924 r820502  
    55Requires at least: 3.5 
    66Tested up to: 3.8 
    7 Stable tag: 1.1.0 
     7Stable tag: 1.1.1 
    88 
    99A widget improves upon the built-in text widget by adding a class to each instance of the widget, based on the title. 
     
    1919== Upgrade Notice == 
    2020 
     21= 1.1.1 = 
     22Fixes an issue with the 1.1.0 release where some widgets were getting lost, and rescues those lost widgets if possible. 
     23 
    2124= 1.1.0 = 
    2225More efficient and based off the new text widget code 
     
    2730== Changelog == 
    2831 
     32= 1.1.1 = 
     33* Convert old Better Text Widget widgets to regular Text widgets 
     34 
    2935= 1.1.0 = 
    3036* Now extends the existing text widget and simply replaces it's class 
Note: See TracChangeset for help on using the changeset viewer.