Skip to content

Commit

Permalink
Site Icon: Remove all traces (#3156)
Browse files Browse the repository at this point in the history
* Site Icon: remove unused code for Site Icon

* Site Icon: update instances to point to core's site icon methods

* Site Icon: remove more unused code

* Site Icon: remove from scss and other instances

* Site Icon: re-add blank file with deprecation comment.

* Site Icon: remove unused file

* Site Icon: re-add jetpack_site_icon_url for back-compat checking

* Site Icon: remove unecessary check for back compat updating to core Icon

THis is being handled in sync jetpack_sync_core_icon()

* Site Icon: remove site icon code from the WP API
  • Loading branch information
dereksmart authored and samhotchkiss committed Nov 9, 2016
1 parent b37cd69 commit 472dd44
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 1,171 deletions.
25 changes: 0 additions & 25 deletions _inc/lib/class.core-rest-api-endpoints.php
Expand Up @@ -1315,22 +1315,6 @@ public static function get_updateable_data_list( $selector = '' ) {
'jp_group' => 'sso',
),

// Site Icon
'site_icon_id' => array(
'description' => esc_html__( 'Site Icon ID', 'jetpack' ),
'type' => 'integer',
'default' => 1,
'validate_callback' => __CLASS__ . '::validate_posint',
'jp_group' => 'site-icon',
),
'site_icon_url' => array(
'description' => esc_html__( 'Site Icon URL', 'jetpack' ),
'type' => 'string',
'default' => '',
'sanitize_callback' => 'esc_url',
'jp_group' => 'site-icon',
),

// Subscriptions
'stb_enabled' => array(
'description' => esc_html__( "Show a <em>'follow blog'</em> option in the comment form", 'jetpack' ),
Expand Down Expand Up @@ -2049,15 +2033,6 @@ public static function prepare_options_for_response( $module = '' ) {
$options['sharing_services']['current_value'] = $sharer->get_blog_services();
break;

case 'site-icon':
// Return site icon ID and URL to make it more complete.
$options['site_icon_id']['current_value'] = Jetpack_Options::get_option( 'site_icon_id' );
if ( ! function_exists( 'jetpack_site_icon_url' ) ) {
@include( JETPACK__PLUGIN_DIR . 'modules/site-icon/site-icon-functions.php' );
}
$options['site_icon_url']['current_value'] = jetpack_site_icon_url();
break;

case 'after-the-deadline':
if ( ! function_exists( 'AtD_get_options' ) ) {
@include( JETPACK__PLUGIN_DIR . 'modules/after-the-deadline.php' );
Expand Down
17 changes: 1 addition & 16 deletions class.jetpack-modules-list-table.php
Expand Up @@ -62,7 +62,6 @@ function __construct() {
'nonces' => array(
'bulk' => wp_create_nonce( 'bulk-jetpack_page_jetpack_modules' ),
),
'coreIconAvailable' => Jetpack::jetpack_site_icon_available_in_core(),
) );

wp_enqueue_script( 'jetpack-modules-list-table' );
Expand All @@ -83,21 +82,7 @@ function js_templates() {
<# var i = 0;
if ( data.items.length ) {
_.each( data.items, function( item, key, list ) {
if ( item === undefined ) return;
if ( jetpackModulesData.coreIconAvailable && 'site-icon' == item.module ) { #>
<tr class="jetpack-module deprecated <# if ( ++i % 2 ) { #> alternate<# } #>" id="site-icon-deprecated">
<th scope="row" class="check-column">
<input type="checkbox" name="modules[]" value="{{{ item.module }}}" disabled />
</th>
<td class='name column-name'>
<span class='info'>{{{ item.name }}}</span>
<div class="row-actions">
<span class="dep-msg"><?php _ex( 'WordPress now has Site Icon built in!', '"Site Icon" is the feature name.', 'jetpack' ); ?></span>
<span class='configure'><a href="<?php esc_html_e( admin_url( 'customize.php?autofocus[control]=site_icon' ), 'jetpack' ); ?>"><?php _e( 'Configure' , 'jetpack' ); ?></a></span>
</div>
</td>
</tr>
<# return; } #>
if ( item === undefined ) return; #>
<tr class="jetpack-module <# if ( ++i % 2 ) { #> alternate<# } #><# if ( item.activated ) { #> active<# } #><# if ( ! item.available ) { #> unavailable<# } #>" id="{{{ item.module }}}">
<th scope="row" class="check-column">
<input type="checkbox" name="modules[]" value="{{{ item.module }}}" />
Expand Down
4 changes: 2 additions & 2 deletions class.jetpack-post-images.php
Expand Up @@ -353,8 +353,8 @@ static function from_blavatar( $post_id, $size = 96 ) {
}

$url = blavatar_url( $domain, 'img', $size );
} elseif ( function_exists( 'jetpack_has_site_icon' ) && jetpack_has_site_icon() ) {
$url = jetpack_site_icon_url( null, $size, $default = false );
} elseif ( function_exists( 'has_site_icon' ) && has_site_icon() ) {
$url = get_site_icon_url( $size );
} else {
return array();
}
Expand Down
4 changes: 2 additions & 2 deletions class.jetpack-twitter-cards.php
Expand Up @@ -140,8 +140,8 @@ static function twitter_cards_define_type_based_on_image_count( $og_tags, $extra
}

// Third fall back, Site Icon
if ( empty( $og_tags['twitter:image'] ) && ( function_exists( 'jetpack_has_site_icon' ) && jetpack_has_site_icon() ) ) {
$og_tags['twitter:image'] = jetpack_site_icon_url( null, '240' );
if ( empty( $og_tags['twitter:image'] ) && ( function_exists( 'has_site_icon' ) && has_site_icon() ) ) {
$og_tags['twitter:image'] = get_site_icon_url( '240' );
}

// Not falling back on Gravatar, because there's no way to know if we end up with an auto-generated one.
Expand Down
51 changes: 0 additions & 51 deletions class.jetpack.php
Expand Up @@ -547,7 +547,6 @@ private function __construct() {
add_action( 'wp_print_styles', array( $this, 'implode_frontend_css' ), -1 ); // Run first
add_action( 'wp_print_footer_scripts', array( $this, 'implode_frontend_css' ), -1 ); // Run first to trigger before `print_late_styles`
}

}

function jetpack_admin_ajax_tracks_callback() {
Expand Down Expand Up @@ -5992,55 +5991,6 @@ public function dashboard_widget_connect_to_wpcom() {
<?php
}

/*
* A graceful transition to using Core's site icon.
*
* All of the hard work has already been done with the image
* in all_done_page(). All that needs to be done now is update
* the option and display proper messaging.
*
* @todo remove when WP 4.3 is minimum
*
* @since 3.6.1
*
* @return bool false = Core's icon not available || true = Core's icon is available
*/
public static function jetpack_site_icon_available_in_core() {
global $wp_version;
$core_icon_available = function_exists( 'has_site_icon' ) && version_compare( $wp_version, '4.3-beta' ) >= 0;

if ( ! $core_icon_available ) {
return false;
}

// No need for Jetpack's site icon anymore if core's is already set
if ( has_site_icon() ) {
if ( Jetpack::is_module_active( 'site-icon' ) ) {
Jetpack::log( 'deactivate', 'site-icon' );
Jetpack::deactivate_module( 'site-icon' );
}
return true;
}

// Transfer Jetpack's site icon to use core.
$site_icon_id = Jetpack::get_option( 'site_icon_id' );
if ( $site_icon_id ) {
// Update core's site icon
update_option( 'site_icon', $site_icon_id );

// Delete Jetpack's icon option. We still want the blavatar and attached data though.
delete_option( 'site_icon_id' );
}

// No need for Jetpack's site icon anymore
if ( Jetpack::is_module_active( 'site-icon' ) ) {
Jetpack::log( 'deactivate', 'site-icon' );
Jetpack::deactivate_module( 'site-icon' );
}

return true;
}

/**
* Return string containing the Jetpack logo.
*
Expand Down Expand Up @@ -6092,5 +6042,4 @@ function jetpack_user_col_style() {
</style>
<?php }
}

}
6 changes: 0 additions & 6 deletions modules/module-headings.php
Expand Up @@ -155,11 +155,6 @@ function jetpack_get_module_i18n( $key ) {
'description' => _x( 'Enable WP.me-powered shortlinks for all posts and pages.', 'Module Description', 'jetpack' ),
),

'site-icon' => array(
'name' => _x( 'Site Icon', 'Module Name', 'jetpack' ),
'description' => _x( 'Add a site icon to your site.', 'Module Description', 'jetpack' ),
),

'sitemaps' => array(
'name' => _x( 'Sitemaps', 'Module Name', 'jetpack' ),
'description' => _x( 'Creates sitemaps to allow your site to be easily indexed by search engines.', 'Module Description', 'jetpack' ),
Expand Down Expand Up @@ -229,7 +224,6 @@ function jetpack_get_module_i18n_tag( $key ) {
// Modules with `Other` tag:
// - modules/contact-form.php
// - modules/notes.php
// - modules/site-icon.php
'Other' =>_x( 'Other', 'Module Tag', 'jetpack' ),

// Modules with `Writing` tag:
Expand Down
14 changes: 1 addition & 13 deletions modules/module-info.php
Expand Up @@ -591,19 +591,7 @@ function jetpack_custom_content_types_more_info() { ?>
, 'jetpack' );
}
add_action( 'jetpack_module_more_info_custom-content-types', 'jetpack_custom_content_types_more_info' );

/**
* Site Icon
*/
function jetpack_site_icon_more_link() {
echo 'https://jetpack.com/support/site-icon';
}
add_action( 'jetpack_learn_more_button_site-icon', 'jetpack_site_icon_more_link' );

function jetpack_custom_site_icon() {
esc_html_e( 'Site Icon can now be found in WordPress core!', 'jetpack' );
}
add_action( 'jetpack_module_more_info_site-icon', 'jetpack_custom_site_icon' );
// Custom Content Types: STOP

/**
* Manage
Expand Down
15 changes: 3 additions & 12 deletions modules/site-icon.php
@@ -1,15 +1,6 @@
<?php

/**
* Module Name: Site Icon
* Module Description: Add a site icon to your site.
* Sort Order: 22
* First Introduced: 3.2
* Requires Connection: No
* Auto Activate: No
* Module Tags: Other
* Additional Search Queries: favicon, icon, site icon
* Deprecated. No longer needed. Site Icons are in Core.
*
* @package Jetpack
*/

include dirname( __FILE__ ) . '/site-icon/jetpack-site-icon.php';
include dirname( __FILE__ ) . '/site-icon/site-icon-functions.php';
Binary file removed modules/site-icon/browser.png
Binary file not shown.
57 changes: 0 additions & 57 deletions modules/site-icon/css/site-icon-admin.css

This file was deleted.

0 comments on commit 472dd44

Please sign in to comment.