Explorar o código

codeman attempt to organize php

Xen hai 1 ano
pai
achega
f7f02e4c15
Modificáronse 1 ficheiros con 25 adicións e 30 borrados
  1. 25 30
      www/index.php

+ 25 - 30
www/index.php

@@ -104,37 +104,32 @@ function clean_str($str) {
 	Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
 	*/
 	foreach ($feed->get_items() as $item):
+		$item_title = clean_str($item->get_title());
+		$item_link = "article.php?loc=" . $loc . '&a=' . $item->get_permalink();
+		$subheadlines = clean_str($item->get_description());
+		
+		$remove_google_link = explode("<li><strong>", $subheadlines);
+		$no_blank = str_replace('target="_blank"', "", $remove_google_link[0]) . "</li></ol></font></p>"; 
+		$cleaned_links = str_replace('<a href="', '<a href="article.php?loc=' . $loc . '&a=', $no_blank);
+		$cleaned_links = strip_tags($cleaned_links, '<a><ol><ul><li><br><p><small><font><b><strong><i><em><blockquote><h1><h2><h3><h4><h5><h6>');
+		$cleaned_links = str_replace( 'strong>', 'b>', $cleaned_links); //change <strong> to <b>
+		$cleaned_links = str_replace( 'em>', 'i>', $cleaned_links); //change <em> to <i>
+		$cleaned_links = str_replace( "View Full Coverage on Google News", "", $cleaned_links);
 	?>
- 
-			<h3 style="font-size: 5;"><a href="<?php echo 'article.php?loc=' . $loc . '&a=' . $item->get_permalink(); ?>"><?php echo clean_str($item->get_title()); ?></a></h3>
-			<p style="font-size: 4;">
-			<?php 
-				$subheadlines = clean_str($item->get_description());
-				$remove_google_link = explode("<li><strong>", $subheadlines);
-				$no_blank = str_replace('target="_blank"', "", $remove_google_link[0]) . "</li></ol></font></p>"; 
-				$cleaned_links = str_replace('<a href="', '<a href="article.php?loc=' . $loc . '&a=', $no_blank);
-				$cleaned_links = strip_tags($cleaned_links, '<a><ol><ul><li><br><p><small><font><b><strong><i><em><blockquote><h1><h2><h3><h4><h5><h6>');
-				$cleaned_links = str_replace( 'strong>', 'b>', $cleaned_links); //change <strong> to <b>
-				$cleaned_links = str_replace( 'em>', 'i>', $cleaned_links); //change <em> to <i>
-				$cleaned_links = str_replace( "View Full Coverage on Google News", "", $cleaned_links);
-				echo $cleaned_links;
-            ?>
-			</p>
-			<p style="font-size: small;">Posted on 
-				<?php 
-					echo $item->get_date('j F Y | g:i a');
-				?>
-				|
-				<?php 
-					echo clean_str($item->get_source()); 
-					echo ', ';
-					echo clean_str($item->get_category(0));
-					echo ", ";
-					echo clean_str($item->get_categories());
-					echo ".";
-				?>
-			</p>
- 
+		<h3 style="font-size: 5;">
+			<a href="<?php echo $item_link; ?>">
+				<?php echo clean_str($item->get_title()); ?>
+			</a>
+		</h3>
+		
+		<p style="font-size: 4;">
+			<?php echo $cleaned_links; ?>
+		</p>
+
+		<p style="font-size: small;">Posted on 
+			<?php echo $item->get_date('j F Y | g:i a'); ?>
+		</p>
+
 	<?php endforeach; ?>
 	<p style="text-align: center; font-size: small;">v1.0 Powered by Mozilla Readability (Andres Rey PHP Port) and SimplePie</p>
 </body>