Opened 14 years ago
Closed 14 years ago
#20315 closed defect (bug) (invalid)
Remove unused code in media.php
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.9 |
| Component: | Embeds | Keywords: | close |
| Focuses: | Cc: |
Description
linkifunknown variable is useless because always false when tested !
wp-includes/media.php:1029: var $linkifunknown = true; wp-includes/media.php:1276: $oldval = $this->linkifunknown; wp-includes/media.php:1277: $this->linkifunknown = false; wp-includes/media.php:1279: $this->linkifunknown = $oldval; wp-includes/media.php:1291: $output = ( $this->linkifunknown ) ? '<a href="' . esc_attr($url) . '">' . esc_html($url) . '</a>' : $url;
Change History (3)
Note: See
TracTickets for help on using
tickets.
It's not immediately clear what's going on, but it's definitely not dead code.
It's first declared as true:
var $linkifunknown = true;Then a shortcode named 'embed' is added:
add_shortcode( 'embed', array(&$this, 'shortcode') );In the
shortcodemethod, amaybe_make_linkmethod is called, which uses$linkifunknown. It's true here.$output = ( $this->linkifunknown ) ? '<a href="' . esc_attr($url) . '">' . esc_html($url) . '</a>' : $url;$linkifunknownis only false when called fromautoembed_callback.function autoembed_callback( $match ) { $oldval = $this->linkifunknown; $this->linkifunknown = false; $return = $this->shortcode( array(), $match[1] ); $this->linkifunknown = $oldval; return "\n$return\n"; }When
shortcodeis called fromautoembed_callback,$linkifunknownis false.