Alternate Syntax

Most commonly, the type of argument used in WordPress files for get_option() is a string.

Some files however, use variables. i.e.

$options = array('this', 'that', 'and', 'another');

foreach($options as $option)
{
	get_option($option);
}

/* or */

foreach($options as $option)
{
	get_option('prefix_' . $option);
}

Because the Clean Options plugin uses regex to gather option names from existing PHP files and compares them to the option_name values in the wp_option table, when the alternate syntax ("non-string" arguments) is used, the option_name values may be considered as orphaned when in fact they may not be.

Earlier versions of the Clean Options plugin did not check for files that used alternate syntax but simply stated that plugin users should exercise thought and care when deleting options — which is always true.

Starting with version 1.1.3, the plugin checks files for lines of code that use the above forms of alternate syntax.

If any files are found that use alternate syntax, a warning message is displayed showing the name of the file and the argument used. This information should be helpful for determining which, if any, of the options displayed as orphans might be associated with the file and in fact not be orphaned.

However, in some cases the use of alernate syntax does not present the possibility of a problem (eg. some core WordPress files, the WordPress.com Stats plugin, and this plugin), and seeing warnings that are not needed could be potentially annoying at best and distracting at worse.

Because of the ever-growing number of plugins, I can not determine all such files on my own and ask the help of those using the Clean Options plugin to bring them (only those found within the WordPress plugin directory please) to my attention. I will then be able to analyze the plugin and add them to the "ignore" array in future version releases if it is safe to do so.

Please leave a brief comment here if you believe you know of such a plugin. Many Thanks.

Technorati Tags: , ,

5 Comments

  1. Posted March 7, 2009 at 3:32 am | Permalink

    cforms II, wpSEO, AntiVirus (http://wordpress.org/extend/plugins/antivirus/)

    …all three absolutely trustworthy – have this problem. LinkLift's Plugins as well as the ones from Text-Link-Ads, too. They, however, appear under different filenames.

  2. Posted March 8, 2009 at 1:46 am | Permalink

    Hi,

    I get warnings regarding the following (trustworthy) Plugins:

    - WP Ajax Edit Comments
    - Limit Login Attempts
    - WP Cache Inspect
    - WP Widget Cache
    - AntiVirus

    Thanks for putting them on the whitelist!

  3. Posted March 8, 2009 at 2:24 pm | Permalink

    Thank you both for posting the information.

    @Michael I looked a bit but couldn't find cformsII, wpSEO, LinkLift, or Text-Link-Ad plugins in the WordPress org Plugin Directory. If these plugins are not there but elsewhere, I apologize but due to the vast number of plugins I must (at least for now) limit myself to only those that are at wordpress.og/extend/plugins/

    I did find the antivirus plugin. Unfortunately when I tested version 0.2 an option named 'antivirus' apeared in the orphaned options list even though the plugin was installed and activated.

    @zonebattler I found and checked the plugins, however

    wp-ajax-edit-comments listed the 'WPAjaxEditAuthorUserOptions' and 'WPAjaxEditComments20' options

    limit-login-attempts listed the 'limit_login_allowed_lockouts', 'limit_login_allowed_retries', 'limit_login_client_type', 'limit_login_cookies', 'limit_login_lockout_duration', 'limit_login_lockout_notify', 'limit_login_long_duration', 'limit_login_notify_email_after', and 'limit_login_valid_duration' options

    wp-cache-inspect listed the 'wpci_settings' option

    wp-widget-cache listed the 'widget_cache_settings' option

    It is when options are listed as being orphaned when in fact they aren't that the "Alternate Syntax" warnings are most important. The information they provide is meant to help in identifying the options so they won't accidently be removed.

    Sometimes a file uses alternate syntax, but no options associated with it appear in the orphaned options list. It is then that the plugin is "OK and safe to add to the ignore list"

    I have been thinking about things, and although it seemed like a good idea, I now realize that maintaining an up-to-date list will be next to impossible.

    However, I understand that seeing a bunch of Warnings all the time could be a problem too. So in the next version release I'll add a show/hide Alternate Syntax Warnings checkbox which should be an adequate solution.

  4. Posted March 13, 2009 at 12:52 am | Permalink

    You are right: a checkbox would be the preferable (and desirable) solution to suppress dozens of warnings. Thanks!

  5. Posted May 3, 2010 at 12:44 pm | Permalink

    I am getting "Alternate Syntax – …. has an option line with ….".

    Not sure what Plugin that is. I have: Akismet, All in One SEO Pack, Breadcrumb NavXT, Clean Options, Exclude Pages from Navigation, Google XML Sitemaps, NextGEN Gallery, Spectacu.la Page Widget, TinyMCE Advanced, Widget Logic, ZigPress Clean Head

Post a Comment

Your email is never shared. Required fields are marked *

*
*