Skip to content
Browse files

Now setting a default (and adding a option setting method) to remove/…

…not include posts without a "message"
  • Loading branch information...
1 parent 06446fa commit df1eb7451ee72e75cfeff155a9043d99ebacb17b @Rican7 Rican7 committed May 9, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 includes/Mobile/Feeds/Facebook.php
View
19 includes/Mobile/Feeds/Facebook.php
@@ -7,6 +7,7 @@
class Facebook extends Feeds {
// Settings
private $post_limit = 8;
+ private $remove_empty_message_posts = true;
/**
* Constructor
@@ -37,6 +38,18 @@ public function set_post_limit($limit) {
return $this->post_limit = $limit;
}
+ /*
+ * Method to set the feed to remove any posts with an empty description
+ * @param boolean $boolean A boolean value representing whether the feed should remove posts with empty descriptions
+ */
+ public function set_remove_empty_message_posts($boolean) {
+ // Set the option to true
+ $this->remove_empty_message_posts = $boolean;
+
+ // Set the limit and return
+ return $this->remove_empty_message_posts;
+ }
+
/**
* Method to grab the Facebook feed data and return it as an array
*/
@@ -62,6 +75,12 @@ protected function parse_data() {
$post['message'] = $post['name'];
}
+ // If the post's message is empty $this->remove_empty_message_posts is set to true
+ if (empty($post['message']) && $this->remove_empty_message_posts) {
+ // Just skip adding the post
+ continue;
+ }
+
$parsed_data[] = array(
'source' => 'Facebook',
'title' => $post['from']['name'],

0 comments on commit df1eb74

Please sign in to comment.
Something went wrong with that request. Please try again.