private function controlNodeContent($name, $value) { if (FeedValidator::isNull($value) == FALSE) { switch (strtolower($name)) { case 'start': case 'published': case 'updated': return FeedValidator::isValidDate(FeedWriter::getISODate($value)); break; case 'name': return FeedValidator::isNull($value) == FALSE ? TRUE : FALSE; break; case 'email': return FeedValidator::isValidEmail($value); break; case 'logo': case 'icon': case 'uri': return FeedValidator::isValidURL($value); break; case 'latitude': return FeedValidator::isValidLatitude($value); break; case 'longitude': return FeedValidator::isValidLongitude($value); break; case 'country_code': return FeedValidator::isValidCountryCode($value); break; case 'currency': return FeedValidator::isValidCurrency($value); break; default: return TRUE; break; } } return TRUE; }
private function getAggregatorResponse($response) { $r = $response['result']; $isOK = isset($r['result']) ? TRUE : FALSE; $isVersionUptoDate = isset($r['version']) ? (string) $r['version'] != (string) self::LIBRARY_VERSION && $isOK ? FALSE : TRUE : TRUE; if ($this->DEBUG == TRUE) { $DARK_RED = '#ff0000;'; $bg_color = $isOK ? '#91ff86' : '#ffd5d5'; $mn_color = $isOK ? '#168c0a' : $DARK_RED; echo "<div style='background-color:{$bg_color};color:{$mn_color};border:1px solid {$mn_color};width:95%;padding:10px;font-size:14px;margin:10px;'>" . ($isVersionUptoDate == FALSE ? "<h3 style='color:{$DARK_RED};font-size:20px;border:1px dotted {$DARK_RED};padding:10px;margin:5px;'>The PHP-ESS library have been updated.<br/>" . "Download the last GitHub version (" . $r['version'] . ") : <a target='_blank' href='https://github.com/essfeed/php-ess' style='color:#ff0000;'>https://github.com/essfeed/php-ess</a>" . "</h3>" . "<br/>" : '') . "Set the DEBUG attribute to false to remove this warning message." . "<br/><br/>" . "\$ newFeed = new FeedWriter();<br/>" . "<b>\$ newFeed->DEBUG = false;</b>" . "<br/><br/>" . self::htmlvardump($response) . "</div>"; } if ($isVersionUptoDate == FALSE && self::EMAIL_UP_TO_DATE && FeedValidator::isValidEmail($_SERVER['SERVER_ADMIN'])) { self::sendEmail($_SERVER['SERVER_ADMIN'], "Update your ESS Library on " . $_SERVER['HTTP_HOST'], "<h3>The library you used on your website " . $_SERVER['HTTP_HOST'] . " is not up to date</h3>" . "<p style='background:#000;color:#FFF;padding:6px;'>" . $_SERVER['DOCUMENT_ROOT'] . "</p>" . "You can upload the lastest version in <a href='https://github.com/essfeed/php-ess/'>https://github.com/essfeed/php-ess/</a>"); } }