EventON 2.1.8 & Call to undefined function date_parse_from_format()

Published on: May 2,2013

EventON version 2.1.8 is now available for download via Envato and direct from your website with activated license. It seems most of you have been experiencing this error when saving new events.

[code]

Fatal error: Call to undefined function date_parse_from_format() in
**/wp-content/plugins/eventON/eventon-core-functions.php on line 240

[/code]

 

Reason for the error

This function requires you to run PHP version 5.3 or higher on your web hosting server and that is why you are getting this error.

 

Solution

I have been working on creating a workaround this error and I am happy to tell you that I have a working solution that you can use for the moment until the next EventON update. I am sure you are probably tired or having to update the plugin as much as you had to in the past few weeks due to the small bugs – my sincere apologies about this.

 

Please copy the below code and paste it in the functions.php file in your theme and that will take care of the event saving error.

[code]

if(!function_exists(‘date_parse_from_format’)){
function date_parse_from_format($_wp_format, $date){

$date_pcs = preg_split(‘/ (?!.* )/’,$_wp_format);
$time_pcs = preg_split(‘/ (?!.* )/’,$date);

$_wp_date_str = preg_split(“/[\s . , \: \- \/ ]/”,$date_pcs[0]);
$_ev_date_str = preg_split(“/[\s . , \: \- \/ ]/”,$time_pcs[0]);

$check_array = array(
‘Y’=>’year’,
‘y’=>’year’,
‘m’=>’month’,
‘n’=>’month’,
‘M’=>’month’,
‘F’=>’month’,
‘d’=>’day’,
‘j’=>’day’,
‘D’=>’day’,
‘l’=>’day’,
);

foreach($_wp_date_str as $strk=>$str){

if($str==’M’ || $str==’F’ ){
$str_value = date(‘n’, strtotime($_ev_date_str[$strk]));
}else{
$str_value=$_ev_date_str[$strk];
}

if(!empty($str) )
$ar[ $check_array[$str] ]=$str_value;

}

$ar[‘hour’]= date(‘H’, strtotime($time_pcs[1]));
$ar[‘minute’]= date(‘i’, strtotime($time_pcs[1]));

return $ar;
}
}
[/code]

Ready to setup your calendar?

Buy EventON Now