Ticket #5770: widgets.php.diff
| File widgets.php.diff, 5.5 KB (added by AndrewFrazier, 5 years ago) |
|---|
-
wp-includes/widgets.php
159 159 /* $options: height, width, id_base 160 160 * height: never used 161 161 * width: width of fully expanded control form. Try hard to use the default width. 162 * id_base: for multi-widgets (widgets which allow multiple instancessuch as the text widget), an id_base must be provided.162 * id_base: for widgets which allow multiple instances (such as the text widget), an id_base must be provided. 163 163 * the widget id will ennd up looking like {$id_base}-{$unique_number} 164 164 */ 165 165 function wp_register_widget_control($id, $name, $control_callback, $options = array()) { … … 1317 1317 extract($args); 1318 1318 $options = get_option('widget_tag_cloud'); 1319 1319 $title = empty($options['title']) ? __('Tags') : $options['title']; 1320 $smallest = empty($options['smallest']) ? __('8') : $options['smallest']; 1321 $largest = empty($options['largest']) ? __('22') : $options['largest']; 1322 $unit = empty($options['unit']) ? __('pt') : $options['unit']; 1323 $number = empty($options['number']) ? __('45') : $options['number']; 1324 $format = empty($options['format']) ? __('flat') : $options['format']; 1325 $orderby = empty($options['orderby']) ? __('name') : $options['orderby']; 1326 $order = empty($options['order']) ? __('ASC') : $options['order']; 1320 1327 1321 1328 echo $before_widget; 1322 1329 echo $before_title . $title . $after_title; 1323 wp_tag_cloud( );1330 wp_tag_cloud('smallest='.$smallest.'&largest='.$largest.'&unit='.$unit.'&number='.$number.'&format='.$format.'&orderby='.$orderby.'&order='.$order); 1324 1331 echo $after_widget; 1325 1332 } 1326 1333 1327 1334 function wp_widget_tag_cloud_control() { 1328 1335 $options = $newoptions = get_option('widget_tag_cloud'); 1329 1336 1337 $smallest = 8; 1338 $largest = 22; 1339 $unit = 'pt'; 1340 $number = 45; 1341 $format = 'flat'; 1342 $orderby = 'name'; 1343 $order = 'ASC'; 1344 $exclude = ''; 1345 $include = ''; 1346 1330 1347 if ( $_POST['tag-cloud-submit'] ) { 1331 1348 $newoptions['title'] = strip_tags(stripslashes($_POST['tag-cloud-title'])); 1349 $newoptions['smallest'] = strip_tags(stripslashes($_POST['tag-cloud-minsize'])); 1350 $newoptions['largest'] = strip_tags(stripslashes($_POST['tag-cloud-maxsize'])); 1351 $newoptions['unit'] = strip_tags(stripslashes($_POST['tag-cloud-unit'])); 1352 $newoptions['number'] = strip_tags(stripslashes($_POST['tag-cloud-number'])); 1353 $newoptions['format'] = strip_tags(stripslashes($_POST['tag-cloud-format'])); 1354 $newoptions['orderby'] = strip_tags(stripslashes($_POST['tag-cloud-orderby'])); 1355 $newoptions['order'] = strip_tags(stripslashes($_POST['tag-cloud-order'])); 1332 1356 } 1333 1357 1334 1358 if ( $options != $newoptions ) { … … 1337 1361 } 1338 1362 1339 1363 $title = attribute_escape( $options['title'] ); 1364 $smallest = attribute_escape( $options['smallest'] ); 1365 $largest = attribute_escape( $options['largest'] ); 1366 $unit = attribute_escape( $options['unit'] ); 1367 $number = attribute_escape( $options['number'] ); 1368 $format = attribute_escape( $options['format'] ); 1369 $orderby = attribute_escape( $options['orderby'] ); 1370 $order = attribute_escape( $options['order'] ); 1340 1371 ?> 1341 1372 <p><label for="tag-cloud-title"> 1342 1373 <?php _e('Title:') ?> <input type="text" class="widefat" id="tag-cloud-title" name="tag-cloud-title" value="<?php echo $title ?>" /></label> 1343 1374 </p> 1375 <p><label for="tag-cloud-maxsize"> 1376 <?php _e('Maximum Font Size:')?> <input type="text" class="" id="tag-cloud-maxsize" name="tag-cloud-maxsize" value="<?php echo $largest ?>" size="4" /></label> 1377 </p> 1378 <p><label for="tag-cloud-minsize"> 1379 <?php _e('Minimum Font Size:')?> <input type="text" class="" id="tag-cloud-minsize" name="tag-cloud-minsize" value="<?php echo $smallest ?>" size="4" /></label> 1380 </p> 1381 <p><label for="tag-cloud-unit"> 1382 <?php _e('Unit:')?> <input type="text" class="" id="tag-cloud-unit" name="tag-cloud-unit" value="<?php echo $unit ?>" size="4" /></label> 1383 </p> 1384 <p><label for="tag-cloud-number"> 1385 <?php _e('Number:')?> <input type="text" class="" id="tag-cloud-number" name="tag-cloud-number" value="<?php echo $number ?>" size="4" /></label> 1386 </p> 1387 <p><label for="tag-cloud-format"> 1388 <?php _e('Format:')?> <select size="1" id="tag-cloud-format" name="tag-cloud-format"> 1389 <option value="flat" <?php if($format == 'flat'){echo "selected";}?>>Flat</option> 1390 <option value="list" <?php if($format == 'list'){echo "selected";}?>>List</option> 1391 <option value="array" <?php if($format == 'array'){echo "selected";}?>>Array</option> 1392 </select></label> 1393 </p> 1394 <p><label for="tag-cloud-orderby"> 1395 <?php _e('Order By:')?> <select size="1" id="tag-cloud-orderby" name="tag-cloud-orderby"> 1396 <option value="name" <?php if($orderby == 'name'){echo "selected";}?>>Name</option> 1397 <option value="count" <?php if($orderby == 'count'){echo "selected";}?>>Count</option> 1398 </select></label> 1399 </p> 1400 <p><label for="tag-cloud-order"> 1401 <?php _e('Order:')?> <select size="1" id="tag-cloud-order" name="tag-cloud-order"> 1402 <option value="ASC" <?php if($order == 'ASC'){echo "selected";}?>>Ascending</option> 1403 <option value="DESC" <?php if($order == 'DESC'){echo "selected";}?>>Descending</option> 1404 </select></label> 1405 </p> 1344 1406 <input type="hidden" name="tag-cloud-submit" id="tag-cloud-submit" value="1" /> 1345 1407 <?php 1346 1408 } … … 1389 1451 1390 1452 add_action('init', 'wp_widgets_init', 1); 1391 1453 1392 /* Pattern for multi-widget (allows multiple instances such as the text widget).1454 /* Pattern for widget which allows multiple instances (such as the text widget) 1393 1455 1394 1456 // Displays widget on blag 1395 1457 // $widget_args: number
