Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Public Functions

Thorsten Frommen edited this page Dec 10, 2015 · 18 revisions

Display the link to other Languages

Wrapper of Inpsyde_Multilingualpress_Helpers function for function to get the linked elements and display them as a list

 /**
 * wrapper of Inpsyde_Multilingualpress_Helpers function for function to get the linked elements and display them as a list
 *
 * @access  public
 * @since   0.8
 * @param   mixed param array
 */
 function mlp_show_linked_elements( $args )

Parameters

  • link_text
    • Available values
      • text - only show the name of the language (default)
      • flag - display the flag of the language
      • text_flag - display name of the language and the flag of the language
  • echo
    • Available values
      • TRUE - Output the HTML (default)
      • FALSE - Return the HTML
  • sort
    • Available values
      • blogid - use the blogid to sort (default)
      • name - use the language name to sort
  • show_current_blog
    • Available values
      • TRUE - display the current language
      • FALSE - hide the current language (default)

Example

Output of mlp_show_linked_elements( array( 'link_text' => 'flag', 'show_current_blog' => TRUE ) );

<div class="mlp_language_box">
	<ul>
		<li><a href="http://example.org/blog2?noredirect=en"><img title="en" alt="en" src="http://example.org/wp-content/plugins/multilingual-press/flags/us.gif"></a></li>
		<li class="current"><a href="http://example.org/blog3?noredirect=de"><img title="de" alt="de" src="http://example.org/wp-content/plugins/multilingual-press/flags/de.gif" id="mlp_current_locale">de</a></li>
	</ul>
</div>

Load the available languages

Wrapper of internal inpsyde_multilingualpress:get_available_languages

/**
 * wrapper of internal inpsyde_multilingualpress:get_available_languages
 * load the available languages  
 *
 * @access  public
 * @since   0.1
 * @return  array Available languages
 */
mlp_get_available_languages()

Load the available language titles

Wrapper of internal inpsyde_multilingualpress:: get_available_language_title

/**
 * wrapper of internal inpsyde_multilingualpress:: get_available_language_title
 * load the available language titles  
 *
 * @access  public
 * @since   0.5.3b
 * @return  array Available languages
 */
mlp_get_available_languages_titles()

Get the element ID in other blogs for the selected element

Wrapper of internal inpsyde_multilingualpress function to get the element ID in other blogs for the selected element

/**
 * wrapper of internal inpsyde_multilingualpress function to get the element ID in other blogs for the selected element  
 *
 * @access  public
 * @since   0.1
 * @param   int $element_id ID of the selected element
 * @param   string $type type of the selected element
 * @param   int $blog_id ID of the selected blog
 * @return  array linked elements
 */
mlp_get_linked_elements( $element_id, $type = '', $blog_id = 0 )

Return an Array with Blog_ID => Post_ID Example:

array
  2 => int 48 (length=2)
  5 => int 10 (length=2)

Get activated on all language blogs

Wrapper of internal inpsyde_multilingualpress function for custom plugins to get activated on all language blogs

/**
 * wrapper of internal inpsyde_multilingualpress function for custom plugins to get activated on all language blogs  
 *
 * @access  public
 * @since   0.1
 * @param   int $element_id ID of the selected element
 * @param   string $type type of the selected element
 * @param   int $blog_id ID of the selected blog
 * @param   string $hook name of the hook that will be executed
 * @param   array $param parameters for the function
 * @return  array linked elements
 */
mlp_run_custom_plugin( $element_id, $type = '', $blog_id = 0, $hook, $param )

Get the url of the flag from a blogid

Wrapper of internal inpsyde_multilingualpress function for function to get the url of the flag from a blogid

/**
 * wrapper of internal inpsyde_multilingualpress function for function to get the url of the flag from a blogid  

 * @access  public
 * @since   0.1
 * @param   int $blog_id ID of a blog
 * @return  string url of the language image
 */
mlp_get_language_flag( $blog_id = 0 ) 

Clone this wiki locally