]> git.mxchange.org Git - friendica.git/blobdiff - include/like.php
More missed calls
[friendica.git] / include / like.php
index 8b8759c2f6401b90061cb6c90092d306e3f50c0d..ae344d4269a3358ea03e7304832697efa6eeaef8 100644 (file)
@@ -1,6 +1,10 @@
 <?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;
@@ -30,31 +34,31 @@ function do_like($item_id, $verb) {
 
        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:
@@ -85,7 +89,7 @@ function do_like($item_id, $verb) {
                $uid = local_user();
        }
 
-       if (!can_write_wall($a, $uid)) {
+       if (!can_write_wall($uid)) {
                logger('like: unable to write on wall ' . $uid);
                return false;
        }
@@ -168,7 +172,7 @@ function do_like($item_id, $verb) {
                // 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);
@@ -184,9 +188,9 @@ function do_like($item_id, $verb) {
        }
 
        // 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") ;
@@ -208,7 +212,7 @@ EOT;
        $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'],
@@ -238,8 +242,7 @@ EOT;
                'deny_gid'      => $item['deny_gid'],
                'visible'       => 1,
                'unseen'        => 1,
-               'last-child'    => 0
-       );
+       ];
 
        $new_item_id = item_store($new_item);
 
@@ -255,7 +258,7 @@ EOT;
 
        $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);