XPressME Integration Kit

Trac

Changeset 21


Ignore:
Timestamp:
Dec 12, 2008, 1:15:59 AM (15 years ago)
Author:
toemon
Message:

2択用の選択フォーム用の関数(yes_no_radio_option)を追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/xpressme_class.php

    r20 r21  
    6262                $this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path'])); 
    6363        } 
     64         
     65        function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= ''){ 
     66        if (empty( $yes ))  $yes = __('YES','xpressme') ; 
     67        if (empty( $no ))  $no = __('NO','xpressme') ; 
     68        $value = $this->{$option_name}; 
     69        $ans_name = 'ch_' . $option_name; 
     70         
     71        $form  =  "<tr>\n"; 
     72        $form .=  '<th><label for="images_to_link">' . $option_desc . "</label></th>\n"; 
     73        $form .=  "<td>\n"; 
     74        if ($value){ 
     75                $form .= "<label><input type='radio' name='". $ans_name . "' value='1' checked='checked' />" . $yes ."</label><br />\n"; 
     76                $form .= "<label><input type='radio' name='". $ans_name . "' value='0' />". $no . "</label>\n"; 
     77        }else{ 
     78                $form .= "<label><input type='radio' name='". $ans_name . "' value='1' />" . $yes . "</label><br />\n"; 
     79                $form .= "<label><input type='radio' name='". $ans_name . "' value='0' checked='checked' />". $no ."</label>\n"; 
     80        } 
     81        $form .=  "</td>\n"; 
     82        $form .=  "</tr><tr>\n"; 
     83                 
     84    return $form; 
     85         
     86} 
    6487                 
    6588        function option_page() 
     
    7497 
    7598                 
    76                 echo    '<div class="wrap">'; 
    77                 echo            '<div id="icon-options-general" class="icon32"><br /></div>'; 
    78                 echo            '<h2>' . __('XPressME Configuration Page', 'xpressme') . '</h2> '; 
     99                echo    '<div class="wrap">'."\n"; 
     100                echo            '<div id="icon-options-general" class="icon32"><br /></div>'."\n"; 
     101                echo            '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2>\n"; 
     102                echo            '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ; 
     103                echo                    '<table class="form-table">'."\n"; 
     104                echo                            $this->yes_no_radio_option('is_use_xoops_upload_path', 
     105                                                                                                __('Media Upload Base Path','xpressme'), 
     106                                                                                                __('Use XOOPS UPLOAD PATH','xpressme'), 
     107                                                                                                __('USE WordPress BASE_PATH') 
     108                                                                                                ); 
     109                         
     110//              $this->is_use_xoops_upload_path_html(); 
     111                echo                    "</table>\n"; 
     112                 
     113                echo            '<p class="submit">'."\n"; 
     114                echo            '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n"; 
     115                echo            '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n"; 
     116                echo            "</p>\n"; 
    79117 
    80                 echo            '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">' ; 
    81                 echo                    '<table class="form-table">'; 
    82                                                         $this->is_use_xoops_upload_path_html(); 
    83                 echo                    '</table>'; 
    84                  
    85                 echo            '<p class="submit">'; 
    86                 echo            '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />'; 
    87                 echo            '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />'; 
    88                 echo            '</p>'; 
    89  
    90                 echo            '</form>' ; 
    91                 echo    '</div>'; 
     118                echo            "</form>\n" ; 
     119                echo    "</div>\n"; 
    92120        } 
    93  
    94         function is_use_xoops_upload_path_html() 
    95         { 
    96                  
    97                 echo '<tr>'; 
    98                 echo '<th><label for="images_to_link">' . __('Media Upload Base Path','xpressme') . '</label></th>'; 
    99                 echo '<td>'; 
    100  
    101                 if ($this->is_use_xoops_upload_path == true){ 
    102                         echo '<label><input type="radio" name="ch_is_use_xoops_upload_path"  value="1" checked="checked" /> ' . __('Use XOOPS UPLOAD PATH','xpressme') .'</label><br />'; 
    103                         echo '<label><input type="radio" name="ch_is_use_xoops_upload_path" value="0" />' . __('USE WordPress BASE_PATH','xpressme') . '</label>'; 
    104                 } else { 
    105                         echo '<label><input type="radio" name="ch_is_use_xoops_upload_path"  value="1" /> ' . __('Use XOOPS UPLOAD PATH','xpressme') .'</label><br />'; 
    106                         echo '<label><input type="radio" name="ch_is_use_xoops_upload_path" value="0" checked="checked" />' . __('USE WordPress BASE_PATH','xpressme') . '</label>'; 
    107                 } 
    108                 echo '</td>'; 
    109                 echo '</tr><tr>'; 
    110                  
    111         } 
    112  
    113121         
    114122        function xpress_upload_filter($uploads) 
Note: See TracChangeset for help on using the changeset viewer.