=== FileSmith Editor ===
Contributors: wpwebguru
Tags: file editor, theme editor, plugin editor, code editor, file manager
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Edit theme and plugin files with the familiar editor layout, plus create, rename, move, delete, backups and zip download.

== Description ==

The built-in Theme File Editor and Plugin File Editor can only change existing files. FileSmith Editor keeps the same familiar layout, with the code editor on the left, the file list on the right and the theme or plugin selector on top, and adds the tools they are missing.

**Features**

* Syntax highlighting with the same code editor WordPress uses.
* Open several files as tabs. Each tab keeps its own changes, cursor and undo history.
* Create files and folders, rename, move, duplicate and delete them from the file list.
* Upload files, such as images and fonts, into any folder.
* Automatic backup before every save, with a changes view (diff), a preview and a restore screen.
* Trash: deleted files and folders can be restored.
* Backups follow your files when you rename or move them.
* PHP syntax check before saving, so a typo cannot break your site.
* Download a whole theme or plugin as a zip.
* Works with themes and plugins from one screen.
* Settings page: backups per file, allowed file types, excluded folders, editor font size and theme.
* Activity log: see who saved, created, renamed, moved, deleted or downloaded what, and when.
* Access control by role or by user for view, edit, create, upload, rename, move, delete, backups, trash and zip download.

**Built with security in mind**

* Every request is protected by a nonce and a capability check (`edit_themes` or `edit_plugins`).
* Respects `DISALLOW_FILE_EDIT` and `DISALLOW_FILE_MODS`, so hosts that turn file editing off stay protected.
* Paths are validated, so nothing outside the selected theme or plugin folder can be read or changed.
* Only text based file types can be edited and created.

Editing live code is always risky. FileSmith Editor adds a safety net, but you should still keep regular full backups of your site.

== Installation ==

1. Upload the `filesmith-editor` folder to the `/wp-content/plugins/` directory, or install the plugin from the Plugins screen.
2. Activate the plugin through the Plugins screen.
3. Go to FileSmith, then Editor, in the admin menu.
4. Choose Theme or Plugin, pick the item to edit, and select a file from the list.

== Frequently Asked Questions ==

= I cannot see the editor. =

The editor is hidden when `DISALLOW_FILE_EDIT` or `DISALLOW_FILE_MODS` is set in `wp-config.php`, or when your user cannot edit themes or plugins. On a multisite network only super admins can use it.

= Are single-file plugins supported? =

Not yet. A plugin needs to live in its own folder.

= Which files can I edit? =

php, css, scss, less, js, json, txt, md, html, htm, xml, svg, po, pot, ini, yml and yaml. Developers can change the list with the `fsed_editable_extensions` filter.

= Can I limit what other users do? =

Yes. Go to FileSmith, then Settings. Tick the actions each role may do, or add a user to give that person their own list. Administrators always have full access. The settings can only limit access: users still need the WordPress `edit_themes` or `edit_plugins` capability.

= Where are the backups stored? =

In a folder with a random name inside your uploads folder. The folder is protected with an `index.php` and an `.htaccess` file, and backups use the `.bak` extension so they are never executed. Each backup also records the name of the user who saved the change. The latest 20 backups of each file are kept. If a backup cannot be created, the file is not saved.

= Does the PHP syntax check catch every error? =

No. It catches parse errors, such as a missing semicolon or bracket. It cannot catch runtime errors, such as calling a function that does not exist.

= Can I undo a delete? =

Yes. Deleted files and folders go to the Trash and can be restored from the Trash button. Items are removed for good after 30 days, and the trash keeps up to 100 items.

= How do I keep the backups when I delete the plugin? =

Add `define( 'FSED_KEEP_DATA', true );` to your `wp-config.php` before deleting the plugin. Otherwise the plugin options and the backup folder are removed on uninstall.

= Which hooks are available for developers? =

* `fsed_editable_extensions` filters the editable file types.
* `fsed_max_file_size` filters the maximum size of an editable file.
* `fsed_upload_extensions` filters the file types that can be uploaded.
* `fsed_max_upload_size` filters the maximum size of an uploaded file (default 5 MB, never above the server limit).
* `fsed_pre_save` runs before a file is saved and can stop the save by returning a `WP_Error`.
* `fsed_check_php_syntax` turns the PHP syntax check on or off.
* `fsed_require_backup` decides whether a failed backup stops the save.
* `fsed_max_backups` filters how many backups are kept for each file.
* `fsed_trash_enabled` turns the trash on or off.
* `fsed_trash_days` filters how many days trashed items are kept.
* `fsed_trash_max_items` filters how many trashed items are kept.
* `fsed_zip_excluded` filters the names left out of a zip download.
* `fsed_zip_max_size` filters the maximum size of a zip download.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
