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


PHP Diff::Render方法代码示例

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


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

示例1: compareVersions

 /**
  * Show difference between two versions.
  *
  * @param  \App\Version
  * @param  \App\Version
  * @return void
  */
 protected function compareVersions(Version $before, Version $after)
 {
     // Parse source
     $beforeArray = explode("\n", $before->source);
     $afterArray = explode("\n", $after->source);
     // Compare versions
     $diff = new \Diff($beforeArray, $afterArray, $options = []);
     // Load view
     return view('version.compare', ['title' => _('Versions'), 'subtitle' => _('Compare'), 'before' => $before, 'after' => $after, 'sideBySideDiff' => $diff->Render(new \Diff_Renderer_Html_SideBySide()), 'inlineDiff' => $diff->render(new \Diff_Renderer_Html_Inline())]);
 }
开发者ID:superdol,项目名称:Wiki,代码行数:17,代码来源:VersionController.php

示例2: diff

function diff($path, $action, $title, $content)
{
    $Head = '<meta name="robots" content="noindex, nofollow" />';
    $content['PageNav']->Active("Page History");
    if (is_numeric($action[1])) {
        $pageQuery = mysql_query("SELECT `PageID`,`AccountID`,`EditTime`,`Name`,`Description`,`Title`,`Content` FROM `Wiki_Edits` WHERE `ID`='{$action['1']}' and `Archived` = 0");
        list($PageID, $AccountID, $PageEditTime, $PageName, $PageDescription, $PageTitle, $pageContent) = mysql_fetch_array($pageQuery);
        $previousQuery = mysql_query("Select `ID`, `Content` from `Wiki_Edits` where `ID` < '{$action['1']}' and `PageID`='{$PageID}' and `Archived` = 0 order by `ID` desc limit 1");
        list($previousID, $previousContent) = mysql_fetch_array($previousQuery);
        $nextQuery = mysql_query("Select `ID` from `Wiki_Edits` where `ID` > '{$action['1']}' and `PageID`='{$PageID}' and `Archived` = 0 order by `ID` limit 1");
        list($nextID) = mysql_fetch_array($nextQuery);
        if (!empty($previousID)) {
            $previousPath = FormatPath("/{$path}/?diff/{$previousID}");
            $content['Title'] = "<a href='{$previousPath}' title='Previous Revision'>⟨</a> ";
        }
        $content['Title'] .= FishFormat($PageTitle);
        if (!empty($nextID)) {
            $nextPath = FormatPath("/{$path}/?diff/{$nextID}");
            $content['Title'] .= " <a href='{$nextPath}' title='Next Revision'>⟩</a>";
        }
        $content['Body'] .= <<<JavaScript
        
        <script>
            \$(document).ready(function ()
            {
                \$('body').on('keydown', function(event)
                {
                    event.stopImmediatePropagation()
                    
                    if(event.keyCode == 37) // Previous
                        location.href = '{$previousPath}';
                    else if(event.keyCode == 39) // Next
                        location.href = '{$nextPath}';
                });
            });
        </script>
JavaScript;
        $old = explode("\n", html_entity_decode($previousContent, ENT_QUOTES));
        $new = explode("\n", html_entity_decode($pageContent, ENT_QUOTES));
        // Initialize the diff class
        $diff = new Diff($old, $new);
        require_once dirname(__FILE__) . '/../libraries/Diff/Renderer/Html/SideBySide.php';
        $renderer = new Diff_Renderer_Html_SideBySide();
        $content['Body'] .= $diff->Render($renderer);
        date_default_timezone_set('America/New_York');
        $PageEditTime = formatTime($PageEditTime);
        $content['Footer'] = "This page is an old revision made by <b><a href='/names?id={$AccountID}'>{$PageName}</a></b> on {$PageEditTime}.";
        if ($PageDescription) {
            $content['Footer'] .= "<br />'{$PageDescription}'";
        }
    }
    return array($title, $content);
}
开发者ID:kelsh,项目名称:classic,代码行数:53,代码来源:diff.php

