Plugin Directory

Changeset 1911694


Ignore:
Timestamp:
07/19/2018 02:10:53 PM (8 years ago)
Author:
smshivamsm
Message:

Add Post view functionality

Location:
davsy/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • davsy/trunk/assets/js/wp_davsy_front.js

    r1911588 r1911694  
    11jQuery(document).ready(function(e){
     2   jQuery('.wp_davsy_link').click(function(){
     3           var href =jQuery(this).attr('data-href');
     4       window.open(href,'_blank');
     5        });
    26
    3    jQuery('.wp_davsy_link').click(function(){
    4      
    5        var href =jQuery(this).attr('data-href');
    6        window.open(href,'_blank');
    7      
    8     });
    9    
    107});
  • davsy/trunk/davsy.php

    r1911485 r1911694  
    238238            //print_r($app_data);
    239239        if(!empty($app_data['result']) && is_array($app_data['result'])){
    240            
    241         $davsy_obj .="<div class='davsy-main-widget'>";
     240            $coloClass='davsy-col-'.$no_post;
     241        $davsy_obj .="<div class='davsy-main-widget $coloClass'>";
    242242        $davsy_obj .= "<h2>".$davsy_header_title."</h2>";
    243243        $davsy_obj .="<ul class='davsy-widget'>";
    244244        $i=1;
    245245        foreach($app_data['result'] as $key=>$widget_value){
     246            $pids[]=$widget_value->id;
    246247            $widget_img=$widget_value->blog_post_image;
    247248            $widget_link=$widget_value->blog_post_url;
     
    254255            $i++;
    255256        }
     257        Wp_Davsy_API::updateDavsyPostsviewCount(json_encode($pids));
    256258        $davsy_obj .= "</ul>";
    257259        $davsy_obj .= "</div>";
  • davsy/trunk/includes/class-davsy-widget.php

    r1911485 r1911694  
    3737         $davsy_header_title=$instance['header'];
    3838         $davsy_api_key=trim( get_option('davsy_api_key') );
    39          
     39       
    4040       
    4141        $no_post=isset($no_post)?$no_post:'1';
     
    5151        echo "<ul class='davsy-widget'>";
    5252        $i=1;
     53       
    5354        foreach($app_data['result'] as $key=>$widget_value){
     55            $pids[]=$widget_value->id;
    5456            $widget_img=$widget_value->blog_post_image;
    5557            $widget_link=$widget_value->blog_post_url;
     
    6264            $i++;
    6365        }
     66       
     67        Wp_Davsy_API::updateDavsyPostsviewCount(json_encode($pids));
    6468        echo "</ul>";
    6569        echo "</div>";
     
    118122        return $instance;
    119123    }
    120    
    121    
    122124
    123125}
  • davsy/trunk/includes/class-wp-davsy-api.php

    r1911485 r1911694  
    3838
    3939    }
     40   
     41    public static function updateDavsyPostsviewCount($requestJson) {
     42        $postUrl = 'http://app.davsy.com/views_update';
     43        $ch = curl_init();
     44        curl_setopt($ch, CURLOPT_URL,$postUrl);
     45        curl_setopt($ch, CURLOPT_POST, 1);
     46        curl_setopt($ch, CURLOPT_POSTFIELDS,
     47        "pids=".$requestJson);
     48        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     49        $response = curl_exec ($ch);
     50        curl_close ($ch);
     51        return $response;
     52    }
    4053
    4154}
Note: See TracChangeset for help on using the changeset viewer.