Failed Conditions
Pull Request — master (#1327)
by Nick
11:49
created
scripts/mprss.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,49 +20,49 @@  discard block
 block discarded – undo
20 20
 
21 21
 $starttime = time();
22 22
 for ($personrow=0; $personrow<$q->rows(); $personrow++) {
23
-	$person_id = $q->field($personrow, 'person_id');
23
+    $person_id = $q->field($personrow, 'person_id');
24 24
 
25
-	$args = array ( 'person_id' => $person_id );
26
-	$speeches = $HANSARDLIST->display('person', $args, 'none');
25
+    $args = array ( 'person_id' => $person_id );
26
+    $speeches = $HANSARDLIST->display('person', $args, 'none');
27 27
 
28
-	// Some data about this person that we'll need for the feed.
29
-	$MEMBER = new MEMBER(array('person_id' => $person_id));
30
-	$MPURL = new \MySociety\TheyWorkForYou\Url('mp');
31
-	$MPURL->insert(array('pid'=>$person_id));
32
-	$mpurl = $MPURL->generate();
28
+    // Some data about this person that we'll need for the feed.
29
+    $MEMBER = new MEMBER(array('person_id' => $person_id));
30
+    $MPURL = new \MySociety\TheyWorkForYou\Url('mp');
31
+    $MPURL->insert(array('pid'=>$person_id));
32
+    $mpurl = $MPURL->generate();
33 33
 
34
-	$date = gmdate('Y-m-d');
35
-	$time = gmdate('H:i:s');
36
-	$datenow = $date . 'T' . $time . '+00:00';
34
+    $date = gmdate('Y-m-d');
35
+    $time = gmdate('H:i:s');
36
+    $datenow = $date . 'T' . $time . '+00:00';
37 37
 
38
-	// Prepare the meat of the RSS file.
39
-	$items = '';
40
-	$entries = '';
41
-	if (isset ($speeches['rows']) && count($speeches['rows']) > 0) {
38
+    // Prepare the meat of the RSS file.
39
+    $items = '';
40
+    $entries = '';
41
+    if (isset ($speeches['rows']) && count($speeches['rows']) > 0) {
42 42
 
43
-		foreach ($speeches['rows'] as $n => $row) {
43
+        foreach ($speeches['rows'] as $n => $row) {
44 44
 
45
-			// While we're linking to individual speeches,
46
-			// the text is the body of the parent, ie (sub)section.
47
-			$title = _htmlentities(str_replace('&#8212;', '-', $row['parent']['body']));
45
+            // While we're linking to individual speeches,
46
+            // the text is the body of the parent, ie (sub)section.
47
+            $title = _htmlentities(str_replace('&#8212;', '-', $row['parent']['body']));
48 48
 
49
-			$link = isset($row['listurl']) ? $row['listurl'] : '';
50
-			$link = 'https://' . DOMAIN . $link;
49
+            $link = isset($row['listurl']) ? $row['listurl'] : '';
50
+            $link = 'https://' . DOMAIN . $link;
51 51
 
52
-			$description = _htmlentities(trim_characters($row['body'], 0, 200));
53
-			$contentencoded = $row['body'];
52
+            $description = _htmlentities(trim_characters($row['body'], 0, 200));
53
+            $contentencoded = $row['body'];
54 54
 
55
-			$hdate = format_date($row['hdate'], 'Y-m-d');
56
-			if ($row['htime'] != NULL) {
57
-				$htime = format_time($row['htime'], 'H:i:s');
58
-			} else {
59
-				$htime = '00:00:00';
60
-			}
55
+            $hdate = format_date($row['hdate'], 'Y-m-d');
56
+            if ($row['htime'] != NULL) {
57
+                $htime = format_time($row['htime'], 'H:i:s');
58
+            } else {
59
+                $htime = '00:00:00';
60
+            }
61 61
 
62
-			$date = $hdate . 'T' . $htime . '+00:00';
62
+            $date = $hdate . 'T' . $htime . '+00:00';
63 63
 
64
-			$items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n";
65
-			$entries .= "<item rdf:about=\"$link\">
64
+            $items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n";
65
+            $entries .= "<item rdf:about=\"$link\">
66 66
 	<title>$title</title>
67 67
 	<link>$link</link>
68 68
 	<description>$description</description>
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 </item>
72 72
 ";
73 73
 
74
-		}
75
-	}
74
+        }
75
+    }
76 76
 
77
-	// Prepare the whole text of the RSS file.
78
-	$rsstext = '<?xml version="1.0" encoding="utf-8"?>
77
+    // Prepare the whole text of the RSS file.
78
+    $rsstext = '<?xml version="1.0" encoding="utf-8"?>
79 79
 <rdf:RDF
80 80
   xmlns:dc="http://purl.org/dc/elements/1.1/"
81 81
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 
102 102
 </rdf:RDF>';
103 103
 
104
-	// Write the text to the file...
105
-	$filename = $rsspath . $person_id . '.rdf';
106
-	$fh = @fopen($filename, "w");
107
-	if (!$fh) { # Problem writing, just carry on
108
-		echo "Could not write to file ($filename)\n";
109
-		continue;
110
-	}
111
-	fwrite($fh, $rsstext);
112
-	fclose ($fh);
104
+    // Write the text to the file...
105
+    $filename = $rsspath . $person_id . '.rdf';
106
+    $fh = @fopen($filename, "w");
107
+    if (!$fh) { # Problem writing, just carry on
108
+        echo "Could not write to file ($filename)\n";
109
+        continue;
110
+    }
111
+    fwrite($fh, $rsstext);
112
+    fclose ($fh);
113 113
 }
114 114
 
115 115
 #print "Took " . (time()-$starttime) . " seconds\n";
Please login to merge, or discard this patch.