Changeset 1319

Show
Ignore:
Timestamp:
09/01/08 18:51:48 (3 months ago)
Author:
_ck_
Message:

0.0.3 workaround for bbPress's buggy activation hook under Windows

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • edit-history/trunk/edit-history.php

    r1220 r1319  
    66Author: _ck_ 
    77Author URI: http://bbShowcase.org 
    8 Version: 0.0.2 
     8Version: 0.0.3 
    99 
    1010License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ 
     
    1717/*    stop editing here   */ 
    1818 
    19 bb_register_activation_hook( __FILE__,  'edit_history_create_table'); 
    2019add_filter( 'post_edit_uri', 'edit_history_link'); 
    2120add_action( 'bb_update_post', 'edit_history_update_post'); 
    2221add_action( 'bb_init', 'edit_history_init'); 
     22bb_register_activation_hook(str_replace(array(str_replace("/","\\",BB_PLUGIN_DIR),str_replace("/","\\",BB_CORE_PLUGIN_DIR)),array("user#","core#"),__FILE__),'edit_history_create_table'); 
    2323 
    2424function edit_history_init() { 
     
    5252        <?php $link=get_user_name($edit->user_id); //  user_profile_link($id) ?> 
    5353        <div><span style="background:#eeee00;">&nbsp;<?php printf( __('Edited %s ago by %s'), bb_since($edit->time), $link); ?>&nbsp;</span></div> 
    54         <div class="post"><?php  echo balanceTags(apply_filters( 'post_text', edit_history_visual($bb_post->post_text, $newer), $bb_post->post_id),true); ?></div> 
     54        <div class="post"><?php  echo force_balance_tags(apply_filters( 'post_text', edit_history_visual($bb_post->post_text, $newer), $bb_post->post_id)); ?></div> 
    5555        <div class="poststuff"><?php printf( __('Edited %s ago by %s'), bb_since($edit->time), $link); ?></div> 
    5656</div> 
     
    131131function edit_history_visual($old, $new) { 
    132132        $diff = edit_history_diff(edit_history_split($old),edit_history_split($new)); 
    133         // echo "<code>"; print_r($diff); echo "</code>"; 
     133        // if (bb_current_user_can('administrate')) {echo "<code>"; print_r($diff); echo "</code>";} 
    134134        foreach($diff as $k){ 
    135135                if (is_array($k)) { 
     
    138138                        if ($d && $i && str_replace("</p>","",$d)==str_replace("</p>","",$k['i'][0])) {$ret.=$k['i'][0]; unset($d); unset($k['i'][0]); $i=implode(' ',$k['i']);}         
    139139                        if ($d && $i && substr($d,-6)=="<br />" && substr($i,-6)=="<br />") {$d=substr($d,0,-6);}                        
     140                        // to do: strip end tags in $d that have no start tags as they will be in $i  - also for ending bbcode tags                      
     141                        // if ($d && $i) {$d=force_balance_tags(post_text($d));} 
    140142                        $ret .= (!empty($d)?"<del style='background:#ffdddd;'>".str_replace("<p>","</del><p><del style='background:#ffdddd;'>",$d)."</del> ":''). 
    141143                                (!empty($i)?"<ins style='text-decoration:none; background:#ddFFdd;'>".str_replace("<p>","</ins><p><ins style='text-decoration:none; background:#ddFFdd;'>",$i)."</ins> ":'');