本文整理汇总了PHP中Versioned::inline_diff方法的典型用法代码示例。如果您正苦于以下问题:PHP Versioned::inline_diff方法的具体用法?PHP Versioned::inline_diff怎么用?PHP Versioned::inline_diff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Versioned
的用法示例。
在下文中一共展示了Versioned::inline_diff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_diff
/**
* 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: testInlineComparison
/**
* 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);
}