Respect <meta name="robots" content="noindex"/>
[phinde.git] / bin / index.php
index 5a55427b6fbc15cd70e0ac3f4195fc723e8a8a00..5985a3e9bfb2e0a8e1d3103c6e351f8a1d6d6a66 100755 (executable)
@@ -90,6 +90,17 @@ if ($xbase) {
     );
 }
 
     );
 }
 
+$meta = $dx->evaluate('/html/head/meta[@name="robots" and @content]')
+    ->item(0);
+if ($meta) {
+    $robots = $meta->attributes->getNamedItem('content')->textContent;
+    foreach (explode(',', $robots) as $value) {
+        if (trim($value) == 'noindex') {
+            echo "URL does not want to be indexed: $url\n";
+            exit(0);
+        }
+    }
+}
 
 //remove script tags
 removeTags($doc, 'script');
 
 //remove script tags
 removeTags($doc, 'script');