Plugin Directory

Changeset 1958169


Ignore:
Timestamp:
10/17/2018 04:10:47 PM (7 years ago)
Author:
thrivehive
Message:

v2.51

Location:
thrivehive/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • thrivehive/trunk/README.md

    r1957751 r1958169  
    107107
    108108## Changelog
     109* V 2.51 Added Thrivehive Wysiwyg Button widget
    109110* V 2.5 Added Wysiwyg button functionality
    110111* V 2.301 Remove slashes and ensure correct character encoding for saved CSS
  • thrivehive/trunk/scripts/production_deployment.sh

    r1953286 r1958169  
    2424      git checkout master
    2525      git pull
    26       zip -r /tmp/thrivehive.zip .. -x "*scripts*" -x "*.git*" -x "*.circleci*" -x "*.vscode*" -x "*tests*" -x "*.DS_Store*"
     26      zip -r /tmp/thrivehive.zip . -x "*scripts*" -x "*.git*" -x "*.circleci*" -x "*.vscode*" -x "*tests*" -x "*.DS_Store*"
    2727      for c in customers customers2 customers3 customers4; do
    2828        server="${c}.thrivehivesite.com"
  • thrivehive/trunk/thrivehive.php

    r1957751 r1958169  
    55   *Plugin URI: http://thrivehive.com
    66   *Description: A plugin to include ThriveHive's tracking code
    7    *Version: 2.5
     7   *Version: 2.51
    88   *Author: ThriveHive
    99   *Author URI: http://thrivehive.com
     
    110110  register_widget('ThriveHiveLogo');
    111111  register_widget('ThriveHiveButton');
     112  register_widget('ThriveHiveWysiwygButton');
    112113  register_widget('ThriveHiveSocialButtons');
    113114  register_widget('ThriveHivePhone');
     
    983984    echo $before_widget;
    984985      $buttonId = empty($instance['buttonId']) ? ' ' : $instance['buttonId'];
    985       if (!empty($buttonId))
     986      if (!empty($buttonId)) {
     987        $buttonId = '1';
     988      }
    986989      $buttonOptions = get_thrivehive_button( $buttonId );
    987990      $css =  stripslashes($buttonOptions['generated_css']);
     
    993996
    994997      echo $after_widget;
     998  }
     999  /**
     1000   * Back-end widget form.
     1001   *
     1002   * @see WP_Widget::form()
     1003   *
     1004   * @param array $instance Previously saved values from database.
     1005   */
     1006   public function form( $instance ) {
     1007    // outputs the options form on admin
     1008    $defaults = array( 'buttonId' => '1' );
     1009    $instance = wp_parse_args( $instance, $defaults );
     1010      $buttonId = $instance['buttonId'];
     1011  ?>
     1012    <p><label for="<?php echo $this->get_field_id('buttonId'); ?>">Button ID: <input class="widefat" id="<?php echo $this->get_field_id('buttonId'); ?>" name="<?php echo $this->get_field_name('buttonId'); ?>" type="text" value="<?php echo attribute_escape($buttonId); ?>" /></label></p>
     1013  <?php
     1014    }
     1015  /**
     1016   * Sanitize widget form values as they are saved.
     1017   *
     1018   * @see WP_Widget::update()
     1019   *
     1020   * @param array $new_instance Values just sent to be saved.
     1021   * @param array $old_instance Previously saved values from database.
     1022   *
     1023   * @return array Updated safe values to be saved.
     1024   */
     1025  public function update( $new_instance, $old_instance ) {
     1026    // processes widget options to be saved
     1027    $instance = $old_instance;
     1028    $instance['buttonId'] = ( ! empty( $new_instance['buttonId'] ) ) ? strip_tags( $new_instance['buttonId'] ) : '';
     1029    return $instance;
     1030  }
     1031
     1032}
     1033
     1034/*****************************************************************************
     1035// Wysiwyg Button Widget
     1036*/
     1037
     1038class ThriveHiveWysiwygButton extends WP_Widget {
     1039
     1040  /**
     1041   * Register widget with WordPress.
     1042   */
     1043  public function __construct() {
     1044    parent::__construct(
     1045      'th_wysiwyg_button_widget', // Base ID
     1046      'ThriveHive Wysiwyg Button', // Name
     1047      array( 'description' => __( 'Displays a wysiwyg button in the widget area', 'text_domain' ), ));// Args
     1048  }
     1049  /**
     1050   * Register widget with WordPress.
     1051   */
     1052  public function widget( $args, $instance ) {
     1053
     1054    echo $before_widget;
     1055    $buttonId = empty($instance['buttonId']) ? ' ' : $instance['buttonId'];
     1056    if (!empty($buttonId)) {
     1057      $buttonId = '1';
     1058    }
     1059    $buttonOptions = get_wysiwyg_button( $buttonId );
     1060    $text = stripslashes($buttonOptions['text']);
     1061    $url = stripslashes($buttonOptions['url']);
     1062    $target = stripslashes($buttonOptions['target']);
     1063    $classes =  stripslashes($buttonOptions['classes']);
     1064
     1065    echo "<a class='$classes' target='$target' href='$url'>$text</a>";
     1066
     1067    echo $after_widget;
    9951068  }
    9961069  /**
Note: See TracChangeset for help on using the changeset viewer.