示例3: isset

 /**
  * Wrapper function to get differences
  *
  * @return	string	Diff data
  */
 function get_diff($str1, $str2, $type = 'side_by_side')
 {
     $type = isset($this->diff_types[$type]) ? $this->diff_types[$type] : current($this->diff_types);
     #		require_once $this->module_path.'Diff.php';
     // Options for generating the diff
     $options = [];
     //Prepare content
     $str1 = explode("\n", $str1);
     $str2 = explode("\n", $str2);
     // Initialize the diff class
     $diff = new Diff($str1, $str2, $options);
     #		require_once $this->module_path.'Diff/Renderer/Html/'.$type.'.php';
     $diff_type_class = 'Diff_Renderer_Html_' . $type;
     $renderer = new $diff_type_class();
     return $this->custom_style() . $diff->Render($renderer);
 }
开发者ID:yfix,项目名称:yf,代码行数:21,代码来源:yf_diff.class.php

示例4: process_ajax

 public function process_ajax()
 {
     $a = __Request::get('a');
     $b = __Request::get('b');
     $it = org_glizy_objectFactory::createModelIterator('org.glizycms.core.models.Content');
     $it->where("document_detail_id", $a)->allStatuses();
     $ar_a = $it->first();
     $it = org_glizy_objectFactory::createModelIterator('org.glizycms.core.models.Content');
     $it->where("document_detail_id", $b)->allStatuses();
     $ar_b = $it->first();
     $a = explode("\n", str_replace("<\\/p>", "<\\/p>\n", json_encode(json_decode($ar_a->document_detail_object), JSON_PRETTY_PRINT)));
     $b = explode("\n", str_replace("<\\/p>", "<\\/p>\n", json_encode(json_decode($ar_b->document_detail_object), JSON_PRETTY_PRINT)));
     glz_importLib('Diff/Diff.php');
     glz_importLib('Diff/Diff/Renderer/Html/SideBySide.php');
     // Options for generating the diff
     $options = array();
     $diff = new Diff($a, $b, $options);
     $renderer = new Diff_Renderer_Html_SideBySide();
     $result = $diff->Render($renderer);
     return array('html' => $result);
 }
开发者ID:GruppoMeta,项目名称:Movio,代码行数:21,代码来源:ShowHistory.php

