wp/wp-admin/includes/translation-install.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    12  *
    12  *
    13  * @since 4.0.0
    13  * @since 4.0.0
    14  *
    14  *
    15  * @param string       $type Type of translations. Accepts 'plugins', 'themes', 'core'.
    15  * @param string       $type Type of translations. Accepts 'plugins', 'themes', 'core'.
    16  * @param array|object $args Translation API arguments. Optional.
    16  * @param array|object $args Translation API arguments. Optional.
    17  * @return object|WP_Error On success an object of translations, WP_Error on failure.
    17  * @return array|WP_Error On success an associative array of translations, WP_Error on failure.
    18  */
    18  */
    19 function translations_api( $type, $args = null ) {
    19 function translations_api( $type, $args = null ) {
    20 	// Include an unmodified $wp_version.
    20 	// Include an unmodified $wp_version.
    21 	require ABSPATH . WPINC . '/version.php';
    21 	require ABSPATH . WPINC . '/version.php';
    22 
    22 
    27 	/**
    27 	/**
    28 	 * Allows a plugin to override the WordPress.org Translation Installation API entirely.
    28 	 * Allows a plugin to override the WordPress.org Translation Installation API entirely.
    29 	 *
    29 	 *
    30 	 * @since 4.0.0
    30 	 * @since 4.0.0
    31 	 *
    31 	 *
    32 	 * @param false|object $result The result object. Default false.
    32 	 * @param false|array $result The result array. Default false.
    33 	 * @param string       $type   The type of translations being requested.
    33 	 * @param string      $type   The type of translations being requested.
    34 	 * @param object       $args   Translation API arguments.
    34 	 * @param object      $args   Translation API arguments.
    35 	 */
    35 	 */
    36 	$res = apply_filters( 'translations_api', false, $type, $args );
    36 	$res = apply_filters( 'translations_api', false, $type, $args );
    37 
    37 
    38 	if ( false === $res ) {
    38 	if ( false === $res ) {
    39 		$url      = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
    39 		$url      = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
   100 	/**
   100 	/**
   101 	 * Filters the Translation Installation API response results.
   101 	 * Filters the Translation Installation API response results.
   102 	 *
   102 	 *
   103 	 * @since 4.0.0
   103 	 * @since 4.0.0
   104 	 *
   104 	 *
   105 	 * @param object|WP_Error $res  Response object or WP_Error.
   105 	 * @param array|WP_Error $res  Response as an associative array or WP_Error.
   106 	 * @param string          $type The type of translations being requested.
   106 	 * @param string         $type The type of translations being requested.
   107 	 * @param object          $args Translation API arguments.
   107 	 * @param object         $args Translation API arguments.
   108 	 */
   108 	 */
   109 	return apply_filters( 'translations_api_result', $res, $type, $args );
   109 	return apply_filters( 'translations_api_result', $res, $type, $args );
   110 }
   110 }
   111 
   111 
   112 /**
   112 /**