Plugin Directory

Changeset 2004174


Ignore:
Timestamp:
12/31/2018 07:50:47 AM (7 years ago)
Author:
mechter
Message:

updated code that was deprecated in PHP 7.2

Location:
you-have-a-new-message
Files:
2 edited
7 copied

Legend:

Unmodified
Added
Removed
  • you-have-a-new-message/tags/2.1/readme.txt

    r1990104 r2004174  
    55Requires at least: 3.6
    66Tested up to: 5.0
    7 Stable tag: 2.0
     7Stable tag: 2.1
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2323== Changelog ==
    2424
     25= 2.1 =
     26
     27* Updated code that was deprecated in PHP 7.2
     28
    2529= 2.0 =
    2630
  • you-have-a-new-message/tags/2.1/you-have-a-new-message.php

    r1681403 r2004174  
    66Author: Markus Echterhoff
    77Author URI: https://www.markusechterhoff.com
    8 Version: 2.0
     8Version: 2.1
    99License: GPLv3 or later
    1010Text Domain: you-have-a-new-message
     
    1717}
    1818
    19 add_action('widgets_init', create_function('', 'register_widget("YouHaveANewBuddyPressMessageWidget");'));
    2019class YouHaveANewBuddyPressMessageWidget extends WP_Widget {
    2120
     
    3635    public function form( $instance ) {
    3736        $single = ! empty( $instance['single'] ) ? $instance['single'] : esc_html__( 'You have a new message', 'you-have-a-new-message' );
    38    
     37
    3938        ?>
    4039            <p>
    41             <label for="<?php echo esc_attr( $this->get_field_id( 'single' ) ); ?>"><?php esc_attr_e( 'Single Message:', 'you-have-a-new-message' ); ?></label> 
     40            <label for="<?php echo esc_attr( $this->get_field_id( 'single' ) ); ?>"><?php esc_attr_e( 'Single Message:', 'you-have-a-new-message' ); ?></label>
    4241            <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'single' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'single' ) ); ?>" type="text" value="<?php echo esc_attr( $single ); ?>">
    4342            </p>
    4443        <?php
    45    
     44
    4645        $multiple = ! empty( $instance['multiple'] ) ? $instance['multiple'] : esc_html__( 'You have %s new messages', 'you-have-a-new-message' );
    47    
     46
    4847        ?>
    4948            <p>
    50             <label for="<?php echo esc_attr( $this->get_field_id( 'multiple' ) ); ?>"><?php esc_attr_e( 'Multiple Messages: (%s = message count)', 'you-have-a-new-message' ); ?></label> 
     49            <label for="<?php echo esc_attr( $this->get_field_id( 'multiple' ) ); ?>"><?php esc_attr_e( 'Multiple Messages: (%s = message count)', 'you-have-a-new-message' ); ?></label>
    5150            <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'multiple' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'multiple' ) ); ?>" type="text" value="<?php echo esc_attr( $multiple ); ?>">
    52             </p> 
     51            </p>
    5352        <?php
    5453    }
     
    6059        return $instance;
    6160    }
     61}
     62
     63add_action( 'widgets_init', 'yhanm_register_widget' );
     64function yhanm_register_widget() {
     65    register_widget( 'YouHaveANewBuddyPressMessageWidget' );
    6266}
    6367
     
    7377
    7478function yhanm_get_notice( $single = '', $multiple = '' ) {
    75    
     79
    7680    if ( !is_user_logged_in() ) {
    7781        return;
    7882    }
    79    
     83
    8084    if ( bp_is_messages_component() && bp_is_current_action( 'inbox' ) ) {
    8185        return;
    8286    }
    83    
     87
    8488    $count = bp_get_total_unread_messages_count();
    8589    if ( !$count ) {
     
    9498    }
    9599    $out .= '</a>';
    96    
    97     return $out;           
     100
     101    return $out;
    98102}
    99103
  • you-have-a-new-message/trunk/readme.txt

    r1990104 r2004174  
    55Requires at least: 3.6
    66Tested up to: 5.0
    7 Stable tag: 2.0
     7Stable tag: 2.1
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2323== Changelog ==
    2424
     25= 2.1 =
     26
     27* Updated code that was deprecated in PHP 7.2
     28
    2529= 2.0 =
    2630
  • you-have-a-new-message/trunk/you-have-a-new-message.php

    r1681403 r2004174  
    66Author: Markus Echterhoff
    77Author URI: https://www.markusechterhoff.com
    8 Version: 2.0
     8Version: 2.1
    99License: GPLv3 or later
    1010Text Domain: you-have-a-new-message
     
    1717}
    1818
    19 add_action('widgets_init', create_function('', 'register_widget("YouHaveANewBuddyPressMessageWidget");'));
    2019class YouHaveANewBuddyPressMessageWidget extends WP_Widget {
    2120
     
    3635    public function form( $instance ) {
    3736        $single = ! empty( $instance['single'] ) ? $instance['single'] : esc_html__( 'You have a new message', 'you-have-a-new-message' );
    38    
     37
    3938        ?>
    4039            <p>
    41             <label for="<?php echo esc_attr( $this->get_field_id( 'single' ) ); ?>"><?php esc_attr_e( 'Single Message:', 'you-have-a-new-message' ); ?></label> 
     40            <label for="<?php echo esc_attr( $this->get_field_id( 'single' ) ); ?>"><?php esc_attr_e( 'Single Message:', 'you-have-a-new-message' ); ?></label>
    4241            <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'single' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'single' ) ); ?>" type="text" value="<?php echo esc_attr( $single ); ?>">
    4342            </p>
    4443        <?php
    45    
     44
    4645        $multiple = ! empty( $instance['multiple'] ) ? $instance['multiple'] : esc_html__( 'You have %s new messages', 'you-have-a-new-message' );
    47    
     46
    4847        ?>
    4948            <p>
    50             <label for="<?php echo esc_attr( $this->get_field_id( 'multiple' ) ); ?>"><?php esc_attr_e( 'Multiple Messages: (%s = message count)', 'you-have-a-new-message' ); ?></label> 
     49            <label for="<?php echo esc_attr( $this->get_field_id( 'multiple' ) ); ?>"><?php esc_attr_e( 'Multiple Messages: (%s = message count)', 'you-have-a-new-message' ); ?></label>
    5150            <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'multiple' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'multiple' ) ); ?>" type="text" value="<?php echo esc_attr( $multiple ); ?>">
    52             </p> 
     51            </p>
    5352        <?php
    5453    }
     
    6059        return $instance;
    6160    }
     61}
     62
     63add_action( 'widgets_init', 'yhanm_register_widget' );
     64function yhanm_register_widget() {
     65    register_widget( 'YouHaveANewBuddyPressMessageWidget' );
    6266}
    6367
     
    7377
    7478function yhanm_get_notice( $single = '', $multiple = '' ) {
    75    
     79
    7680    if ( !is_user_logged_in() ) {
    7781        return;
    7882    }
    79    
     83
    8084    if ( bp_is_messages_component() && bp_is_current_action( 'inbox' ) ) {
    8185        return;
    8286    }
    83    
     87
    8488    $count = bp_get_total_unread_messages_count();
    8589    if ( !$count ) {
     
    9498    }
    9599    $out .= '</a>';
    96    
    97     return $out;           
     100
     101    return $out;
    98102}
    99103
Note: See TracChangeset for help on using the changeset viewer.