define('DISALLOW_FILE_EDIT', true); wordpress plugin – unFocus Projects – Kevin Newman and Ken Newman

Scripts n Styles update 2.0.1

Scripts n Styles is a tool to allow admins to add scripts and styles without editing template files, or worrying about authors overwriting the code.

Scripts n Styles is a tool to allow admins (and editors in single installs) to add scripts and styles without editing template files, or worrying about authors overwriting the code (code is stripped when an author updates since they don’t have permission to use unfiltered html).

Improvements in version 2.0.1:

The meta box has been improved to provide a tabbed interface for less clutter, and syntax highlight and formating is added using the open-source CodeMirror 2.1.

An option has been added to allow adding script to the head element in addition to the traditional bottom of the page spot.

An Options page (under Tools) has been added so you can add Script n Styles to the entire site, rather then just the individual posts and pages.

Some minor code improvements:

  • Better selection of post_types.
  • micro-optimization for storage of class names.
  • Defined a later priority for Scripts n Styles to print after other scripts and styles.
  • Better adherence to coding standards.
  • began contextual help (notes on capabilities).

Correct User IP for WordPress comments on Mosso

Update #2: It looks like a couple of days after I posted this, the Mosso guys sent word on fresh clicks that the issue has been fixed on their end, rendering this plugin completely useless, days after I put it up. 🙂

I stumbled across a problem running WordPress on Mosso (Rackspace Clould) servers (which I’m now quite happily running unFocus.com on 🙂 ) in the Mosso Knowledge Base, where the ip address of the user is not properly recorded in comments when running in the Mosso cluster. The knowledge based linked to a fresh clicks article, but I wanted something a little easier to maintain than an inline hack. So I rolled a quick and dirty plugin, which seems to do the trick. Here is what it does:

[cc lang=’php’]
< ?php /* Plugin Name: unFocus.Mosso-User-IP Plugin URI: http://www.unfocus.com/projects/ Description: A plugin to set REMOTE_ADDR on Mosso clusters to HTTP_X_CLUSTER_CLIENT_IP to fix tracking and comment posts, etc. Version: 1.0a Author: Kevin Newman Author URI: http://www.unfocus.com/projects/ */ function unFocus_MossoUserIP() { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; } add_action('init', 'unFocus_MossoUserIP'); ?>
[/cc]

That’s it! It just sets the regular REMOTE_ADDR value to the Mosso Server var HTTP_X_CLUSTER_CLIENT_IP. Pretty simple. 🙂 Update: I forgot to upload a zip archive. unFocus.Mosso-User-IP.zip