示例5: wfFunc_diff

 public static function wfFunc_diff()
 {
     if (preg_match('/[\'\\"<>\\!\\{\\}\\(\\)\\&\\@\\%\\$\\*\\+\\[\\]\\?]+/', $_GET['file'])) {
         echo "File contains illegal characters.";
         exit;
     }
     $result = self::getWPFileContent($_GET['file'], $_GET['cType'], $_GET['cName'], $_GET['cVersion']);
     if (isset($result['errorMsg']) && $result['errorMsg']) {
         echo wp_kses($result['errorMsg'], array());
         exit(0);
     } else {
         if (!$result['fileContent']) {
             echo "We could not get the contents of the original file to do a comparison.";
             exit(0);
         }
     }
     $localFile = realpath(ABSPATH . '/' . preg_replace('/^[\\.\\/]+/', '', $_GET['file']));
     $localContents = file_get_contents($localFile);
     if ($localContents == $result['fileContent']) {
         $diffResult = '';
     } else {
         $diff = new Diff(preg_split("/(?:\r\n|\n)/", $result['fileContent']), preg_split("/(?:\r\n|\n)/", $localContents), array());
         $renderer = new Diff_Renderer_Html_SideBySide();
         $diffResult = $diff->Render($renderer);
     }
     require 'diffResult.php';
     exit(0);
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:28,代码来源:wordfenceClass.php

示例6: historyAction

 /**
  * Shows the latest modification made to a post
  */
 public function historyAction($id = 0)
 {
     $this->view->disable();
     /**
      * Find the post using get
      */
     $post = Posts::findFirstById($id);
     if (!$post) {
         $this->flashSession->error('The discussion does not exist');
         return $this->response->redirect();
     }
     $a = explode("\n", $post->content);
     $first = true;
     $parameters = ['posts_id = ?0', 'bind' => [$post->id], 'order' => 'created_at DESC'];
     /** @var PostsHistory[] $postHistories */
     $postHistories = PostsHistory::find($parameters);
     if (count($postHistories) > 1) {
         foreach ($postHistories as $postHistory) {
             if ($first) {
                 $first = false;
                 continue;
             }
             break;
         }
     } else {
         $postHistory = $postHistories->getFirst();
     }
     if (is_object($postHistory)) {
         $b = explode("\n", $postHistory->content);
         $diff = new \Diff($b, $a, []);
         $renderer = new \Diff_Renderer_Html_SideBySide();
         echo $diff->Render($renderer);
     } else {
         $this->flash->notice('No history available to show');
     }
 }
开发者ID:kjmtrue,项目名称:forum,代码行数:39,代码来源:DiscussionsController.php

示例7: PHPDiff

 /**
  * Show diff using php (optional)
  *
  */
 function PHPDiff($compiled, $css, $force = false)
 {
     if (!$force && isset($_COOKIE['phpdiff']) && $_COOKIE['phpdiff'] == 0) {
         return;
     }
     $compiled = explode("\n", $compiled);
     $css = explode("\n", $css);
     $options = array();
     $diff = new Diff($compiled, $css, $options);
     $renderer = new Diff_Renderer_Html_SideBySide();
     //$renderer = new Diff_Renderer_Html_Inline();
     echo $diff->Render($renderer);
     //show the full contents
     /*
     if( isset($_GET['file']) ){
     	echo '</table>';
     	echo '<table style="width:100%"><tr><td>';
     	echo '<pre>';
     	echo implode("\n",$compiled);
     	echo '</pre>';
     	echo '</td><td>';
     	echo '<pre>';
     	echo implode("\n",$css);
     	echo '</pre>';
     	echo '</td></tr></table>';
     }
     */
 }
开发者ID:kevcom,项目名称:scheduler,代码行数:32,代码来源:index.php

示例8: compare

 /**
  * Compare versions
  */
 public function compare()
 {
     $strBuffer = '';
     $arrVersions = array();
     $intTo = 0;
     $intFrom = 0;
     $objVersions = $this->Database->prepare("SELECT * FROM tl_version WHERE pid=? AND fromTable=? ORDER BY version DESC")->execute($this->intPid, $this->strTable);
     if ($objVersions->numRows < 2) {
         $strBuffer = '<p>There are no versions of ' . $this->strTable . '.id=' . $this->intPid . '</p>';
     } else {
         $intIndex = 0;
         $from = array();
         // Store the versions and mark the active one
         while ($objVersions->next()) {
             if ($objVersions->active) {
                 $intIndex = $objVersions->version;
             }
             $arrVersions[$objVersions->version] = $objVersions->row();
             $arrVersions[$objVersions->version]['info'] = $GLOBALS['TL_LANG']['MSC']['version'] . ' ' . $objVersions->version . ' (' . \Date::parse(\Config::get('datimFormat'), $objVersions->tstamp) . ') ' . $objVersions->username;
         }
         // To
         if (\Input::post('to') && isset($arrVersions[\Input::post('to')])) {
             $intTo = \Input::post('to');
             $to = deserialize($arrVersions[\Input::post('to')]['data']);
         } elseif (\Input::get('to') && isset($arrVersions[\Input::get('to')])) {
             $intTo = \Input::get('to');
             $to = deserialize($arrVersions[\Input::get('to')]['data']);
         } else {
             $intTo = $intIndex;
             $to = deserialize($arrVersions[$intTo]['data']);
         }
         // From
         if (\Input::post('from') && isset($arrVersions[\Input::post('from')])) {
             $intFrom = \Input::post('from');
             $from = deserialize($arrVersions[\Input::post('from')]['data']);
         } elseif (\Input::get('from') && isset($arrVersions[\Input::get('from')])) {
             $intFrom = \Input::get('from');
             $from = deserialize($arrVersions[\Input::get('from')]['data']);
         } elseif ($intIndex > 1) {
             $intFrom = $intIndex - 1;
             $from = deserialize($arrVersions[$intFrom]['data']);
         }
         // Only continue if both version numbers are set
         if ($intTo > 0 && $intFrom > 0) {
             \System::loadLanguageFile($this->strTable);
             $this->loadDataContainer($this->strTable);
             // Get the order fields
             $objDcaExtractor = \DcaExtractor::getInstance($this->strTable);
             $arrOrder = $objDcaExtractor->getOrderFields();
             // Find the changed fields and highlight the changes
             foreach ($to as $k => $v) {
                 if ($from[$k] != $to[$k]) {
                     if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['inputType'] == 'password' || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['doNotShow'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['hideInput']) {
                         continue;
                     }
                     $blnIsBinary = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['inputType'] == 'fileTree' || in_array($k, $arrOrder);
                     // Decrypt the values
                     if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['encrypt']) {
                         $to[$k] = \Encryption::decrypt($to[$k]);
                         $from[$k] = \Encryption::decrypt($from[$k]);
                     }
                     // Convert serialized arrays into strings
                     if (is_array($tmp = deserialize($to[$k])) && !is_array($to[$k])) {
                         $to[$k] = $this->implodeRecursive($tmp, $blnIsBinary);
                     }
                     if (is_array($tmp = deserialize($from[$k])) && !is_array($from[$k])) {
                         $from[$k] = $this->implodeRecursive($tmp, $blnIsBinary);
                     }
                     unset($tmp);
                     // Convert binary UUIDs to their hex equivalents (see #6365)
                     if ($blnIsBinary && \Validator::isBinaryUuid($to[$k])) {
                         $to[$k] = \String::binToUuid($to[$k]);
                     }
                     if ($blnIsBinary && \Validator::isBinaryUuid($from[$k])) {
                         $to[$k] = \String::binToUuid($from[$k]);
                     }
                     // Convert date fields
                     if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['rgxp'] == 'date') {
                         $to[$k] = \Date::parse(\Config::get('dateFormat'), $to[$k] ?: '');
                         $from[$k] = \Date::parse(\Config::get('dateFormat'), $from[$k] ?: '');
                     } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['rgxp'] == 'time') {
                         $to[$k] = \Date::parse(\Config::get('timeFormat'), $to[$k] ?: '');
                         $from[$k] = \Date::parse(\Config::get('timeFormat'), $from[$k] ?: '');
                     } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['rgxp'] == 'datim' || $k == 'tstamp') {
                         $to[$k] = \Date::parse(\Config::get('datimFormat'), $to[$k] ?: '');
                         $from[$k] = \Date::parse(\Config::get('datimFormat'), $from[$k] ?: '');
                     }
                     // Convert strings into arrays
                     if (!is_array($to[$k])) {
                         $to[$k] = explode("\n", $to[$k]);
                     }
                     if (!is_array($from[$k])) {
                         $from[$k] = explode("\n", $from[$k]);
                     }
                     $objDiff = new \Diff($from[$k], $to[$k]);
                     $strBuffer .= $objDiff->Render(new DiffRenderer(array('field' => $GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['label'][0] ?: (isset($GLOBALS['TL_LANG']['MSC'][$k]) ? is_array($GLOBALS['TL_LANG']['MSC'][$k]) ? $GLOBALS['TL_LANG']['MSC'][$k][0] : $GLOBALS['TL_LANG']['MSC'][$k] : $k))));
                 }
//.........这里部分代码省略.........
开发者ID:juergen83,项目名称:contao,代码行数:101,代码来源:Versions.php

示例9: diff

 public function diff($fid, $rid)
 {
     //load diff engine
     require_once dirname(APPPATH) . '/iu-application/libraries/diff/Diff.php';
     require_once dirname(APPPATH) . '/iu-application/libraries/diff/Diff/Renderer/Html/SideBySide.php';
     $file = File::factory()->get_by_id((int) $fid);
     $revision = FileRevision::factory()->get_by_id((int) $rid);
     $file_html = explode("\n", $file->contents());
     $revision_html = explode("\n", $revision->contents);
     $options = array('ignoreWhitespace' => true);
     $diff = new Diff($revision_html, $file_html, $options);
     $renderer = new Diff_Renderer_Html_SideBySide();
     $differences = $diff->Render($renderer);
     $this->templatemanager->assign("file", $file);
     $this->templatemanager->assign("revision", $revision);
     $this->templatemanager->assign("differences", $differences);
     $this->templatemanager->set_title("View Differences");
     $this->templatemanager->show_template("templates_diff");
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:19,代码来源:templates.php

示例10: foreach

</pre>
<?php 
}
?>


<?php 
if (PerchUtil::count($historical_logs) > 1 && $Action->resourceType() === LOG_REGION_TYPE) {
    echo $HTML->heading1('History');
    $i = 0;
    foreach ($historical_logs as $History) {
        if (isset($historical_logs[$i - 1])) {
            $a = explode("\n", $History->resourceModification());
            $b = explode("\n", $historical_logs[$i - 1]->resourceModification());
            $diff = new Diff($a, $b);
            $renderer = new Diff_Renderer_Html_SideBySide();
            $html = $diff->Render($renderer);
            if ($html) {
                echo '<div class="diff-table">';
                echo '<h2>' . $HTML->encode($Action->relativeTime() . ' by ' . $Action->userProperty('userUsername', 'N/A')) . '</h2>';
                echo $html;
                echo '</div>';
            }
        }
        $i++;
    }
}
?>

<?php 
echo $HTML->main_panel_end();
开发者ID:drewm,项目名称:Perch-Activity-Log,代码行数:31,代码来源:view.post.php

示例11: wiki_url

<?
require_once WIKI_PATH."/lib/Diff/Diff.php";
require_once WIKI_PATH."/lib/Diff/Renderer/Html/SideBySide.php";
$options = array(
	//'ignoreWhitespace' => true,
	//'ignoreCase' => true
);
if(wiki_is_euckr()) {
	$history['content'] = iconv("CP949", "UTF-8", $history['content']);
	$article['wr_content'] = iconv("CP949", "UTF-8", $article['wr_content']);
}
$history_content = explode("\n", $history['content']);
$current_content = explode("\n", $article['wr_content']);
$diff = new Diff($history_content, $current_content, $options);
$renderer = new Diff_Renderer_Html_SideBySide();
$diffData = $diff->Render($renderer);

if(wiki_is_euckr()) {
	$diffData = preg_replace_callback("/(<td(.*?)>)(.*?)(<\/td>)/s", create_function('$matches', 'return $matches[1].iconv("UTF-8", "CP949", $matches[3]).$matches[4];'), $diffData);
}

echo $diffData;
?>

<div class="clear" style="margin-top:10px">
	<div style="float:left">
		<span class="button"><a href="<?php 
echo wiki_url();
?>
">시작페이지</a></span>
		<span class="button"><a href="<?php 
开发者ID:J2paper,项目名称:narinwiki,代码行数:31,代码来源:diff.php

示例12: run

 /**
  * Run the controller
  */
 public function run()
 {
     $strBuffer = '';
     $arrVersions = array();
     $intTo = 0;
     $intFrom = 0;
     if (!Input::get('table') || !Input::get('pid')) {
         $strBuffer = 'Please provide the table name and PID';
     } else {
         $objVersions = $this->Database->prepare("SELECT * FROM tl_version WHERE pid=? AND fromTable=?" . (!$this->User->isAdmin ? " AND userid=?" : "") . " ORDER BY version DESC")->execute(Input::get('pid'), Input::get('table'), $this->User->id);
         if ($objVersions->numRows < 1) {
             $strBuffer = 'There are no versions of ' . Input::get('table') . '.id=' . Input::get('pid');
         } else {
             $intIndex = 0;
             $from = array();
             // Store the versions and mark the active one
             while ($objVersions->next()) {
                 if ($objVersions->active) {
                     $intIndex = $objVersions->version;
                 }
                 $arrVersions[$objVersions->version] = $objVersions->row();
                 $arrVersions[$objVersions->version]['info'] = $GLOBALS['TL_LANG']['MSC']['version'] . ' ' . $objVersions->version . ' (' . $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $objVersions->tstamp) . ') ' . $objVersions->username;
             }
             // To
             if (Input::get('to') && isset($arrVersions[Input::get('to')])) {
                 $intTo = Input::get('to');
                 $to = deserialize($arrVersions[Input::get('to')]['data']);
             } else {
                 $intTo = $intIndex;
                 $to = deserialize($arrVersions[$intTo]['data']);
             }
             // From
             if (Input::get('from') && isset($arrVersions[Input::get('from')])) {
                 $intFrom = Input::get('from');
                 $from = deserialize($arrVersions[Input::get('from')]['data']);
             } elseif ($intIndex > 1) {
                 $intFrom = $intIndex - 1;
                 $from = deserialize($arrVersions[$intFrom]['data']);
             }
             $this->loadLanguageFile(Input::get('table'));
             $this->loadDataContainer(Input::get('table'));
             $arrFields = $GLOBALS['TL_DCA'][Input::get('table')]['fields'];
             // Find the changed fields and highlight the changes
             foreach ($to as $k => $v) {
                 if ($from[$k] != $to[$k]) {
                     if (!isset($arrFields[$k]['inputType']) || $arrFields[$k]['inputType'] == 'password' || $arrFields[$k]['eval']['doNotShow'] || $arrFields[$k]['eval']['hideInput']) {
                         continue;
                     }
                     // Convert serialized arrays into strings
                     if (is_array($tmp = deserialize($to[$k])) && !is_array($to[$k])) {
                         $to[$k] = $this->implode($tmp);
                     }
                     if (is_array($tmp = deserialize($from[$k])) && !is_array($from[$k])) {
                         $from[$k] = $this->implode($tmp);
                     }
                     unset($tmp);
                     // Convert date fields
                     if ($arrFields[$k]['eval']['rgxp'] == 'date') {
                         $to[$k] = $this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $to[$k] ?: '');
                         $from[$k] = $this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $from[$k] ?: '');
                     } elseif ($arrFields[$k]['eval']['rgxp'] == 'time') {
                         $to[$k] = $this->parseDate($GLOBALS['TL_CONFIG']['timeFormat'], $to[$k] ?: '');
                         $from[$k] = $this->parseDate($GLOBALS['TL_CONFIG']['timeFormat'], $from[$k] ?: '');
                     } elseif ($arrFields[$k]['eval']['rgxp'] == 'datim') {
                         $to[$k] = $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $to[$k] ?: '');
                         $from[$k] = $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $from[$k] ?: '');
                     }
                     // Convert strings into arrays
                     if (!is_array($to[$k])) {
                         $to[$k] = explode("\n", $to[$k]);
                     }
                     if (!is_array($from[$k])) {
                         $from[$k] = explode("\n", $from[$k]);
                     }
                     $objDiff = new Diff($from[$k], $to[$k]);
                     $strBuffer .= $objDiff->Render(new Diff_Renderer_Html_Contao(array('field' => $arrFields[$k]['label'][0] ?: $k)));
                 }
             }
         }
     }
     // Identical versions
     if ($strBuffer == '') {
         $strBuffer = '<p>' . $GLOBALS['TL_LANG']['MSC']['identicalVersions'] . '</p>';
     }
     $this->Template = new BackendTemplate('be_diff');
     // Template variables
     $this->Template->content = $strBuffer;
     $this->Template->versions = $arrVersions;
     $this->Template->to = $intTo;
     $this->Template->from = $intFrom;
     $this->Template->fromLabel = 'Von';
     $this->Template->toLabel = 'Zu';
     $this->Template->showLabel = specialchars($GLOBALS['TL_LANG']['MSC']['showDifferences']);
     $this->Template->table = Input::get('table');
     $this->Template->pid = intval(Input::get('pid'));
     $this->Template->theme = $this->getTheme();
     $this->Template->base = Environment::get('base');
