本文整理匯總了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);
}