_get_plugin_data_markup_translate [ WordPress Function ]
_get_plugin_data_markup_translate ( $plugin_file, $plugin_data, $markup = true, $translate = true )
| Access: |
|
| See: | |
| Defined at: |
|
Soorgelijke functies: get_plugin_data, get_plugin_updates, _get_list_table, get_plugin_page_hook, get_plugin_files
Sanitizes plugin data, optionally adds markup, optionally translates.
Source
<?php
function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) {
// Translate fields
if ( $translate ) {
if ( $textdomain = $plugin_data['TextDomain'] ) {
if ( $plugin_data['DomainPath'] )
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
else
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
} elseif ( in_array( basename( $plugin_file ), array( 'hello.php', 'akismet.php' ) ) ) {
$textdomain = 'default';
}
if ( $textdomain ) {
foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field )
$plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
}
}
// Sanitize fields
$allowed_tags = $allowed_tags_in_links = array(
'abbr' => array( 'title' => true ),
'acronym' => array( 'title' => true ),
'code' => true,
'em' => true,
'strong' => true,
);
$allowed_tags['a'] = array( 'href' => true, 'title' => true );
// Name is marked up inside <a> tags. Don't allow these.
// Author is too, but some plugins have used <a> here (omitting Author URI).
$plugin_data['Name'] = wp_kses( $plugin_data['Name'], $allowed_tags_in_links );
$plugin_data['Author'] = wp_kses( $plugin_data['Author'], $allowed_tags );
$plugin_data['Description'] = wp_kses( $plugin_data['Description'], $allowed_tags );
$plugin_data['Version'] = wp_kses( $plugin_data['Version'], $allowed_tags );
$plugin_data['PluginURI'] = esc_url( $plugin_data['PluginURI'] );
$plugin_data['AuthorURI'] = esc_url( $plugin_data['AuthorURI'] );
$plugin_data['Title'] = $plugin_data['Name'];
$plugin_data['AuthorName'] = $plugin_data['Author'];
// Apply markup
if ( $markup ) {
if ( $plugin_data['PluginURI'] && $plugin_data['Name'] )
$plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__( 'Visit plugin homepage' ) . '">' . $plugin_data['Name'] . '</a>';
if ( $plugin_data['AuthorURI'] && $plugin_data['Author'] )
$plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . esc_attr__( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
$plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
if ( $plugin_data['Author'] )
$plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s.'), $plugin_data['Author'] ) . '</cite>';
}
return $plugin_data;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/ get plugin data markup translate « WordPress ...
_get_plugin_data_markup_translate is the name of an undocumented function in the global namespace within WordPress. It is a File Header related function.
codex.wordpress.org - #20266 (Update get_plugin_data()) – WordPress Trac
#20103 started with taking get_plugin_data() and _get_plugin_data_markup_translate() and applying the same concept to themes. Eventually I discarded that ...
core.trac.wordpress.org - #15858 (Twenty Ten i18n - translated strings not visible ...
comment:4 SergeyBiryukov — 17 months ago. Should we reuse _get_plugin_data_markup_translate() or create a separate function?
core.trac.wordpress.org - Docs for page plugin.php
_get_plugin_data_markup_translate (line 109). void _get_plugin_data_markup_translate ( $plugin_file, $plugin_data, [ $markup = true], [ $translate = true]) ...
phpdoc.ftwr.co.uk