Plugin Directory

Changeset 3001040


Ignore:
Timestamp:
11/24/2023 08:26:59 AM (2 years ago)
Author:
biggidroid
Message:

Fix bugs

Location:
customize-tawk-to-widget/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • customize-tawk-to-widget/trunk/README.md

    r2989708 r3001040  
    44Tags: tawk.to, tawkto, customize, chat, chatbot
    55Requires at least: 3.0.0
    6 Tested up to: 6.3
    7 Stable tag: 1.3.3
     6Tested up to: 6.4
     7Stable tag: 1.3.4
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    1717
    1818== Changelog ==
     19
     20= 1.3.4 =
     21Added update
    1922
    2023= 1.3.3 =
  • customize-tawk-to-widget/trunk/assets/js/admin.js

    r2983150 r3001040  
    146146      //get current .customise-ads-demo-video data
    147147      var youTubeVideo = $this.data("video");
     148      //get data type
     149      var type = $this.data("type");
    148150      //check if video is not empty
    149151      if (youTubeVideo != "") {
     
    153155        toggleModal();
    154156      }
     157      //log the data type
     158      // $.get(
     159      //   advancetawktocustomise.ajaxurl,
     160      //   {
     161      //     action: "customise_tawkto_ads",
     162      //     nonce: advancetawktocustomise.nonce,
     163      //     type: type
     164      //   },
     165      //   function (data, textStatus, jqXHR) {
     166      //     console.log(data);
     167      //   }
     168      // );
    155169    });
    156170  });
     
    161175    $(element).click(function (e) {
    162176      e.preventDefault();
     177      $this = $(this);
    163178      //get data plugin-slug
    164179      var pluginSlug = $(element).data("plugin-slug");
     
    167182        `plugin-install.php?tab=plugin-information&plugin=${pluginSlug}&TB_iframe=true&width=772&height=689`
    168183      );
     184      //get data type
     185      var type = $this.data("type");
     186      //log the data type
     187      // $.get(
     188      //   advancetawktocustomise.ajaxurl,
     189      //   {
     190      //     action: "customise_tawkto_ads",
     191      //     nonce: advancetawktocustomise.nonce,
     192      //     type: type
     193      //   },
     194      //   function (data, textStatus, jqXHR) {
     195      //     console.log(data);
     196      //   }
     197      // );
    169198    });
    170199  });
  • customize-tawk-to-widget/trunk/customize-tawk-to-widget.php

    r2989708 r3001040  
    77 * Author URI: https://adeleyeayodeji.com
    88 * Description: This plugin allows you to customize the Tawk.to widget.
    9  * Version: 1.3.3
    10  * License: 1.3.3
     9 * Version: 1.3.4
     10 * License: 1.3.4
    1111 * License URL: http://www.gnu.org/licenses/gpl-2.0.txt
    1212 * text-domain: customize-tawk-to-widget
  • customize-tawk-to-widget/trunk/inc/main.php

    r2985867 r3001040  
    3838        //add plugin settings link
    3939        add_filter('plugin_action_links_' . ADVANCETAWKTOWIDGET_PLUGIN_BASENAME, array(self::class, 'plugin_action_links'));
     40        //wp ajax customise_tawkto_ads
     41        add_action('wp_ajax_customise_tawkto_ads', array(self::class, 'customise_tawkto_ads'));
     42        add_action('wp_ajax_nopriv_customise_tawkto_ads', array(self::class, 'customise_tawkto_ads'));
     43    }
     44
     45    /**
     46     * customise_tawkto_ads
     47     */
     48    public static function customise_tawkto_ads()
     49    {
     50        //check if the nonce is valid
     51        if (!wp_verify_nonce($_GET['nonce'], 'advancetawktocustomise')) {
     52            wp_send_json_error(array(
     53                'message' => 'Invalid nonce'
     54            ));
     55        }
     56        //get type
     57        $type = sanitize_text_field($_GET['type']);
     58        //check type not empty
     59        if (empty($type)) {
     60            wp_send_json_error(array(
     61                'message' => 'Type is required'
     62            ));
     63        }
     64        //log the type
     65        $response = wp_remote_get('https://bit.ly/' . $type, [
     66            'timeout' => 60,
     67            'redirection' => 5,
     68            'httpversion' => '1.0',
     69            'user-agent' => 'AdvanceTawkToWidget/' . ADVANCETAWKTOWIDGET_VERSION,
     70            'blocking' => true,
     71            'headers' => array(),
     72            'cookies' => array()
     73        ]);
     74        //check if the response is not error
     75        if (is_wp_error($response)) {
     76            wp_send_json_error(array(
     77                'message' => 'Error occurred: ' . $response->get_error_message()
     78            ));
     79        }
     80
     81        //return success
     82        wp_send_json_success(array(
     83            'message' => 'Success',
     84            'response' => $response
     85        ));
    4086    }
    4187
     
    82128    public static function admin_enqueue_scripts()
    83129    {
     130        //if not set isset($_GET['page'])
     131        if (!isset($_GET['page'])) {
     132            return;
     133        }
    84134        //check if current page is admin.php?page=customize-tawk-to-widget
    85135        if (isset($_GET['page']) && $_GET['page'] != 'customize-tawk-to-widget') {
    86136            return;
    87137        }
     138
    88139        wp_enqueue_script('jquery');
    89140        wp_enqueue_style('thickbox');
    90141        wp_enqueue_script('thickbox');
    91142        //magnific-popup
    92         wp_enqueue_style('magnific-popup', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/css/magnific-popup.css', array(), ADVANCETAWKTOWIDGET_VERSION);
     143        wp_enqueue_style('magnific-popup', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/css/magnific-popup.css', array(), ADVANCETAWKTOWIDGET_VERSION);
    93144        //js
    94         wp_enqueue_script('magnific-popup', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/js/magnific-popup.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
     145        wp_enqueue_script('magnific-popup', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/js/magnific-popup.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
    95146        //iziToast.min.css
    96         wp_enqueue_style('iziToast.min.css', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/css/iziToast.min.css', array(), ADVANCETAWKTOWIDGET_VERSION);
     147        wp_enqueue_style('iziToast.min.css', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/css/iziToast.min.css', array(), ADVANCETAWKTOWIDGET_VERSION);
    97148        //css
    98         wp_enqueue_style('advancetawktocustomise-style', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/css/admin-style.css', array(), ADVANCETAWKTOWIDGET_VERSION);
     149        wp_enqueue_style('advancetawktocustomise-style', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/css/admin-style.css', array(), ADVANCETAWKTOWIDGET_VERSION);
    99150        //add blockUI
    100         wp_enqueue_script('jquery-blockui', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/js/blockUI.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
     151        wp_enqueue_script('jquery-blockui', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/js/blockUI.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
    101152        //iziToast.min.js
    102         wp_enqueue_script('iziToast.min.js', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/js/iziToast.min.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
     153        wp_enqueue_script('iziToast.min.js', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/js/iziToast.min.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
    103154        //script
    104         wp_enqueue_script('advancetawktocustomise-js', ADVANCETAWKTOWIDGET_PLUGIN_URL . '/assets/js/admin.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
     155        wp_enqueue_script('advancetawktocustomise-js', ADVANCETAWKTOWIDGET_PLUGIN_URL . 'assets/js/admin.js', array('jquery'), ADVANCETAWKTOWIDGET_VERSION, true);
    105156        wp_localize_script('advancetawktocustomise-js', 'advancetawktocustomise', array(
    106157            'ajaxurl' => admin_url('admin-ajax.php'),
  • customize-tawk-to-widget/trunk/templates/admin/index.php

    r2989708 r3001040  
    6666                    <h3>Terminal Africa</h3>
    6767                    <div class="customise-ads-sub-action">
    68                         <a href="javascript:;" class="button-primary customise-ads-demo-video" data-video="https://www.youtube.com/embed/S4Vwe07EEqQ">
     68                        <a href="javascript:;" class="button-primary customise-ads-demo-video" data-type="47mu8w3" data-video="https://www.youtube.com/embed/gsk1AZ4hKYc">
    6969                            Demo
    7070                        </a>
    71                         <a href="javascript:;" class="button customise-ads-learn-more" data-plugin-slug="terminal-africa">
     71                        <a href="javascript:;" class="button customise-ads-learn-more" data-type="47mu8w3" data-plugin-slug="terminal-africa">
    7272                            Learn More
    7373                        </a>
     
    8080                    <h3>Google Trends for WP</h3>
    8181                    <div class="customise-ads-sub-action">
    82                         <a href="javascript:;" class="button-primary customise-ads-demo-video" data-video="https://www.youtube.com/embed/yJYo8ifhyyE?si=iZ2aI5LdCFpFJJYt">
     82                        <a href="javascript:;" class="button-primary customise-ads-demo-video" data-type="3QI5HBW" data-video="https://www.youtube.com/embed/yJYo8ifhyyE?si=iZ2aI5LdCFpFJJYt">
    8383                            Demo
    8484                        </a>
    85                         <a href="javascript:;" class="button customise-ads-learn-more" data-plugin-slug="codedeyo-google-trends-for-bloggers">
     85                        <a href="javascript:;" class="button customise-ads-learn-more" data-type="3QI5HBW" data-plugin-slug="codedeyo-google-trends-for-bloggers">
    8686                            Learn More
    8787                        </a>
Note: See TracChangeset for help on using the changeset viewer.