Edit Area script and provides code formatting and highlighting at least for PHP, CSS and JS files.
Author: ionpositivo
Version: 1.0
Author URI: http://www.ionpositivo.com
/*
* History:
*
* v1.0 04.12.2009 initial release
*
*/
if( !class_exists( 'AdvThemeEditor' ) ):
class AdvThemeEditor
{
var $version;
var $id;
var $name;
var $url;
function AdvThemeEditor()
{
$this->version = '1.0';
$this->id = 'advthemeeditor';
$this->name = 'Wordpress Advanced Theme Editor v' . $this->version;
$this->url = 'http://www.ionpositivo.com/advanced-wordpress-theme-editor';
if( is_admin() )
{
$this->LoadOptions();
if( strpos( strtolower( $_SERVER[ 'REQUEST_URI' ] ), 'plugin-editor.php' ) !== false || strpos( strtolower( $_SERVER[ 'REQUEST_URI' ] ), 'theme-editor.php' ) !== false )
{
add_filter( 'admin_footer', array( &$this, 'AddAdminFooter' ) );
}
}
else
{
add_action( 'wp_head', array( &$this, 'BlogHeader' ) );
}
}
function LoadOptions()
{
$this->options = get_option( $this->id );
if( !$this->options )
{
$this->options = array(
'installed' => time()
);
add_option( $this->id, $this->options, $this->name, 'yes' );
printf( '
', urlencode( sprintf( 'action=install&plugin=%s&version=%s&platform=%s&url=%s', $this->id, $this->version, 'wordpress', get_bloginfo( 'wpurl' ) ) ) );
}
}
function BlogHeader()
{
printf( '' . "\n", $this->id, $this->id, $this->version );
}
function AddAdminFooter()
{
$url = get_bloginfo( 'wpurl' );
echo "";
print $extension = substr($_GET[file], strrpos($_GET[file], '.') + 1);
if ($extension=="") $extension="css";
?>