//.........这里部分代码省略.........
开发者ID:rikaix,项目名称:core,代码行数:101,代码来源:diff.php

示例13: wfFunc_diff

 public static function wfFunc_diff()
 {
     $result = self::getWPFileContent($_GET['file'], $_GET['cType'], $_GET['cName'], $_GET['cVersion']);
     if (isset($result['errorMsg']) && $result['errorMsg']) {
         echo htmlentities($result['errorMsg']);
         exit(0);
     } else {
         if (!$result['fileContent']) {
             echo "We could not get the contents of the original file to do a comparison.";
             exit(0);
         }
     }
     $localFile = realpath(ABSPATH . '/' . preg_replace('/^[\\.\\/]+/', '', $_GET['file']));
     $localContents = file_get_contents($localFile);
     if ($localContents == $result['fileContent']) {
         $diffResult = '';
     } else {
         $diff = new Diff(preg_split("/(?:\r\n|\n)/", $result['fileContent']), preg_split("/(?:\r\n|\n)/", $localContents), array());
         $renderer = new Diff_Renderer_Html_SideBySide();
         $diffResult = $diff->Render($renderer);
     }
     require 'diffResult.php';
     exit(0);
 }
开发者ID:verbazend,项目名称:AWFA,代码行数:24,代码来源:wordfenceClass.php

