public function getTitleAddon() { if ($c = $this->getData('created')) { return 'Dołączył ' . getDiff($c, false); } return false; }
/** * Creates the array which contains two compared page versions * * @author Johannes Klose <*****@*****.**> * @param string $origText Original page text * @param string $finalText Final page text * @param array $versions All page versions * @return array Page differences **/ function makeDiff($origText, $finalText) { $finalText = preg_replace("/(\r\n|\r|\n)+/", "\n", $finalText); $origText = preg_replace("/(\r\n|\r|\n)/", "\n", $origText); $diff = getDiff($finalText, $origText); $origLines = explode("\n", $origText); $finalLines = explode("\n", $finalText); $lineCount = count($origLines) > count($finalLines) ? count($origLines) : count($finalLines); $origTextT = array(); $finalTextT = array(); $ol = 0; $fl = 0; for ($i = 0; $i <= $lineCount; $i++) { if (isset($diff[$i])) { $opType = $diff[$i][0]; $opVal = isset($diff[$i][1]) ? $diff[$i][1] : ''; if ($opType == '~') { $algo = levenshtein($origLines[$ol], $opVal); $length = (strlen($origLines[$ol]) + strlen($opVal)) / 2 * 0.5; if ($algo < $length) { $origTextT[] = array('type' => 'edit', 'line' => htmlentities($origLines[$ol])); $finalTextT[] = array('type' => 'edit', 'line' => htmlentities($opVal)); $ol++; $fl++; } else { $origTextT[] = array('type' => 'subs', 'line' => htmlentities($origLines[$ol])); $finalTextT[] = array('type' => 'add', 'line' => htmlentities($opVal)); $ol++; $fl++; } } elseif ($opType == '+') { $origTextT[] = array('type' => 'none', 'line' => ' '); $finalTextT[] = array('type' => 'add', 'line' => htmlentities($opVal)); $fl++; } else { $origTextT[] = array('type' => 'subs', 'line' => htmlentities($origLines[$ol])); $finalTextT[] = array('type' => 'none', 'line' => ' '); $ol++; } } else { if (isset($origLines[$ol])) { $origTextT[] = array('type' => 'none', 'line' => htmlentities($origLines[$ol])); $ol++; } if (isset($finalLines[$fl])) { $finalTextT[] = array('type' => 'none', 'line' => htmlentities($finalLines[$fl])); $fl++; } } } return array('orig' => $origTextT, 'final' => $finalTextT); }
<?php include 'header-title.php'; ?> <div class="row"> <?php $diff = getDiff(getPath(), getRev(), getRev2()); include 'breadcrumb.php'; ?> <?php /*<pre class="prettyprint linenums"><?php echo trim(htmlspecialchars($diff)); ?></pre>*/ ?> <div class="col-md-3"> <?php include 'modules/SingleDiffControl.php'; include 'modules/RevDiff.php'; include 'modules/goToTop.php'; ?> </div> <div class="col-md-9"> <?php if (!empty($diff)) { ?> <ul class="list-group"> <?php foreach ($diff as $key => $value) { if (substr($value, 0, 1) == "-") { ?>
?> <?endif?> </td> </tr> <? $tabControl->EndCustomField("DETAIL_PICTURE", ""); $tabControl->BeginCustomField("DETAIL_TEXT", GetMessage("IBLOCK_FIELD_DETAIL_TEXT"), $arIBlock["FIELDS"]["DETAIL_TEXT"]["IS_REQUIRED"] === "Y"); ?> <tr class="heading" id="tr_DETAIL_TEXT_LABEL"> <td colspan="2"><?echo $tabControl->GetCustomLabelHTML()?></td> </tr> <?if($ID && $PREV_ID && $bWorkflow):?> <tr id="tr_DETAIL_TEXT_DIFF"> <td colspan="2"> <div style="width:95%;background-color:white;border:1px solid black;padding:5px"> <?echo getDiff($prev_arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT"])?> </div> </td> </tr> <?elseif(COption::GetOptionString("iblock", "use_htmledit", "Y")=="Y" && $bFileman):?> <tr id="tr_DETAIL_TEXT_EDITOR"> <td colspan="2" align="center"> <?CFileMan::AddHTMLEditorFrame( "DETAIL_TEXT", $str_DETAIL_TEXT, "DETAIL_TEXT_TYPE", $str_DETAIL_TEXT_TYPE, array( 'height' => 450, 'width' => '100%' ),
} } } ?> </tr> <?php if (!empty($entities)) { foreach ($entities as $entity) { if (!$entity['enabled']) { continue; } echo "<tr class='data-node'>"; echo "<td class='status'><div class='status-div'></div></td>"; echo "<td class='time' data-time=" . (empty($entity['lastInsertDate']) ? "" : toTimestamp($entity['lastInsertDate'])) . ">" . (empty($entity['lastInsertDate']) ? "" : prepareDate($entity['lastInsertDate'])) . "</td>"; echo "<td class='diff' sorttable_customkey='" . (empty($entity['lastInsertDate']) ? "0" : toTimestamp($entity['lastInsertDate'])) . "'>" . (empty($entity['lastInsertDate']) ? "" : getDiff($date, toTimestamp($entity['lastInsertDate']))) . "</td>"; echo '<td><a href=javascript:redirect("' . rawurlencode($entity['name']) . '")>' . $entity['name'] . '</a></td>'; foreach ($orderedTags as $tagName) { if (!empty($entity['tags'][$tagName])) { echo "<td>" . $entity['tags'][$tagName] . "</td>"; } else { echo "<td></td>"; } } echo "</tr>"; } } ?> </table> <!-- Start of StatCounter Code --> <script type="text/javascript">
$ranking_position = array_search($nick, $top_scorers); } else { //redirect_to("http://wszechwiedzacy.pl/ranking"); } } // end of if/else session is logged in // make the user object that holds all information that is stored in database $user_exists = User::user_exists($nick); if ($user_exists) { $current_user = User::find_user($nick); $last = strtotime($current_user->last_activity); } else { $current_user = false; } // function displays last activity in polish $wynik = getDiff($last); $display_status = "nieaktywny"; if (time() - $last < 600) { $display_status = "aktywny"; } $sex = "ukryty"; // if sex was chosen if ($current_user->sex != 0) { $current_user->sex == 1 ? $sex = "kobieta" : ($sex = "mężczyzna"); } $wiek = "ukryty"; if ($current_user->show_wiek != 0) { $wiek = date("Y", time()) - date("Y", strtotime($current_user->birthday)); } $miasto = "ukryte"; if ($current_user->city != "") {
function test06($cache) { echo "Testing scope..."; $tmpl = new Scurvy('06_scope.html', './', $cache); $tmpl->set('a', array(array('b' => 'first'), array('b' => 'second'), array('b' => 'third'), array('b' => 'fourth'))); $tmpl->set('b', 'rumplestiltskin'); $output = $tmpl->render(); file_put_contents('06_scope.run', $output); return getDiff('06_scope.out', '06_scope.run'); }
?> "><?php echo $str_STATUS_ID; ?> </a>] <?php echo $str_STATUS_TITLE; ?> </td> </tr> <?php if ($ID > 0 && $PREV_ID > 0) { ?> <tr> <td colspan=2> <?php echo getDiff($prev_ar["BODY"], $ar["BODY"]); ?> </td> </tr> <?php } elseif (COption::GetOptionString("workflow", "USE_HTML_EDIT", "Y") == "Y" && CModule::IncludeModule("fileman")) { ?> <tr> <td align="center" colspan="2"><?php $bWithoutPHP = !$USER->IsAdmin(); CFileMan::AddHTMLEditorFrame("BODY", $str_BODY, "BODY_TYPE", $str_BODY_TYPE, 300, "Y", $str_DOCUMENT_ID, GetDirPath($str_FILENAME), "", false, $bWithoutPHP); ?> </td> </tr> <?php } else {
?> <table id="data" border="1px" class="table-striped table-bordered table-condensed sortable midtable data-table"> <tr class="table-head"> <th>Status</th> <th>Last Insert</th> <th>Time Lag (min:sec)</th> <th>Metric Name</th> </tr> <?php if (!empty($metrics)) { foreach ($metrics as $metric) { echo "<tr class='data-node'>"; echo "<td class='status'><div class='status-div'></div></td>"; echo "<td class='time' data-time=" . (empty($metric['lastInsertTime']) ? "" : $metric['lastInsertTime']) . ">" . (empty($metric['lastInsertTime']) ? "" : prepareTimestamp($metric['lastInsertTime'])) . "</td>"; echo "<td class='diff' sorttable_customkey='" . (empty($metric['lastInsertTime']) ? "0" : $metric['lastInsertTime']) . "'>" . (empty($metric['lastInsertTime']) ? "" : getDiff($date, $metric['lastInsertTime'])) . "</td>"; echo "<td>" . $metric['name'] . "</td>"; echo "</tr>"; } } ?> </table> <input type="hidden" id="lag" value="<?php echo $_REQUEST['lag']; ?> "/> <input type="hidden" id="ahead" value="<?php echo $_REQUEST['ahead']; ?> "/> <!-- Start of StatCounter Code -->