Completed
Push — master ( f0fb12...3087cf )
by Jacob
07:20
created
script/cron/generate-rss-feeds.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  * @return boolean
22 22
  */
23 23
 $buildFeed = function (Feed $feed, $folder, $name = 'rss') {
24
-    $tempFeed = __DIR__ . "/../../public/{$folder}/{$name}-new.xml";
25
-    $finalFeed = __DIR__ . "/../../public/{$folder}/{$name}.xml";
24
+	$tempFeed = __DIR__ . "/../../public/{$folder}/{$name}-new.xml";
25
+	$finalFeed = __DIR__ . "/../../public/{$folder}/{$name}.xml";
26 26
 
27
-    $feedHandle = fopen($tempFeed, 'w');
28
-    fwrite($feedHandle, $feed->render());
29
-    fclose($feedHandle);
27
+	$feedHandle = fopen($tempFeed, 'w');
28
+	fwrite($feedHandle, $feed->render());
29
+	fclose($feedHandle);
30 30
 
31
-    rename($tempFeed, $finalFeed);
31
+	rename($tempFeed, $finalFeed);
32 32
 };
33 33
 
34 34
 
@@ -47,51 +47,51 @@  discard block
 block discarded – undo
47 47
 $activeBlogPosts = $blogPostRepository->getActivePosts();
48 48
 
49 49
 foreach ($activeBlogPosts as $blogPost) {
50
-    $blogPostItem = new Item();
50
+	$blogPostItem = new Item();
51 51
 
52
-    $blogPostItem->title($blogPost['title']);
52
+	$blogPostItem->title($blogPost['title']);
53 53
 
54
-    $url = "http://blog.jacobemerick.com/{$blogPost['category']}/{$blogPost['path']}/";
55
-    $blogPostItem->url($url);
56
-    $blogPostItem->guid($url, true);
54
+	$url = "http://blog.jacobemerick.com/{$blogPost['category']}/{$blogPost['path']}/";
55
+	$blogPostItem->url($url);
56
+	$blogPostItem->guid($url, true);
57 57
 
58
-    $description = $blogPost['body'];
59
-    $description = strip_tags($description);
60
-    $description = strtok($description, "\n");
61
-    if (strlen($description) > 250) {
62
-        $description = wordwrap($description, 250);
63
-        $description = strtok($description, "\n");
64
-        if (substr($description, -1) != '.') {
65
-            $description .= '…';
66
-        }
67
-    }
68
-    $description = html_entity_decode($description);
69
-    $blogPostItem->description($description);
58
+	$description = $blogPost['body'];
59
+	$description = strip_tags($description);
60
+	$description = strtok($description, "\n");
61
+	if (strlen($description) > 250) {
62
+		$description = wordwrap($description, 250);
63
+		$description = strtok($description, "\n");
64
+		if (substr($description, -1) != '.') {
65
+			$description .= '…';
66
+		}
67
+	}
68
+	$description = html_entity_decode($description);
69
+	$blogPostItem->description($description);
70 70
 
71
-    $categoryUrl = "http://blog.jacobemerick.com/{$blogPost['category']}/";
72
-    $blogPostItem->category($blogPost['category'], $categoryUrl);
71
+	$categoryUrl = "http://blog.jacobemerick.com/{$blogPost['category']}/";
72
+	$blogPostItem->category($blogPost['category'], $categoryUrl);
73 73
 
74
-    $pubDate = new DateTime($blogPost['date']);
75
-    $blogPostItem->pubDate($pubDate->getTimestamp());
74
+	$pubDate = new DateTime($blogPost['date']);
75
+	$blogPostItem->pubDate($pubDate->getTimestamp());
76 76
 
77
-    $firstPhoto = Content::instance('FetchFirstPhoto', $blogPost['body'])->activate(true, 'large');
78
-    if (!empty($firstPhoto)) {
79
-        $firstPhotoPieces = sscanf($firstPhoto, '<img src="%s" height="%d" width="%d" alt="%s" />');
80
-        $firstPhotoPath = current($firstPhotoPieces);
81
-        $firstPhotoPath = trim($firstPhotoPath, '"');
77
+	$firstPhoto = Content::instance('FetchFirstPhoto', $blogPost['body'])->activate(true, 'large');
78
+	if (!empty($firstPhoto)) {
79
+		$firstPhotoPieces = sscanf($firstPhoto, '<img src="%s" height="%d" width="%d" alt="%s" />');
80
+		$firstPhotoPath = current($firstPhotoPieces);
81
+		$firstPhotoPath = trim($firstPhotoPath, '"');
82 82
 
83
-        $firstPhotoInternalPath = __DIR__ . '/../../public' . $firstPhotoPath;
83
+		$firstPhotoInternalPath = __DIR__ . '/../../public' . $firstPhotoPath;
84 84
 
85
-        $firstPhotoSize = filesize($firstPhotoInternalPath);
85
+		$firstPhotoSize = filesize($firstPhotoInternalPath);
86 86
 
87
-        $fInfo = new finfo(FILEINFO_MIME_TYPE);
88
-        $firstPhotoType = $fInfo->file($firstPhotoInternalPath);
89
-        unset($fInfo);
87
+		$fInfo = new finfo(FILEINFO_MIME_TYPE);
88
+		$firstPhotoType = $fInfo->file($firstPhotoInternalPath);
89
+		unset($fInfo);
90 90
 
91
-        $blogPostItem->enclosure("http://blog.jacobemerick.com{$firstPhotoPath}", $firstPhotoSize, $firstPhotoType);
92
-    }
91
+		$blogPostItem->enclosure("http://blog.jacobemerick.com{$firstPhotoPath}", $firstPhotoSize, $firstPhotoType);
92
+	}
93 93
 
94
-    $blogPostItem->appendTo($blogPostChannel);
94
+	$blogPostItem->appendTo($blogPostChannel);
95 95
 }
