<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[GlotPress][1084] trunk: Add gp_json_encode(), a wrapper for json_encode() that ensures everything is converted to UTF-8.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://glotpress.trac.wordpress.org/changeset/1084">1084</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://glotpress.trac.wordpress.org/changeset/1084","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>markoheijnen</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-07-17 14:28:44 +0000 (Fri, 17 Jul 2015)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Add gp_json_encode(), a wrapper for json_encode() that ensures everything is converted to UTF-8.

Change all core calls from json_encode() to gp_json_encode().

Props ocean90
Fixes <a href="http://glotpress.trac.wordpress.org/ticket/452">#452</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkgpincludesmiscphp">trunk/gp-includes/misc.php</a></li>
<li><a href="#trunkgpincludesroutesglossaryentryphp">trunk/gp-includes/routes/glossary-entry.php</a></li>
<li><a href="#trunkgpincludesroutesprojectphp">trunk/gp-includes/routes/project.php</a></li>
<li><a href="#trunkgpincludesroutestranslationphp">trunk/gp-includes/routes/translation.php</a></li>
<li><a href="#trunkgpincludestemplatephp">trunk/gp-includes/template.php</a></li>
<li><a href="#trunkgptemplates404apiphp">trunk/gp-templates/404.api.php</a></li>
<li><a href="#trunkgptemplateshelperfunctionsphp">trunk/gp-templates/helper-functions.php</a></li>
<li><a href="#trunkgptemplateslocaleapiphp">trunk/gp-templates/locale.api.php</a></li>
<li><a href="#trunkgptemplateslocalesapiphp">trunk/gp-templates/locales.api.php</a></li>
<li><a href="#trunkgptemplatesprofilepublicapiphp">trunk/gp-templates/profile-public.api.php</a></li>
<li><a href="#trunkgptemplatestranslationsapiphp">trunk/gp-templates/translations.api.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkgpincludesmiscphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/misc.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/misc.php        2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-includes/misc.php  2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -327,7 +327,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int $id translation set ID
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function gp_clean_translation_set_cache( $id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        wp_cache_delete( $id, 'translation_set_status_breakdown' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_delete( $id, 'translation_set_status_breakdown' ); 
</ins><span class="cx" style="display: block; padding: 0 10px">         wp_cache_delete( $id, 'translation_set_last_modified' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -513,4 +513,140 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $newlist;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
+
+/**
+ * Encode a variable into JSON, with some sanity checks.
+ *
+ * @since 1.0.0
+ *
+ * @param mixed $data    Variable (usually an array or object) to encode as JSON.
+ * @param int   $options Optional. Options to be passed to json_encode(). Default 0.
+ * @param int   $depth   Optional. Maximum depth to walk through $data. Must be
+ *                       greater than 0. Default 512.
+ * @return string|false The JSON encoded string, or false if it cannot be encoded.
+ */
+function gp_json_encode( $data, $options = 0, $depth = 512 ) {
+       /*
+        * json_encode() has had extra params added over the years.
+        * $options was added in 5.3, and $depth in 5.5.
+        * We need to make sure we call it with the correct arguments.
+        */
+       if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
+               $args = array( $data, $options, $depth );
+       } else {
+               $args = array( $data, $options );
+       }
+
+       $json = call_user_func_array( 'json_encode', $args );
+
+       // If json_encode() was successful, no need to do more sanity checking.
+       // ... unless we're in an old version of PHP, and json_encode() returned
+       // a string containing 'null'. Then we need to do more sanity checking.
+       if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) )  {
+               return $json;
+       }
+
+       try {
+               $args[0] = _gp_json_sanity_check( $data, $depth );
+       } catch ( Exception $e ) {
+               return false;
+       }
+
+       return call_user_func_array( 'json_encode', $args );
+}
+
+/**
+ * Perform sanity checks on data that shall be encoded to JSON.
+ *
+ * @ignore
+ * @since 1.0.0
+ * @access private
+ *
+ * @see gp_json_encode()
+ *
+ * @param mixed $data  Variable (usually an array or object) to encode as JSON.
+ * @param int   $depth Maximum depth to walk through $data. Must be greater than 0.
+ * @return mixed The sanitized data that shall be encoded to JSON.
+ */
+function _gp_json_sanity_check( $data, $depth ) {
+       if ( $depth < 0 ) {
+               throw new Exception( 'Reached depth limit' );
+       }
+
+       if ( is_array( $data ) ) {
+               $output = array();
+               foreach ( $data as $id => $el ) {
+                       // Don't forget to sanitize the ID!
+                       if ( is_string( $id ) ) {
+                               $clean_id = _gp_json_convert_string( $id );
+                       } else {
+                               $clean_id = $id;
+                       }
+
+                       // Check the element type, so that we're only recursing if we really have to.
+                       if ( is_array( $el ) || is_object( $el ) ) {
+                               $output[ $clean_id ] = _gp_json_sanity_check( $el, $depth - 1 );
+                       } elseif ( is_string( $el ) ) {
+                               $output[ $clean_id ] = _gp_json_convert_string( $el );
+                       } else {
+                               $output[ $clean_id ] = $el;
+                       }
+               }
+       } elseif ( is_object( $data ) ) {
+               $output = new stdClass;
+               foreach ( $data as $id => $el ) {
+                       if ( is_string( $id ) ) {
+                               $clean_id = _gp_json_convert_string( $id );
+                       } else {
+                               $clean_id = $id;
+                       }
+
+                       if ( is_array( $el ) || is_object( $el ) ) {
+                               $output->$clean_id = _gp_json_sanity_check( $el, $depth - 1 );
+                       } elseif ( is_string( $el ) ) {
+                               $output->$clean_id = _gp_json_convert_string( $el );
+                       } else {
+                               $output->$clean_id = $el;
+                       }
+               }
+       } elseif ( is_string( $data ) ) {
+               return _gp_json_convert_string( $data );
+       } else {
+               return $data;
+       }
+
+       return $output;
+}
+
+/**
+ * Convert a string to UTF-8, so that it can be safely encoded to JSON.
+ *
+ * @ignore
+ * @since 1.0.0
+ * @access private
+ *
+ * @see _gp_json_sanity_check()
+ *
+ * @staticvar bool $use_mb
+ *
+ * @param string $string The string which is to be converted.
+ * @return string The checked string.
+*/
+function _gp_json_convert_string( $string ) {
+       static $use_mb = null;
+       if ( is_null( $use_mb ) ) {
+               $use_mb = function_exists( 'mb_convert_encoding' );
+       }
+
+       if ( $use_mb ) {
+               $encoding = mb_detect_encoding( $string, mb_detect_order(), true );
+               if ( $encoding ) {
+                       return mb_convert_encoding( $string, 'UTF-8', $encoding );
+               } else {
+                       return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
+               }
+       } else {
+               return wp_check_invalid_utf8( $string, true );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunkgpincludesroutesglossaryentryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/routes/glossary-entry.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/routes/glossary-entry.php       2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-includes/routes/glossary-entry.php 2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,7 +97,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $ge     = $glossary_entry->reload();
</span><span class="cx" style="display: block; padding: 0 10px">                        $output = gp_tmpl_get_output( 'glossary-entry-row', get_defined_vars() );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        echo json_encode( $output );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 echo gp_json_encode( $output );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                exit();
</span></span></pre></div>
<a id="trunkgpincludesroutesprojectphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/routes/project.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/routes/project.php      2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-includes/routes/project.php        2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -386,7 +386,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                header('Content-Type: application/json');
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo json_encode( $project->set_difference_from( $other_project ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo gp_json_encode( $project->set_difference_from( $other_project ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function branch_project_get( $project_path ) {
</span></span></pre></div>
<a id="trunkgpincludesroutestranslationphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/routes/translation.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/routes/translation.php  2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-includes/routes/translation.php    2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -217,7 +217,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo json_encode( $output );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo gp_json_encode( $output );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function bulk_post( $project_path, $locale_slug, $translation_set_slug ) {
</span></span></pre></div>
<a id="trunkgpincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/template.php    2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-includes/template.php      2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -266,7 +266,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> function gp_array_of_things_to_json( $array ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return json_encode( array_map( function( $thing ) { return $thing->fields(); }, $array ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return gp_json_encode( array_map( function( $thing ) { return $thing->fields(); }, $array ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> function gp_array_of_array_of_things_to_json( $array ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -276,7 +276,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }, $array );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return json_encode( array_map( $map_to_fields, $array ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return gp_json_encode( array_map( $map_to_fields, $array ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> function things_to_fields( $data ) {
</span></span></pre></div>
<a id="trunkgptemplates404apiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/404.api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/404.api.php    2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-templates/404.api.php      2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,3 +1,3 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-echo json_encode( array( 'success' => false, 'error' => __('Not Found') ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+echo gp_json_encode( array( 'success' => false, 'error' => __('Not Found') ) );
</ins></span></pre></div>
<a id="trunkgptemplateshelperfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/helper-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/helper-functions.php   2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-templates/helper-functions.php     2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,7 +40,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                //Replace terms in strings with markup
</span><span class="cx" style="display: block; padding: 0 10px">                foreach( $matching_entries as $term => $glossary_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $replacement = '<span class="glossary-word" data-translations="' . htmlspecialchars( json_encode( $glossary_data ), ENT_QUOTES, 'UTF-8') . '">$1</span>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $replacement = '<span class="glossary-word" data-translations="' . htmlspecialchars( gp_json_encode( $glossary_data ), ENT_QUOTES, 'UTF-8') . '">$1</span>';
</ins><span class="cx" style="display: block; padding: 0 10px">                         $translations[$key]->singular_glossary_markup = preg_replace( '/\b(' . preg_quote( $term, '/' ) . '[es|s]?)(?![^<]*<\/span>)\b/iu', $replacement, $translations[$key]->singular_glossary_markup, 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( $t->plural ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,7 +119,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                <li><a target="_blank" tabindex="-1" href="<?php echo $source_url; ?>"><?php echo $file.':'.$line ?></a></li>
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php
</span><span class="cx" style="display: block; padding: 0 10px">                        else :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo "<li>$file:$line</li>"; 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         echo "<li>$file:$line</li>";
</ins><span class="cx" style="display: block; padding: 0 10px">                         endif;
</span><span class="cx" style="display: block; padding: 0 10px">                endforeach;
</span><span class="cx" style="display: block; padding: 0 10px">                ?>
</span></span></pre></div>
<a id="trunkgptemplateslocaleapiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/locale.api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/locale.api.php 2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-templates/locale.api.php   2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,2 +1,2 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        echo json_encode( things_to_fields( $projects_data ) );
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        echo gp_json_encode( things_to_fields( $projects_data ) );
</ins></span></pre></div>
<a id="trunkgptemplateslocalesapiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/locales.api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/locales.api.php        2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-templates/locales.api.php  2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,2 +1,2 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        echo json_encode( $locales );
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        echo gp_json_encode( $locales );
</ins></span></pre></div>
<a id="trunkgptemplatesprofilepublicapiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/profile-public.api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/profile-public.api.php 2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-templates/profile-public.api.php   2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,12 +18,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( gp_get('filter') ) {
</span><span class="cx" style="display: block; padding: 0 10px">        case 'meta':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo json_encode( $meta );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo gp_json_encode( $meta );
</ins><span class="cx" style="display: block; padding: 0 10px">                 break;
</span><span class="cx" style="display: block; padding: 0 10px">        case 'recent_projects':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo json_encode( compact('recent_projects') );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo gp_json_encode( compact('recent_projects') );
</ins><span class="cx" style="display: block; padding: 0 10px">                 break;
</span><span class="cx" style="display: block; padding: 0 10px">        default:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                echo json_encode( $arr );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         echo gp_json_encode( $arr );
</ins><span class="cx" style="display: block; padding: 0 10px">                 break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunkgptemplatestranslationsapiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/translations.api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/translations.api.php   2015-07-17 13:57:54 UTC (rev 1083)
+++ trunk/gp-templates/translations.api.php     2015-07-17 14:28:44 UTC (rev 1084)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,2 +1,2 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-echo json_encode( $translations );
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+echo gp_json_encode( $translations );
</ins></span></pre>
</div>
</div>

</body>
</html>