Добавление комментария к посту по номеру

@param int $post_id Номер поста
@param string $text Текст комментария
@param int $comment_id Номер комментария для ответа на комментарий
@return array
@throws IncorrectUsageException
507172
public function postComment($post_id, $text, $comment_id = 0)
    {
        $this->checkId($post_id);

        $params = [
            'text' => $text,
            'parent_id' => $comment_id
        ];

        return $this->adapter->put(sprintf('/comments/%d', $post_id), $params);
    }
992193
public function deleteComment(int $comment_id, array $args = [])
    {
        $this->getDriver()->comment->delete($comment_id, $args);
    }
1100069
public function voteMinus($comment_id)
    {
        $this->checkId($comment_id);

        return $this->vote($comment_id, self::VOTE_MINUS);
    }
967565
protected function updatePost( $post_id, $status ) {

		$post = get_post( $post_id, 'ARRAY_A' );
		if ( empty( $post ) ) {
			return;
		}

		global $wpdb;
		$menu_order = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT MAX(menu_order) FROM {$wpdb->posts} WHERE post_type = %s AND post_parent = %d AND ID != %d ",
				$post['post_type'],
				$post['post_parent'],
				$post_id
			)
		);
		if ( $menu_order !== null ) {
			$post['menu_order'] = $menu_order + 1;
		}

		$post['post_status'] = $status;

		wp_update_post( $post );
	}
120766
public function postComment($id)
    {
        $text = isset($_POST["text"]) ? $_POST["text"] : "nothingfound";

        if ($text == "nothingfound") {
            return false;
        }
        $user = $this->di->get("session")->get("user");
        $comment = new Comment($this->di->get("db"));
        $comment->text = $text;
        $comment->parentId = $id;
        $comment->user = $user;
        $comment->save();
        return true;
    }
150367
public function commentList($msg_data_id, $begin, $count, $type, $index = null) {
        if ($count > 50) {
            $count = 50;
        }
        $args = $this->getCommentList()->parameters(
            compact('msg_data_id', 'begin', 'count', 'type', 'index'))->json();
        if ($args['errcode'] != 0) {
            throw new Exception($args['errmsg']);
        }
        return $args;
    }
736151
public function commentOnProject($projectId = null, $text = "")
    {
        $projectId = $projectId ?: $this->defaultProjectId;

        $data = [
            "text" => $text
        ];

        return $this->curl->post("projects/{$projectId}/stories", ['data' => $data]);
    }
712361
public function dispatchCommentPublishEvent(Post $post, Comment $comment)
    {
        $event = new LogCommentPublishEvent($post, $comment, $this->translator);

        return $this->dispatch($event);
    }
686201
public function save_post($post_id, \WP_Post $post ){
        // Skip auto save
        if( wp_is_post_revision($post) || wp_is_post_autosave($post) ){
            return;
        }
        // Check Nonce
        if( !$this->verify_nonce() ){
            return;
        }
        // O.K., let's save
        foreach( $this->loop_fields() as $field ){
            try{
                if( is_wp_error($field) ){
                    /** @var \WP_Error $field */
                    throw new \Exception($field->get_error_message(), $field->get_error_code());
                }
                if( !$this->is_override_field($field->name) ){
                    /** @var \WPametu\UI\Field\Base $field */
                    $field->update($this->input->post($field->name), $post);
                }
            }catch ( \Exception $e ){
                $this->prg->addErrorMessage($e->getMessage());
            }

        }
    }
181093
private function updateFromPostCache(Comment $comment, $c)
    {
        if ($comment->postId == null)
        {
            return;
        }
        if ($this->postCache == null || $this->postCache['ID'] != $comment->postId)
        {
            $this->postCache = $this->adminApi->getPost($comment->postId);
        }

        $comment->date = $this->getMetaKeyValue($this->postCache, "linkoscope_created_$comment->id") ?: $c['date'];
        $comment->score =
            $this->getMetaKeyValue($this->postCache, "linkoscope_score_$comment->id") ?: strtotime($c['date']);
    }
1371053
public function update(Request $request, Comment $comment)
    {
        $this->authorize('edit-comment', $comment);

        $this->validate($request, [
            'message' => 'required|string'
        ]);

        $comment->update([
            'comment' => $request->message
        ]);

        return redirect()->to(url()->previous() . '#comment-' . $comment->id);
    }
