Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey Tom,

    Here’s a TL;DR version of how diff works.

    Lines starting by +++ and — are saying which files are involved and what symbol (add ‘+’, remove ‘-‘) each file has different from the other. In this case its a diff between two versions of the same file.

    Lines with @@ is to describe where in terms of line number, column. Gives hint which line to get to.

    Now the fix is to add ‘public static’. In front of the word ‘function’ for the two methods of that class.

    There are two ways to use classes. As a container of functions which we refer as calling “statically” which is the case here.

    Quixk way to assess? When its called Foo::postmeta(…) compared to

    $foo = new FooClass();
    echo $foo->bar(‘bazz’);

    The fix is easy, classes are called statically and the function definition is using old conventions when static methods didn’t exist (before PHP 5.2). In other words procedural functions inside a class but its an easy fix.

    Look at this diff and do the same. I might push upstream the fix someday.

    diff --git i/revision-control.php w/revision-control.php
    index d0d3958..ade99f9 100644
    --- i/revision-control.php
    +++ w/revision-control.php
    @@ -299,7 +299,7 @@ class Plugin_Revision_Control {
     }
    
     class Plugin_Revision_Control_Compat {
    - function postmeta($meta, $post) {
    + public static function postmeta($meta, $post) {
        if ( is_array($meta) )
          return $meta;
    
    @@ -318,7 +318,7 @@ class Plugin_Revision_Control_Compat {
        return $_meta;
      }
    
    - function options($options) {
    + public static function options($options) {
        $_options = $options;
        if ( ! is_array($options) ) { // Upgrade from 1.0 to 1.1
          $options = array( 'post' => $options, 'page' => $options );
Viewing 2 replies - 1 through 2 (of 2 total)