function get_etaturgence() { $etat_urgence = get_cache(); if (!empty($etat_urgence)) { return $etat_urgence; } $curl_connection = curl_init('https://estcequecestencoreletatdurgence.fr/'); curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); $html = curl_exec($curl_connection); $dom = new DOMDocument(); $dom->loadHTML($html); $status_etat_urgence = get_tag_html($dom, '//h1'); $for_etat_urgence = get_tag_html($dom, '//p'); $subtitle_etat_urgence = get_tag_html($dom, '//small'); preg_match_all('!\\d+!', $for_etat_urgence, $matches); $for_int_etat_urgence = (int) $matches[0][0]; $etat_urgence = array('status' => $status_etat_urgence == "Oui" ? true : false, 'status_string' => $status_etat_urgence, 'for' => $for_int_etat_urgence, 'for_string' => $for_etat_urgence, 'subtitle' => $subtitle_etat_urgence); set_cache($etat_urgence); return $etat_urgence; }
function cdbr_get_activity_action_callback($action, $activity) { if ($activity->type == 'new_blog_post') { $links = get_tag_html($activity->action); $action = '<span class="activity-blog">' . $links[2] . '</span>'; $action .= '<span class="activity-title">' . $links[1] . '</span>'; $action .= '<span class="activity-author">' . $links[0] . '</span>'; } return $action; }