WordPress plugin intelligence profile

Code Revisions

WordPress native revisions for the theme and plugin editors.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 3.7
Current version1.0
WordPress coverageTested up to WordPress 3.7
Minimum stackWP 3.6 · PHP —
Directory statusactive
Last directory update30 Sept 201313y ago
Active installations10Adoption metric — not a quality score
WordPress.org rating4.2 / 5 from 6 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Code Revisions version 1.0 as active, updated 13y ago and tested up to WordPress 3.7.

Overview

About this plugin

This plugin will help you to keep track of changes made to theme and plugin files through the WordPress code editors. You no longer need to worry about possibly breaking something with bad changes because you can always return to an older version of the file. Additionally the plugin helps you to redo your changes when they might have been overwritten by a plugin update by easily showing you what changed.

The revisions are handled in a way native to WordPress. 6.

This plugin is part of my Google Summer of Code 2013 project at WordPress. You can find more information on make/core. com if you are interested in some background information.

Developer’s Guide

php: The main plugin file. It defines constants, loads the other files, instantiates the classes if appropriate and contains the uninstall automatism.

php: Loaded on all pages this class does multiple general things. php ) when he tries to view those posts directly ( redirect() ). php ) when viewing code revisions so it feels more code-editor-ish ( styles() ).

php hooks. Using either, if available, POST and GET data or falling back to the appropriate default file the class generates an array containing meta information on the currently viewed file ( generate_meta() ). In an attempt to have as less theme or plugin file specific code this array contains 4 strings:

  • type: ‘plugin’/’theme’
  • package: theme slug or ‘plugin/plugin.php’
  • file: relative file path from the theme’s folder or the WordPress plugin directory
  • checksum: md5-checksum of the file

Using this data the plugin can check the database for a related post and retrieve it’s id if available ( retrieve() ). The meta information array is stored as custom post meta data alongside a file’s post.

When a file is opened in the editor and a related post is found in the database the plugin checks if the post’s content and the file’s content still match. If they don’t the post is updated with the new content (which results in a new revision) and the user is notified about the change using an admin notice ( handle_direct_changes() ).

On file updates through the code editor the plugin checks if the file has actually changed before WordPress writes to it. Only when changes are found a revision needs to be created. If no post is associated with the file yet a new post is created with the old contents.

This post is then updated with the new content. This process guarantees that there is a revision with the initial file content to which the user can revert to ( handle_file_update() ). php files to prevent breaking the WordPress installation ( check_syntax() ).

As mostly recommended the plugin utilizes php -l for this by writing the new contents to a temporary file. If this feature is not available a more basic check using eval is performed. When a syntax error is found the actual file is not written, but the user is redirected back to the editor with a notification about the error and it’s location with line highlighting.

php: Contains a slightly changed version of the pluggable wp_text_diff() function. wp_text_diff() is utilized for generating the diffs rendered in the revision viewer. Normally it strips leading, trailing and multiple successive whitespaces.

However this behavior is not very helpful when viewing code revisions, wherefore the plugin suppresses it for revisions associated with the custom code revisions post type.

php: The template for the revision metabox.

php ). It adds the revisions metabox below the editors, the revisions text with link next to the ‘Update File’ button and handles the text replacement and line highlighting when a syntax error was found.

css: Styles for the code editors. php -> scripts().

php ). php -> styles().

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • revision php
  • code
  • editors
  • revision.php
  • revisions
  • theme
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 3.7

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 3.7.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to3.7
Minimum requirementsWordPress 3.6 · PHP not listed
Update activity30 Sept 201313y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.