mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 10:02:43 +01:00
Press This:
- Remove classes from suggested HTML for the editor. - Improve the filter, pass an associative array as param. - Use <em> instead of <cite>. Props Michael-Arestad, kraftbj. Fixes #31493. git-svn-id: https://develop.svn.wordpress.org/trunk@31601 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
340fa25658
commit
0b962e2238
@ -31,8 +31,11 @@ class WP_Press_This {
|
||||
* @return array Site settings.
|
||||
*/
|
||||
public function site_settings() {
|
||||
$html = '<p class="press-this-suggested-source">' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
|
||||
' <cite><a href="%1$s">%2$s</a></cite></p>';
|
||||
$default_html = array(
|
||||
'quote' => '<blockquote>%1$s</blockquote>',
|
||||
'link' => '<p>' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
|
||||
' <em><a href="%1$s">%2$s</a></em></p>',
|
||||
);
|
||||
|
||||
return array(
|
||||
// Used to trigger the bookmarklet update notice.
|
||||
@ -49,13 +52,14 @@ class WP_Press_This {
|
||||
'redirInParent' => apply_filters( 'press_this_redirect_in_parent', false ),
|
||||
|
||||
/**
|
||||
* Filter the HTML for the Press This source attribution.
|
||||
* Filter the default HTML for the Press This editor.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @param string $html Default HTML, %1$s is link href, %2$s is link text.
|
||||
* @param array $default_html Associative array with two keys: 'quote' where %1$s is replaced with the site description
|
||||
* or the selected content, and 'link' there %1$s is link href, %2$s is link text.
|
||||
*/
|
||||
'suggestedHTML' => apply_filters( 'press_this_suggested_html', $html ),
|
||||
'html' => apply_filters( 'press_this_suggested_html', $default_html ),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -200,15 +200,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ( text ) {
|
||||
text = sanitizeText( text );
|
||||
// Wrap suggested content in blockquote tag.
|
||||
content = '<blockquote class="press-this-suggested-content">' + text + '</blockquote>';
|
||||
if ( text && siteConfig.html.quote ) {
|
||||
// Wrap suggested content in specified HTML.
|
||||
content = siteConfig.html.quote.replace( /%1\$s/g, sanitizeText( text ) );
|
||||
}
|
||||
|
||||
// Add a source attribution if there is one available.
|
||||
if ( url && siteConfig.suggestedHTML && ( ( title && __( 'newPost' ) !== title ) || siteName ) ) {
|
||||
content += siteConfig.suggestedHTML.replace( /%1\$s/g, encodeURI( url ) ).replace( /%2\$s/g, ( title || siteName ) );
|
||||
if ( url && siteConfig.html.link && ( ( title && __( 'newPost' ) !== title ) || siteName ) ) {
|
||||
content += siteConfig.html.link.replace( /%1\$s/g, encodeURI( url ) ).replace( /%2\$s/g, ( title || siteName ) );
|
||||
}
|
||||
|
||||
return content || '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user