function nxs_chckRmImage($url, $chType = 'head') { if (ini_get('allow_url_fopen') == '1' && @getimagesize($url) !== false) { return true; } $hdrsArr = nxs_getNXSHeaders(); $nxsWPRemWhat = 'wp_remote_' . $chType; $rsp = $nxsWPRemWhat($url, array('headers' => $hdrsArr)); if (is_wp_error($rsp)) { nxs_addToLog('IMAGE', 'E', '-=ERROR=- ' . print_r($rsp, true), ''); return false; } if (is_array($rsp) && ($rsp['response']['code'] == '200' || $rsp['response']['code'] == '403' && $rsp['headers']['server'] == 'cloudflare-nginx')) { return true; } else { if ($chType == 'head') { return nxs_chckRmImage($url, 'get'); } else { nxs_addToLog('IMAGE', 'E', '-=ERROR=- ' . print_r($rsp, true), $url); return false; } } }
function nxs_chckRmImage($url, $chType = 'head') { if (ini_get('allow_url_fopen') == '1' && @getimagesize($url) !== false) { return true; } $hdrsArr = nxs_getNXSHeaders(); $nxsWPRemWhat = 'wp_remote_' . $chType; $rsp = $nxsWPRemWhat($url, array('headers' => $hdrsArr)); if (is_wp_error($rsp)) { nxs_addToLogN('E', 'Error', 'IMAGE', '-=ERROR=- Server can\'t access it\'s own images. (Image URL: ' . $url . ') Most probably it\'s a DNS problem. Please contact your hosting provider. ' . serialize($rsp), ''); return false; } if (is_array($rsp) && ($rsp['response']['code'] == '200' || $rsp['response']['code'] == '403' && $rsp['headers']['server'] == 'cloudflare-nginx')) { return true; } else { if ($chType == 'head') { return nxs_chckRmImage($url, 'get'); } else { nxs_addToLogN('E', 'Error', 'IMAGE', '-=ERROR=- Server can\'t access it\'s own images. (Image URL: ' . $url . ') Most probably it\'s a DNS problem. Please contact your hosting provider. ' . serialize($rsp), $url); return false; } } }