�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135
0x0x
PHP 8.2.31
Preview: copy-post.php Size: 15.45 KB
/home/mciraet/www/wp-content/plugins/jetpack/modules/copy-post.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
 * Module Name: Copy Post
 * Module Description: Duplicate any post or page in one click to speed up content creation.
 * Sort Order: 15
 * First Introduced: 7.0
 * Requires Connection: No
 * Auto Activate: No
 * Module Tags: Writing
 * Feature: Writing
 * Additional Search Queries: copy, duplicate
 *
 * @package automattic/jetpack
 */

use Automattic\Jetpack\Assets\Logo;

if ( ! defined( 'ABSPATH' ) ) {
	exit( 0 );
}

// phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.

/**
 * Copy Post class.
 *
 * @phan-constructor-used-for-side-effects
 */
class Jetpack_Copy_Post {
	/**
	 * Jetpack_Copy_Post_By_Param constructor.
	 * Add row actions to post/page/CPT listing screens.
	 * Process any `?copy` param if on a create new post/page/CPT screen.
	 *
	 * @return void
	 */
	public function __construct() {
		if ( 'edit.php' === $GLOBALS['pagenow'] || ( 'admin-ajax.php' === $GLOBALS['pagenow'] && ! empty( $_POST['post_view'] ) && 'list' === $_POST['post_view'] && ! empty( $_POST['action'] ) && 'inline-save' === $_POST['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- update_post_data() handles access check.
			add_action( 'admin_head', array( $this, 'print_inline_styles' ) );
			add_filter( 'post_row_actions', array( $this, 'add_row_action' ), 10, 2 );
			add_filter( 'page_row_actions', array( $this, 'add_row_action' ), 10, 2 );
			return;
		}

		if ( ! empty( $_GET['jetpack-copy'] ) && 'post-new.php' === $GLOBALS['pagenow'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- update_post_data() handles access check.
			add_action( 'wp_insert_post', array( $this, 'update_post_data' ), 10, 3 );
			add_filter( 'pre_option_default_post_format', '__return_empty_string' );
		}
	}

	/**
	 * Echos inline styles for the Jetpack logo.
	 *
	 * @return void
	 */
	public function print_inline_styles() {
		echo '
			<style id="jetpack-copy-post-styles">
				#jetpack-logo__icon {
					height: 14px;
					width: 14px;
					vertical-align: text-bottom;
				}
				#jetpack-logo__icon path {
					fill: inherit;
				}
			</style>
		';
	}

	/**
	 * Update the new (target) post data with the source post data.
	 *
	 * @param int     $target_post_id Target post ID.
	 * @param WP_Post $post           Target post object (not used).
	 * @param bool    $update         Whether this is an existing post being updated or not.
	 * @return void
	 */
	public function update_post_data( $target_post_id, $post, $update ) {
		// This `$update` check avoids infinite loops of trying to update our updated post.
		if ( $update ) {
			return;
		}

		// Shouldn't happen, since this filter is only added when the value isn't empty, but check anyway.
		if ( empty( $_GET['jetpack-copy'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
			return;
		}

		$source_post = get_post( intval( $_GET['jetpack-copy'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		if ( ! $source_post instanceof WP_Post ||
			! $this->user_can_access_post( $source_post->ID ) ||
			! $this->validate_post_type( $source_post ) ) {
			return;
		}

		$update_results = array(
			'update_content'         => $this->update_content( $source_post, $target_post_id ),
			'update_featured_image'  => $this->update_featured_image( $source_post, $target_post_id ),
			'update_post_format'     => $this->update_post_format( $source_post, $target_post_id ),
			'update_likes_sharing'   => $this->update_likes_sharing( $source_post, $target_post_id ),
			'update_post_type_terms' => $this->update_post_type_terms( $source_post, $target_post_id ),
		);

		// Required to satisfy get_default_post_to_edit(), which has these filters after post creation.
		add_filter( 'default_title', array( $this, 'filter_title' ), 10, 2 );
		add_filter( 'default_content', array( $this, 'filter_content' ), 10, 2 );
		add_filter( 'default_excerpt', array( $this, 'filter_excerpt' ), 10, 2 );

		// Required to avoid the block editor from adding default blocks according to post format.
		add_filter( 'block_editor_settings_all', array( $this, 'remove_post_format_template' ) );

		/**
		 * Fires after all updates have been performed, and default content filters have been added.
		 * Allows for any cleanup or post operations, and default content filters can be removed or modified.
		 *
		 * @module copy-post
		 *
		 * @since 7.0.0
		 *
		 * @param WP_Post $source_post Post object that was copied.
		 * @param int     $target_post_id Target post ID.
		 * @param array   $update_results Results of all update operations, allowing action to be taken.
		 */
		do_action( 'jetpack_copy_post', $source_post, $target_post_id, $update_results );
	}

	/**
	 * Determine if the current user has edit access to the source post.
	 *
	 * @param int $post_id Source post ID (the post being copied).
	 * @return bool True if user has the meta cap of `edit_post` for the given post ID, false otherwise.
	 */
	protected function user_can_access_post( $post_id ) {
		return current_user_can( 'edit_post', $post_id );
	}

	/**
	 * Update the target post's title, content, excerpt, categories, and tags.
	 *
	 * @param WP_Post $source_post Post object to be copied.
	 * @param int     $target_post_id Target post ID.
	 * @return int    0 on failure, or the updated post ID on success.
	 */
	protected function update_content( $source_post, $target_post_id ) {
		$data = array(
			'ID'             => $target_post_id,
			'post_title'     => $source_post->post_title,
			'post_content'   => $source_post->post_content,
			'post_excerpt'   => $source_post->post_excerpt,
			'comment_status' => $source_post->comment_status,
			'ping_status'    => $source_post->ping_status,
			'post_category'  => wp_get_post_categories( $source_post->ID ),
			'post_password'  => $source_post->post_password,
			'tags_input'     => $source_post->tags_input,
		);

		// Copy footnotes with regenerated IDs.
		$data = $this->copy_footnotes( $data, $source_post, $target_post_id );

		/**
		 * Fires just before the target post is updated with its new data.
		 * Allows for final data adjustments before updating the target post.
		 *
		 * @module copy-post
		 *
		 * @since 7.0.0
		 *
		 * @param array $data Post data with which to update the target (new) post.
		 * @param WP_Post $source_post Post object being copied.
		 * @param int     $target_post_id Target post ID.
		 */
		$data = apply_filters( 'jetpack_copy_post_data', $data, $source_post, $target_post_id );
		return wp_update_post( wp_slash( $data ) );
	}

	/**
	 * Update terms for post types.
	 *
	 * @param WP_Post $source_post Post object to be copied.
	 * @param int     $target_post_id Target post ID.
	 * @return array Results of attempts to set each term to the target (new) post.
	 */
	protected function update_post_type_terms( $source_post, $target_post_id ) {
		$results = array();

		$bypassed_post_types = apply_filters( 'jetpack_copy_post_bypassed_post_types', array( 'post', 'page' ), $source_post, $target_post_id );
		if ( in_array( $source_post->post_type, $bypassed_post_types, true ) ) {
			return $results;
		}

		$taxonomies = get_object_taxonomies( $source_post, 'objects' );
		foreach ( $taxonomies as $taxonomy ) {
			$terms     = wp_get_post_terms( $source_post->ID, $taxonomy->name, array( 'fields' => 'ids' ) );
			$results[] = wp_set_post_terms( $target_post_id, $terms, $taxonomy->name );
		}

		return $results;
	}

	/**
	 * Update the target post's featured image.
	 *
	 * @param WP_Post $source_post Post object to be copied.
	 * @param int     $target_post_id Target post ID.
	 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
	 */
	protected function update_featured_image( $source_post, $target_post_id ) {
		$featured_image_id = get_post_thumbnail_id( $source_post );
		return update_post_meta( $target_post_id, '_thumbnail_id', $featured_image_id );
	}

	/**
	 * Update the target post's post format.
	 *
	 * @param WP_Post $source_post Post object to be copied.
	 * @param int     $target_post_id Target post ID.
	 * @return array|WP_Error|false WP_Error on error, array of affected term IDs on success.
	 */
	protected function update_post_format( $source_post, $target_post_id ) {
		$post_format = get_post_format( $source_post );
		return set_post_format( $target_post_id, $post_format );
	}

	/**
	 * Ensure the block editor doesn't modify the source post content for non-standard post formats.
	 *
	 * @param array $settings Settings to be passed into the block editor.
	 * @return array Settings with any `template` key removed.
	 */
	public function remove_post_format_template( $settings ) {
		unset( $settings['template'] );
		return $settings;
	}

	/**
	 * Update the target post's Likes and Sharing statuses.
	 *
	 * @param WP_Post $source_post Post object to be copied.
	 * @param int     $target_post_id Target post ID.
	 * @return array Array with the results of each update action.
	 */
	protected function update_likes_sharing( $source_post, $target_post_id ) {
		$likes   = get_post_meta( $source_post->ID, 'switch_like_status', true );
		$sharing = get_post_meta( $source_post->ID, 'sharing_disabled', true );

		if ( '' !== $likes ) {
			$likes_result = update_post_meta( $target_post_id, 'switch_like_status', $likes );
		} else {
			$likes_result = null;
		}

		if ( '' !== $sharing ) {
			$sharing_result = update_post_meta( $target_post_id, 'sharing_disabled', $sharing );
		} else {
			$sharing_result = null;
		}

		return array(
			'likes'   => $likes_result,
			'sharing' => $sharing_result,
		);
	}

	/**
	 * Copy footnotes from source post, regenerating IDs for uniqueness.
	 *
	 * Gutenberg's Footnotes block stores content in post meta rather than
	 * in the block markup itself. The IDs must be regenerated to ensure uniqueness,
	 * otherwise multiple posts on the same page (e.g., archive views) would
	 * have conflicting footnote anchor links.
	 *
	 * @param array   $data Post data with which to update the target (new) post.
	 * @param WP_Post $source_post Post object being copied.
	 * @param int     $target_post_id Target post ID.
	 * @return array Modified post data.
	 */
	public function copy_footnotes( $data, $source_post, $target_post_id ) {
		$footnotes_json = get_post_meta( $source_post->ID, 'footnotes', true );

		if ( '' === $footnotes_json ) {
			return $data;
		}

		$footnotes = json_decode( $footnotes_json, true );

		if ( ! is_array( $footnotes ) || empty( $footnotes ) ) {
			return $data;
		}

		// Build a mapping of old IDs to new IDs and update the footnotes array.
		$id_mapping = array();
		foreach ( $footnotes as &$footnote ) {
			if ( isset( $footnote['id'] ) ) {
				$old_id                = $footnote['id'];
				$new_id                = wp_generate_uuid4();
				$id_mapping[ $old_id ] = $new_id;
				$footnote['id']        = $new_id;
			}
		}
		unset( $footnote );

		// Update the post content to use the new footnote IDs.
		foreach ( $id_mapping as $old_id => $new_id ) {
			// Replace data-fn attribute values.
			$data['post_content'] = str_replace( 'data-fn="' . $old_id . '"', 'data-fn="' . $new_id . '"', $data['post_content'] );
			// Replace href anchor links.
			$data['post_content'] = str_replace( 'href="#' . $old_id . '"', 'href="#' . $new_id . '"', $data['post_content'] );
			// Replace id attributes (e.g., id="uuid-link").
			$data['post_content'] = str_replace( 'id="' . $old_id . '-link"', 'id="' . $new_id . '-link"', $data['post_content'] );
			$data['post_content'] = str_replace( 'id="' . $old_id . '"', 'id="' . $new_id . '"', $data['post_content'] );
		}

		// Save the footnotes meta with new IDs.
		update_post_meta( $target_post_id, 'footnotes', wp_json_encode( $footnotes, JSON_UNESCAPED_SLASHES ) );

		return $data;
	}

	/**
	 * Update the target post's title.
	 *
	 * @param string  $post_title Post title determined by `get_default_post_to_edit()`.
	 * @param WP_Post $post       Post object of newly-inserted post.
	 * @return string             Updated post title from source post.
	 */
	public function filter_title( $post_title, $post ) {
		return $post->post_title;
	}

	/**
	 * Update the target post's content (`post_content`).
	 *
	 * @param string  $post_content Post content determined by `get_default_post_to_edit()`.
	 * @param WP_Post $post         Post object of newly-inserted post.
	 * @return string               Updated post content from source post.
	 */
	public function filter_content( $post_content, $post ) {
		return $post->post_content;
	}

	/**
	 * Update the target post's excerpt.
	 *
	 * @param string  $post_excerpt Post excerpt determined by `get_default_post_to_edit()`.
	 * @param WP_Post $post         Post object of newly-inserted post.
	 * @return string               Updated post excerpt from source post.
	 */
	public function filter_excerpt( $post_excerpt, $post ) {
		return $post->post_excerpt;
	}

	/**
	 * Validate the post type to be used for the target post.
	 *
	 * @param WP_Post $post Post object of current post in listing.
	 * @return bool True if the post type is in a list of supported psot types; false otherwise.
	 */
	protected function validate_post_type( $post ) {
		/**
		 * Fires when determining if the "Copy" row action should be made available.
		 * Allows overriding supported post types.
		 *
		 * @module copy-post
		 *
		 * @since 7.0.0
		 *
		 * @param array   Post types supported by default.
		 * @param WP_Post $post Post object of current post in listing.
		 */
		$valid_post_types = apply_filters(
			'jetpack_copy_post_post_types',
			array(
				'post',
				'page',
				'jetpack-testimonial',
				'jetpack-portfolio',
			),
			$post
		);
		return in_array( $post->post_type, $valid_post_types, true );
	}

	/**
	 * Add a "Copy" row action to supported posts/pages/CPTs on list views.
	 *
	 * @param array   $actions Existing actions.
	 * @param WP_Post $post    Post object of current post in list.
	 * @return array           Array of updated row actions.
	 */
	public function add_row_action( $actions, $post ) {
		if ( ! $this->user_can_access_post( $post->ID ) ||
			! $post instanceof WP_Post ||
			! $this->validate_post_type( $post ) ) {
			return $actions;
		}

		$edit_url = add_query_arg(
			array(
				'post_type'    => $post->post_type,
				'jetpack-copy' => $post->ID,
			),
			admin_url( 'post-new.php' )
		);

		$jetpack_logo = new Logo();
		$edit_action  = array(
			'jetpack-copy' => sprintf(
				'<a href="%1$s" aria-label="%2$s">%3$s %4$s</a>',
				esc_url( $edit_url ),
				esc_attr__( 'Duplicate this post with Jetpack.', 'jetpack' ),
				esc_html__( 'Duplicate', 'jetpack' ),
				$jetpack_logo->get_jp_emblem()
			),
		);

		// Insert the Copy action before the Trash action.
		$edit_offset     = array_search( 'trash', array_keys( $actions ), true );
		$updated_actions = array_merge(
			array_slice( $actions, 0, $edit_offset ),
			$edit_action,
			array_slice( $actions, $edit_offset )
		);

		/**
		 * Fires after the new Copy action has been added to the row actions.
		 * Allows changes to the action presentation, or other final checks.
		 *
		 * @module copy-post
		 *
		 * @since 7.0.0
		 *
		 * @param array   $updated_actions Updated row actions with the Copy Post action.
		 * @param array   $actions Original row actions passed to this filter.
		 * @param WP_Post $post Post object of current post in listing.
		 */
		return apply_filters( 'jetpack_copy_post_row_actions', $updated_actions, $actions, $post );
	}
}

/**
 * Instantiate an instance of Jetpack_Copy_Post on the `admin_init` hook.
 */
function jetpack_copy_post_init() {
	new Jetpack_Copy_Post();
}
add_action( 'admin_init', 'jetpack_copy_post_init' );

Directory Contents

Dirs: 35 × Files: 53
Name Size Perms Modified Actions
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
carousel DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
comments DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
gravatar DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
likes DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
markdown DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
scan DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
seo-tools DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:47
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
site-icon DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
sitemaps DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
stats DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-09-26 14:12:38
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
widgets DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
wordads DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
wpcom-tos DIR
- drwxr-xr-x 2026-08-21 10:05:50
Edit Download
369 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.03 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.82 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
2.46 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
612 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
8.04 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.08 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
798 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
15.45 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
4.00 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
643 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
11.91 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
8.25 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
503 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
4.63 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
20.99 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.04 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
2.73 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
45.61 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
27.27 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
3.70 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
7.47 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
12.69 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
698 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
22.77 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
866 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
676 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
570 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
609 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
3.76 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
2.42 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.18 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.76 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.06 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
6.45 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
4.58 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
421 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.30 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
681 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
43.81 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
36.31 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
2.47 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.12 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.80 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
899 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
989 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
309 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
558 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
2.80 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
928 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
632 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
461 B lrw-r--r-- 2026-08-21 10:05:50
Edit Download
1.93 KB lrw-r--r-- 2026-08-21 10:05:50
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 0xNothings — Secure File Manager. All rights reserved. Built with ❤️ & Tailwind x Dark UI