Ticket #9296: permalink-settings-fix.diff

File permalink-settings-fix.diff, 21.5 KB (added by jfarthing84, 4 years ago)

Contains options.php, options-head.php & options-permalink.php

  • wp-admin/options-head.php

     
    1010 */ 
    1111 
    1212wp_reset_vars(array('action', 'standalone', 'option_group_id')); 
    13 ?> 
    1413 
    15 <?php if (isset($_GET['updated'])) : ?> 
     14if ( (isset($_GET['updated'])) && ('Permalink Settings' != $title) ): ?> 
    1615<div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div> 
    17 <?php endif; ?> 
    18  No newline at end of file 
     16<?php endif; ?> 
  • wp-admin/options-permalink.php

     
    7070include('admin-header.php'); 
    7171 
    7272$home_path = get_home_path(); 
    73  
    74 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { 
    75         check_admin_referer('update-permalink'); 
    76  
    77         if ( isset($_POST['permalink_structure']) ) { 
    78                 $permalink_structure = $_POST['permalink_structure']; 
    79                 if (! empty($permalink_structure) ) 
    80                         $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); 
    81                 $wp_rewrite->set_permalink_structure($permalink_structure); 
    82         } 
    83  
    84         if ( isset($_POST['category_base']) ) { 
    85                 $category_base = $_POST['category_base']; 
    86                 if (! empty($category_base) ) 
    87                         $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']); 
    88                 $wp_rewrite->set_category_base($category_base); 
    89         } 
    90  
    91         if ( isset($_POST['tag_base']) ) { 
    92                 $tag_base = $_POST['tag_base']; 
    93                 if (! empty($tag_base) ) 
    94                         $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']); 
    95                 $wp_rewrite->set_tag_base($tag_base); 
    96         } 
    97 } 
    98  
    9973$permalink_structure = get_option('permalink_structure'); 
    10074$category_base = get_option('category_base'); 
    10175$tag_base = get_option( 'tag_base' ); 
    10276 
    10377if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') ) 
    104         $writable = true; 
     78    $writable = true; 
    10579else 
    106         $writable = false; 
     80    $writable = false; 
    10781 
    10882if ($wp_rewrite->using_index_permalinks()) 
    109         $usingpi = true; 
     83    $usingpi = true; 
    11084else 
    111         $usingpi = false; 
     85    $usingpi = false; 
    11286 
    11387$wp_rewrite->flush_rules(); 
    11488?> 
    11589 
    116 <?php if (isset($_POST['submit'])) : ?> 
     90<?php if (isset($_GET['updated'])) : ?> 
    11791<div id="message" class="updated fade"><p><?php 
    11892if ( $permalink_structure && !$usingpi && !$writable ) 
    119         _e('You should update your .htaccess now.'); 
     93    _e('You should update your .htaccess now.'); 
    12094else 
    121         _e('Permalink structure updated.'); 
     95    _e('Permalink structure updated.'); 
    12296?></p></div> 
    12397<?php endif; ?> 
    12498 
     
    126100<?php screen_icon(); ?> 
    127101<h2><?php echo wp_specialchars( $title ); ?></h2> 
    128102 
    129 <form name="form" action="options-permalink.php" method="post"> 
    130 <?php wp_nonce_field('update-permalink') ?> 
     103<form name="form" action="options.php" method="post"> 
     104<?php settings_fields('permalink'); ?> 
    131105 
    132106  <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p> 
    133107 
     
    135109$prefix = ''; 
    136110 
    137111if ( ! got_mod_rewrite() ) 
    138         $prefix = '/index.php'; 
     112    $prefix = '/index.php'; 
    139113 
    140114$structures = array( 
    141         '', 
    142         $prefix . '/%year%/%monthnum%/%day%/%postname%/', 
    143         $prefix . '/%year%/%monthnum%/%postname%/', 
    144         $prefix . '/archives/%post_id%' 
    145         ); 
     115    '', 
     116    $prefix . '/%year%/%monthnum%/%day%/%postname%/', 
     117    $prefix . '/%year%/%monthnum%/%postname%/', 
     118    $prefix . '/archives/%post_id%' 
     119    ); 
    146120?> 
    147121<h3><?php _e('Common settings'); ?></h3> 
    148122<table class="form-table"> 
    149         <tr> 
    150                 <th><label><input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th> 
    151                 <td><code><?php echo get_option('home'); ?>/?p=123</code></td> 
    152         </tr> 
    153         <tr> 
    154                 <th><label><input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th> 
    155                 <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td> 
    156         </tr> 
    157         <tr> 
    158                 <th><label><input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th> 
    159                 <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td> 
    160         </tr> 
    161         <tr> 
    162                 <th><label><input name="selection" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th> 
    163                 <td><code><?php echo get_option('home') . $prefix  ; ?>/archives/123</code></td> 
    164         </tr> 
    165         <tr> 
    166                 <th> 
    167                         <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog" 
    168                         <?php if ( !in_array($permalink_structure, $structures) ) { ?> 
    169                         checked="checked" 
    170                         <?php } ?> 
    171                         /> 
    172                         <?php _e('Custom Structure'); ?> 
    173                         </label> 
    174                 </th> 
    175                 <td> 
    176                         <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo attribute_escape($permalink_structure); ?>" class="regular-text code" /> 
    177                 </td> 
    178         </tr> 
     123    <tr> 
     124        <th><label><input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th> 
     125        <td><code><?php echo get_option('home'); ?>/?p=123</code></td> 
     126    </tr> 
     127    <tr> 
     128        <th><label><input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th> 
     129        <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td> 
     130    </tr> 
     131    <tr> 
     132        <th><label><input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th> 
     133        <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td> 
     134    </tr> 
     135    <tr> 
     136        <th><label><input name="selection" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th> 
     137        <td><code><?php echo get_option('home') . $prefix  ; ?>/archives/123</code></td> 
     138    </tr> 
     139    <tr> 
     140        <th> 
     141            <label><input name="selection" id="custom_selection" type="radio" value="custom" class="tog" 
     142            <?php if ( !in_array($permalink_structure, $structures) ) { ?> 
     143            checked="checked" 
     144            <?php } ?> 
     145            /> 
     146            <?php _e('Custom Structure'); ?> 
     147            </label> 
     148        </th> 
     149        <td> 
     150            <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo attribute_escape($permalink_structure); ?>" class="regular-text code" /> 
     151        </td> 
     152    </tr> 
    179153</table> 
    180154 
    181155<h3><?php _e('Optional'); ?></h3> 
    182156<?php if ($is_apache) : ?> 
    183         <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p> 
     157    <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p> 
    184158<?php else : ?> 
    185         <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p> 
     159    <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p> 
    186160<?php endif; ?> 
    187161 
    188162<table class="form-table"> 
    189         <tr> 
    190                 <th><label for="category_base"><?php _e('Category base'); ?></label></th> 
    191                 <td><input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape($category_base); ?>" class="regular-text code" /></td> 
    192         </tr> 
    193         <tr> 
    194                 <th><label for="tag_base"><?php _e('Tag base'); ?></label></th> 
    195                 <td><input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td> 
    196         </tr> 
    197         <?php do_settings_fields('permalink', 'optional'); ?> 
     163    <tr> 
     164        <th><label for="category_base"><?php _e('Category base'); ?></label></th> 
     165        <td><input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape($category_base); ?>" class="regular-text code" /></td> 
     166    </tr> 
     167    <tr> 
     168        <th><label for="tag_base"><?php _e('Tag base'); ?></label></th> 
     169        <td><input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td> 
     170    </tr> 
     171    <?php do_settings_fields('permalink', 'optional'); ?> 
    198172</table> 
    199173 
    200174<?php do_settings_sections('permalink'); ?> 
    201175 
    202176<p class="submit"> 
    203         <input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 
     177    <input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 
    204178</p> 
    205179  </form> 
    206180<?php if ( $permalink_structure && !$usingpi && !$writable ) : ?> 
    207181  <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> 
    208 <form action="options-permalink.php" method="post"> 
     182<form action="options.php" method="post"> 
    209183<?php wp_nonce_field('update-permalink') ?> 
    210         <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p> 
     184    <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p> 
    211185</form> 
    212186<?php endif; ?> 
    213187 
  • wp-admin/options.php

     
    2222wp_reset_vars(array('action')); 
    2323 
    2424$whitelist_options = array( 
    25         'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ), 
    26         'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 
    27         'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ), 
    28         'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 
    29         'privacy' => array( 'blog_public' ), 
    30         'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 
    31         'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ), 
    32         'options' => array( '' ) ); 
     25    'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ), 
     26    'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 
     27    'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ), 
     28    'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 
     29    'privacy' => array( 'blog_public' ), 
     30    'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 
     31    'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ), 
     32    'options' => array( '' ) ); 
    3333if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl'; 
    3434if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home'; 
    3535 
    3636$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); 
    3737 
    3838if ( !current_user_can('manage_options') ) 
    39         wp_die(__('Cheatin&#8217; uh?')); 
     39    wp_die(__('Cheatin&#8217; uh?')); 
    4040 
    4141switch($action) { 
    4242 
    4343case 'update': 
    44         if ( isset($_POST[ 'option_page' ]) ) { 
    45                 $option_page = $_POST[ 'option_page' ]; 
    46                 check_admin_referer( $option_page . '-options' ); 
    47         } else { 
    48                 // This is for back compat and will eventually be removed. 
    49                 $option_page = 'options'; 
    50                 check_admin_referer( 'update-options' ); 
    51         } 
     44    if ( isset($_POST[ 'option_page' ]) ) { 
     45        $option_page = $_POST[ 'option_page' ]; 
     46        check_admin_referer( $option_page . '-options' ); 
     47    } else { 
     48        // This is for back compat and will eventually be removed. 
     49        $option_page = 'options'; 
     50        check_admin_referer( 'update-options' ); 
     51    } 
    5252 
    53         if ( !isset( $whitelist_options[ $option_page ] ) ) 
    54                 wp_die( __( 'Error! Options page not found.' ) ); 
     53    if ( !isset( $whitelist_options[ $option_page ] ) ) 
     54        wp_die( __( 'Error! Options page not found.' ) ); 
    5555 
    56         if ( 'options' == $option_page ) { 
    57                 $options = explode(',', stripslashes( $_POST[ 'page_options' ] )); 
    58         } else { 
    59                 $options = $whitelist_options[ $option_page ]; 
    60         } 
     56    if ( 'options' == $option_page ) { 
     57        $options = explode(',', stripslashes( $_POST[ 'page_options' ] )); 
     58    } else { 
     59        $options = $whitelist_options[ $option_page ]; 
     60    } 
    6161 
    62         // Handle custom date/time formats 
    63         if ( 'general' == $option_page ) { 
    64                 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) ) 
    65                         $_POST['date_format'] = $_POST['date_format_custom']; 
    66                 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) ) 
    67                         $_POST['time_format'] = $_POST['time_format_custom']; 
    68         } 
     62    // Handle custom date/time formats 
     63    if ( 'general' == $option_page ) { 
     64        if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) ) 
     65            $_POST['date_format'] = $_POST['date_format_custom']; 
     66        if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) ) 
     67            $_POST['time_format'] = $_POST['time_format_custom']; 
     68    } 
     69     
     70    //Handle permalink updates 
     71    if ( 'permalink' == $option_page ) { 
     72        if ( isset($_POST['permalink_structure']) ) { 
     73            $permalink_structure = $_POST['permalink_structure']; 
     74            if (! empty($permalink_structure) ) 
     75                $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); 
     76            $wp_rewrite->set_permalink_structure($permalink_structure); 
     77        } 
    6978 
    70         if ( $options ) { 
    71                 foreach ( $options as $option ) { 
    72                         $option = trim($option); 
    73                         $value = null; 
    74                         if ( isset($_POST[$option]) ) 
    75                                 $value = $_POST[$option]; 
    76                         if ( !is_array($value) ) $value = trim($value); 
    77                         $value = stripslashes_deep($value); 
    78                         update_option($option, $value); 
    79                 } 
    80         } 
     79        if ( isset($_POST['category_base']) ) { 
     80            $category_base = $_POST['category_base']; 
     81            if (! empty($category_base) ) 
     82                $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']); 
     83            $wp_rewrite->set_category_base($category_base); 
     84        } 
    8185 
    82         $goback = add_query_arg( 'updated', 'true', wp_get_referer() ); 
    83         wp_redirect( $goback ); 
    84         break; 
     86        if ( isset($_POST['tag_base']) ) { 
     87            $tag_base = $_POST['tag_base']; 
     88            if (! empty($tag_base) ) 
     89                $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']); 
     90            $wp_rewrite->set_tag_base($tag_base); 
     91        } 
     92    } 
    8593 
     94    if ( $options ) { 
     95        foreach ( $options as $option ) { 
     96            $option = trim($option); 
     97            $value = null; 
     98            if ( isset($_POST[$option]) ) 
     99                $value = $_POST[$option]; 
     100            if ( !is_array($value) ) $value = trim($value); 
     101            $value = stripslashes_deep($value); 
     102            update_option($option, $value); 
     103        } 
     104    } 
     105 
     106    $goback = add_query_arg( 'updated', 'true', wp_get_referer() ); 
     107    wp_redirect( $goback ); 
     108    break; 
     109 
    86110default: 
    87         include('admin-header.php'); ?> 
     111    include('admin-header.php'); ?> 
    88112 
    89113<div class="wrap"> 
    90114<?php screen_icon(); ?> 
     
    98122$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name"); 
    99123 
    100124foreach ( (array) $options as $option) : 
    101         $disabled = ''; 
    102         $option->option_name = attribute_escape($option->option_name); 
    103         if ( is_serialized($option->option_value) ) { 
    104                 if ( is_serialized_string($option->option_value) ) { 
    105                         // this is a serialized string, so we should display it 
    106                         $value = maybe_unserialize($option->option_value); 
    107                         $options_to_update[] = $option->option_name; 
    108                         $class = 'all-options'; 
    109                 } else { 
    110                         $value = 'SERIALIZED DATA'; 
    111                         $disabled = ' disabled="disabled"'; 
    112                         $class = 'all-options disabled'; 
    113                 } 
    114         } else { 
    115                 $value = $option->option_value; 
    116                 $options_to_update[] = $option->option_name; 
    117                 $class = 'all-options'; 
    118         } 
    119         echo " 
     125    $disabled = ''; 
     126    $option->option_name = attribute_escape($option->option_name); 
     127    if ( is_serialized($option->option_value) ) { 
     128        if ( is_serialized_string($option->option_value) ) { 
     129            // this is a serialized string, so we should display it 
     130            $value = maybe_unserialize($option->option_value); 
     131            $options_to_update[] = $option->option_name; 
     132            $class = 'all-options'; 
     133        } else { 
     134            $value = 'SERIALIZED DATA'; 
     135            $disabled = ' disabled="disabled"'; 
     136            $class = 'all-options disabled'; 
     137        } 
     138    } else { 
     139        $value = $option->option_value; 
     140        $options_to_update[] = $option->option_name; 
     141        $class = 'all-options'; 
     142    } 
     143    echo " 
    120144<tr> 
    121         <th scope='row'><label for='$option->option_name'>$option->option_name</label></th> 
     145    <th scope='row'><label for='$option->option_name'>$option->option_name</label></th> 
    122146<td>"; 
    123147 
    124         if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>"; 
    125         else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . attribute_escape($value) . "'$disabled />"; 
     148    if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>"; 
     149    else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . attribute_escape($value) . "'$disabled />"; 
    126150 
    127         echo "</td> 
     151    echo "</td> 
    128152</tr>"; 
    129153endforeach; 
    130154?>