Plugin Directory

Changeset 2143202


Ignore:
Timestamp:
08/21/2019 02:33:11 PM (7 years ago)
Author:
118group
Message:

V 1.3 Endpoit for access log added

Location:
team-118group-agent/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • team-118group-agent/trunk/modules/hooks.php

    r2130319 r2143202  
    7272}
    7373
     74
     75add_action('rest_api_init', function () {
     76  register_rest_route( 'alog/v1', 'date/(?P<date>[a-zA-Z0-9-]+)',array(
     77                'methods'  => 'GET',
     78                'callback' => 'wtgaf_get_alog_info'
     79      ));
     80});
     81
     82function wtgaf_get_alog_info($request) {
     83    global $wpdb;
     84 
     85    $date = sanitize_text_field( str_replace('-', '/', $request['date'] ) );   
     86 
     87    $timestamp = strtotime( $date );
     88 
     89    $date_start = $timestamp;
     90    $date_end= $timestamp + ( 24*60*60 ) - 1;
     91 
     92 
     93    $results = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->prefix}wsal_occurrences WHERE `created_on` BETWEEN %d AND %d", $date_start, $date_end ) );
     94 
     95    if( count( $results ) > 0 ){
     96        $out_data = array();
     97        foreach( $results as $s_result ){
     98            $results_meta = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->prefix}wsal_metadata WHERE  occurrence_id = %d", $s_result->id ) );
     99            $s_result->meta = $results_meta;
     100            $out_data[] = (array)$s_result;
     101        }
     102   
     103        $response = new WP_REST_Response( $out_data );
     104        $response->set_status(200);
     105
     106        return $response;
     107       
     108    }else{
     109        $out_data = array(
     110            'status' => 'error',
     111            'message' => 'No entried found'
     112        );
     113        $response = new WP_REST_Response( $out_data );
     114        $response->set_status(404);
     115
     116        return $response;
     117    }
     118 
     119   
     120 
     121    #########
     122 
     123     
     124 
     125 
     126   
     127   
     128}
     129
     130
    74131?>
  • team-118group-agent/trunk/readme.txt

    r2130325 r2143202  
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
    9 Stable tag: 1.2
    10 Version: 1.2
     9Stable tag: 1.3
     10Version: 1.3
    1111
    1212Outputs Gravity Form Entries into JSON
  • team-118group-agent/trunk/wp-tga-filter.php

    r2130325 r2143202  
    33Plugin Name: Team 118GROUP Agent
    44Description: Team 118GROUP Web Design Plugin to assist with monitoring your WordPress installation and assisting with system care
    5 Version: 1.2
     5Version: 1.3
    66Author: Team118GROUP
    77Author URI: http://www.118group.com
    8 Stable tag: 1.2
     8Stable tag: 1.3
    99*/
    1010
     
    1212//ini_set('display_errors', 'On');
    1313
     14
     15 
    1416
    1517// core initiation
Note: See TracChangeset for help on using the changeset viewer.