[wp-testers] Editing Plugin files in 2.8

Silverstein, Jesse Jesse.Silverstein at xerox.com
Fri Apr 3 02:46:37 GMT 2009


If this change goes in, it makes sense to include a slew of extensions that cannot be edited in a text editor, but might be included in a plugin:
$exlude = array("gif", "jpg", "png", "bmp", "swf", "flv", "mp3", "wav" /* others */);

Then change 
if($ext != 'gif' && $ext != 'jpg') : ?>
to
if ( false !== array_search($ext, $exclude)) continue; ?>
and take out the endif line.

-Jesse Silverstein

-----Original Message-----
From: wp-testers-bounces at lists.automattic.com [mailto:wp-testers-bounces at lists.automattic.com] On Behalf Of Ibrahim A. Mohamed
Sent: Thursday, April 02, 2009 9:51 PM
To: wp-testers at lists.automattic.com
Subject: [wp-testers] Editing Plugin files in 2.8

Dear all,

In 2.8, a new feature added to the Plugin editor in which you can edit any
file, not the plugin's file only. A problem can be found, especially with
plugins that has pictures included like akismet that you can edit these
files, which is not logical, why should I edit a picture file in an editor?
:)

So, I think we can remove this by adding some rules for files that can be
editted, or files that don't need to be editted like image files this might
solve the problem. For example, for Akismet, in wp-admin/plugin-editor.php
in line 164 where it says:

<?php foreach($plugin_files as $plugin_file) : ?>
> <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a
> href="plugin-editor.php?file=<?php echo $plugin_file; ?>&plugin=<?php echo
> $plugin; ?>"><?php echo $plugin_file ?></a></li>
> <?php endforeach; ?>
>

We can make it:

<?php foreach($plugin_files as $plugin_file) :
> // Get the extension of the file.
>     $ext = substr($plugin_file, strpos($plugin_file, '.') + 1);
> // Extensions to be eliminated
>     if($ext != 'gif' && $ext != 'jpg') : ?>
>         <li<?php echo $file == $plugin_file ? ' class="highlight"' : '';
> ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>&plugin=<?php
> echo $plugin; ?>"><?php echo $plugin_file ?></a></li>
>     <?php endif; ?>
> <?php endforeach; ?>
>

This actually solves it for gif file and jpg one.

Thanks in Advance!

-- 
Regards,
Ibrahim Abdel Fattah Mohamed
Web Developer
Twitter: @bingorabbit
e-mail: bingorabbit at gmail.com
Personal bLOG: http://bingorabbit.com/
_______________________________________________
wp-testers mailing list
wp-testers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-testers

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.238 / Virus Database: 270.11.35/2034 - Release Date: 04/02/09 06:09:00


More information about the wp-testers mailing list