Browse Source

another fix

vbracco 15 years ago
parent
commit
7f28472b77
1 changed files with 11 additions and 9 deletions
  1. 11 9
      plugins/kodrs.php

+ 11 - 9
plugins/kodrs.php View File

@@ -18,15 +18,17 @@ class kodrs extends plugins {
18 18
 
19 19
 	function source_code_beautifier() {
20 20
 		global $rows;
21
-		foreach($rows as $key=>$post){
22
-			// Si no es tipo 'post' entonces no tiene 'Body' :)
23
-			if($post["postType"]=="post"){
24
-				$text = $rows[$key]['Body'];		
25
-				$result = preg_replace_callback("/<code\s+.*lang\s*=\"(.*)\">(.*)<\/code>/siU", 
26
-					array('kodrs', 'replace_with_geshi'), 
27
-					$text
28
-				);
29
-				$rows[$key]['Body'] = $result;
21
+		if(count($rows)>0){
22
+			foreach($rows as $key=>$post){
23
+				// Si no es tipo 'post' entonces no tiene 'Body' :)
24
+				if($post["postType"]=="post"){
25
+					$text = $rows[$key]['Body'];		
26
+					$result = preg_replace_callback("/<code\s+.*lang\s*=\"(.*)\">(.*)<\/code>/siU", 
27
+						array('kodrs', 'replace_with_geshi'), 
28
+						$text
29
+					);
30
+					$rows[$key]['Body'] = $result;
31
+				}
30 32
 			}
31 33
 		}
32 34
 	}