ID,'_imb_filter_links',true) == 1){//} $regexp = "]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; if(preg_match_all("/$regexp/siU", $content, $matches)) { $temp = []; foreach($matches[2] as $key => $match){ $temp[$key] = "'".str_replace(["'",'"'],[],$match)."'"; } $checked = []; $checked = $wpdb -> get_results(" SELECT url, status_code, last_check,id FROM {$wpdb->prefix}affilipus_linkfilter WHERE url IN (".implode(',',$temp).");",OBJECT_K); foreach($matches[2] as $key => &$match){ $url = $this -> check_url($match); if($this -> check_url($match)) { if (isset($checked[$match]) && strtotime($post->post_modified) > strtotime($checked[$match]->last_check)) { $response = $this->get_status_code($url); $wpdb->update( $wpdb->prefix . 'affilipus_linkfilter', array('status_code' => $response, 'url' => $match, 'last_check' => date('Y-m-d H:i:s')), array('id' => $checked[$match]->id), array('%s', '%s', '%s') ); } else if (!isset($checked[$match])) { $response = $this->get_status_code($url); $wpdb->insert( $wpdb->prefix . 'affilipus_linkfilter', array( 'status_code' => $response, 'url' => $match ), array( '%s', '%s' ) ); } else { $response = $checked[$match]->status_code; } if ($response == 404 || $response == 0) { $content = str_replace($matches[0][$key], '' . $matches[3][$key] . '', $content); } } } } return $content; } }