'custom-fields' ) * * @return array updated add_post_type_support() array */ public static function mla_edit_media_support_filter( $add_support ) { /* * Uncomment the error_log statements in any of the filters to see what's passed in */ //error_log( 'MLAMetaboxHooksExample::mla_edit_media_support_filter $add_support = ' . var_export( $add_support, true ), 0 ); // to suppress Custom Fields, return an empty array, i.e., return array(); return $add_support; } // mla_edit_media_support_filter /** * MLA Edit Media Meta Boxes Filter * * This filter gives you an opportunity to record the original list of meta box slugs. * You can also remove elements from the array to suppress one or more meta boxes. * * @since 1.00 * * @param array the file name, type and location * @param array the IPTC, EXIF and WordPress image_metadata * * @return array updated file name and other information */ public static function mla_edit_media_meta_boxes_filter( $active_boxes ) { /* * Uncomment the error_log statements in any of the filters to see what's passed in */ //error_log( 'MLAMetaboxHooksExample::mla_edit_media_meta_boxes_filter $active_boxes = ' . var_export( $active_boxes, true ), 0 ); /* * Save the information for use in the later filters */ self::$default_meta_boxes = $active_boxes; // to suppress a box, remove it from the array, e.g., unset( $active_boxes['mla-menu-order'] ); self::$active_meta_boxes = $active_boxes; return $active_boxes; } // mla_edit_media_meta_boxes_filter /** * MLA Parent Info Meta Box Filter * * This filter gives you an opportunity to modify the text portion of the "Parent Info" meta box. * * @since 1.00 * * @param string the default parent information * @param array the attachment references information for this post * @param object the current post * * @return array updated parent information */ public static function mla_parent_info_meta_box_filter( $parent_info, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_parent_info_meta_box_filter $parent_info = ' . var_export( $parent_info, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_parent_info_meta_box_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_parent_info_meta_box_filter $post = ' . var_export( $post, true ), 0 ); return $parent_info; } // mla_parent_info_meta_box_filter /** * MLA Menu Order Meta Box Filter * * This filter gives you an opportunity to modify the "Menu Order" meta box. * * @since 1.00 * * @param string the default menu order * @param object the current post * * @return array updated menu order */ public static function mla_menu_order_meta_box_filter( $menu_order, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_menu_order_meta_box_filter $menu_order = ' . var_export( $menu_order, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_menu_order_meta_box_filter $post = ' . var_export( $post, true ), 0 ); return $menu_order; } // mla_menu_order_meta_box_filter /** * MLA Attachment Metadata Meta Box Filter * * This filter gives you an opportunity to modify the "Attachment Metadata" meta box. * * @since 1.00 * * @param array ( [value] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment metadata for this post (all of it); image metadata, if any, is in * $metadata['mla_wp_attachment_metadata'] * @param object the current post * * @return array updated parent information */ public static function mla_image_metadata_meta_box_filter( $value, $metadata, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_filter $value = ' . var_export( $value, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_filter $metadata = ' . var_export( $metadata, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_filter $post = ' . var_export( $post, true ), 0 ); return $value; } // mla_image_metadata_meta_box_filter /** * MLA Attachment Metadata Meta Box HTML Filter * * This filter gives you an opportunity to modify the "Attachment Metadata" meta box HTML content. * * @since 1.00 * * @param string Meta box contents markup * @param array ( [value] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment metadata for this post (all of it); image metadata, if any, is in * $metadata['mla_wp_attachment_metadata'] * @param object the current post * * @return array updated meta box contents markup */ public static function mla_image_metadata_meta_box_html_filter( $html, $value, $metadata, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_html_filter $html = ' . var_export( $html, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_html_filter $value = ' . var_export( $value, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_html_filter $metadata = ' . var_export( $metadata, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_image_metadata_meta_box_html_filter $post = ' . var_export( $post, true ), 0 ); return $html; } // mla_image_metadata_meta_box_html_filter /** * MLA Featured in Meta Box Filter * * This filter gives you an opportunity to modify the "Featured in" meta box. * * @since 1.00 * * @param array ( [features] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated text, rows, columns */ public static function mla_featured_in_meta_box_filter( $features, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_filter $features = ' . var_export( $features, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_filter $post = ' . var_export( $post, true ), 0 ); return $features; } // mla_featured_in_meta_box_filter /** * MLA Featured in Meta Box HTML Filter * * This filter gives you an opportunity to modify the "Featured in" meta box HTML content. * * @since 1.00 * * @param string Meta box contents markup * @param array ( [features] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated meta box contents markup */ public static function mla_featured_in_meta_box_html_filter( $html, $features, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_html_filter $html = ' . var_export( $html, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_html_filter $features = ' . var_export( $features, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_html_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_featured_in_meta_box_html_filter $post = ' . var_export( $post, true ), 0 ); return $html; } // mla_featured_in_meta_box_html_filter /** * MLA Inserted in Meta Box Filter * * This filter gives you an opportunity to modify the "Inserted in" meta box. * * @since 1.00 * * @param array ( [inserts] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated text, rows, columns */ public static function mla_inserted_in_meta_box_filter( $inserts, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_filter $inserts = ' . var_export( $inserts, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_filter $post = ' . var_export( $post, true ), 0 ); // Comment out this return statement to fall through to the example code that simplifies the display return $inserts; $new_inserts = array(); $upload_dir = wp_upload_dir(); $file_url = $upload_dir['baseurl'] . '/' . $references['base_file']; $new_inserts[] = $references['file']; $new_inserts[] = '(' . $file_url . ')'; // Index on post ID to eliminate duplicates $base_references = array(); foreach( $references['inserts'] as $key => $file_references ) { foreach ( $file_references as $reference ) { $base_references[ $reference->ID ] = $reference; } } foreach ( $base_references as $reference ) { $new_inserts[] = $reference->post_title; $new_inserts[] = '(' . get_permalink( $reference->ID, false ) . ')'; } // Uncomment these lines to display the arguments in the meta box //$new_inserts[] = '----- debug information -----'; //$new_inserts[] = '$inserts = ' . var_export( $inserts, true ); //$new_inserts[] = '$references = ' . var_export( $references, true ); //$new_inserts[] = '$post = ' . var_export( $post, true ); $inserts['inserts'] = implode( "\n", $new_inserts ); return $inserts; } // mla_inserted_in_meta_box_filter /** * MLA Inserted in Meta Box HTML Filter * * This filter gives you an opportunity to modify the "Inserted in" meta box HTML content. * * @since 1.00 * * @param string Meta box contents markup * @param array ( [inserts] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated meta box contents markup */ public static function mla_inserted_in_meta_box_html_filter( $html, $inserts, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_html_filter $html = ' . var_export( $html, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_html_filter $inserts = ' . var_export( $inserts, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_html_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_html_filter $post = ' . var_export( $post, true ), 0 ); return $html; } // mla_inserted_in_meta_box_html_filter /** * MLA Gallery in Meta Box Filter * * This filter gives you an opportunity to modify the "Gallery in" meta box. * * @since 1.00 * * @param array ( [galleries] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated text, rows, columns */ public static function mla_gallery_in_meta_box_filter( $galleries, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_filter $galleries = ' . var_export( $galleries, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_filter $post = ' . var_export( $post, true ), 0 ); return $galleries; } // mla_gallery_in_meta_box_filter /** * MLA Gallery in Meta Box HTML Filter * * This filter gives you an opportunity to modify the "Gallery in" meta box HTML content. * * @since 1.00 * * @param string Meta box contents markup * @param array ( [galleries] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated meta box contents markup */ public static function mla_gallery_in_meta_box_html_filter( $html, $galleries, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_html_filter $html = ' . var_export( $html, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_html_filter $galleries = ' . var_export( $galleries, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_html_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_gallery_in_meta_box_html_filter $post = ' . var_export( $post, true ), 0 ); return $html; } // mla_gallery_in_meta_box_html_filter /** * MLA MLA Gallery in Meta Box Filter * * This filter gives you an opportunity to modify the "MLA Gallery in" meta box. * * @since 1.00 * * @param array ( [galleries] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated text, rows, columns */ public static function mla_mla_gallery_in_meta_box_filter( $galleries, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_filter $galleries = ' . var_export( $galleries, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_filter $post = ' . var_export( $post, true ), 0 ); return $galleries; } // mla_mla_gallery_in_meta_box_filter /** * MLA MLA Gallery in Meta Box HTML Filter * * This filter gives you an opportunity to modify the "MLA Gallery in" meta box HTML content. * * @since 1.00 * * @param string Meta box contents markup * @param array ( [galleries] => default text, [rows] => textbox rows, [cols] => textbox columns ) * @param array the attachment references information for this post * @param object the current post * * @return array updated meta box contents markup */ public static function mla_mla_gallery_in_meta_box_html_filter( $html, $galleries, $references, $post ) { //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_html_filter $html = ' . var_export( $html, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_html_filter $galleries = ' . var_export( $galleries, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_html_filter $references = ' . var_export( $references, true ), 0 ); //error_log( 'MLAMetaboxHooksExample::mla_mla_gallery_in_meta_box_html_filter $post = ' . var_export( $post, true ), 0 ); return $html; } // mla_mla_gallery_in_meta_box_html_filter } //MLAMetaboxHooksExample /* * Install the filters at an early opportunity */ add_action('init', 'MLAMetaboxHooksExample::initialize'); ?>