Archived
1
0

Fixed most of the redundant br elements in the core.

This commit is contained in:
Matthias Mees
2012-12-03 13:35:59 +01:00
parent bd8c2bbda0
commit 7288ffdef8
28 changed files with 172 additions and 170 deletions
+22 -22
View File
@@ -673,7 +673,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$old_references = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}references WHERE (type = '' OR type IS NULL) AND entry_id = " . (int)$id, false, 'assoc');
if ($debug && is_string($old_references)) {
echo $old_references . "<br />\n";
echo '<span class="block_level">' . $old_references . "</span>";
}
if (is_array($old_references) && count($old_references) > 0) {
@@ -684,15 +684,15 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$saved_urls[$old_reference['link']] = true;
}
}
if ($debug) echo "Got references in dry run: <pre>" . print_r($current_references, true) . "</pre><br />\n";
if ($debug) echo "Got references in dry run: <pre>" . print_r($current_references, true) . "</pre>\n";
} else {
// A dry-run was called previously and restorable references are found. Restore them now.
$del = serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE (type = '' OR type IS NULL) AND entry_id = " . (int)$id);
if ($debug && is_string($del)) {
echo $del . "<br />\n";
echo '<span class="block_level">' . $del . "</span>";
}
if ($debug) echo "Deleted references.<br />\n";
if ($debug) echo "<span class='block_level'>Deleted references.</span>";
if (is_array($old_references) && count($old_references) > 0) {
$current_references = array();
@@ -702,12 +702,12 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$q = serendipity_db_insert('references', $old_reference, 'show');
$cr = serendipity_db_query($q);
if ($debug && is_string($cr)) {
echo $cr . "<br />\n";
echo '<span class="block_level">' . $cr . "</span>";
}
}
}
if ($debug) echo "Got references in final run: <pre>" . print_r($current_references, true) . "</pre><br />\n";
if ($debug) echo "Got references in final run: <pre>" . print_r($current_references, true) . "</pre>\n";
}
if (!preg_match_all('@<a[^>]+?href\s*=\s*["\']?([^\'" >]+?)[ \'"][^>]*>(.+?)</a>@i', $text, $matches)) {
@@ -729,13 +729,13 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$checked_locations = array();
serendipity_plugin_api::hook_event('backend_trackbacks', $locations);
for ($i = 0, $j = count($locations); $i < $j; ++$i) {
if ($debug) echo "Checking {$locations[$i]}...<br />\n";
if ($debug) echo "<span class='block_level'>Checking {$locations[$i]}...</span>";
if ($locations[$i][0] == '/') {
$locations[$i] = 'http' . (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $locations[$i];
}
if (isset($checked_locations[$locations[$i]])) {
if ($debug) echo "Already checked.<br />\n";
if ($debug) echo "<span class='block_level'>Already checked.</span>";
continue;
}
@@ -756,7 +756,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$row = serendipity_db_query($query, true, 'num');
if ($debug && is_string($row)) {
echo $row . "<br />\n";
echo '<span class="block_level">' . $row . "</span>";
}
$names[$i] = strip_tags($names[$i]);
@@ -766,31 +766,31 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
}
if ($row[0] > 0 && isset($saved_references[$locations[$i] . $names[$i]])) {
if ($debug) echo "Found references for $id, skipping rest<br />\n";
if ($debug) echo "<span class='block_level'>Found references for $id, skipping rest</span>";
continue;
}
if (!isset($serendipity['noautodiscovery']) || !$serendipity['noautodiscovery']) {
if (!$dry_run) {
if (!isset($saved_urls[$locations[$i]])){
if ($debug) echo "Enabling autodiscovery.<br />\n";
if ($debug) echo "<span class='block_level'>Enabling autodiscovery.</span>";
serendipity_reference_autodiscover($locations[$i], $url, $author, $title, serendipity_trackback_excerpt($text));
}
elseif ($debug) echo "This reference was already used before in $id and therefore will not be trackbacked again.<br/>\n";
elseif ($debug) echo "<span class='block_level'>This reference was already used before in $id and therefore will not be trackbacked again.</span>";
} elseif ($debug) {
echo "Dry run: Skipping autodiscovery<br />\n";
echo "<span class='block_level'>Dry run: Skipping autodiscovery</span>";
}
$checked_locations[$locations[$i]] = true; // Store trackbacked link so that no further trackbacks will be sent to the same link
} elseif ($debug) {
echo "Skipping full autodiscovery<br />\n";
echo "<span class='block_level'>Skipping full autodiscovery</span>";
}
}
$del = serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE entry_id=" . (int)$id . " AND (type = '' OR type IS NULL)");
if ($debug && is_string($del)) {
echo $del . "<br />\n";
echo '<span class="block_level">' . $del . "</span>";
}
if ($debug) echo "Deleted references again.<br />\n";
if ($debug) echo "<span class='block_level'>Deleted references again.</span>";
if (!is_array($old_references)) {
$old_references = array();
@@ -811,7 +811,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$query .= (int)$current_references[$locations[$i] . $names[$i]]['id'] . ", " . (int)$id . ", '" . $i_link . "', '" . $i_location . "')";
$ins = serendipity_db_query($query);
if ($debug && is_string($ins)) {
echo $ins . "<br />\n";
echo '<span class="block_level">' . $ins . "</span>";
}
$duplicate_check[$locations[$i] . $names[$i]] = true;
} else {
@@ -819,7 +819,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$query .= (int)$id . ", '" . $i_link . "', '" . $i_location . "')";
$ins = serendipity_db_query($query);
if ($debug && is_string($ins)) {
echo $ins . "<br />\n";
echo '<span class="block_level">' . $ins . "</span>";
}
$old_references[] = array(
@@ -832,13 +832,13 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
}
if ($debug) {
echo "Current lookup for {$locations[$i]}{$names[$i]} is <pre>" . print_r($current_references[$locations[$i] . $names[$i]], true) . "</pre><br />\n";
echo $query . "<br />\n";
echo "Current lookup for {$locations[$i]}{$names[$i]} is <pre>" . print_r($current_references[$locations[$i] . $names[$i]], true) . "</pre>\n";
echo '<span class="block_level">' . $query . "</span>";
}
}
if ($debug) {
echo "Old/Saved locations: <pre>" . print_r($old_references, true) . "</pre><br />\n";
echo "Old/Saved locations: <pre>" . print_r($old_references, true) . "</pre>\n";
}
// Add citations
@@ -850,7 +850,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
$cite = serendipity_db_query($query);
if ($debug && is_string($cite)) {
echo $cite . "<br />\n";
echo '<span class="block_level">' . $cite . "</span>";
}
}
}