96 96
 
97 97
 $buildFeed($blogPostFeed, 'blog');
@@ -109,33 +109,33 @@  discard block
 block discarded – undo
109 109
 $activeBlogComments = $commentRepository->getActiveCommentsBySite('blog');
110 110
 
111 111
 foreach ($activeBlogComments as $blogComment) {
112
-    $blogCommentItem = new Item();
113
-
114
-    $blogCommentItem->title("Comment on '{$blogComment['title']}' from {$blogComment['name']}");
115
-
116
-    $url = "http://blog.jacobemerick.com/{$blogComment['category']}/{$blogComment['path']}/";
117
-    $url .= "#comment-{$blogComment['id']}";
118
-    $blogCommentItem->url($url);
119
-    $blogCommentItem->guid($url, true);
120
-
121
-    $description = $blogComment['body'];
122
-    $description = strip_tags($description);
123
-    $description = strtok($description, "\n");
124
-    if (strlen($description) > 250) {
125
-        $description = wordwrap($description, 250);
126
-        $description = strtok($description, "\n");
127
-        if (substr($description, -1) != '.') {
128
-            $description .= '&hellip;';
129
-        }
130
-    }
131
-    $description = html_entity_decode($description);
132
-    $description = trim($description);
133
-    $blogCommentItem->description($description);
134
-
135
-    $pubDate = new DateTime($blogComment['date']);
136
-    $blogCommentItem->pubDate($pubDate->getTimestamp());
137
-
138
-    $blogCommentItem->appendTo($blogCommentChannel);
112
+	$blogCommentItem = new Item();
113
+
114
+	$blogCommentItem->title("Comment on '{$blogComment['title']}' from {$blogComment['name']}");
115
+
116
+	$url = "http://blog.jacobemerick.com/{$blogComment['category']}/{$blogComment['path']}/";
117
+	$url .= "#comment-{$blogComment['id']}";
118
+	$blogCommentItem->url($url);
119
+	$blogCommentItem->guid($url, true);
120
+
121
+	$description = $blogComment['body'];
122
+	$description = strip_tags($description);
123
+	$description = strtok($description, "\n");
124
+	if (strlen($description) > 250) {
125
+		$description = wordwrap($description, 250);
126
+		$description = strtok($description, "\n");
127
+		if (substr($description, -1) != '.') {
128
+			$description .= '&hellip;';
129
+		}
130
+	}
131
+	$description = html_entity_decode($description);
132
+	$description = trim($description);
133
+	$blogCommentItem->description($description);
134
+
135
+	$pubDate = new DateTime($blogComment['date']);
136
+	$blogCommentItem->pubDate($pubDate->getTimestamp());
137
+
138
+	$blogCommentItem->appendTo($blogCommentChannel);
139 139
 }
140 140
 
141 141
 $buildFeed($blogCommentFeed, 'blog', 'rss-comments');
Please login to merge, or discard this patch.