Ticket #16434: 16434.diff
File 16434.diff, 6.3 KB (added by , 13 years ago) |
---|
-
wp-includes/functions.php
1775 1775 'png' => 'image/png', 1776 1776 'bmp' => 'image/bmp', 1777 1777 'tif|tiff' => 'image/tiff', 1778 'ico' => 'image/ x-icon',1778 'ico' => 'image/vnd.microsoft.icon', 1779 1779 'asf|asx|wax|wmv|wmx' => 'video/asf', 1780 1780 'avi' => 'video/avi', 1781 1781 'divx' => 'video/divx', -
wp-includes/general-template.php
1587 1587 } 1588 1588 1589 1589 /** 1590 * Convenience function that echoes the HTML for the site's favicon icon. 1591 * By default, automatically included in the header via the 'wp_head' action, which can be removed by themes if a custom favicon is desired. 1592 * 1593 * @uses generate_site_favicon_html() to do the actual heavy lifting 1594 */ 1595 function site_favicon(){ 1596 echo generate_site_favicon_html(); 1597 } 1598 add_action( 'wp_head', 'site_favicon' ); 1599 add_action( 'admin_head', 'site_favicon' ); 1600 1601 /** 1602 * Return the HTML for the site's favicon icon, if such has been defined. 1603 * 1604 * @uses get_site_favicon_uri(); 1605 * 1606 * Includes the conditional tag wrapper for an IE (.ico) version. 1607 */ 1608 function generate_site_favicon_html() { 1609 $ie_favicon_uri = get_site_favicon_uri( 'ico' ); 1610 $favicon_uri = get_site_favicon_uri(); 1611 1612 $content = ""; 1613 if (! is_wp_error( $ie_favicon_uri ) && ! is_wp_error( $favicon_uri ) ){ 1614 1615 $content .= <<<FAVICON_HTML 1616 <!--Favicon (via 'wp_head' action) --> 1617 <!--[if IE]> 1618 <link rel="shortcut icon" href="{$ie_favicon_uri}" /> 1619 <![endif]--> 1620 <!--[if !IE]>--> 1621 <link href="{$favicon_uri}" rel="icon" type="image/png" /> 1622 <!--<![endif]--> 1623 FAVICON_HTML; 1624 } 1625 return $content; 1626 } 1627 1628 /** 1629 * Returns the URI for the site's favicon based on the option set in Admin > Settings > General. 1630 * 1631 * @param string $format png|ico default 'png'. Use 'ico' for serving up an IE-compatible ICO file 1632 * @return mixed WP_Error | fully qualified URI 1633 */ 1634 function get_site_favicon_uri( $format = 'png' ){ 1635 /** @TODO provide error checking for validity of $format and $size */ 1636 //return site_url( '/wp-content/uploads/2012/02/wp-favicon_' . $size . 'x' . $size . '.' . $format ); 1637 $error = null; 1638 1639 $favicon_basename = get_option ( 'sitefavicon' ); 1640 if ( ! empty( $favicon_basename ) ) { 1641 $favicon_fullname = $favicon_basename . '-' . $format; 1642 1643 $posts = get_posts( array( 'name' => $favicon_fullname, 'post_type' => 'attachment' ) ); 1644 if ( $posts[0] ){ 1645 $favicon_file = wp_get_attachment_url( $posts[0]->ID ); 1646 return $favicon_file ; 1647 } else { 1648 $error = new WP_Error( 'attachment_missing', __( "Favicon file '$favicon_fullname' not found." ) ); 1649 } 1650 } else { 1651 $error = new WP_Error( 'no_icon', __( "No favicon file provided." ) ); 1652 } 1653 1654 // We get here because of an error condition 1655 /** @TODO default to the theme's favicon **/ 1656 return $error; 1657 } 1658 1659 /** 1590 1660 * Display the links to the general feeds. 1591 1661 * 1592 1662 * @since 2.8.0 -
wp-includes/script-loader.php
88 88 89 89 $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), false, 1 ); 90 90 91 $scripts->add( 'wp-favicon', "/wp-admin/js/wp-favicon$suffix.js", array('jquery'), false, 1 ); 92 91 93 $scripts->add( 'prototype', '/wp-includes/js/prototype.js', array(), '1.6.1'); 92 94 93 95 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 ); -
wp-admin/js/wp-favicon.dev.js
1 (function($){ 2 $('#faviconfile').change(function(){ 3 // check the file extention 4 if (! $.inArray( $(this).val().split('.').pop().toLowerCase() , /* valid file extentions */ ['gif','png','jpg','jpeg'] ) ) 5 $('#favicon-invalid-filetype').show(); 6 else 7 { 8 $('#faviconupload').submit(); 9 } 10 }); 11 12 })(jQuery); -
wp-admin/js/wp-favicon.js
1 (function($){ 2 $('#faviconfile').change(function(){ 3 // check the file extention 4 if (! $.inArray( $(this).val().split('.').pop().toLowerCase() , /* valid file extentions */ ['gif','png','jpg','jpeg'] ) ) 5 $('#favicon-invalid-filetype').show(); 6 else 7 { 8 $('#faviconupload').submit(); 9 } 10 }); 11 12 })(jQuery); -
wp-admin/options-general.php
81 81 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 82 82 ); 83 83 84 wp_enqueue_script('wp-favicon'); 85 84 86 include('./admin-header.php'); 85 87 ?> 86 88 … … 88 90 <?php screen_icon(); ?> 89 91 <h2><?php echo esc_html( $title ); ?></h2> 90 92 93 <form action="<?php echo admin_url('favicon-upload.php')?>" method="post" enctype="multipart/form-data" id="faviconupload"> 94 <input type="hidden" name="action" value="wp_upload_favicon" /> 95 96 <table class="form-table"> 97 <tr valign="top"> 98 <th scope="row"><label for="sitefavicon"><?php _e('Favicon') ?></label></th> 99 <td> 100 <?php //echo generate_media_thumbnail_link( 'options-general-favicon', 0, __( 'Upload favicon image' ) ); ?> 101 <input class="button" name="avatarfile" type="file" id="faviconfile" size="20" /> 102 <p class="submit no-js hide-if-js"><input type="submit" name="Submit" value="Upload Image »" id="faviconsubmit" /></p> 103 <span class="description no-js"><?php _e('Click to upload your own custom icon ("favicon") for your blog. You\'ll be able to crop and scale it once it\'s uploaded.') ?></span> 104 </td> 105 </tr> 106 </table> 107 </form> 108 109 91 110 <form method="post" action="options.php"> 92 111 <?php settings_fields('general'); ?> 93 112