当前位置: 首页>>代码示例>>PHP>>正文


PHP Diff::toTable方法代码示例

本文整理汇总了PHP中Diff::toTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Diff::toTable方法的具体用法?PHP Diff::toTable怎么用?PHP Diff::toTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Diff的用法示例。


在下文中一共展示了Diff::toTable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: empty

    }
}
?>
        </div>
        <?php 
if (!empty($oracle_says)) {
    ?>
        <div class="row">
          <div class="col-md-8 col-md-offset-2">
          <span><h3 style="text-align:center">YOU vs. ORACLE</h3></span>
          <div style="display:table;text-align:left;margin-left:auto;margin-right:auto">
            <?php 
    // include the Diff class
    require_once 'class.Diff.php';
    // output the result of comparing two files as a table
    echo Diff::toTable(Diff::compare(preg_replace('~\\R~u', "\n", empty($expected) ? '' : $expected), $oracle_says));
    ?>
          </div>
          </div>
        </div>
        <?php 
}
?>
        <div class="jumbotron" style="height:75%;position:relative;">
        <?php 
if (empty($error)) {
    ?>
        <form role="form" id="login-form" action="" method="POST" class="row">
        <div class="form-group col-md-6">
            <div class="input-group input-group-lg">
              <span class="input-group-addon">@</span>
开发者ID:rajiteh,项目名称:eecs3311-oracle,代码行数:31,代码来源:index.php

示例2: getDiff

 public function getDiff()
 {
     $fileNew = realpath($this->getFile());
     $fileOld = dirname(__DIR__) . '/../addons/files/local/' . $this->aid . '.zip';
     if (!is_file($fileOld)) {
         $path = realpath(dirname(__DIR__) . '/../addons/files/local/');
         $fh = fopen($path . '/' . $this->aid . '.zip', 'w');
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, "http://" . AWSFileManager::getBucket() . "/addons/" . $this->aid . "_1");
         curl_setopt($ch, CURLOPT_FILE, $fh);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         // this will follow redirects
         curl_exec($ch);
         curl_close($ch);
         fclose($fh);
     }
     $fileOld = realpath(dirname(__DIR__) . '/../addons/files/local/' . $this->aid . '.zip');
     $zipNew = new ZipArchive();
     $zipOld = new ZipArchive();
     $resNew = $zipNew->open($fileNew);
     $resOld = $zipOld->open($fileOld);
     if ($resNew === TRUE && $resOld === TRUE) {
         $newFiles = array();
         for ($i = 0; $i < $zipNew->numFiles; $i++) {
             $newFiles[] = $zipNew->getNameIndex($i);
         }
         $oldFiles = [];
         for ($i = 0; $i < $zipOld->numFiles; $i++) {
             $oldFiles[] = $zipOld->getNameIndex($i);
         }
         $added = array_diff($newFiles, $oldFiles);
         $removed = array_diff($oldFiles, $newFiles, ["glass.json", "version.json"]);
         $commonFiles = array_intersect($newFiles, $oldFiles);
         $commonFiles = array_diff($commonFiles, ["glass.json", "version.json"]);
         $diff = [];
         foreach ($commonFiles as $fi) {
             if (strpos($fi, ".cs") == strlen($fi) - 3) {
                 $newStr = $zipNew->getFromName($fi);
                 $oldStr = $zipOld->getFromName($fi);
                 if (trim($newStr) != trim($oldStr)) {
                     $diff[$fi] = Diff::toTable(Diff::compare($oldStr, $newStr));
                 }
             }
         }
         $ret = ["added" => $added, "removed" => $removed, "changes" => $diff];
         return $ret;
     } else {
         return false;
     }
 }
开发者ID:BlocklandGlass,项目名称:GlassWebsite,代码行数:50,代码来源:AddonUpdateObject.php

示例3: array

		<?php 
$input_array = array('id' => $args['content']->id);
$before = build_field_content_blockquote($input_array);
$input_array = array('id' => $args['content']->parent);
$after = build_field_content_blockquote($input_array);
foreach ($before as $key => $val) {
    ?>
		
		<blockquote class="content_field_blockquote">
			<div class="content_field">
				<label><?php 
    echo $val['field_name'];
    ?>
</label>
				<div class="content_field_value">
					<?php 
    $before_val = $val['field_val'];
    $after_val = $after[$key]['field_val'];
    echo Diff::toTable(Diff::compare($before_val, $after_val));
    ?>
				</div>
			</div>
		</blockquote>
		
		<?php 
}
?>

	</div>

</div>
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:31,代码来源:chapter_view.php

示例4: wiki_compare_page

