wphooks.info - editable_extensions

editable_extensions

The hook occurs in the following file:

wp-admin/plugin-editor.php:
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
	// List of allowable extensions
	$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');

	/**
	 * Filters file type extensions editable in the plugin editor.
	 *
	 * @since 2.8.0
	 *
	 * @param array $editable_extensions An array of editable plugin file extensions.
	 */
	$editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions );

	if ( ! is_file($real_file) ) {
		wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
	} else {
		// Get the extension of the file
		if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) {
			$ext = strtolower($matches[1]);
			// If extension is not in the acceptable list, skip it
			if ( !in_array( $ext, $editable_extensions) )