LLMS_Tracker::send_data( boolean $force = false )
Send data home
Parameters Parameters
- $force
-
(boolean) (Optional) force a send regardless or the last send time
Default value: false
Return Return
(void)
Source Source
File: includes/class.llms.tracker.php
public static function send_data( $force = false ) { // Don't trigger during AJAX Requests. if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { return; } // Allow forcing of the send despite the interval. if ( ! $force && ! apply_filters( 'llms_tracker_force_send', false ) ) { // Only send data once a week. $last_send = self::get_last_send_time(); if ( $last_send && $last_send > apply_filters( 'llms_tracker_send_interval', strtotime( '-1 week' ) ) ) { return; } } // Record a last send time. update_option( 'llms_tracker_last_send_time', time() ); $r = wp_remote_post( self::API_URL, array( 'body' => array( 'data' => json_encode( LLMS_Data::get_data( 'tracker' ) ), ), 'cookies' => array(), 'headers' => array( 'user-agent' => 'LifterLMS_Tracker/' . md5( esc_url( home_url( '/' ) ) ) . ';', ), 'method' => 'POST', 'redirection' => 5, 'timeout' => 60, ) ); if ( ! is_wp_error( $r ) ) { return json_decode( $r['body'], true ); } else { return $r; } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |