[wp-trac] Re: [WordPress Trac] #4275: PHP Exec Widgets repeat in WP
2.2 widget implementation
WordPress Trac
wp-trac at lists.automattic.com
Thu May 17 14:02:40 GMT 2007
#4275: PHP Exec Widgets repeat in WP 2.2 widget implementation
---------------------------------+------------------------------------------
Reporter: technosailor | Owner: anonymous
Type: defect | Status: closed
Priority: high | Milestone: 2.2.1
Component: Administration | Version: 2.2
Severity: normal | Resolution: fixed
Keywords: widgets needs-patch |
---------------------------------+------------------------------------------
Comment (by Otto42):
Replying to [comment:4 ryan]:
> Oh, wow, the plugin version of widgets had a strange "feature" where
classname was included as part of the params to pass to the widget due to
slicing func_get_args at 2 instead of 3. This allowed widgets to specify
things such as $number in the classname argument. Hard to blame them for
doing this since the default text widget did the same thing.
Yes. In fact, the ExecPHP widget is an almost exact duplicate of the
original text widget, with the addition of some minor code to do eval()'s
on php in there (and renaming it and such). Other than that, it's
basically the same.
Would it be possible to do something like this to make it compatible both
ways?
{{{
if (function_exists('wp_register_sidebar_widget'))
{
$id = "php-code-$i";
wp_register_sidebar_widget($id, $name, $i <= $number ? 'widget_execphp' :
/* unregister */ '', '', $i);
wp_register_widget_control($id, $name, $i <= $number ?
'widget_execphp_control' : /* unregister */ '', 'width=460&height=350',
$i);
}
else
{
register_sidebar_widget($name, $i <= $number ? 'widget_execphp' : /*
unregister */ '', $i);
register_widget_control($name, $i <= $number ? 'widget_execphp_control' :
/* unregister */ '', 460, 350, $i);
}
}}}
Or is there more to it than that?
If this would work, I'll try to throw that fix into the main ExecPHP code
tonight for everybody to grab.
--
Ticket URL: <http://trac.wordpress.org/ticket/4275#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list