Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/popup-ma.../trunk/classes
File: Ajax.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* AJAX Initialization & Helper Functions
[2] Fix | Delete
*
[3] Fix | Delete
* @since 1.4
[4] Fix | Delete
* @package PUM
[5] Fix | Delete
* @subpackage PUM/includes
[6] Fix | Delete
* @author Daniel Iser <danieliser@wizardinternetsolutions.com>
[7] Fix | Delete
* @copyright Copyright (c) 2023, Code Atlantic LLC
[8] Fix | Delete
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
[12] Fix | Delete
// Exit if accessed directly
[13] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[14] Fix | Delete
exit;
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Controls the basic analytics methods for Popup Maker
[19] Fix | Delete
*/
[20] Fix | Delete
class PUM_Ajax {
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Creates and returns a 1x1 tracking gif to the browser.
[24] Fix | Delete
*/
[25] Fix | Delete
public static function serve_pixel() {
[26] Fix | Delete
$gif = self::get_file( POPMAKE_DIR . 'assets/images/beacon.gif' );
[27] Fix | Delete
header( 'Content-Type: image/gif' );
[28] Fix | Delete
header( 'Content-Length: ' . strlen( $gif ) );
[29] Fix | Delete
exit( $gif );
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public static function get_file( $path ) {
[33] Fix | Delete
[34] Fix | Delete
if ( function_exists( 'realpath' ) ) {
[35] Fix | Delete
$path = realpath( $path );
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
if ( ! $path || ! @is_file( $path ) ) {
[39] Fix | Delete
return '';
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
return @file_get_contents( $path );
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Returns a 204 no content header.
[47] Fix | Delete
*/
[48] Fix | Delete
public static function serve_no_content() {
[49] Fix | Delete
header( 'HTTP/1.0 204 No Content' );
[50] Fix | Delete
header( 'Content-Type: image/gif' );
[51] Fix | Delete
header( 'Content-Length: 0' );
[52] Fix | Delete
exit;
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Serves a proper json response.
[57] Fix | Delete
*
[58] Fix | Delete
* @param mixed $data
[59] Fix | Delete
*/
[60] Fix | Delete
public static function serve_json( $data = 0 ) {
[61] Fix | Delete
header( 'Content-Type: application/json' );
[62] Fix | Delete
echo PUM_Utils_Array::safe_json_encode( $data );
[63] Fix | Delete
exit;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function