本文整理汇总了PHP中html_diff函数的典型用法代码示例。如果您正苦于以下问题:PHP html_diff函数的具体用法?PHP html_diff怎么用?PHP html_diff使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_diff函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<head><style>' . file_get_contents(dirname(dirname(dirname(__DIR__))) . '/res/css/diff.css') . '</style></head>');
$sourceFile = $input->getArgument('pathSource');
$targetFile = $input->getArgument('pathCompare');
$sourceCode = explode("\n", file_get_contents($sourceFile));
$targetCode = explode("\n", file_get_contents($targetFile));
array_shift($sourceCode);
array_shift($targetCode);
$output->write(html_diff(join("\n", $sourceCode), join("\n", $targetCode)));
}
示例2: _tpl_act_changes
function _tpl_act_changes(&$event, $param)
{
global $TEXT;
global $PRE;
global $SUF;
if ('changes' != $event->data) {
return;
}
html_edit($TEXT);
echo '<br id="scroll__here" />';
html_diff(con($PRE, $TEXT, $SUF));
$event->preventDefault();
return;
}
示例3: diff
public function diff()
{
// dump($sourceDocument);
// Source = 3 ; target = 2
$sourceData = json_decode($source->content);
$targetData = json_decode($target->content);
$diff = array();
$diff['title'] = html_diff($sourceData->title, $targetData->title, true);
$diff['permalink'] = html_diff($sourceData->permalink, $targetData->permalink, true);
$diff['intro'] = html_diff($sourceData->intro, $targetData->intro);
// $diff['state'] = html_diff($sourceData->state,$targetData->state, true);
// TODO: get category title
$sourceCategory = EB::table('Category');
$sourceCategory->load($sourceData->category_id);
$diff['source_category_title'] = $sourceCategory->title;
$targetCategory = EB::table('Category');
$targetCategory->load($targetData->category_id);
$diff['diff_category_title'] = $targetCategory->title;
return $diff;
}
示例4: tpl_content_core
/**
* Default Action of TPL_ACT_RENDER
*
* @return bool
*/
function tpl_content_core()
{
global $ACT;
global $TEXT;
global $PRE;
global $SUF;
global $SUM;
global $IDX;
global $INPUT;
switch ($ACT) {
case 'show':
html_show();
break;
/** @noinspection PhpMissingBreakStatementInspection */
/** @noinspection PhpMissingBreakStatementInspection */
case 'locked':
html_locked();
case 'edit':
case 'recover':
html_edit();
break;
case 'preview':
html_edit();
html_show($TEXT);
break;
case 'draft':
html_draft();
break;
case 'search':
html_search();
break;
case 'revisions':
html_revisions($INPUT->int('first'));
break;
case 'diff':
html_diff();
break;
case 'recent':
html_recent($INPUT->extract('first')->int('first'), $INPUT->str('show_changes'));
break;
case 'index':
html_index($IDX);
#FIXME can this be pulled from globals? is it sanitized correctly?
break;
case 'backlink':
html_backlinks();
break;
case 'conflict':
html_conflict(con($PRE, $TEXT, $SUF), $SUM);
html_diff(con($PRE, $TEXT, $SUF), false);
break;
case 'login':
html_login();
break;
case 'register':
html_register();
break;
case 'resendpwd':
html_resendpwd();
break;
case 'denied':
print p_locale_xhtml('denied');
break;
case 'profile':
html_updateprofile();
break;
case 'admin':
tpl_admin();
break;
case 'subscribe':
tpl_subscribe();
break;
case 'media':
tpl_media();
break;
default:
$evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
if ($evt->advise_before()) {
msg("Failed to handle command: " . hsc($ACT), -1);
}
$evt->advise_after();
unset($evt);
return false;
}
return true;
}
示例5: tpl_content_core
function tpl_content_core()
{
global $ACT;
global $TEXT;
global $PRE;
global $SUF;
global $SUM;
global $IDX;
switch ($ACT) {
case 'show':
html_show();
break;
case 'locked':
html_locked();
case 'edit':
case 'recover':
html_edit();
break;
case 'preview':
html_edit();
html_show($TEXT);
break;
case 'draft':
html_draft();
break;
case 'search':
html_search();
break;
case 'revisions':
$first = isset($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
html_revisions($first);
break;
case 'diff':
html_diff();
break;
case 'recent':
if (is_array($_REQUEST['first'])) {
$_REQUEST['first'] = array_keys($_REQUEST['first']);
$_REQUEST['first'] = $_REQUEST['first'][0];
}
$first = is_numeric($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
html_recent($first);
break;
case 'index':
html_index($IDX);
#FIXME can this be pulled from globals? is it sanitized correctly?
break;
case 'backlink':
html_backlinks();
break;
case 'conflict':
html_conflict(con($PRE, $TEXT, $SUF), $SUM);
html_diff(con($PRE, $TEXT, $SUF), false);
break;
case 'login':
html_login();
break;
case 'register':
html_register();
break;
case 'resendpwd':
html_resendpwd();
break;
case 'denied':
print p_locale_xhtml('denied');
break;
case 'profile':
html_updateprofile();
break;
case 'admin':
tpl_admin();
break;
case 'subscribe':
tpl_subscribe();
break;
default:
$evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
if ($evt->advise_before()) {
msg("Failed to handle command: " . hsc($ACT), -1);
}
$evt->advise_after();
unset($evt);
return false;
}
return true;
}
示例6: html_diff
be added after it.
This paragraph contains
important new additions
to this document.';
echo '
<style type="text/css">
.ins { background: #cfc; }
.del { background: #fcc; }
ins { background: #9f9; }
del { background: #f99; }
hr { background: none; border: none; border-top: 2px dotted #000; color: #fff; }
</style>
<pre>
';
echo html_diff($original, $updated);
function html_diff($old, $new)
{
$diff = simpleDiff::diff_to_array(false, $old, $new, 1);
$out = '<table class="diff">';
$prev = key($diff);
foreach ($diff as $i => $line) {
if ($i > $prev + 1) {
$out .= '<tr><td colspan="5" class="separator"><hr /></td></tr>';
}
list($type, $old, $new) = $line;
$class1 = $class2 = '';
$t1 = $t2 = '';
if ($type == simpleDiff::INS) {
$class2 = 'ins';
$t2 = '+';
示例7: ws_display
//.........这里部分代码省略.........
<td>
<a title="View host. ID: {$old_host['id']}"
class="nav"
onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_host\\', \\'host_id=>{$old_host['id']}\\', \\'display\\')');"
>{$old_host['name']}</a
>.<a title="View domain. ID: {$old_host['domain_id']}"
class="domain"
onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_domain\\', \\'domain_id=>{$old_host['domain_id']}\\', \\'display\\')');"
>{$old_host['domain_fqdn']}</a>
</td>
</tr>
<tr>
<td style="font-weight: bold;">Insert date:</td>
<td>{$old['ctime']}</td>
</tr>
<tr>
<td style="font-weight: bold;">Config type:</td>
<td>{$old['config_type_name']}</td>
</tr>
<tr>
<td style="font-weight: bold;">MD5:</td>
<td>{$old['md5_checksum']}</td>
</tr>
<tr>
<td style="font-weight: bold;">Actions:</td>
<td>
<a title="View config"
class="nav"
onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'{$window_name}\\', \\'host_id=>{$old_host['id']},displayconf=>{$old['id']}\\', \\'display\\')');"
><img src="{$images}/silk/zoom.png" alt="View config" border="0"></a>
<a title="Download config" class="act" target="null" href="{$baseURL}/config_dnld.php?config_id={$old['id']}&download=1"
><img src="{$images}/silk/disk.png" alt="Download config" border="0"></a>
</td>
</tr>
</table>
</td>
<td align="left" style="background-color: {$color['bar_bg']};">
<table cellspacing="0" border="0" cellpadding="2" align="left" style="font-size:small;">
<tr>
<td style="font-weight: bold;">Host:</td>
<td>
<a title="View host. ID: {$new_host['id']}"
class="nav"
onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_host\\', \\'host_id=>{$new_host['id']}\\', \\'display\\')');"
>{$new_host['name']}</a
>.<a title="View domain. ID: {$new_host['domain_id']}"
class="domain"
onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'display_domain\\', \\'domain_id=>{$new_host['domain_id']}\\', \\'display\\')');"
>{$new_host['domain_fqdn']}</a>
</td>
</tr>
<tr>
<td style="font-weight: bold;">Insert date:</td>
<td>{$new['ctime']}</td>
</tr>
<tr>
<td style="font-weight: bold;">Config type:</td>
<td>{$new['config_type_name']}</td>
</tr>
<tr>
<td style="font-weight: bold;">MD5:</td>
<td>{$new['md5_checksum']}</td>
</tr>
<tr>
<td style="font-weight: bold;">Actions:</td>
<td>
<a title="View config"
class="nav"
onClick="xajax_window_submit('work_space', 'xajax_window_submit(\\'{$window_name}\\', \\'host_id=>{$new_host['id']},displayconf=>{$new['id']}\\', \\'display\\')');"
><img src="{$images}/silk/zoom.png" alt="View config" border="0"></a>
<a title="Download config" class="act" target="null" href="{$baseURL}/config_dnld.php?config_id={$new['id']}&download=1"
><img src="{$images}/silk/disk.png" alt="Download config" border="0"></a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
EOL;
// Display the diff
$html .= html_diff(html_entity_decode($old['config_body'], ENT_QUOTES, $conf['php_charset']), html_entity_decode($new['config_body'], ENT_QUOTES, $conf['php_charset']), "Config A", "Config B", 0);
$html .= <<<EOL
</td>
</tr>
</table>
</div>
EOL;
}
// Insert the new html into the window
// Instantiate the xajaxResponse object
$response = new xajaxResponse();
$response->addAssign("work_space_content", "innerHTML", $html);
if ($js) {
$response->addScript($js);
}
return $response->getXML();
}
示例8: diff
/**
* Displays a comparison of two versions for the blog post
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function diff()
{
require JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/htmldiff/html_diff.php';
// Only allow logged in users on this page
EB::requireLogin();
//Get revision table
$Revision = EB::table('Revision');
// get blogid
$versionId = JRequest::getVar('id', '');
$postId = JRequest::getVar('post_id', '');
//Load the version for the blog post
$currentBlog = $Revision->getCurrentBlog($postId);
$compareBlog = $Revision->getCompareBlog($versionId);
$currentData = json_decode($currentBlog->params);
$compareData = json_decode($compareBlog->params);
$diff = html_diff($currentData->intro, $compareData->intro, true);
// Get category title
$category = EB::table('Category');
$category->load($currentData->category_id);
$dataArr = array();
$dataArr['catOld'] = $category->title;
$category->load($compareData->category_id);
$dataArr['catNew'] = $category->title;
$this->set('currentData', $currentData);
$this->set('compareData', $compareData);
$this->set('dataArr', $dataArr);
$this->set('diff', $diff);
$this->set('blogId', $postId);
$this->set('versionId', $versionId);
echo parent::display('dashboard/version/compare');
}
示例9: write_rss2
write_rss2();
} elseif (in_array($_GET['dl'], $arrowdesc, true)) {
draw_arrow($_GET['dl']);
}
}
html_header();
html_style();
html_breadcrumbs();
html_pages();
if (isset($_GET['p'])) {
html_spacer();
html_summary($_GET['p']);
html_spacer();
if ($_GET['a'] == "commitdiff") {
html_title("diff --git {$_GET['p']} {$_GET['h']}");
html_diff($_GET['p'], $_GET['h']);
} elseif (isset($_GET['tr'])) {
html_title("Files");
html_browse($_GET['p']);
}
} else {
html_spacer();
html_home();
}
html_title("Help");
if (isset($_GET['p'])) {
html_help($_GET['p']);
} else {
html_help("projectname.git ");
}
html_footer();
示例10: git_render_page
function git_render_page()
{
global $git_embed, $repos;
$git_embed = true;
/* Add the default css */
$git_css = true;
/* Add the git logo in the footer */
$git_logo = true;
$title = "git";
$repo_index = "index.aux";
$repo_directory = '/home/david/git/';
$geshi_directory = '/home/david/src/mediawiki/extensions/SyntaxHighlight_GeSHi/geshi';
//if git is not installed into standard path, we need to set the path
$mypath = getenv("PATH");
$addpath = "/usr/lib/git-core";
if (isset($mypath)) {
$mypath .= ":{$addpath}";
} else {
$mypath = $addpath;
}
putenv("PATH={$mypath}");
//repos could be made by an embeder script
if (!is_array($repos)) {
$repos = array();
}
if (file_exists($repo_index)) {
$r = file($repo_index);
foreach ($r as $repo) {
$repos[] = trim($repo);
}
} else {
if (file_exists($repo_directory) && is_dir($repo_directory)) {
if ($handle = opendir($repo_directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
/* TODO: Check for valid git repos */
$repos[] = trim($repo_directory . $file);
}
}
closedir($handle);
}
}
}
sort($repos);
if ($geshi_directory != '') {
require "{$geshi_directory}/geshi.php";
}
if (!isset($git_embed) && $git_embed != true) {
$git_embed = false;
}
foreach ($_GET as $var => $val) {
$_GET[$var] = str_replace(";", "", $_GET[$var]);
}
$str = '';
if (isset($_GET['dl'])) {
if ($_GET['dl'] == 'targz') {
write_targz(get_repo_path($_GET['p']));
} else {
if ($_GET['dl'] == 'zip') {
write_zip(get_repo_path($_GET['p']));
} else {
if ($_GET['dl'] == 'git_logo') {
write_git_logo();
} else {
if ($_GET['dl'] == 'plain') {
write_plain();
} else {
if ($_GET['dl'] == 'rss2') {
write_rss2();
}
}
}
}
}
}
$str .= html_header($title);
$str .= html_style($git_css);
$str .= html_breadcrumbs();
if (isset($_GET['p'])) {
$str .= html_spacer();
$str .= html_desc($_GET['p']);
$str .= html_spacer();
$str .= html_summary($_GET['p']);
$str .= html_spacer();
if ($_GET['a'] == "commitdiff") {
$str .= html_diff($_GET['p'], $_GET['c'], $_GET['cp']);
} else {
$str .= html_browse($_GET['p']);
}
} else {
$str .= html_spacer();
$str .= html_home($repos);
}
$str .= html_footer($git_logo);
return $str;
}
示例11: foreach
$curRev = $index;
break;
}
}
}
// Get the source for the active revision
foreach ($revisions[$curRev]['files'] as $file => $url) {
$gistSource[$file]['cur'] = curl($url);
// Get the source for the previous revision (for diffing)
$gistSource[$file]['prev'] = '';
if ($curRev < count($revisions) - 1) {
$gistSource[$file]['prev'] = curl($revisions[$curRev + 1]['files'][$file]);
}
// Diff the two
$diff = simpleDiff::diff($gistSource[$file]['prev'], $gistSource[$file]['cur']);
$gistSource[$file]['diff'] = html_diff($gistSource[$file]['prev'], $gistSource[$file]['cur']);
}
//print_r($gistSource);
//echo '<pre>' . print_r($gistSource, true) . '</pre>';
}
}
// Make sure there is no whitespace before first HTML code
// so we don't trigger Quirks mode
?>
<!DOCTYPE html>
<html>
<head>
<title>GistPad</title>
<!--
Copyright (c) 2010 Brandon Williams