inc/class-Iac_Attach_Media.php
public function attach_media( $attachments, $iac_options, $item_ID ) {

		if ( '1' !== $iac_options[ 'send_attachments' ] )
			return $attachments;

		$size  = 0;
		$max_size = $iac_options[ 'attachment_max_size' ];
		$links = array();
		$files = array();
		$dir   = wp_upload_dir();
		$posts = get_children(
			array(
				'post_parent'    => $item_ID,
				'post_type'      => 'attachment',
				'post_status'    => array( 'publish', 'inherit' ),
				'posts_per_page' => -1
			)
		);

		$posts = apply_filters( 'iac_attach_media_posts', $posts, $item_ID, $iac_options );

		if ( empty( $posts ) )
			return $attachments;

		$unique_posts = array();
		foreach ( $posts as $p ) {
			# avoid attach one file twice
			if ( in_array( $p->ID, $unique_posts ) )
				continue;
			$meta = wp_get_attachment_metadata( $p->ID );
			$file = self::get_thumbnail_file( $meta );
			if ( ! $file )
				$file = $dir[ 'basedir' ] . DIRECTORY_SEPARATOR . $meta[ 'file' ];

			if ( ! file_exists( $file ) )
				continue;

			# limit the size of all attachments
			$size = filesize( $file );
			if ( $size < $max_size ) {
				$attachments[]  = $file;
				$unique_posts[] = $p->ID;
			}
		}

		return $attachments;
	}
public function attach_media( $attachments, $iac_options, $item_ID ) {

		if ( '1' !== $iac_options[ 'send_attachments' ] )
			return $attachments;

		$size  = 0;
		$max_size = $iac_options[ 'attachment_max_size' ];
		$links = array();
		$files = array();
		$dir   = wp_upload_dir();
		$posts = get_children(
			array(
				'post_parent'    => $item_ID,
				'post_type'      => 'attachment',
				'post_status'    => array( 'publish', 'inherit' ),
				'posts_per_page' => -1
			)
		);

		$posts = apply_filters( 'iac_attach_media_posts', $posts, $item_ID, $iac_options );

		if ( empty( $posts ) )
			return $attachments;

		$unique_posts = array();
		foreach ( $posts as $p ) {
			# avoid attach one file twice
			if ( in_array( $p->ID, $unique_posts ) )
				continue;
			$meta = wp_get_attachment_metadata( $p->ID );
			$file = self::get_thumbnail_file( $meta );
			if ( ! $file )
				$file = $dir[ 'basedir' ] . DIRECTORY_SEPARATOR . $meta[ 'file' ];

			if ( ! file_exists( $file ) )
				continue;

			# limit the size of all attachments
			$size = filesize( $file );
			if ( $size < $max_size ) {
				$attachments[]  = $file;
				$unique_posts[] = $p->ID;
			}
		}

		return $attachments;
	}
public function attach_media ( $ attachments , $ iac_options , $ item_ID ) { if ( '1' !== $ iac_options [ 'send_attachments' ] ) return $ attachments ; $ size = 0 ; $ max_size = $ iac_options [ 'attachment_max_size' ] ; $ links = array ( ) ; $ files = array ( ) ; $ dir = wp_upload_dir ( ) ; $ posts = get_children ( array ( 'post_parent' => $ item_ID , 'post_type' => 'attachment' , 'post_status' => array ( 'publish' , 'inherit' ) , 'posts_per_page' => - 1 ) ) ; $ posts = apply_filters ( 'iac_attach_media_posts' , $ posts , $ item_ID , $ iac_options ) ; if ( empty ( $ posts ) ) return $ attachments ; $ unique_posts = array ( ) ; foreach ( $ posts as $ p ) { # avoid attach one file twice if ( in_array ( $ p -> ID , $ unique_posts ) ) continue ; $ meta = wp_get_attachment_metadata ( $ p -> ID ) ; $ file = self :: get_thumbnail_file ( $ meta ) ; if ( ! $ file ) $ file = $ dir [ 'basedir' ] . DIRECTORY_SEPARATOR . $ meta [ 'file' ] ; if ( ! file_exists ( $ file ) ) continue ; # limit the size of all attachments $ size = filesize ( $ file ) ; if ( $ size < $ max_size ) { $ attachments [ ] = $ file ; $ unique_posts [ ] = $ p -> ID ; } } return $ attachments ; }
apply reference headers

@param array $attachments
@param array $iac_options
@param int $post_ID
@return array
apply reference headers