Make WordPress Core

Changeset 48163


Ignore:
Timestamp:
06/25/2020 09:29:19 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Synchronize documentation and variable names in wp_get_(plugin|theme)_file_editable_extensions() for consistency.

Add missing @since tag to wp_get_theme_file_editable_extensions().

See #49572.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r48161 r48163  
    175175
    176176/**
    177  * Get list of file extensions that are editable in plugins.
     177 * Gets the list of file extensions that are editable in plugins.
    178178 *
    179179 * @since 4.9.0
     
    183183 */
    184184function wp_get_plugin_file_editable_extensions( $plugin ) {
    185 
    186     $editable_extensions = array(
    187         'bash',
    188         'conf',
    189         'css',
    190         'diff',
    191         'htm',
    192         'html',
    193         'http',
    194         'inc',
    195         'include',
    196         'js',
    197         'json',
    198         'jsx',
    199         'less',
    200         'md',
    201         'patch',
    202         'php',
    203         'php3',
    204         'php4',
    205         'php5',
    206         'php7',
    207         'phps',
    208         'phtml',
    209         'sass',
    210         'scss',
    211         'sh',
    212         'sql',
    213         'svg',
    214         'text',
    215         'txt',
    216         'xml',
    217         'yaml',
    218         'yml',
    219     );
    220 
    221     /**
    222      * Filters file type extensions editable in the plugin editor.
    223      *
    224      * @since 2.8.0
    225      * @since 4.9.0 Added the `$plugin` parameter.
    226      *
    227      * @param string[] $editable_extensions An array of editable plugin file extensions.
    228      * @param string   $plugin              Path to the plugin file relative to the plugins directory.
    229      */
    230     $editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions, $plugin );
    231 
    232     return $editable_extensions;
    233 }
    234 
    235 /**
    236  * Get list of file extensions that are editable for a given theme.
    237  *
    238  * @param WP_Theme $theme Theme object.
    239  * @return string[] Array of editable file extensions.
    240  */
    241 function wp_get_theme_file_editable_extensions( $theme ) {
    242185
    243186    $default_types = array(
     
    277220
    278221    /**
    279      * Filters the list of file types allowed for editing in the Theme editor.
     222     * Filters the list of file types allowed for editing in the plugin editor.
     223     *
     224     * @since 2.8.0
     225     * @since 4.9.0 Added the `$plugin` parameter.
     226     *
     227     * @param string[] $default_types An array of editable plugin file extensions.
     228     * @param string   $plugin        Path to the plugin file relative to the plugins directory.
     229     */
     230    $file_types = (array) apply_filters( 'editable_extensions', $default_types, $plugin );
     231
     232    return $file_types;
     233}
     234
     235/**
     236 * Gets the list of file extensions that are editable for a given theme.
     237 *
     238 * @since 4.9.0
     239 *
     240 * @param WP_Theme $theme Theme object.
     241 * @return string[] Array of editable file extensions.
     242 */
     243function wp_get_theme_file_editable_extensions( $theme ) {
     244
     245    $default_types = array(
     246        'bash',
     247        'conf',
     248        'css',
     249        'diff',
     250        'htm',
     251        'html',
     252        'http',
     253        'inc',
     254        'include',
     255        'js',
     256        'json',
     257        'jsx',
     258        'less',
     259        'md',
     260        'patch',
     261        'php',
     262        'php3',
     263        'php4',
     264        'php5',
     265        'php7',
     266        'phps',
     267        'phtml',
     268        'sass',
     269        'scss',
     270        'sh',
     271        'sql',
     272        'svg',
     273        'text',
     274        'txt',
     275        'xml',
     276        'yaml',
     277        'yml',
     278    );
     279
     280    /**
     281     * Filters the list of file types allowed for editing in the theme editor.
    280282     *
    281283     * @since 4.4.0
    282284     *
    283      * @param string[] $default_types List of allowed file types.
    284      * @param WP_Theme $theme         The current Theme object.
     285     * @param string[] $default_types An array of editable theme file extensions.
     286     * @param WP_Theme $theme         The current theme object.
    285287     */
    286288    $file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );
Note: See TracChangeset for help on using the changeset viewer.