<?php
-
+/**
+ * @file include/like.php
+ */
use Friendica\App;
+use Friendica\Core\Addon;
+use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
switch ($verb) {
case 'like':
- $bodyverb = t('%1$s likes %2$s\'s %3$s');
+ $bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
$activity = ACTIVITY_LIKE;
break;
case 'unlike':
- $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
+ $bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
$activity = ACTIVITY_LIKE;
break;
case 'dislike':
case 'undislike':
- $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
+ $bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
$activity = ACTIVITY_DISLIKE;
break;
case 'attendyes':
case 'unattendyes':
- $bodyverb = t('%1$s is attending %2$s\'s %3$s');
+ $bodyverb = L10n::t('%1$s is attending %2$s\'s %3$s');
$activity = ACTIVITY_ATTEND;
break;
case 'attendno':
case 'unattendno':
- $bodyverb = t('%1$s is not attending %2$s\'s %3$s');
+ $bodyverb = L10n::t('%1$s is not attending %2$s\'s %3$s');
$activity = ACTIVITY_ATTENDNO;
break;
case 'attendmaybe':
case 'unattendmaybe':
- $bodyverb = t('%1$s may attend %2$s\'s %3$s');
+ $bodyverb = L10n::t('%1$s may attend %2$s\'s %3$s');
$activity = ACTIVITY_ATTENDMAYBE;
break;
default:
$uid = local_user();
}
- if (!can_write_wall($a, $uid)) {
+ if (!can_write_wall($uid)) {
logger('like: unable to write on wall ' . $uid);
return false;
}
// Clean up the Diaspora signatures for this like
// Go ahead and do it even if Diaspora support is disabled. We still want to clean up
// if it had been enabled in the past
- dba::delete('sign', array('iid' => $like_item['id']));
+ dba::delete('sign', ['iid' => $like_item['id']]);
$like_item_id = $like_item['id'];
Worker::add(PRIORITY_HIGH, "Notifier", "like", $like_item_id);
}
// Else or if event verb different from existing row, create a new item row
- $post_type = (($item['resource-id']) ? t('photo') : t('status'));
+ $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
if ($item['object-type'] === ACTIVITY_OBJ_EVENT) {
- $post_type = t('event');
+ $post_type = L10n::t('event');
}
$objtype = $item['resource-id'] ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE ;
$link = xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . '" />' . "\n") ;
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . System::baseUrl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
- $new_item = array(
+ $new_item = [
'guid' => get_guid(32),
'uri' => item_new_uri($a->get_hostname(), $item['uid']),
'uid' => $item['uid'],
'deny_gid' => $item['deny_gid'],
'visible' => 1,
'unseen' => 1,
- 'last-child' => 0
- );
+ ];
$new_item_id = item_store($new_item);
$new_item['id'] = $new_item_id;
- call_hooks('post_local_end', $new_item);
+ Addon::callHooks('post_local_end', $new_item);
Worker::add(PRIORITY_HIGH, "Notifier", "like", $new_item_id);