🔞 ADULT: Changeset/ - Complete Album!

Changeset 884545


Ignore:
Timestamp:
03/30/2014 09:42:11 AM (12 years ago)
Author:
aniketpant
Message:

Remove old assets and use same logic as im-embed

Location:
instamojo/trunk
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • instamojo/trunk/widget.php

    r884496 r884545  
    4848  function widget($args, $instance)
    4949  {
    50     wp_register_style('widgetcss', plugin_dir_url(__FILE__).'assets/css/imojo.css');
    51     wp_enqueue_style('widgetcss');
     50    wp_register_script('widgetjs', 'https://d2xwmjc4uy2hr5.cloudfront.net/im-embed/im-embed.min.js', 'jquery', null, true);
     51    wp_enqueue_script('widgetjs');
    5252
    5353    $instamojo_credentials = get_option('instamojo_credentials');
     
    6969    }
    7070
    71     $button_html = '<div class="btn-container"><a href="https://www.instamojo.com/'.$instamojo_credentials['username'].'/'.$instance['instamojo_offer'].'" ';
    72     if ($instance['button_style'] != 'none') {
    73       $button_html .= 'class="im-checkout-btn btn--'.$instance['button_style'].'" ';
    74     }
    75     $button_html .= 'target="_blank">Buy Now</a></div>';
     71    $button_html = '<a href="https://www.instamojo.com/'.$instamojo_credentials['username'].'/'.$instance['instamojo_offer'].'/" rel="im-checkout" data-style="'.$instance['button_style'].'" data-text="'.$instance['button_text'].'"></a>';
    7672    echo $button_html;
    7773    echo $after_widget;
     
    8480  function update($new_instance, $old_instance)
    8581  {
    86     $instance = $old_instance;
     82    $instance = $new_instance;
    8783    return $instance;
    8884  }
     
    9490  function form($instance)
    9591  {
    96     $defaults = array('title' => '', 'instamojo_offer' => '', 'button_style' => 'none');
     92    $defaults = array('title' => '', 'button_text' => 'Checkout with Instamojo', 'instamojo_offer' => '', 'button_style' => 'none');
    9793    $instance = wp_parse_args((array)$instance, $defaults);
    9894
     
    117113          name="<?php echo $this->get_field_name('title');?>"
    118114          value="<?php echo $instance['title'];?>" />
     115      </p>
     116      <p>
     117        <label for="<?php echo $this->get_field_id('button_text');?>">Button Text:</label>
     118        <input class="widefat" id="<?php echo $this->get_field_id('button_text');?>"
     119          name="<?php echo $this->get_field_name('button_text');?>"
     120          value="<?php echo $instance['button_text'];?>" />
    119121      </p>
    120122      <p>
Note: See TracChangeset for help on using the changeset viewer.