1249203
public function update(CommentRequest $request, Comment $comment)
    {
        try {
            $attributes = $request->all();

            $comment->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('news::comment.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('news/comment/' . $comment->getRouteKey()))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('news/comment/' . $comment->getRouteKey()))
                ->redirect();
        }

    }
117007
public function update(Request $request, Comment $comment)
    {
        $attributes = $request->validate([
            'text' => 'required'
        ]);

        tap($comment)
            ->update($attributes)
            ->clearMentions()
            ->mention($request->mentions);

        return back();
    }
470485
public function dispatchCommentUpdateEvent(Post $post, Comment $comment, $changeSet)
    {
        $event = new LogCommentUpdateEvent($post, $comment, $changeSet, $this->translator);

        return $this->dispatch($event);
    }
594885
public static function instance($postId, $title, $body, Author $author, array $comments)
    {
        $post = new self();

        $post->postId   = $postId;
        $post->title    = $title;
        $post->body     = $body;
        $post->author   = $author;
        $post->comments = $comments;

        return $post;
    }
647223
public function save_post( $post_id, $post, $update = null ) {

		if ( empty( $post ) ) {
			return;
		}

		$is_new_item = false;

		if ( is_bool( $update ) ) {
			$is_new_item = ! $update;
		} // false is new item
		elseif ( isset( self::$old_post_status[ $post->post_type ] ) && in_array( self::$old_post_status[ $post->post_type ], array(
				'new',
				'auto-draft'
			), true ) ) {
			$is_new_item = true;
		}

		$nonced = wp_verify_nonce( pods_v( 'pods_meta', 'post' ), 'pods_meta_post' );

		if ( ! $is_new_item && false === $nonced ) {
			return;
		}

		// Unset to avoid manual new post issues
		if ( isset( self::$old_post_status[ $post->post_type ] ) ) {
			unset( self::$old_post_status[ $post->post_type ] );
		}

		$blacklisted_types = array(
			'revision',
			'_pods_pod',
			'_pods_field'
		);

		$blacklisted_types = apply_filters( 'pods_meta_save_post_blacklist_types', $blacklisted_types, $post_id, $post );

		// @todo Figure out how to hook into autosave for saving meta

		// Block Autosave and Revisions
		if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || in_array( $post->post_type, $blacklisted_types ) ) {
			return;
		}

		// Block Quick Edits / Bulk Edits
		if ( 'edit.php' === pods_v( 'pagenow', 'global' ) && ( 'inline-save' === pods_v( 'action', 'post' ) || null !== pods_v( 'bulk_edit' ) || is_array( pods_v( 'post' ) ) ) ) {
			return;
		}

		// Block Trash
		if ( in_array( pods_v( 'action' ), array( 'untrash', 'trash' ), true ) ) {
			return;
		}

		// Block Auto-drafting and Trash (not via Admin action)
		$blacklisted_status = array(
			'auto-draft',
			'trash',
		);

		$blacklisted_status = apply_filters( 'pods_meta_save_post_blacklist_status', $blacklisted_status, $post_id, $post );

		if ( in_array( $post->post_status, $blacklisted_status ) ) {
			return;
		}

		$groups = $this->groups_get( 'post_type', $post->post_type );

		$id = $post_id;

		if ( ! is_object( self::$current_pod ) || self::$current_pod->pod !== $post->post_type ) {
			self::$current_pod = pods( $post->post_type, $id, true );
		} elseif ( is_object( self::$current_pod ) && (int) self::$current_pod->id() !== (int) $id ) {
			self::$current_pod->fetch( $id );
		}

		$pod  = self::$current_pod;
		$data = array();

		if ( $pod ) {
			$rest_enable = (boolean) pods_v( 'rest_enable', $pod->pod_data['options'], false );

			// Block REST API saves, we handle those separately in PodsRESTHandlers
			if ( defined( 'REST_REQUEST' ) && REST_REQUEST && $rest_enable ) {
				return;
			}
		}
		// The following code will run for all post_types (not just Pods)

		if ( false !== $nonced && ! empty( $groups ) ) {
			foreach ( $groups as $group ) {
				if ( empty( $group['fields'] ) ) {
					continue;
				}

				foreach ( $group['fields'] as $field ) {
					if ( false === PodsForm::permission( $field['type'], $field['name'], $field, $group['fields'], $pod, $id ) ) {
						if ( ! pods_v( 'hidden', $field['options'], false ) ) {
							continue;
						}
					}

					$data[ $field['name'] ] = '';

					if ( isset( $_POST[ 'pods_meta_' . $field['name'] ] ) ) {
						$data[ $field['name'] ] = $_POST[ 'pods_meta_' . $field['name'] ];
					}
				}
			}

			if ( $is_new_item ) {
				do_action( 'pods_meta_create_pre_post', $data, $pod, $id, $groups, $post, $post->post_type );
				do_action( "pods_meta_create_pre_post_{$post->post_type}", $data, $pod, $id, $groups, $post );
			}

			do_action( 'pods_meta_save_pre_post', $data, $pod, $id, $groups, $post, $post->post_type, $is_new_item );
			do_action( "pods_meta_save_pre_post_{$post->post_type}", $data, $pod, $id, $groups, $post, $is_new_item );
		}

		if ( $is_new_item || false !== $nonced ) {
			pods_no_conflict_on( 'post' );

			if ( ! empty( $pod ) ) {
				// Fix for Pods doing it's own sanitizing
				$data = pods_unslash( (array) $data );

				$pod->save( $data, null, null, array( 'is_new_item' => $is_new_item, 'podsmeta' => true ) );
			} elseif ( ! empty( $id ) ) {
				foreach ( $data as $field => $value ) {
					update_post_meta( $id, $field, $value );
				}
			}

			pods_no_conflict_off( 'post' );
		}

		if ( false !== $nonced && ! empty( $groups ) ) {
			if ( $is_new_item ) {
				do_action( 'pods_meta_create_post', $data, $pod, $id, $groups, $post, $post->post_type );
				do_action( "pods_meta_create_post_{$post->post_type}", $data, $pod, $id, $groups, $post );
			}

			do_action( 'pods_meta_save_post', $data, $pod, $id, $groups, $post, $post->post_type, $is_new_item );
			do_action( "pods_meta_save_post_{$post->post_type}", $data, $pod, $id, $groups, $post, $is_new_item );
		}

	}
271811
function editComment($commentId, array $comment)
    {
        $params = array(1, $this->username, $this->password, $commentId, $comment);

        return $this->sendRequest('wp.editComment', $params);
    }