_get_plugin_data_markup_translate

Definition:
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {}

Parameters

  • $plugin_file
  • $plugin_data
  • $markup
  • $translate

Source code

function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {



	//Translate fields

	if ( $translate && ! empty($plugin_data['TextDomain']) ) {

		if ( ! empty( $plugin_data['DomainPath'] ) )

			load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']);

		else

			load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));



		foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field )

			$plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);

	}



	$plugins_allowedtags = array(

		'a'       => array( 'href' => array(), 'title' => array() ),

		'abbr'    => array( 'title' => array() ),

		'acronym' => array( 'title' => array() ),

		'code'    => array(),

		'em'      => array(),

		'strong'  => array(),

	);



	$plugin_data['AuthorName'] = $plugin_data['Author'] = wp_kses( $plugin_data['Author'], $plugins_allowedtags );



	//Apply Markup

	if ( $markup ) {

		if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) )

			$plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__( 'Visit plugin homepage' ) . '">' . $plugin_data['Name'] . '</a>';

		else

			$plugin_data['Title'] = $plugin_data['Name'];



		if ( ! empty($plugin_data['AuthorURI']) && ! empty($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 ( ! empty($plugin_data['Author']) )

			$plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';

	}



	// Sanitize all displayed data. Author and AuthorName sanitized above.

	$plugin_data['Title']       = wp_kses( $plugin_data['Title'],       $plugins_allowedtags );

	$plugin_data['Version']     = wp_kses( $plugin_data['Version'],     $plugins_allowedtags );

	$plugin_data['Description'] = wp_kses( $plugin_data['Description'], $plugins_allowedtags );

	$plugin_data['Name']        = wp_kses( $plugin_data['Name'],        $plugins_allowedtags );



	return $plugin_data;

}

4327

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: