示例#1
0
 /**
  * Show inline difference between two versions
  */
 public function action_diff()
 {
     Kohana::$log->add(Kohana::DEBUG, 'Executing Controller_Admin_Article::action_diff');
     $this->template->content = View::factory('blog/admin/article_diff')->bind('article', $this->_resource)->bind('ver1', $ver1)->bind('ver2', $ver2)->bind('diff', $diff);
     // Bind locally
     $article =& $this->_resource;
     $ver1 = $this->request->param('ver1');
     $ver2 = $this->request->param('ver2');
     // Get versions of the text
     $article->version($ver2);
     $new_text = $article->text;
     $article->version($ver1);
     $old_text = $article->text;
     $diff = Versioned::inline_diff($old_text, $new_text);
 }
示例#2
0
 /**
  * Test inline comparison
  */
 public function testInlineComparison()
 {
     $diff = Versioned::inline_diff($this->text1, $this->text2);
     $this->assertRegExp('/<ins>unoriginal<\\/ins>/', $diff);
     $this->assertRegExp('/<del>original<\\/del>/', $diff);
 }