function wiki_compare_page($arr)
{
    $pageUrlName = array_key_exists('pageUrlName', $arr) ? $arr['pageUrlName'] : '';
    $resource_id = array_key_exists('resource_id', $arr) ? $arr['resource_id'] : '';
    $currentCommit = array_key_exists('currentCommit', $arr) ? $arr['currentCommit'] : 'HEAD';
    $compareCommit = array_key_exists('compareCommit', $arr) ? $arr['compareCommit'] : null;
    if (!$compareCommit) {
        return array('message' => 'No compare commit was provided', 'success' => false);
    }
    $w = wiki_get_wiki($resource_id);
    if (!$w['path']) {
        return array('message' => 'Error reading wiki', 'success' => false);
    }
    $page_path = $w['path'] . '/' . $pageUrlName . '.md';
    if (is_readable($page_path) === true) {
        $reponame = array_key_exists('title', $w['wiki']) ? urlencode($w['wiki']['title']) : 'repo';
        if ($reponame === '') {
            $reponame = 'repo';
        }
        $git = new GitRepo('', null, false, $w['wiki']['title'], $w['path']);
        $compareContent = $currentContent = '';
        try {
            foreach ($git->git->tree($currentCommit) as $object) {
                if ($object['type'] == 'blob' && $object['file'] === $pageUrlName . '.md') {
                    $currentContent = $git->git->cat->blob($object['hash']);
                }
            }
            foreach ($git->git->tree($compareCommit) as $object) {
                if ($object['type'] == 'blob' && $object['file'] === $pageUrlName . '.md') {
                    $compareContent = $git->git->cat->blob($object['hash']);
                }
            }
            require_once 'library/class.Diff.php';
            $diff = Diff::toTable(Diff::compare($currentContent, $compareContent));
        } catch (\PHPGit\Exception\GitException $e) {
            return array('message' => 'GitRepo error thrown', 'success' => false);
        }
        return array('diff' => $diff, 'message' => '', 'success' => true);
    } else {
        return array('message' => 'Page file not writable', 'success' => false);
    }
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:42,代码来源:wiki.php

示例5: fopen

<?php

$email = $website_url = $handle = fopen("/opt/lampp/htdocs/{$email}/{$website_url}/change.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        $pieces = explode(" ", $line);
        $variable1 = $pieces[0];
        if ($variable1 == "Files") {
            $variable2 = $pieces[1];
            $variable3 = $pieces[3];
            ob_start();
            require_once '/opt/lampp/htdocs/project/class.Diff2.php';
            $d = Diff::toTable(Diff::compareFiles("{$variable2}", "{$variable3}"));
            echo "<iframe src='http://localhost/left.html' width='49%' height='100%'></iframe>";
            echo "<iframe src='http://localhost/right.html' width='49%' height='100%'></iframe>";
            require_once '/opt/lampp/htdocs/project/class.Diff.php';
            $d = Diff1::toTable(Diff1::compareFiles("{$variable2}", "{$variable3}"));
            echo $d;
            $content = ob_get_contents();
            ob_end_clean();
            $variable2 = str_replace("/", ".", $variable2);
            $variable3 = str_replace("/", ".", $variable3);
            $search = ".opt.lampp.htdocs.{$email}.{$website_url}.";
            $variable2 = str_replace($search, '', $variable2);
            $variable3 = str_replace($search, '', $variable3);
            file_put_contents("/opt/lampp/htdocs/{$email}/{$website_url}/diff/{$variable2}.{$variable3}.html", $content);
        } else {
            $variable1 = $pieces[2];
            $variable2 = $pieces[3];
            $variable1 = str_replace(":", "/", $variable1);
            $output1 = "cp {$variable1}{$variable2} /opt/lampp/htdocs/{$email}/{$website_url}/diff/";
开发者ID:sky56,项目名称:Web_Page_Change_Notification_System,代码行数:31,代码来源:ch.php

示例6: diff

 public function diff($snapshotId1, $snapshotId2)
 {
     $x = Snapshot::find($snapshotId1)->readNoTags();
     $y = Snapshot::find($snapshotId2)->readNoTags();
     $html = "<style>\n    \t\t.diffInserted{\n    \t\t\tborder: 1px solid rgb(192,255,192);\n    \t\t\tbackground: rgb(224,255,224);\n    \t\t}\n    \t\t.diffDeleted{\n    \t\t\tborder: 1px solid rgb(255,192,192);\n    \t\t\tbackground: rgb(255,224,224);\n    \t\t}\n    \t</style>";
     return $html . Diff::toTable(Diff::compare($x, $y));
 }
开发者ID:SimZal,项目名称:laracrawl,代码行数:7,代码来源:CrawlerController.php


注:本文中的Diff::toTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。