Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete webmention #227

Merged
merged 2 commits into from
Apr 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions Idno/Common/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1401,12 +1401,14 @@ function addAnnotation($subtype, $owner_name, $owner_url, $owner_image, $content
if (empty($annotation_url)) {
$annotation_url = $this->getURL() . '/annotations/' . md5(time() . $content); // Invent a URL for this annotation
}
// Create a local URL (fixes #199)
$local_url = $this->getURL() . '/annotations/' . md5(time() . $content); // Invent a URL for this annotation
if (empty($time)) {
$time = time();
} else {
$time = (int)$time;
}
$annotation = ['owner_name' => $owner_name, 'owner_url' => $owner_url, 'owner_image' => $owner_image, 'content' => $content, 'time' => $time];
$annotation = ['permalink' => $annotation_url, 'owner_name' => $owner_name, 'owner_url' => $owner_url, 'owner_image' => $owner_image, 'content' => $content, 'time' => $time];
$annotations = $this->annotations;
if (empty($annotations)) {
$annotations = [];
Expand All @@ -1415,7 +1417,7 @@ function addAnnotation($subtype, $owner_name, $owner_url, $owner_image, $content
$annotations[$subtype] = [];
}

$annotations[$subtype][$annotation_url] = $annotation;
$annotations[$subtype][$local_url] = $annotation;
$this->annotations = $annotations;

\Idno\Core\site()->triggerEvent('annotation/add/' . $subtype, ['annotation' => $annotation, 'object' => $this]);
Expand Down
2 changes: 1 addition & 1 deletion external/bonita
6 changes: 4 additions & 2 deletions templates/default/entity/annotations/replies.tpl.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

if (!empty($vars['annotations']) && is_array($vars['annotations'])) {
foreach($vars['annotations'] as $permalink => $annotation) {
foreach($vars['annotations'] as $locallink => $annotation) {

$permalink = $annotation['permalink'] ? $annotation['permalink'] : $locallink;
?>
<div class="idno-annotation row">
<div class="idno-annotation-image span1 hidden-phone">
Expand All @@ -15,7 +17,7 @@
<a href="<?=$permalink?>"><?=date('M d Y', $annotation['time']);?></a></small></p>
</div>
<?php
$this->annotation_permalink = $permalink;
$this->annotation_permalink = $locallink;

if ($vars['object']->canEdit())
echo $this->draw('content/annotation/edit');
Expand Down