Changeset 1059

Show
Ignore:
Timestamp:
12/06/05 18:15:51 (3 years ago)
Author:
sdcosta
Message:

Yippe!! plugins can now have options.... #276

Location:
trunk/rss
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/admin/plugins.php

    r1058 r1059  
    130130 
    131131function plugin_options() { 
    132     if (!array_key_exists('plugin_name',$_REQUEST)) { 
     132    if (!array_key_exists('plugin_name',$_REQUEST) || 
     133            array_key_exists('admin_plugin_options_cancel_changes', $_REQUEST)) { 
     134        plugins(); 
    133135        return; 
    134136    } 
    135137    $plugin_filename = $_REQUEST['plugin_name']; 
    136138    $plugin_filename = str_replace("%2F", "/", $plugin_filename); 
     139    $plugin_output = ""; 
    137140    if (preg_match('/([a-zA-Z0-9_\/\-]+).php/',$plugin_filename,$matches)) { 
    138141        $plugin_filename = $matches[1] .".php"; // sanitize input 
     
    140143        if($plugin_info && array_key_exists('configuration', $plugin_info)) { 
    141144            $plugin_config_func = $plugin_info['configuration']; 
     145            ob_start(); 
    142146            require_once("../".RSS_PLUGINS_DIR. "/" . $plugin_filename); 
    143147            if(function_exists($plugin_config_func)) { 
    144148                call_user_func($plugin_config_func); // Are you happy now? 
    145             } 
     149                $plugin_output = ob_get_contents(); 
     150 
     151            } 
     152            ob_end_clean(); 
     153        } 
     154        if ($plugin_output) { // Let us set up a form 
     155            echo "<h2 
     156            class=\"trigger\">".LBL_ADMIN_PLUGINS_OPTIONS." ".TITLE_SEP." ". $plugin_info['name']. "</h2>\n" 
     157            ."<div id=\"admin_plugin_options\">\n"; 
     158            echo "<form method=\"post\" action=\"" .$_SERVER['PHP_SELF'] ."\">\n"; 
     159            echo "<p><input type=\"hidden\" name=\"".CST_ADMIN_DOMAIN 
     160            ."\" value=\"".CST_ADMIN_DOMAIN_PLUGIN_OPTIONS."\" /></p>\n"; 
     161            echo $plugin_output; 
     162            echo "<p><input type=\"hidden\" name=\"plugin_name\" value=\"".$plugin_filename."\"/>\n"; 
     163            echo "<p><input type=\"hidden\" name=\"". CST_ADMIN_METAACTION 
     164            ."\" value=\"LBL_ADMIN_SUBMIT_CHANGES\"/>\n"; 
     165            echo "<input type=\"submit\" name=\"admin_plugin_options_submit_changes\" value=\"" 
     166            .LBL_ADMIN_SUBMIT_CHANGES."\" />\n"; 
     167            echo "<input type=\"submit\" name=\"admin_plugin_options_cancel_changes\" 
     168            value=\"".LBL_ADMIN_CANCEL."\" /></p></form>\n"; 
     169            echo "</div>"; 
     170        } else { 
     171            plugins(); 
    146172        } 
    147173    } 
     
    344370} 
    345371 
     372function rss_plugins_is_submit() { 
     373    return array_key_exists("admin_plugin_options_submit_changes", $_REQUEST); 
     374} 
     375 
    346376?> 
  • trunk/rss/intl/en.php

    r1058 r1059  
    148148define ('LBL_ADMIN_PLUGINS_HEADING_ACTION','Active'); 
    149149define ('LBL_ADMIN_PLUGINS_HEADING_OPTIONS','Options'); 
     150define ('LBL_ADMIN_PLUGINS_OPTIONS','Plugin Options'); 
    150151 
    151152