PO::add_comment_to_entry() WordPress Method

The PO::add_comment_to_entry() Wordpress method inserts a new comment into the WordPress database. The comment will be associated with the post specified by the $entry parameter.

PO::add_comment_to_entry( Translation_Entry $entry, string $po_comment_line ) #


Parameters

$entry

(Translation_Entry)(Required)

$po_comment_line

(string)(Required)


Top ↑

Source

File: wp-includes/pomo/po.php

		public function add_comment_to_entry( &$entry, $po_comment_line ) {
			$first_two = substr( $po_comment_line, 0, 2 );
			$comment   = trim( substr( $po_comment_line, 2 ) );
			if ( '#:' === $first_two ) {
				$entry->references = array_merge( $entry->references, preg_split( '/\s+/', $comment ) );
			} elseif ( '#.' === $first_two ) {
				$entry->extracted_comments = trim( $entry->extracted_comments . "\n" . $comment );
			} elseif ( '#,' === $first_two ) {
				$entry->flags = array_merge( $entry->flags, preg_split( '/,\s*/', $comment ) );
			} else {
				$entry->translator_comments = trim( $entry->translator_comments . "\n" . $comment );
			}
		}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.