<!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>[28525] trunk/src/wp-includes/wp-diff.php: Add access modifiers to `WP_Text_Diff_Renderer_Table` that are compatible with its parent class.</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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28525">28525</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-05-19 15:22:45 +0000 (Mon, 19 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add access modifiers to `WP_Text_Diff_Renderer_Table` that are compatible with its parent class. Some of the inline docs suggest access that, if implemented, would produce fatal errors.

Add magic methods for BC: __get(), __set(), __isset(), __unset(), and __call().

See <a href="http://core.trac.wordpress.org/ticket/27881">#27881</a>, <a href="http://core.trac.wordpress.org/ticket/22234">#22234</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludeswpdiffphp">trunk/src/wp-includes/wp-diff.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludeswpdiffphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/wp-diff.php (28524 => 28525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/wp-diff.php        2014-05-19 06:51:35 UTC (rev 28524)
+++ trunk/src/wp-includes/wp-diff.php   2014-05-19 15:22:45 UTC (rev 28525)
</span><span class="lines">@@ -28,18 +28,18 @@
</span><span class="cx">  /**
</span><span class="cx">   * @see Text_Diff_Renderer::_leading_context_lines
</span><span class="cx">   * @var int
</span><del>-        * @access protected
</del><ins>+         * @access public
</ins><span class="cx">    * @since 2.6.0
</span><span class="cx">   */
</span><del>-       var $_leading_context_lines  = 10000;
</del><ins>+        public $_leading_context_lines  = 10000;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * @see Text_Diff_Renderer::_trailing_context_lines
</span><span class="cx">   * @var int
</span><del>-        * @access protected
</del><ins>+         * @access public
</ins><span class="cx">    * @since 2.6.0
</span><span class="cx">   */
</span><del>-       var $_trailing_context_lines = 10000;
</del><ins>+        public $_trailing_context_lines = 10000;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * {@internal Missing Description}}
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">   * @access protected
</span><span class="cx">   * @since 2.6.0
</span><span class="cx">   */
</span><del>-       var $_diff_threshold = 0.6;
</del><ins>+        protected $_diff_threshold = 0.6;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * Inline display helper object name.
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">   * @access protected
</span><span class="cx">   * @since 2.6.0
</span><span class="cx">   */
</span><del>-       var $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
</del><ins>+        protected $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * Should we show the split view or not
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">   * @access protected
</span><span class="cx">   * @since 3.6.0
</span><span class="cx">   */
</span><del>-       var $_show_split_view = true;
</del><ins>+        protected $_show_split_view = true;
</ins><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * Constructor - Call parent constructor with params array.
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx">   *
</span><span class="cx">   * @param array $params
</span><span class="cx">   */
</span><del>-       function __construct( $params = array() ) {
</del><ins>+        public function __construct( $params = array() ) {
</ins><span class="cx">           parent::__construct( $params );
</span><span class="cx">          if ( isset( $params[ 'show_split_view' ] ) )
</span><span class="cx">                  $this->_show_split_view = $params[ 'show_split_view' ];
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">   * @param string $header
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function _startBlock( $header ) {
</del><ins>+        public function _startBlock( $header ) {
</ins><span class="cx">           return '';
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">   * @param array $lines
</span><span class="cx">   * @param string $prefix
</span><span class="cx">   */
</span><del>-       function _lines( $lines, $prefix=' ' ) {
</del><ins>+        public function _lines( $lines, $prefix=' ' ) {
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">   * @param string $line HTML-escape the value.
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function addedLine( $line ) {
</del><ins>+        public function addedLine( $line ) {
</ins><span class="cx">           return "<td class='diff-addedline'>{$line}</td>";
</span><span class="cx"> 
</span><span class="cx">  }
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">   * @param string $line HTML-escape the value.
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function deletedLine( $line ) {
</del><ins>+        public function deletedLine( $line ) {
</ins><span class="cx">           return "<td class='diff-deletedline'>{$line}</td>";
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">   * @param string $line HTML-escape the value.
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function contextLine( $line ) {
</del><ins>+        public function contextLine( $line ) {
</ins><span class="cx">           return "<td class='diff-context'>{$line}</td>";
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -138,19 +138,19 @@
</span><span class="cx">   *
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function emptyLine() {
</del><ins>+        public function emptyLine() {
</ins><span class="cx">           return '<td>&nbsp;</td>';
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * @ignore
</span><del>-        * @access private
</del><ins>+         * @access public
</ins><span class="cx">    *
</span><span class="cx">   * @param array $lines
</span><span class="cx">   * @param bool $encode
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function _added( $lines, $encode = true ) {
</del><ins>+        public function _added( $lines, $encode = true ) {
</ins><span class="cx">           $r = '';
</span><span class="cx">          foreach ($lines as $line) {
</span><span class="cx">                  if ( $encode )
</span><span class="lines">@@ -166,13 +166,13 @@
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * @ignore
</span><del>-        * @access private
</del><ins>+         * @access public
</ins><span class="cx">    *
</span><span class="cx">   * @param array $lines
</span><span class="cx">   * @param bool $encode
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function _deleted( $lines, $encode = true ) {
</del><ins>+        public function _deleted( $lines, $encode = true ) {
</ins><span class="cx">           $r = '';
</span><span class="cx">          foreach ($lines as $line) {
</span><span class="cx">                  if ( $encode )
</span><span class="lines">@@ -189,13 +189,13 @@
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * @ignore
</span><del>-        * @access private
</del><ins>+         * @access public
</ins><span class="cx">    *
</span><span class="cx">   * @param array $lines
</span><span class="cx">   * @param bool $encode
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function _context( $lines, $encode = true ) {
</del><ins>+        public function _context( $lines, $encode = true ) {
</ins><span class="cx">           $r = '';
</span><span class="cx">          foreach ($lines as $line) {
</span><span class="cx">                  if ( $encode )
</span><span class="lines">@@ -215,14 +215,14 @@
</span><span class="cx">   * (TRAC style) sometimes these lines can actually be deleted or added rows.
</span><span class="cx">   * We do additional processing to figure that out
</span><span class="cx">   *
</span><del>-        * @access private
</del><ins>+         * @access public
</ins><span class="cx">    * @since 2.6.0
</span><span class="cx">   *
</span><span class="cx">   * @param array $orig
</span><span class="cx">   * @param array $final
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function _changed( $orig, $final ) {
</del><ins>+        public function _changed( $orig, $final ) {
</ins><span class="cx">           $r = '';
</span><span class="cx"> 
</span><span class="cx">          // Does the aforementioned additional processing
</span><span class="lines">@@ -313,7 +313,7 @@
</span><span class="cx">   * @param unknown_type $final
</span><span class="cx">   * @return unknown
</span><span class="cx">   */
</span><del>-       function interleave_changed_lines( $orig, $final ) {
</del><ins>+        public function interleave_changed_lines( $orig, $final ) {
</ins><span class="cx"> 
</span><span class="cx">          // Contains all pairwise string comparisons. Keys are such that this need only be a one dimensional array.
</span><span class="cx">          $matches = array();
</span><span class="lines">@@ -402,7 +402,7 @@
</span><span class="cx">   * @param string $string2
</span><span class="cx">   * @return int
</span><span class="cx">   */
</span><del>-       function compute_string_distance( $string1, $string2 ) {
</del><ins>+        public function compute_string_distance( $string1, $string2 ) {
</ins><span class="cx">           // Vectors containing character frequency for all chars in each string
</span><span class="cx">          $chars1 = count_chars($string1);
</span><span class="cx">          $chars2 = count_chars($string2);
</span><span class="lines">@@ -426,10 +426,66 @@
</span><span class="cx">   * @param int $b
</span><span class="cx">   * @return int
</span><span class="cx">   */
</span><del>-       function difference( $a, $b ) {
</del><ins>+        public function difference( $a, $b ) {
</ins><span class="cx">           return abs( $a - $b );
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Make private properties readable for backwards compatibility
+        *
+        * @since 4.0.0
+        * @param string $name
+        * @return mixed
+        */
+       public function __get( $name ) {
+               return $this->$name;
+       }
+
+       /**
+        * Make private properties setable for backwards compatibility
+        *
+        * @since 4.0.0
+        * @param string $name
+        * @param string $value
+        * @return mixed
+        */
+       public function __set( $name, $value ) {
+               return $this->$name = $value;
+       }
+
+       /**
+        * Make private properties checkable for backwards compatibility
+        *
+        * @since 4.0.0
+        * @param string $name
+        * @return mixed
+        */
+       public function __isset( $name ) {
+               return isset( $this->$name );
+       }
+
+       /**
+        * Make private properties unsetable for backwards compatibility
+        *
+        * @since 4.0.0
+        * @param string $name
+        * @return mixed
+        */
+       public function __unset( $name ) {
+               unset( $this->$name );
+       }
+
+       /**
+        * Make private/protected methods readable for backwards compatibility
+        *
+        * @since 4.0.0
+        * @param string $name
+        * @param array $arguments
+        * @return mixed
+        */
+       public function __call( $name, $arguments ) {
+               return call_user_func_array( array( $this, $name ), $arguments );
+       }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -448,7 +504,7 @@
</span><span class="cx">   * @param string $newlineEscape
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><del>-       function _splitOnWords($string, $newlineEscape = "\n") {
</del><ins>+        public function _splitOnWords($string, $newlineEscape = "\n") {
</ins><span class="cx">           $string = str_replace("\0", '', $string);
</span><span class="cx">          $words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
</span><span class="cx">          $words  = str_replace( "\n", $newlineEscape, $words );
</span></span></pre>
</div>
</div>

</body>
</html>