Upload::file_name_search_replace( array $m )
Description #
Callback for preg replace callback for replacing temporary images in a string.
Parameters #
- $marray (Required) Matching tags.
Source #
File: lib/form/class-upload.php
private function file_name_search_replace( $m ) { preg_match_all( '/"([^"]*)"/', $m[2], $attrs, PREG_SET_ORDER, 0 ); $sanitized_filename = sanitize_file_name( $attrs[0][1] ); if ( ! empty( $this->uploaded_files[ $sanitized_filename ] ) ) { $url = wp_get_attachment_url( $this->uploaded_files[ $sanitized_filename ] ); $alt = ! empty( $attrs[1][1] ) ? ' alt="' . esc_attr( $attrs[1][1] ) . '"' : ''; return '<img src="' . $url . '"' . $alt . ' />'; } }
Expand full source code Collapse full source code View on GitHub: lib/form/class-upload.php:295
Add your comment