public static function set_event_saved_filter($result = NULL, $event_id = NULL) { if ($result == TRUE) { if (empty($event_id)) { global $EM_Event; } else { $EM_Event = em_get_event($event_id); } if ($EM_Event instanceof EM_Event && intval($EM_Event->event_id) > 0) { $feed_url = ESS_IO::get_feed_url($EM_Event->event_id, FALSE, TRUE); return ESS_IO::get_curl_result(FeedWriter::$AGGREGATOR_WS, $feed_url) !== FALSE; } } return FALSE; }
/** * Simple test to check if the URL targets to an existing file. * * @param String feed_url URL of the ess feed file to test * @return Boolean result return a boolean value. */ public static function is_feed_valid($feed_url = '') { global $ESS_Notices; if (FeedValidator::isValidURL($feed_url) == FALSE) { $ESS_Notices->add_error(sprintf(__("The ESS URL is not valid: <a href='%s' target='_blank'>%s</a>", 'dbem'), $feed_url, $feed_url)); return FALSE; } else { $response = json_decode(ESS_IO::get_curl_result(FeedWriter::$VALIDATOR_WS, $feed_url), TRUE); //dd( $response ); if ($response !== FALSE) { $r = @$response['result']; //dd( $r ); if (@isset($r['result'])) { if (strlen(@$r['result']['error']) > 1 || @$r['type'] == 'KO') { //d( strlen( @$r['result']['error'] ) ); if ($response['result']['error'] == NULL) { $response['result']['error'] = array(); } array_unshift($response['result']['error'], "<b>" . sprintf(__("The Feed URL is not a valide ESS file: <a href='%s' target='_blank'>%s</a>", 'dbem'), $feed_url, $feed_url) . "</b><br>"); array_push($response['result']['error'], "<b>" . sprintf(__("More information about the standard: <a href='%s' target='_blank'>%s</a>", 'dbem'), ESS_IO::ESS_WEBSITE, ESS_IO::ESS_WEBSITE) . "</b><br>"); //dd( $r ); $ESS_Notices->add_error($response); return FALSE; } } return TRUE; } } return FALSE; }