[gnome-web-wppo] added support to store bloginfo translations and display accordingly



commit 41cb471ce444b17603b7d3457f00ebaa283d9526
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Thu Mar 8 23:21:23 2012 -0300

    added support to store bloginfo translations and display accordingly

 backend.php |    2 +-
 wppo.php    |   21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/backend.php b/backend.php
index e60576a..7f1eb43 100644
--- a/backend.php
+++ b/backend.php
@@ -495,7 +495,7 @@ function wppo_generate_po_xml($post_type) {
                         
                         case 'content':
                         
-                            $row->{$column} = wpautop($row->{$column});
+                            $row->{$column} = wptexturize(wpautop($row->{$column}));
 
                             $node[$tag]['value'] = $dom->createDocumentFragment();
                             $node[$tag]['value']->appendXML('<html>'.$row->{$column}.'</html>');
diff --git a/wppo.php b/wppo.php
index caef732..b409750 100644
--- a/wppo.php
+++ b/wppo.php
@@ -290,7 +290,10 @@ if (!is_admin()) {
      * and other generic page requests
      */
 
-    add_filter('the_title', function($title, $id) {
+    add_filter('the_title', 'parse_title', 10, 2);
+    add_filter('single_post_title', 'parse_title', 10, 2);
+    
+    function parse_title($title, $id) {
         global $wppo_cache;
         
         $translated_title = trim(wppo_get_translated_data('translated_title', $id));
@@ -300,9 +303,12 @@ if (!is_admin()) {
         } else {
             return $translated_title;
         }
-    }, 10, 2);
+    }
+    
         
-    add_filter('the_excerpt', function($excerpt) {
+    add_filter('the_excerpt', 'parse_excerpt', 10, 1);
+    
+    function parse_excerpt($excerpt) {
         global $wppo_cache, $post;
 
         if (isset($wppo_cache['posts'][$post->ID])) {
@@ -316,9 +322,12 @@ if (!is_admin()) {
         } else {
             return $translated_excerpt;
         }
-    }, 10, 2);
+    }
+
 
-    add_filter('the_content', function($content) {
+    add_filter('the_content', 'parse_content', 10, 1);
+    
+    function parse_content($content) {
         global $wppo_cache, $post;
 
         if (isset($wppo_cache['posts'][$post->ID])) {
@@ -332,7 +341,7 @@ if (!is_admin()) {
         } else {
             return $translated_content;
         }
-    }, 10, 1);
+    }
 
     add_filter('get_pages', function($pages) {
         



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]