Make WordPress Core


Ignore:
Timestamp:
09/04/2004 09:52:00 PM (22 years ago)
Author:
saxmatt
Message:

Remove optionvalues table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/optionhandler.php

    r1429 r1594  
    4040BOOLSELECT;
    4141            //break;
    42            
    43         case 5: // select
    44             $ret = <<<SELECT
    45                     <label for="$option_result->option_name">$option_result->option_name</label>$between
    46                     <select name="$option_result->option_name" id="$option_result->option_name" $disabled>
    47 SELECT;
    48 
    49             $select = $wpdb->get_results("SELECT optionvalue, optionvalue_desc "
    50                                          ."FROM $wpdb->optionvalues "
    51                                          ."WHERE option_id = $option_result->option_id "
    52                                          ."ORDER BY optionvalue_seq");
    53             if ($select) {
    54                 foreach($select as $option) {
    55                     $ret .= '<option value="'.$option->optionvalue.'"';
    56                     //error_log("comparing [$option_result->option_value] == [$option->optionvalue]");
    57                     if ($option_result->option_value == $option->optionvalue) {
    58                         $ret .=' selected="selected"';
    59                     }
    60                     $ret .= ">$option->optionvalue_desc</option>\n";
    61                 }
    62             }
    63             $ret .= '</select>';
    64             return $ret;
    65             //break;
    66        
    67         case 7: // SQL select
    68             // first get the sql to run
    69             $sql = $wpdb->get_var("SELECT optionvalue FROM $wpdb->optionvalues WHERE option_id = $option_result->option_id");
    70             if (!$sql) {
    71                 return $option_result->option_name . $editable;
    72             }
    73 
    74             // now we may need to do table name substitution
    75            eval("include('../wp-config.php');\$sql = \"$sql\";");
    76 
    77             $ret = <<<SELECT
    78                     <label for="$option_result->option_name">$option_result->option_name</label>$between
    79                     <select name="$option_result->option_name" $disabled>
    80 SELECT;
    81    
    82             $select = $wpdb->get_results("$sql");
    83             if ($select) {
    84                 foreach($select as $option) {
    85                     $ret .= '<option value="'.$option->value.'"';
    86                     //error_log("comparing [$option_result->option_value] == [$option->optionvalue]");
    87                     if ($option_result->option_value == $option->value) {
    88                         $ret .=' selected="selected"';
    89                     }
    90                     $ret .= ">$option->label</option>\n";
    91                 }
    92             }
    93             $ret .= '</select>';
    94             return $ret;
    95             //break;
    9642
    9743    } // end switch
     
    10349    global $wpdb;
    10450    $msg = '';
    105     switch ($option->option_type) {
    106         case 6: // range
    107             // get range
    108             $range = $wpdb->get_row("SELECT optionvalue_max, optionvalue_min FROM $wpdb->optionvalues WHERE option_id = $option->option_id");
    109             if ($range) {
    110                 if (($val < $range->optionvalue_min) || ($val > $range->optionvalue_max)) {
    111                     $msg = "$name is outside the valid range ($range->optionvalue_min - $range->optionvalue_max). ";
    112                 }
    113             }
    114     } // end switch
    11551    return $msg;
    11652} // end validate_option
Note: See TracChangeset for help on using the changeset viewer.