Plugin Directory

Changeset 1869008


Ignore:
Timestamp:
05/05/2018 02:52:06 AM (8 years ago)
Author:
spridz0
Message:

Add customizable message to widget.

Location:
spridz-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • spridz-widget/trunk/readme.txt

    r1868684 r1869008  
    44Requires at least: 4.6
    55Tested up to: 4.95
    6 Stable tag: 0.2
     6Stable tag: 0.3
    77Requires PHP: 5
    88License: GPLv2 or later
     
    4747
    4848For further information please contact info@spridz.com
     49
  • spridz-widget/trunk/spridz-widget.php

    r1864627 r1869008  
    22/*
    33    Plugin Name: Spridz Widget Plugin
    4     Plugin URI: https://bitbucket.org/spridz/spridz-widget
     4    Plugin URI: https://wordpress.org/plugins/spridz-widget
    55    Description: Your own Spridz customer survey widget.
    6     Version: 0.2
     6    Version: 0.3
    77    Author: Spridz Ventures
    88    Author URI: http://spridz.com
     
    3434        'api_token'     => '',
    3535        'host'          => 'https://spridz.com',
    36         'html'          => ''
     36        'html'          => '',
     37        'message'       => 'Your feedback matters. Rate us by clicking a smiley.'
    3738    );
    3839
     
    4142    <?php ?>
    4243    <p>
     44        <label for="<?php echo esc_attr( $this->get_field_id( 'message' ) ); ?>"><?php _e( 'Message', 'text_domain' ); ?></label>
     45        <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'message' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'message' ) ); ?>" type="text" value="<?php echo esc_attr( $message ); ?>" />
     46
    4347        <label for="<?php echo esc_attr( $this->get_field_id( 'api_token' ) ); ?>"><?php _e( 'API Token', 'text_domain' ); ?></label>
    4448        <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'api_token' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'api_token' ) ); ?>" type="text" value="<?php echo esc_attr( $api_token ); ?>" />
     
    5963    $instance['api_token']     = isset( $new_instance['api_token'] ) ? wp_strip_all_tags( $new_instance['api_token'] ) : '';
    6064    $instance['host']          = isset( $new_instance['host'] ) ? wp_strip_all_tags( $new_instance['host'] ) : '';
     65    $instance['message']       = isset( $new_instance['message']) ? wp_strip_all_tags( $new_instance['message']) : '';
    6166
    6267    $url = $instance['host'] . "/admin/api/widget";
     
    7883
    7984    $html     = isset( $instance['html'] ) ? $instance['html'] : '';
     85    $message  = isset( $instance['message'] ) ? $instance['message'] : '';
    8086
    8187    echo $before_widget;
    8288
    8389    echo '<div class="widget-text wp_widget_plugin_box">';
     90
     91      if ( $message ) {
     92        echo '<div>' . $message . '</div>';
     93      }
    8494
    8595      if ( $html ) {
Note: See TracChangeset for help on using the changeset viewer.