• I have installed the Exec-PHP plugin and found that it works fine for text widgets, as it’s supposed to, but it does not work for other widget types that include text entry fields.

    For example, I have the KB Advanced RSS plugin installed on my site, which allows me to display headlines and other data from external RSS feeds in a customized format. There are fields in this widget where you can enter HTML for custom display of data pulled from an RSS feed. To create the specific display features and effects I want, I need to be able to put PHP code in there too, but even with the Exec-PHP plugin it doesn’t recognize it.

    How can I extend Exec-PHP to enable recognition of PHP code in widgets such as the KB Advanced RSS widget which, like the normal text widget, allow entry of text or HTML?

    I have tried looking through all the .php files in the Exec-PHP plugin but can’t figure out how to extend the plugin to do what I need. Any help would be appreciated! Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter estetson

    (@estetson)

    This is what I already tried adding into the KB Advanced RSS plugin, which failed:

    <?php
    function filter_KB_RSS_output_format($output_format) {
    	ob_start();
    	eval("?>$output_format<?php ");
    	$output_format = ob_get_contents();
    	ob_end_clean();
    	return $output_format;
    }
    add_filter('widget_text', array(&$this, 'filter_KB_RSS_output_format'));
    ?>

    $output_format is what the KB Advanced RSS plugin uses to store the user-entered HTML and code for how to format the display of the RSS feed being accessed.

    I looked at the existing Exec-PHP plugin code to see how it works, and it uses a filter similar to the above.

    One problem I found out is that the filter ‘widget_text’ can ONLY be used for the WordPress Text Widget and apparently cannot be used for other widgets in which users enter fields of text, such as the one I want to modify. So I don’t know what filter hook name to use, since there doesn’t seem to be any that will work.

    Also, since I’m a beginner with coding, there might be other problems with the code I wrote which I don’t realize.

    I would very much appreciate any comment from somebody who knows what they’re doing. Am I at least on the right track, or is using a filter not the way to accomplish what I want to do?

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Exec-PHP] Extend PHP Capability for Text Widgets to Other Widgets?’ is closed to new replies.