示例14: yf_autoloader

#!/usr/bin/php
<?php 
$config = ['git_urls' => ['https://github.com/yfix/php-diff.git' => 'php_diff/'], 'require_once' => ['php_diff/lib/Diff.php', 'php_diff/lib/Diff/Renderer/Html/SideBySide.php'], 'example' => function () {
    $str1 = explode(PHP_EOL, 'aaa' . PHP_EOL . '1');
    $str2 = explode(PHP_EOL, 'aaa' . PHP_EOL . 'av');
    $diff = new Diff($str1, $str2, $options);
    echo $diff->Render(new Diff_Renderer_Html_SideBySide());
    echo PHP_EOL;
}];
if ($return_config) {
    return $config;
}
require_once __DIR__ . '/_yf_autoloader.php';
new yf_autoloader($config);
开发者ID:yfix,项目名称:yf,代码行数:14,代码来源:php_diff.php

示例15: array

    require_once PACOWIKI_PLUGIN_PATH . 'library/Diff/Renderer/Html/Inline.php';
    require_once PACOWIKI_PLUGIN_PATH . 'library/Diff/Renderer/Html/SideBySide.php';
    $options = array('ignoreWhitespace' => false, 'ignoreCase' => false);
    // Initialize the diff class for title
    $diff = new Diff(array($new_title), array($old_title), $options);
    $renderer = new Diff_Renderer_Html_SideBySide();
    $diff_output = $diff->Render($renderer);
    if (empty($diff_output)) {
        echo '<p>' . __('No changes were found in wiki Title!', 'pacowiki') . '</p>';
    } else {
        echo '<h2>Title:</h2>';
        echo $diff_output;
    }
    $diff = new Diff($new_content, $old_content, $options);
    $renderer = new Diff_Renderer_Html_Inline();
    $diff_output = $diff->Render($renderer);
    if (empty($diff_output)) {
        echo '<p>' . __('No changes were found in wiki content!', 'pacowiki') . '</p>';
    } else {
        echo '<h2>Content:</h2>';
        echo $diff_output;
    }
} elseif ($view_revision) {
    // View an old revision
    ?>
			<header class="entry-header">
				<h1 class="entry-title"><?php 
    the_title();
    ?>
</h1>
			</header>
开发者ID:PacoWiki,项目名称:PacoWiki,代码行数:31,代码来源:single-pacowiki-history.php


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