__( 'Front End PM Menu Widget', 'front-end-pm' ), ) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; } echo '
'; do_action( 'fep_menu_button' ); echo '
'; echo $args['after_widget']; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { $title = isset( $instance['title'] ) ? $instance['title'] : __( 'FEP Menu Widget', 'front-end-pm' ); ?>

__( 'Front End PM Text Widget', 'front-end-pm' ), ) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { global $user_ID; echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; } $show_messagebox = isset( $instance['show_messagebox'] ) ? $instance['show_messagebox'] : false; $show_announcement = isset( $instance['show_announcement'] ) ? $instance['show_announcement'] : false; if ( $show_messagebox || $show_announcement ) { echo __( 'Welcome', 'front-end-pm' ) . ' ' . fep_user_name( $user_ID ). '
'; echo __( 'You have', 'front-end-pm' ); if ( $show_messagebox ) { echo ' '; $unread_count = fep_get_new_message_number(); $sm = sprintf( _n( '%s message', '%s messages', $unread_count, 'front-end-pm'), number_format_i18n( $unread_count ) ); echo '' . $sm . ''; } if ( $show_messagebox && $show_announcement ) { echo ' '; echo __( 'and', 'front-end-pm' ); } if ( $show_announcement ) { echo ' '; $unread_ann_count = fep_get_new_announcement_number(); $sa = sprintf( _n( '%s announcement', '%s announcements', $unread_ann_count, 'front-end-pm' ), number_format_i18n( $unread_ann_count ) ); echo '' . $sa . ''; } echo ' '; echo __( 'unread', 'front-end-pm' ); } do_action( 'fep_text_widget' ); echo $args['after_widget']; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { $title = isset( $instance['title'] ) ? $instance['title'] : __( 'FEP Text Widget', 'front-end-pm' ); $show_messagebox = isset( $instance['show_messagebox'] ) ? $instance['show_messagebox'] : false; $show_announcement = isset( $instance['show_announcement'] ) ? $instance['show_announcement'] : false; ?>

id="get_field_id( 'show_messagebox' ); ?>" name="get_field_name( 'show_messagebox' ); ?>" value="1"/>

id="get_field_id( 'show_announcement' ); ?>" name="get_field_name( 'show_announcement' ); ?>" value="1"/>

__( 'Front End PM Empty Widget', 'front-end-pm' ), ) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title']; } $show_help = isset( $instance['show_help'] ) ? $instance['show_help'] : false; if ( $show_help ) { _e( 'Use add_action( \'fep_empty_widget_' . $this->number . '\', \'your_function\' ); to hook to ONLY this widget where \'your_function\' is your callback function.', 'front-end-pm' ); _e( '
Use add_action(\'fep_empty_widget\', \'your_function\' ); to hook to all FEP Empty widget where \'your_function\' is your callback function', 'front-end-pm' ); } do_action( 'fep_empty_widget_' . $this->number ); do_action( 'fep_empty_widget' ); echo $args['after_widget']; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { $title = isset( $instance['title'] ) ? $instance['title'] : __( 'FEP Empty Widget', 'front-end-pm' ); $show_help = isset( $instance['show_help'] ) ? $instance['show_help'] : false; ?>

id="get_field_id( 'show_help' ); ?>" name="get_field_name( 'show_help' ); ?>" value="1"/>