pistruiatul / hartapoliticii

Harta Politicii din România
http://hartapoliticii.ro
Other
62 stars 21 forks source link

RSS pentru declarații #51

Open andreicristianpetcu opened 11 years ago

andreicristianpetcu commented 11 years ago

80% complet. Am adăugat RSS pentru pagina de declarații. Mai trebuie să fac puțină curățenie.

--- www/hp-includes/person_class.php    2012-09-29 17:35:56.551697523 +0300
+++ www/hp-includes/person_class.php    2012-09-30 00:19:08.140792747 +0300
@@ -643,5 +643,12 @@

     return $details;
   }
+  
+  /**
+   * Returns the name of the person that can be put in a URL.
+   */
+  public function getNameForUrl() {
+   return str_replace(' ', '+', $this->name);
+  }
 }
 ?>
--- www/index.php   2012-09-29 17:35:56.563697523 +0300
+++ www/index.php   2012-09-29 22:55:43.352840476 +0300
@@ -7,6 +7,14 @@
 // Include the templating engine class.
 include ('smarty/Smarty.class.php');

+/**
+ * Checks whether it is a RSS request
+ * the politics map.
+ * @return {Boolean} True when we should load the blog.
+ */
+function isRssRequest() {
+  return ($_GET['cid'] && $_GET['cid'] >= 50 && $_GET['cid'] <= 100 );  // the rss sections are starting from 50 to 100  
+}

 /**
  * Checks whether we should load the blog instead of loading the main page of
@@ -19,24 +27,32 @@
          (!$_GET['cid'] && $_GET['feed']);        // the rss feed
 }

+if(!isRssRequest()){
+   if (shouldLoadBlog()) {
+     /**
+      * Tells WordPress to load the WordPress theme and output it.
+      * TODO(vivi): I don't remember why this needs to be defined here.
+      * @var bool
+      */
+     define('WP_USE_THEMES', true);
+   
+     // Loads the WordPress Environment and Template.
+     require('./wp-blog-header.php');
+   } else {
+     // If we're not loading the blog, just load our main page. Do load the
+     // wp-config so that we can use the fact that the user is logged in.
+     require_once('./wp-config.php');
+   
+     // Loads the Politics Map front page that displays numbers and stuff.
+     require('./hp-index.php');
+   }
-
-if (shouldLoadBlog()) {
-  /**
-   * Tells WordPress to load the WordPress theme and output it.
-   * TODO(vivi): I don't remember why this needs to be defined here.
-   * @var bool
-   */
-  define('WP_USE_THEMES', true);
-
-  // Loads the WordPress Environment and Template.
-  require('./wp-blog-header.php');
-
 } else {
+   // If we're not loading the blog, just load our main page. Do load the
+   // wp-config so that we can use the fact that the user is logged in.
+   require_once('./wp-config.php');
+
+   // If we're not loading the blog, just load our main page. Do load the
+   // wp-config so that we can use the fact that the user is logged in.
+   require('pages/rss/rss_person_declarations.php');
-  // If we're not loading the blog, just load our main page. Do load the
-  // wp-config so that we can use the fact that the user is logged in.
-  require_once('./wp-config.php');
-
-  // Loads the Politics Map front page that displays numbers and stuff.
-  require('./hp-index.php');
 }
 ?>
okvivi commented 11 years ago

O să redeschid issue-ul ăsta. Putem să includem întreg textul declarației în feed? Nu mi-au plăcut niciodată feed-urile care oferă doar un sumar și mă forțează să vizitez site-ul original ca să citesc.