WordPress.org

Plugin Directory

Changeset 1566326


Ignore:
Timestamp:
01/02/17 14:09:36 (3 months ago)
Author:
sormano
Message:

Versioning WPML Widgets 1.0.5

Location:
wpml-widgets
Files:
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • wpml-widgets/tags/1.0.5/readme.txt

    r1145457 r1566326  
    11=== WPML Widgets === 
    22Contributors: sormano 
    3 Donate link: http://www.jeroensormani.com/donate/ 
    4 Tags: WPML, WPML widget, Wordpress Multilanguage, Wordpress Multilanguage widget, WPML widget selector 
     3Tags: WPML, WPML widget, WordPress Multilanguage, WordPress Multilanguage widget, WPML widget selector 
    54Requires at least: 3.6 
    6 Tested up to: 4.2 
    7 Stable tag: 1.0.4 
     5Tested up to: 4.7 
     6Stable tag: 1.0.5 
    87License: GPLv3 or later 
    98License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    3231== Changelog == 
    3332 
     33= 1.0.5 - 02/01/2016 = 
     34* Change - Removed the unneeded prefixes of the class methods. 
     35* Tested - With the current WordPress version (4.7) 
     36* Improvement - Change the deprecated 'wpml_active_languages' function to 'wpml_get_active_languages' 
     37 
    3438= 1.0.4 - 25/04/2014 = 
    3539* Fix - Escape url in admin 
  • wpml-widgets/tags/1.0.5/wpml-widgets.php

    r1257166 r1566326  
    1 <?PHP 
     1<?php 
    22/* 
    33 * Plugin Name:     WPML Widgets 
    4  * Plugin URI:      http://jeroensormani.com/ 
     4 * Plugin URI:      http://jeroensormani.com 
    55 * Description:     Easily select which widgets you want to show for which languages 
    6  * Version:         1.0.4 
     6 * Version:         1.0.5 
    77 * Author:          Jeroen Sormani 
    8  * Author URI:      http://jeroensormani.com/ 
    9  * Text Domain:     wpml-widgets 
    10 */ 
     8 * Author URI:      http://jeroensormani.com 
     9 * Text domain:     wpml-widgets 
     10 */ 
    1111 
    1212/* 
     
    4747 
    4848    /** 
    49      * Instace of WPML_Widgets. 
    50      * 
    51      * @since 1.0.0 
    52      * @access private 
    53      * @var object $instance The instance of WPML_Widgets. 
     49     * Instance of WPML_Widgets. 
     50     * 
     51     * @since 1.0.0 
     52     * @var WPML_Widgets $instance The instance of WPML_Widgets. 
    5453     */ 
    5554    private static $instance; 
     
    6564        // check if WPML is activated 
    6665        if ( ! function_exists( 'is_plugin_active_for_network' ) ) : 
    67             require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 
     66            require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 
    6867        endif; 
    6968 
     
    7675 
    7776        // Add dropdown to widgets 
    78         add_action( 'in_widget_form', array( $this, 'ww_widget_dropdown' ), 10, 3 ); 
     77        add_action( 'in_widget_form', array( $this, 'widget_dropdown' ), 10, 3 ); 
    7978 
    8079        // Update dropdown value on widget update 
    81         add_filter( 'widget_update_callback', array( $this, 'ww_widget_update' ), 10, 4 ); 
     80        add_filter( 'widget_update_callback', array( $this, 'widget_update' ), 10, 4 ); 
    8281 
    8382        // Filter widgets by language 
    84         add_filter( 'widget_display_callback', array( $this, 'ww_display_widget' ), 10, 3 ); 
     83        add_filter( 'widget_display_callback', array( $this, 'display_widget' ), 10, 3 ); 
    8584 
    8685    } 
     
    119118     * @param   array   $instance   An array of the widget's settings. 
    120119     */ 
    121     public function ww_widget_dropdown( $widget, $form, $instance ) { 
    122  
    123         $languages = icl_get_languages(); 
     120    public function widget_dropdown( $widget, $form, $instance ) { 
     121 
     122        $languages = wpml_get_active_languages(); 
    124123 
    125124        ?><p> 
    126125            <label for='wpml_language'><?php _e( 'Display on language:', 'wpml-widgets' ); ?> </label> 
    127126            <select id='wpml_language' name='wpml_language'><?php 
    128             foreach ( $languages as $language ) : 
    129  
    130                 $wpml_language = isset( $instance['wpml_language'] ) ? $instance['wpml_language'] : null; 
    131                 ?><option <?php selected( $language['language_code'], $wpml_language ); ?> value='<?php echo $language['language_code']; ?>'><?php 
    132                     echo $language['native_name']; 
    133                 ?></option><?php 
    134  
    135             endforeach; 
    136  
    137             $selected = ( ! isset( $instance['wpml_language'] ) || 'all' == $instance['wpml_language'] ) ? true : false; 
    138             ?><option <?php selected( $selected ); ?> value='all'><?php _e( 'All Languages', 'wpml-widgets' ); ?></option> 
     127                foreach ( $languages as $language ) : 
     128 
     129                    $wpml_language = isset( $instance['wpml_language'] ) ? $instance['wpml_language'] : null; 
     130                    ?><option <?php selected( $language['code'], $wpml_language ); ?> value='<?php echo $language['code']; ?>'><?php 
     131                        echo $language['native_name']; 
     132                    ?></option><?php 
     133 
     134                endforeach; 
     135 
     136                $selected = ( ! isset( $instance['wpml_language'] ) || 'all' == $instance['wpml_language'] ) ? true : false; 
     137                ?><option <?php selected( $selected ); ?> value='all'><?php _e( 'All Languages', 'wpml-widgets' ); ?></option> 
    139138 
    140139            </select> 
     
    157156     * @return  array                   List of modified instance. 
    158157     */ 
    159     public function ww_widget_update( $instance, $new_instance, $old_instance, $this2 ) { 
     158    public function widget_update( $instance, $new_instance, $old_instance, $this2 ) { 
    160159 
    161160        $instance['wpml_language'] = $_POST['wpml_language']; 
     
    178177     * @return  array               List of modified widget instance. 
    179178     */ 
    180     public function ww_display_widget( $instance, $widget, $args ) { 
     179    public function display_widget( $instance, $widget, $args ) { 
    181180 
    182181        if ( isset( $instance['wpml_language'] ) && $instance['wpml_language'] != ICL_LANGUAGE_CODE && $instance['wpml_language'] != 'all' ) : 
     
    192191     * Nag message. 
    193192     * 
    194      * Display a nag message when WPML is not actiavted. 
     193     * Display a nag message when WPML is not activated. 
    195194     * 
    196195     * @since 1.0.3 
     
    233232if ( ! function_exists( 'WPML_Widgets' ) ) : 
    234233 
    235     function WPML_Widgets() { 
     234    function WPML_Widgets() { 
    236235        return WPML_Widgets::instance(); 
    237236    } 
  • wpml-widgets/trunk/readme.txt

    r1145457 r1566326  
    11=== WPML Widgets === 
    22Contributors: sormano 
    3 Donate link: http://www.jeroensormani.com/donate/ 
    4 Tags: WPML, WPML widget, Wordpress Multilanguage, Wordpress Multilanguage widget, WPML widget selector 
     3Tags: WPML, WPML widget, WordPress Multilanguage, WordPress Multilanguage widget, WPML widget selector 
    54Requires at least: 3.6 
    6 Tested up to: 4.2 
    7 Stable tag: 1.0.4 
     5Tested up to: 4.7 
     6Stable tag: 1.0.5 
    87License: GPLv3 or later 
    98License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    3231== Changelog == 
    3332 
     33= 1.0.5 - 02/01/2016 = 
     34* Change - Removed the unneeded prefixes of the class methods. 
     35* Tested - With the current WordPress version (4.7) 
     36* Improvement - Change the deprecated 'wpml_active_languages' function to 'wpml_get_active_languages' 
     37 
    3438= 1.0.4 - 25/04/2014 = 
    3539* Fix - Escape url in admin 
  • wpml-widgets/trunk/wpml-widgets.php

    r1257166 r1566326  
    1 <?PHP 
     1<?php 
    22/* 
    33 * Plugin Name:     WPML Widgets 
    4  * Plugin URI:      http://jeroensormani.com/ 
     4 * Plugin URI:      http://jeroensormani.com 
    55 * Description:     Easily select which widgets you want to show for which languages 
    6  * Version:         1.0.4 
     6 * Version:         1.0.5 
    77 * Author:          Jeroen Sormani 
    8  * Author URI:      http://jeroensormani.com/ 
    9  * Text Domain:     wpml-widgets 
    10 */ 
     8 * Author URI:      http://jeroensormani.com 
     9 * Text domain:     wpml-widgets 
     10 */ 
    1111 
    1212/* 
     
    4747 
    4848    /** 
    49      * Instace of WPML_Widgets. 
    50      * 
    51      * @since 1.0.0 
    52      * @access private 
    53      * @var object $instance The instance of WPML_Widgets. 
     49     * Instance of WPML_Widgets. 
     50     * 
     51     * @since 1.0.0 
     52     * @var WPML_Widgets $instance The instance of WPML_Widgets. 
    5453     */ 
    5554    private static $instance; 
     
    6564        // check if WPML is activated 
    6665        if ( ! function_exists( 'is_plugin_active_for_network' ) ) : 
    67             require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 
     66            require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 
    6867        endif; 
    6968 
     
    7675 
    7776        // Add dropdown to widgets 
    78         add_action( 'in_widget_form', array( $this, 'ww_widget_dropdown' ), 10, 3 ); 
     77        add_action( 'in_widget_form', array( $this, 'widget_dropdown' ), 10, 3 ); 
    7978 
    8079        // Update dropdown value on widget update 
    81         add_filter( 'widget_update_callback', array( $this, 'ww_widget_update' ), 10, 4 ); 
     80        add_filter( 'widget_update_callback', array( $this, 'widget_update' ), 10, 4 ); 
    8281 
    8382        // Filter widgets by language 
    84         add_filter( 'widget_display_callback', array( $this, 'ww_display_widget' ), 10, 3 ); 
     83        add_filter( 'widget_display_callback', array( $this, 'display_widget' ), 10, 3 ); 
    8584 
    8685    } 
     
    119118     * @param   array   $instance   An array of the widget's settings. 
    120119     */ 
    121     public function ww_widget_dropdown( $widget, $form, $instance ) { 
    122  
    123         $languages = icl_get_languages(); 
     120    public function widget_dropdown( $widget, $form, $instance ) { 
     121 
     122        $languages = wpml_get_active_languages(); 
    124123 
    125124        ?><p> 
    126125            <label for='wpml_language'><?php _e( 'Display on language:', 'wpml-widgets' ); ?> </label> 
    127126            <select id='wpml_language' name='wpml_language'><?php 
    128             foreach ( $languages as $language ) : 
    129  
    130                 $wpml_language = isset( $instance['wpml_language'] ) ? $instance['wpml_language'] : null; 
    131                 ?><option <?php selected( $language['language_code'], $wpml_language ); ?> value='<?php echo $language['language_code']; ?>'><?php 
    132                     echo $language['native_name']; 
    133                 ?></option><?php 
    134  
    135             endforeach; 
    136  
    137             $selected = ( ! isset( $instance['wpml_language'] ) || 'all' == $instance['wpml_language'] ) ? true : false; 
    138             ?><option <?php selected( $selected ); ?> value='all'><?php _e( 'All Languages', 'wpml-widgets' ); ?></option> 
     127                foreach ( $languages as $language ) : 
     128 
     129                    $wpml_language = isset( $instance['wpml_language'] ) ? $instance['wpml_language'] : null; 
     130                    ?><option <?php selected( $language['code'], $wpml_language ); ?> value='<?php echo $language['code']; ?>'><?php 
     131                        echo $language['native_name']; 
     132                    ?></option><?php 
     133 
     134                endforeach; 
     135 
     136                $selected = ( ! isset( $instance['wpml_language'] ) || 'all' == $instance['wpml_language'] ) ? true : false; 
     137                ?><option <?php selected( $selected ); ?> value='all'><?php _e( 'All Languages', 'wpml-widgets' ); ?></option> 
    139138 
    140139            </select> 
     
    157156     * @return  array                   List of modified instance. 
    158157     */ 
    159     public function ww_widget_update( $instance, $new_instance, $old_instance, $this2 ) { 
     158    public function widget_update( $instance, $new_instance, $old_instance, $this2 ) { 
    160159 
    161160        $instance['wpml_language'] = $_POST['wpml_language']; 
     
    178177     * @return  array               List of modified widget instance. 
    179178     */ 
    180     public function ww_display_widget( $instance, $widget, $args ) { 
     179    public function display_widget( $instance, $widget, $args ) { 
    181180 
    182181        if ( isset( $instance['wpml_language'] ) && $instance['wpml_language'] != ICL_LANGUAGE_CODE && $instance['wpml_language'] != 'all' ) : 
     
    192191     * Nag message. 
    193192     * 
    194      * Display a nag message when WPML is not actiavted. 
     193     * Display a nag message when WPML is not activated. 
    195194     * 
    196195     * @since 1.0.3 
     
    233232if ( ! function_exists( 'WPML_Widgets' ) ) : 
    234233 
    235     function WPML_Widgets() { 
     234    function WPML_Widgets() { 
    236235        return WPML_Widgets::instance(); 
    237236    } 
Note: See TracChangeset for help on using the changeset viewer.