Plugin Directory

Changeset 2427279


Ignore:
Timestamp:
11/27/2020 01:10:32 PM (5 years ago)
Author:
hiren1612
Message:

Bugs solved and functionality updated.

Location:
hb-freshdesk/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • hb-freshdesk/trunk/admin-settings.php

    r2082036 r2427279  
    112112            echo "0";
    113113        }else {
    114           echo "1";
     114            echo "1";
    115115        }
    116116        exit();
     
    131131
    132132        if( $use_apikey == "api" ){
    133 
    134133                $apikey = ( $freshdesk_apikey != '' ) ? $freshdesk_apikey : '';
    135134                $password = "";
     
    142141
    143142        if($method == "POST") {
    144                
    145143            $response = wp_remote_post( $urltopost, array(
    146                     'method' => 'POST',
    147                     'headers' => array( 'Authorization' => 'Basic ' . base64_encode( $apikey . ':' . $password ),
    148                                         'Content-Type' => 'application/json; charset=utf-8'),
    149                     'body' => $data
    150                     )
    151                   );
    152         }
    153        
    154         $args = array(
    155             'headers' => array(
    156                 'Authorization' => 'Basic ' . base64_encode( $apikey . ':' . $password )
    157               )
    158         );
    159 
    160         $response = wp_remote_get( $urltopost, $args );
    161        
    162        
     144                    'method' => 'POST',
     145                    'headers' => array(
     146                        'Authorization' => 'Basic ' . base64_encode( $apikey . ':' . $password ),
     147                    'Content-Type' => 'application/json; charset=utf-8'),
     148                    'body' => $data             
     149                )
     150            );
     151        }else{       
     152            $args = array(
     153                'headers' => array(
     154                    'Authorization' => 'Basic ' . base64_encode( $apikey . ':' . $password )
     155                  )
     156            );     
     157            $response = wp_remote_get( $urltopost, $args );
     158        }
    163159        return $response;
    164160        exit();
     
    178174
    179175        global $wpdb;
    180     $table = $wpdb->prefix . 'freshdesk';
     176        $table = $wpdb->prefix . 'freshdesk';
    181177
    182178        $AllArticleData = $wpdb->get_results( "SELECT * FROM ". $table ."" );
     
    390386   
    391387    function CreateNewTicket() {
    392 
    393388        $data = json_encode($_POST['data_arr'],JSON_NUMERIC_CHECK);
    394      
    395389        $new_ticket_url = "tickets";
    396         $this->curl_api_function($new_ticket_url, "POST", $data);
     390        $results = $this->curl_api_function($new_ticket_url, "POST", $data);
    397391        $TicketData = $this->curl_api_function($new_ticket_url);
     392        $response = isset($results['response']['code']) ? $results['response']['code'] : '0';
     393        echo $response;
    398394        exit();
    399395    }
  • hb-freshdesk/trunk/create_ticket.php

    r2082036 r2427279  
    88        <div class="content-warp">
    99            <form>
     10                <div class="ticket-response" style="display: none;">
     11                </div>
    1012                <div class="ticket-field-row">
    1113                    <div class="main-row">
     
    3840                            <div class="ticket-field-label">
    3941                                <select class="form-control" id="ticket_type">
    40                                     <option value="null">--</option>
    41                                     <option value="Question">Question</option>
     42                                    <option value="Question">Question</option>
    4243                                    <option value="Incident">Incident</option>
    4344                                    <option value="Problem">Problem</option>
  • hb-freshdesk/trunk/css/fd-style.css

    r2082036 r2427279  
    232232    padding-bottom: 10px;
    233233}
    234 
    235 
    236234.ticket_heading {
    237235    font-size: 18px;
     
    242240    padding-left: 15px;
    243241}
     242.ticket-response {
     243    width: 80%;
     244    padding: 10px;
     245}
     246
    244247/*# sourceMappingURL=sourcemap/fd-style.css.map */
    245248
  • hb-freshdesk/trunk/faq_page.php

    r2082036 r2427279  
    22    <h1 class="page-heading"> FreshDesk Faq </h1>
    33    <?php
    4       include_once('admin-settings.php');
     4        include_once('admin-settings.php');
    55        $FreshDeskSettingsPage = new FreshDeskSettingsPage();
    66     
  • hb-freshdesk/trunk/freshdesk.php

    r2404532 r2427279  
    33 Plugin Name:HB Freshdesk
    44 Description: This plugin is used for connect your FreshDesk account in your wordpress site. You can easily to get your FreshDesk FAQs and Ticket, And also create a new ticket in your FreshDesk account directly using this plugin, And also check your ticket conversation.
    5  Version: 3.2
     5 Version: 3.3
    66 Author: Hiren Patel ,Hike Branding
    77 Author URI: https://www.hikebranding.com/
  • hb-freshdesk/trunk/get_all_ticket.php

    r2082036 r2427279  
    77include_once('admin-settings.php');
    88
    9 
    10 
    119    $FreshDeskSettingsPage = new FreshDeskSettingsPage();
    12 
    13 
    1410
    1511    $all_ticket_url = "tickets";
     
    1915    $GetAllTicket = $FreshDeskSettingsPage->curl_api_function($all_ticket_url);
    2016
    21 
    22 
    2317    $siteUrl = get_permalink();
    2418
    2519    $get_ticket_id = filter_var($_GET['ticket_id'], FILTER_SANITIZE_STRING);
    2620
    27     $ticket_data = isset($get_ticket_id) ? $get_ticket_id : '';
    28 
    29    
     21    $ticket_data = isset($get_ticket_id) ? $get_ticket_id : '';   
    3022
    3123    if(isset($ticket_data) && !empty($ticket_data)) {
     
    3830
    3931    }
    40 
    41    
    42 
    4332?>
    4433
     
    4837
    4938        <?php if(isset($TicketData) && !empty($TicketData)) {
    50 
     39            if(isset($TicketData['response']['code']) && $TicketData['response']['code'] == 200){
    5140            $TicketData_array = json_decode($TicketData['body'], true);
    5241
     
    155144                </div>
    156145
    157                
     146            <?php } ?>
    158147
    159148        <?php } else {
    160149
    161                $GetAllTicket_Array = json_decode($GetAllTicket['body'], true);
     150            $GetAllTicket_Array = json_decode($GetAllTicket['body'], true);
    162151
    163                
    164 
     152            if($GetAllTicket_Array['code'] != "invalid_credentials"){
     153               
    165154            foreach ($GetAllTicket_Array as $_GetAllTicket) { ?>
    166155
     
    173162            </div>
    174163
    175         <?php } } ?>
     164        <?php } } } ?>
    176165
    177166    </div>
  • hb-freshdesk/trunk/js/fd-script-frontend.js

    r2082036 r2427279  
    1414 /// Create a New ticket ///
    1515    function create_ticket() {
    16        
     16        jQuery(".ticket-response").hide();
     17       
    1718        var email = jQuery('#email').val();   
    1819        var subject = jQuery('#subject').val();
     
    2122        var ticket_status = 2;   
    2223        var ticket_priority = jQuery('#ticket_priority').val();
    23 //        var assign_to = jQuery('#assign_to').val();
    2424        var description = jQuery('#description').val();
    2525       
     
    3535        };
    3636        jQuery.post(hb_ajax_object.ajax_url, data, function(data){
    37           location.reload();   
     37            if(data == 400){
     38                jQuery(".ticket-response").empty();
     39                jQuery(".ticket-response").show();
     40                jQuery(".ticket-response").css("border", "1px solid #ff0000");
     41                jQuery(".ticket-response").append("<span style='color: #ff0000  ;'><b>Error:</b> Please enter a valid Email address.</span>");
     42            }else if(data == 201){
     43                jQuery('#email').val("");
     44                jQuery('#subject').val("");
     45                jQuery('#description').val("");
     46               
     47                jQuery(".ticket-response").empty();
     48                jQuery(".ticket-response").show();
     49                jQuery(".ticket-response").css("border", "1px solid #28a745");
     50                jQuery(".ticket-response").append("<span style='color: #28a745;'> Your ticket has been created.</span>");
     51            }else{
     52                location.reload();
     53            }
    3854        });   
    3955    }
     
    4258    jQuery( document ).ready(function() {
    4359        var data = {
    44                         action: 'ajaxDataSave',
    45                         data:{}
    46                     };
    47           jQuery.post(hb_ajax_object.ajax_url, data, function(data){
    48 //          location.reload();   
     60            action: 'ajaxDataSave',
     61            data:{}
     62        };
     63        jQuery.post(hb_ajax_object.ajax_url, data, function(data){
     64            //location.reload();   
    4965        });
    5066    });
  • hb-freshdesk/trunk/js/fd-script.js

    r2082036 r2427279  
    3131           
    3232            if(data == "0") {
    33                  jQuery("#message").text("invalid credentials!").css("color","red");
     33                 jQuery("#message").text("Invalid credentials!").css("color","red");
    3434            } else if (data == "1") {
    3535                jQuery("#message").text("Connection successfully established in your Freshdesk account !").css("color","green");
  • hb-freshdesk/trunk/readme.txt

    r2424622 r2427279  
    55Requires at least: 4.1
    66Tested up to: 5.6
    7 Stable tag: 3.2
     7Stable tag: 3.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 A plugin Get your Fresh desk account FAQ's and Crete a new Ticket and view your All ticket with full conversation. 
     11A plugin Get your Freshdesk account FAQ's and Create a new Ticket and view your All ticket with full conversation. 
    1212
    1313== Description ==
Note: See TracChangeset for help on using the changeset viewer.