Sets post updated messages for custom post types.

Check out the `post_updated_messages` in wp-admin/edit-form-advanced.php.

@param array $messages An associative array of post types and their messages.

@return array The filtered messages.
437366
public function add_post_updated_messages( $messages ) {
		global $post_id;

		$preview_url = get_preview_post_link( $post_id );
		$permalink   = get_permalink( $post_id );

		// Preview post link.
		$preview_post_link_html = is_post_type_viewable( $this->post_type )
			? sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
				esc_url( $preview_url ),
				/* translators: %s: Singular post type name */
				sprintf( __( 'Preview %s', 'mind/types' ), $this->name_singular )
			)
			: '';

		// View post link.
		$view_post_link_html = is_post_type_viewable( $this->post_type )
			? sprintf( ' <a href="%1$s">%2$s</a>',
				esc_url( $permalink ),
				/* translators: %s: Singular post type name */
				sprintf( __( 'View %s', 'mind/types' ), $this->name_singular )
			)
			: '';

		/**
		 * Message indices 2, 3, 5 and 9 are not handled, because they are edge cases or they would be too difficult
		 * to reproduce.
		 */
		$messages[ $this->post_type ] = [
			/* translators: %s: Singular post type name */
			1  => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ) . $view_post_link_html,
			/* translators: %s: Singular post type name */
			4  => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Singular post type name */
			6  => sprintf( __( '%s published.', 'mind/types' ), $this->name_singular ) . $view_post_link_html,
			/* translators: %s: Singular post type name */
			7  => sprintf( __( '%s saved.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Singular post type name */
			8  => sprintf( __( '%s submitted.', 'mind/types' ), $this->name_singular ) . $preview_post_link_html,
			/* translators: %s: Singular post type name */
			10 => sprintf( __( '%s draft updated.', 'mind/types' ), $this->name_singular ) . $preview_post_link_html,
		];

		return $messages;
	}
1240341
public function update( array $args ) {

		switch ( current_filter() ) {
			case 'phpmailer_init' :
				return $this->on_mailer_init( $args );
			case 'wp_mail_failed' :
				return $this->on_mail_failed( $args );
		}

		return new NullLog();
	}
921835
public function setMessages($messages)
	{
		if (!is_array($messages))
		{
			throw new InvalidArgumentException(sprintf(
				'Messages must be an array. Type of "%s" passed.',
				gettype($messages)
			));
		}

		$this->_messages = $messages;

		return $this;
	}
937607
public function postMessage(Message $message)
    {
        $options = [
            'text' => $message->getText(),
            'channel' => $message->data['channel'],
            'as_user' => true,
        ];

        if ($message->hasAttachments()) {
            $options['attachments'] = json_encode($message->getAttachments());
        }

        return $this->apiCall('chat.postMessage', $options);
    }
40835
protected function addStatusMessage($type, $messages)
    {
        if (!is_array($messages)) {
            $messages = array($messages);
        }
        $this->addData('status', array($type => $messages));
    }
670993
protected function formatMessages($messages, string $prefix): array
    {
        $result = [];

        // Convert single messages to array
        if (is_string($messages)) {
            $messages = [$messages];
        }

        // Prefix all messages
        foreach ($messages as $message) {
            $result[] = sprintf("[%s][%s] %s : %s", $this->module, $this->configType, $prefix, $message);
        }

        return $result;
    }
1335695
public static function withMessages(array $messages)
    {
        return new static(tap(ValidatorFacade::make([], []), function ($validator) use ($messages) {
            foreach ($messages as $key => $value) {
                foreach (Arr::wrap($value) as $message) {
                    $validator->errors()->add($key, $message);
                }
            }
        }));
    }
850337
public function setMessages(array $messages): MessagesCollection
    {
        foreach ($messages as $message) {
            if (!$message instanceof Message) {
                throw new \InvalidArgumentException('One of the messages is not instance of ' . Message::class);
            }
            $this->messages[] = $message;
        }

        return $this;
    }
4543
public function setMessages(array $translations) {
		foreach ($translations as $key => $message) {
			if($message) {
				$this->msg[$key] = $message;
			}
		}
	}
92834
protected function addMessages($method, array $messages)
    {
        // If there was exactly 1 message, it wasn't put in an array of messages.
        if (array_key_exists('code', $messages)) {
            $messages = array($messages);
        }
        foreach ($messages as $message) {
            call_user_func(array($this, $method), $message);
        }
        return $this;
    }
1236403
public static function uncompressMessageSet($messages)
    {
        if (empty($messages)) {
            return array();
        }

        $result   = array();
        $messages = explode(',', $messages);

        foreach ($messages as $idx => $part) {
            $items = explode(':', $part);
            $max   = max($items[0], $items[1]);

            for ($x=$items[0]; $x<=$max; $x++) {
                $result[] = (int)$x;
            }
            unset($messages[$idx]);
        }

        return $result;
    }
327479
public function addMessage(\BisonLab\SakonninBundle\Entity\Message $messages)
    {
        $this->messages[] = $messages;

        return $this;
    }
292145
public function add_term_updated_messages( $messages ) {
		$messages[ $this->taxonomy ] = [
			0 => '',
			/* translators: %s: Singular taxonomy name */
			1 => sprintf( __( '%s added.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Singular taxonomy name */
			2 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Singular taxonomy name */
			3 => sprintf( __( '%s updated.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Singular taxonomy name */
			4 => sprintf( __( '%s not added.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Singular taxonomy name */
			5 => sprintf( __( '%s not updated.', 'mind/types' ), $this->name_singular ),
			/* translators: %s: Plural taxonomy name */
			6 => sprintf( __( '%s deleted.', 'mind/types' ), $this->name_plural ),
		];

		return $messages;
	}
1314932
private function updateMessages(array $messages)
    {
        $this->reset();

        foreach ($messages as $message) {
            $messageSize = strlen($message);

            $this->data['messages_size'] += $messageSize;
            $this->data['messages_count']++;

            $this->data['messages'] []= array(
                'content' => $message,
                'size' => $messageSize,
                'decoded' => unserialize($message),
            );
        }
    }
599505
public static function messages($messages = [], $append = true)
    {
        if (func_num_args()) {
            static::$_messages = $append ? array_merge(static::$_messages, $messages) : $messages + ['_default_' => 'is invalid'];
        }
        return static::$_messages;
    }
510474
public function saveMessages($blockName, $messages) {
        $allMessages = $this->getMessages();
        $allMessages[$blockName] = array_merge(
            $this->loadMessages($blockName), $messages );
        $this->setMessages($allMessages);
    }
696620
public function setMessage($message, $type = 'info', $key = 'messages')
    {
        if ($message !== '') {

            $messages = (array) $this->get("$key.$type", array());

            if (!in_array($message, $messages)) {
                $messages[] = $message;
                $this->set("$key.$type", $messages);
            }
        }
    }