I am getting this error in my php-fpm error log, and I was hoping one of you could show me how to fix my code. Here's the error:
PHP message: PHP Warning: Missing argument 1 for is_mx_handler::is_mx_handler(), called in /var/www/epiclasers.com/wp-content/plugins/devs-is-mx/devs-is-mx.php on line 37 and defined in /var/www/epiclasers.com/wp-content/plugins/devs-is-mx/devs-is-mx.php on line 16"
and here's my plugin PHP code:
<?php
/*
Plugin Name: Dev's is MX ShortCodes
Description: If / Then shortcodes
Author: Devin Fleenor
Version: 1.0.0
*/
class is_mx_handler {
function generic_handler ($atts, $content, $condition, $elsecode) {
list ($if, $else) = explode ($elsecode, $content, 2);
return do_shortcode($condition ? $if : $else);
}
function is_mx_handler ($atts, $content="") {
$ip = $_SERVER['REMOTE_ADDR'];
global $quick_flag;
if(isset($quick_flag) && is_object($quick_flag)){
if(($info = $quick_flag->get_info($ip)) != false){
$code = $info->code; // Country code: MX
$name = $info->name; // Country name: Mexico
$latitude = $info->latitude; // Country latitude (float): 45.1667
$longitude = $info->longitude; // Country longitude (float): 15.5
}
}
if ($code == "MX") $ismx = "true";
return $this->generic_handler ($atts, $content, isset($ismx), '[not_mx]');
}
}
$is_mx_handler = new is_mx_handler;
add_shortcode('is_mx', array($is_mx_handler, 'is_mx_handler'));
?>
is_mx_handler. Try getting rid of$content=""; you can pass that as part of$attsinstead.