[wp-trac] [WordPress Trac] #20315: Remove unused code in media.php (was: code cleaning)
WordPress Trac
wp-trac at lists.automattic.com
Tue Apr 3 21:35:04 UTC 2012
#20315: Remove unused code in media.php
--------------------------+------------------------------
Reporter: arena | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version: 3.4
Severity: normal | Resolution:
Keywords: close |
--------------------------+------------------------------
Changes (by kurtpayne):
* cc: kpayne@… (added)
* keywords: => close
Comment:
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 `shortcode` method, a `maybe_make_link` method is called, which
uses `$linkifunknown`. It's true here.
`$output = ( $this->linkifunknown ) ? '<a href="' . esc_attr($url) . '">'
. esc_html($url) . '</a>' : $url;`
`$linkifunknown` is only false when called from `autoembed_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 `shortcode` is called from `autoembed_callback`, `$linkifunknown` is
false.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20315#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list