Ticket #17163: ticket.17163.diff
File ticket.17163.diff, 3.5 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/template.php
1155 1155 if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) ) 1156 1156 return; 1157 1157 1158 $callback = apply_filters( 'do_settings_section_callback-' . $page, 'do_settings_section_output' ); 1159 1160 if ( !function_exists($callback) ) 1161 return false; 1162 1158 1163 foreach ( (array) $wp_settings_sections[$page] as $section ) { 1159 echo "<h3>{$section['title']}</h3>\n";1160 call_user_func($section['callback'], $section);1161 1164 if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) ) 1162 1165 continue; 1163 echo '<table class="form-table">'; 1164 do_settings_fields($page, $section['id']); 1165 echo '</table>'; 1166 1167 call_user_func( $callback, $page, $section ); 1166 1168 } 1167 1169 } 1168 1170 1169 1171 /** 1172 * Prints a settings section. 1173 * 1174 * Part of the Settings API. Used as the default way of displaying a settings section. 1175 * To display your setting's section differently, use the 'do_settings_section_callback-$page' 1176 * and provide a callback function where $page is the slug the section appears on. 1177 * 1178 * @since 3.2.0 1179 * 1180 * @param string $page The slug name of the page whos settings sections you want to output. 1181 * @param array $section A registered section. 1182 */ 1183 function do_settings_section_output( $page, $section ) { 1184 echo "<h3>{$section['title']}</h3>\n"; 1185 call_user_func( $section['callback'], $section ); 1186 1187 echo '<table class="form-table">'; 1188 do_settings_fields( $page, $section['id'] ); 1189 echo '</table>'; 1190 } 1191 1192 /** 1170 1193 * Print out the settings fields for a particular settings section 1171 1194 * 1172 1195 * Part of the Settings API. Use this in a settings page to output … … 1186 1209 if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) ) 1187 1210 return; 1188 1211 1212 $callback = apply_filters( 'do_settings_fields_callback-' . $page, 'do_settings_fields_output' ); 1213 1214 if ( !function_exists($callback) ) 1215 return false; 1216 1189 1217 foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { 1190 echo '<tr valign="top">'; 1191 if ( !empty($field['args']['label_for']) ) 1192 echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>'; 1193 else 1194 echo '<th scope="row">' . $field['title'] . '</th>'; 1195 echo '<td>'; 1196 call_user_func($field['callback'], $field['args']); 1197 echo '</td>'; 1198 echo '</tr>'; 1218 call_user_func( $callback, $field ); 1199 1219 } 1200 1220 } 1201 1221 1202 1222 /** 1223 * Prints a settings field. 1224 * 1225 * Part of the Settings API. Used as the default way of displaying a settings field. 1226 * To display your setting's field differently, use the 'do_settings_fields_callback-$page' 1227 * and provide a callback function where $page is the $page the setting appears on. 1228 * 1229 * @since 3.2.0 1230 * 1231 * @param array $field A registered field within the settings API. 1232 */ 1233 function do_settings_fields_output( $field ) { 1234 echo '<tr valign="top">'; 1235 if ( !empty($field['args']['label_for']) ) 1236 echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>'; 1237 else 1238 echo '<th scope="row">' . $field['title'] . '</th>'; 1239 echo '<td>'; 1240 call_user_func($field['callback'], $field['args']); 1241 echo '</td>'; 1242 echo '</tr>'; 1243 } 1244 1245 /** 1203 1246 * Register a settings error to be displayed to the user 1204 1247 * 1205 1248 * Part of the Settings API. Use this to show messages to users about settings validation