refactor
This commit is contained in:
parent
5be8defd38
commit
e4230379d0
|
@ -22,16 +22,15 @@ class ReadabilityExtension extends Minz_Extension {
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ( $regex as $ex ) {
|
foreach ( $regex as $ex ) {
|
||||||
print "Iterating";
|
|
||||||
if (false !== strpos($entry->link(), $ex ) ) {
|
if (false !== strpos($entry->link(), $ex ) ) {
|
||||||
$read = true;
|
$read = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $read){
|
if (! $read){
|
||||||
print "Constantly failing";
|
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
print "should work";
|
|
||||||
$data = "{\"url\": \"" . $entry->link() ."\"}";
|
$data = "{\"url\": \"" . $entry->link() ."\"}";
|
||||||
$headers[] = 'Content-Type: application/json';
|
$headers[] = 'Content-Type: application/json';
|
||||||
|
|
||||||
|
@ -41,14 +40,15 @@ class ReadabilityExtension extends Minz_Extension {
|
||||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
|
||||||
$result = curl_exec($c);
|
$result = curl_exec($c);
|
||||||
$c_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
$c_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
||||||
//$c_error = curl_error($c);
|
|
||||||
curl_close($c);
|
curl_close($c);
|
||||||
|
|
||||||
if ($c_status !== 200) {
|
if ($c_status !== 200) {
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
$val = json_decode($result, true);
|
$val = json_decode($result, true);
|
||||||
$entry->_content($val["content"]);
|
$entry->_content($val["content"]);
|
||||||
|
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue