]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
BBCode - fixed syntax error
[friendica.git] / src / Object / Post.php
index 2bad9a6262110fad7b72ff216327c5e52c918667..c9e5cddb699f6ebb950cf13870a95a2f4e114ede 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\BaseObject;
 use Friendica\Content\ContactSelector;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
@@ -15,7 +16,6 @@ use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
-use Friendica\Model\Conversation;
 use Friendica\Model\Item;
 use Friendica\Model\Term;
 use Friendica\Util\Crypto;
@@ -60,6 +60,7 @@ class Post extends BaseObject
         * Constructor
         *
         * @param array $data data array
+        * @throws \Exception
         */
        public function __construct(array $data)
        {
@@ -115,6 +116,8 @@ class Post extends BaseObject
         *
         * @return mixed The data requested on success
         *               false on failure
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+        * @throws \ImagickException
         */
        public function getTemplateData(array $conv_responses, $thread_level = 1)
        {
@@ -229,7 +232,7 @@ class Post extends BaseObject
                }
 
                $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
-               Addon::callHooks('render_location', $locate);
+               Hook::callAll('render_location', $locate);
                $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
 
                // process action responses - e.g. like/dislike/attend/agree/whatever
@@ -247,7 +250,7 @@ class Post extends BaseObject
                        }
                }
 
-               $responses = get_responses($conv_responses, $response_verbs, $this, $item);
+               $responses = get_responses($conv_responses, $response_verbs, $item, $this);
 
                foreach ($response_verbs as $value => $verbs) {
                        $responses[$verbs]['output'] = !empty($conv_responses[$verbs][$item['uri']]) ? format_like($conv_responses[$verbs][$item['uri']], $conv_responses[$verbs][$item['uri'] . '-l'], $verbs, $item['uri']) : '';
@@ -394,6 +397,7 @@ class Post extends BaseObject
                        'location'        => $location_e,
                        'indent'          => $indent,
                        'shiny'           => $shiny,
+                       'owner_self'      => $item['author-link'] == defaults($_SESSION, 'my_url', null),
                        'owner_url'       => $this->getOwnerUrl(),
                        'owner_photo'     => $a->removeBaseURL(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
                        'owner_name'      => $owner_name_e,
@@ -421,10 +425,18 @@ class Post extends BaseObject
                        'commented'       => $item['commented'],
                        'created_date'    => $item['created'],
                        'return'          => ($a->cmd) ? bin2hex($a->cmd) : '',
+                       'delivery'        => [
+                               'queue_count'       => $item['delivery_queue_count'],
+                               'queue_done'        => $item['delivery_queue_done'],
+                               'notifier_pending'  => L10n::t('Notifier task is pending'),
+                               'delivery_pending'  => L10n::t('Delivery to remote servers is pending'),
+                               'delivery_underway' => L10n::t('Delivery to remote servers is underway'),
+                               'delivery_almost'   => L10n::t('Delivery to remote servers is mostly done'),
+                       ],
                ];
 
                $arr = ['item' => $item, 'output' => $tmp_item];
-               Addon::callHooks('display_item', $arr);
+               Hook::callAll('display_item', $arr);
 
                $result = $arr['output'];
 
@@ -491,6 +503,7 @@ class Post extends BaseObject
         * @param Post $item The child item to add
         *
         * @return mixed
+        * @throws \Exception
         */
        public function addChild(Post $item)
        {
@@ -580,6 +593,7 @@ class Post extends BaseObject
         * @param Post $item The child to be removed
         *
         * @return boolean Success or failure
+        * @throws \Exception
         */
        public function removeChild(Post $item)
        {
@@ -669,6 +683,7 @@ class Post extends BaseObject
         *
         * @param string $name template name
         * @return bool
+        * @throws \Exception
         */
        private function setTemplate($name)
        {
@@ -760,6 +775,7 @@ class Post extends BaseObject
         *
         * @return mixed The comment box string (empty if no comment box)
         *               false on failure
+        * @throws \Exception
         */
        private function getCommentBox($indent)
        {
@@ -773,7 +789,7 @@ class Post extends BaseObject
                }
 
                if ($conv->isWritable() && $this->isWritable()) {
-                       $qc = $qcomment = null;
+                       $qcomment = null;
 
                        /*
                         * Hmmm, code depending on the presence of a particular addon?
@@ -839,6 +855,7 @@ class Post extends BaseObject
         * Check if we are a wall to wall item and set the relevant properties
         *
         * @return void
+        * @throws \Exception
         */
        protected function checkWallToWall()
        {