- $datarray = [];
- $datarray['uid'] = $profile_uid;
- $datarray['wall'] = $wall;
- $datarray['gravity'] = $gravity;
- $datarray['network'] = $network;
- $datarray['contact-id'] = $contact_id;
- $datarray['owner-name'] = $contact_record['name'] ?? '';
- $datarray['owner-link'] = $contact_record['url'] ?? '';
- $datarray['owner-avatar'] = $contact_record['thumb'] ?? '';
- $datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
- $datarray['author-name'] = $author['name'];
- $datarray['author-link'] = $author['url'];
- $datarray['author-avatar'] = $author['thumb'];
- $datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
- $datarray['created'] = empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'];
- $datarray['edited'] = $datarray['created'];
- $datarray['commented'] = $datarray['created'];
- $datarray['changed'] = $datarray['created'];
- $datarray['received'] = DateTimeFormat::utcNow();
- $datarray['extid'] = $extid;
- $datarray['guid'] = $guid;
- $datarray['uri'] = $uri;
- $datarray['title'] = $title;
- $datarray['body'] = $body;
- $datarray['app'] = $app;
- $datarray['location'] = $location;
- $datarray['coord'] = $coord;
- $datarray['file'] = $categories;
- $datarray['inform'] = $inform;
- $datarray['verb'] = $verb;
- $datarray['post-type'] = $posttype;
- $datarray['object-type'] = $objecttype;
- $datarray['allow_cid'] = $str_contact_allow;
- $datarray['allow_gid'] = $str_group_allow;
- $datarray['deny_cid'] = $str_contact_deny;
- $datarray['deny_gid'] = $str_group_deny;
- $datarray['private'] = $private;
- $datarray['pubmail'] = $pubmail_enabled;
- $datarray['attach'] = $attachments;
-
- $datarray['thr-parent'] = $thr_parent_uri;
-
- $datarray['postopts'] = $postopts;
- $datarray['origin'] = $origin;
- $datarray['object'] = $object;
-
- $datarray['attachments'] = $_REQUEST['attachments'] ?? [];
-
- /*
- * These fields are for the convenience of addons...
- * 'self' if true indicates the owner is posting on their own wall
- * If parent is 0 it is a top-level post.
- */
- $datarray['parent'] = $toplevel_item_id;
- $datarray['self'] = $self;
-
- // This triggers posts via API and the mirror functions
- $datarray['api_source'] = $api_source;
-
- // This field is for storing the raw conversation data
- $datarray['protocol'] = Conversation::PARCEL_DIRECT;
- $datarray['direction'] = Conversation::PUSH;
+ $datarray = [
+ 'uid' => $profile_uid,
+ 'wall' => $wall,
+ 'gravity' => $gravity,
+ 'network' => $network,
+ 'contact-id' => $contact_id,
+ 'owner-name' => $contact_record['name'] ?? '',
+ 'owner-link' => $contact_record['url'] ?? '',
+ 'owner-avatar' => $contact_record['thumb'] ?? '',
+ 'author-name' => $author['name'],
+ 'author-link' => $author['url'],
+ 'author-avatar' => $author['thumb'],
+ 'created' => empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'],
+ 'received' => DateTimeFormat::utcNow(),
+ 'extid' => $extid,
+ 'guid' => $guid,
+ 'uri' => $uri,
+ 'title' => $title,
+ 'body' => $body,
+ 'app' => $app,
+ 'location' => $location,
+ 'coord' => $coord,
+ 'file' => $categories,
+ 'inform' => $inform,
+ 'verb' => $verb,
+ 'post-type' => $posttype,
+ 'object-type' => $objecttype,
+ 'allow_cid' => $str_contact_allow,
+ 'allow_gid' => $str_group_allow,
+ 'deny_cid' => $str_contact_deny,
+ 'deny_gid' => $str_group_deny,
+ 'private' => $private,
+ 'pubmail' => $pubmail_enabled,
+ 'attach' => $attachments,
+ 'thr-parent' => $thr_parent_uri,
+ 'postopts' => $postopts,
+ 'origin' => $origin,
+ 'object' => $object,
+ 'attachments' => $_REQUEST['attachments'] ?? [],
+ /*
+ * These fields are for the convenience of addons...
+ * 'self' if true indicates the owner is posting on their own wall
+ * If parent is 0 it is a top-level post.
+ */
+ 'parent' => $toplevel_item_id,
+ 'self' => $self,
+ // This triggers posts via API and the mirror functions
+ 'api_source' => false,
+ // This field is for storing the raw conversation data
+ 'protocol' => Conversation::PARCEL_DIRECT,
+ 'direction' => Conversation::PUSH,
+ ];
+
+ // These cannot be part of above initialization ...
+ $datarray['edited'] = $datarray['created'];
+ $datarray['commented'] = $datarray['created'];
+ $datarray['changed'] = $datarray['created'];
+ $datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
+ $datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);