Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/sharedad...
File: sharing.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
/**
[1] Fix | Delete
* Set up Sharing functionality and management in wp-admin.
[2] Fix | Delete
*
[3] Fix | Delete
* @package automattic/jetpack
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
// phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
[7] Fix | Delete
[8] Fix | Delete
use Automattic\Jetpack\Assets;
[9] Fix | Delete
use Automattic\Jetpack\Redirect;
[10] Fix | Delete
use Automattic\Jetpack\Status;
[11] Fix | Delete
[12] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[13] Fix | Delete
exit( 0 );
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
if ( ! defined( 'WP_SHARING_PLUGIN_URL' ) ) {
[17] Fix | Delete
define( 'WP_SHARING_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
[18] Fix | Delete
define( 'WP_SHARING_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* Utilities to manage sharing settings from wp-admin.
[23] Fix | Delete
*/
[24] Fix | Delete
class Sharing_Admin {
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* Constructor.
[28] Fix | Delete
* Hook into WordPress to add our functionality.
[29] Fix | Delete
*/
[30] Fix | Delete
public function __construct() {
[31] Fix | Delete
require_once WP_SHARING_PLUGIN_DIR . 'sharing-service.php';
[32] Fix | Delete
[33] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- nonces are handled in process_requests.
[34] Fix | Delete
if ( isset( $_GET['page'] ) && ( $_GET['page'] === 'sharing.php' || $_GET['page'] === 'sharing' ) ) {
[35] Fix | Delete
add_action( 'admin_init', array( $this, 'admin_init' ) );
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
add_action( 'admin_menu', array( $this, 'subscription_menu' ) );
[39] Fix | Delete
[40] Fix | Delete
// Insert our CSS and JS
[41] Fix | Delete
add_action( 'load-settings_page_sharing', array( $this, 'sharing_head' ) );
[42] Fix | Delete
[43] Fix | Delete
// Catch AJAX
[44] Fix | Delete
add_action( 'wp_ajax_sharing_save_services', array( $this, 'ajax_save_services' ) );
[45] Fix | Delete
add_action( 'wp_ajax_sharing_save_options', array( $this, 'ajax_save_options' ) );
[46] Fix | Delete
add_action( 'wp_ajax_sharing_new_service', array( $this, 'ajax_new_service' ) );
[47] Fix | Delete
add_action( 'wp_ajax_sharing_delete_service', array( $this, 'ajax_delete_service' ) );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Enqueue scripts and styles on the sharing settings page.
[52] Fix | Delete
*
[53] Fix | Delete
* @return void
[54] Fix | Delete
*/
[55] Fix | Delete
public function sharing_head() {
[56] Fix | Delete
wp_enqueue_script(
[57] Fix | Delete
'sharing-js',
[58] Fix | Delete
Assets::get_file_url_for_environment(
[59] Fix | Delete
'_inc/build/sharedaddy/admin-sharing.min.js',
[60] Fix | Delete
'modules/sharedaddy/admin-sharing.js'
[61] Fix | Delete
),
[62] Fix | Delete
array( 'jquery', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-form' ),
[63] Fix | Delete
JETPACK__VERSION,
[64] Fix | Delete
false
[65] Fix | Delete
);
[66] Fix | Delete
[67] Fix | Delete
/**
[68] Fix | Delete
* Filters the switch that if set to true allows Jetpack to use minified assets. Defaults to true
[69] Fix | Delete
* if the SCRIPT_DEBUG constant is not set or set to false. The filter overrides it.
[70] Fix | Delete
*
[71] Fix | Delete
* @since 6.2.0
[72] Fix | Delete
*
[73] Fix | Delete
* @param boolean $var should Jetpack use minified assets.
[74] Fix | Delete
*/
[75] Fix | Delete
$postfix = apply_filters( 'jetpack_should_use_minified_assets', true ) ? '.min' : '';
[76] Fix | Delete
if ( is_rtl() ) {
[77] Fix | Delete
wp_enqueue_style( 'sharing-admin', WP_SHARING_PLUGIN_URL . 'admin-sharing-rtl' . $postfix . '.css', false, JETPACK__VERSION );
[78] Fix | Delete
} else {
[79] Fix | Delete
wp_enqueue_style( 'sharing-admin', WP_SHARING_PLUGIN_URL . 'admin-sharing' . $postfix . '.css', false, JETPACK__VERSION );
[80] Fix | Delete
}
[81] Fix | Delete
wp_enqueue_style( 'sharing', WP_SHARING_PLUGIN_URL . 'sharing.css', false, JETPACK__VERSION );
[82] Fix | Delete
[83] Fix | Delete
wp_enqueue_style( 'social-logos' );
[84] Fix | Delete
wp_enqueue_script( 'sharing-js-fe', WP_SHARING_PLUGIN_URL . 'sharing.js', array(), 4, false );
[85] Fix | Delete
add_thickbox();
[86] Fix | Delete
[87] Fix | Delete
// On Jetpack sites, make sure we include CSS to style the admin page.
[88] Fix | Delete
if ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) {
[89] Fix | Delete
Jetpack_Admin_Page::load_wrapper_styles();
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Load the process that handles saving changes on the sharing settings page.
[95] Fix | Delete
*
[96] Fix | Delete
* @return void
[97] Fix | Delete
*/
[98] Fix | Delete
public function admin_init() {
[99] Fix | Delete
$this->process_requests();
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Save changes to sharing settings.
[104] Fix | Delete
*
[105] Fix | Delete
* @return void
[106] Fix | Delete
*/
[107] Fix | Delete
public function process_requests() {
[108] Fix | Delete
if (
[109] Fix | Delete
isset( $_POST['_wpnonce'] )
[110] Fix | Delete
&& wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'sharing-options' )
[111] Fix | Delete
) {
[112] Fix | Delete
$sharer = new Sharing_Service();
[113] Fix | Delete
$sharer->set_global_options( $_POST );
[114] Fix | Delete
/**
[115] Fix | Delete
* Fires when updating sharing settings.
[116] Fix | Delete
*
[117] Fix | Delete
* @module sharedaddy
[118] Fix | Delete
*
[119] Fix | Delete
* @since 1.1.0
[120] Fix | Delete
*/
[121] Fix | Delete
do_action( 'sharing_admin_update' );
[122] Fix | Delete
[123] Fix | Delete
wp_safe_redirect( admin_url( 'options-general.php?page=sharing&update=saved' ) );
[124] Fix | Delete
die( 0 );
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
/**
[129] Fix | Delete
* Register Sharing settings menu page in Settings > Sharing.
[130] Fix | Delete
*/
[131] Fix | Delete
public function subscription_menu() {
[132] Fix | Delete
add_submenu_page(
[133] Fix | Delete
'options-general.php',
[134] Fix | Delete
__( 'Sharing Settings', 'jetpack' ),
[135] Fix | Delete
__( 'Sharing', 'jetpack' ),
[136] Fix | Delete
'manage_options',
[137] Fix | Delete
'sharing',
[138] Fix | Delete
array( $this, 'wrapper_admin_page' )
[139] Fix | Delete
);
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* Save changes to sharing services via AJAX.
[144] Fix | Delete
*
[145] Fix | Delete
* @return void
[146] Fix | Delete
*/
[147] Fix | Delete
public function ajax_save_services() {
[148] Fix | Delete
if (
[149] Fix | Delete
isset( $_POST['_wpnonce'] )
[150] Fix | Delete
&& wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'sharing-options' )
[151] Fix | Delete
&& isset( $_POST['hidden'] )
[152] Fix | Delete
&& isset( $_POST['visible'] )
[153] Fix | Delete
) {
[154] Fix | Delete
$sharer = new Sharing_Service();
[155] Fix | Delete
[156] Fix | Delete
$sharer->set_blog_services(
[157] Fix | Delete
explode( ',', sanitize_text_field( wp_unslash( $_POST['visible'] ) ) ),
[158] Fix | Delete
explode( ',', sanitize_text_field( wp_unslash( $_POST['hidden'] ) ) )
[159] Fix | Delete
);
[160] Fix | Delete
die( 0 );
[161] Fix | Delete
}
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* Create a new custom sharing service via AJAX.
[166] Fix | Delete
*
[167] Fix | Delete
* @return never
[168] Fix | Delete
*/
[169] Fix | Delete
public function ajax_new_service() {
[170] Fix | Delete
if (
[171] Fix | Delete
isset( $_POST['_wpnonce'] )
[172] Fix | Delete
&& isset( $_POST['sharing_name'] )
[173] Fix | Delete
&& isset( $_POST['sharing_url'] )
[174] Fix | Delete
&& isset( $_POST['sharing_icon'] )
[175] Fix | Delete
&& wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'sharing-new_service' )
[176] Fix | Delete
) {
[177] Fix | Delete
$sharer = new Sharing_Service();
[178] Fix | Delete
$service = $sharer->new_service(
[179] Fix | Delete
sanitize_text_field( wp_unslash( $_POST['sharing_name'] ) ),
[180] Fix | Delete
esc_url_raw( wp_unslash( $_POST['sharing_url'] ) ),
[181] Fix | Delete
esc_url_raw( wp_unslash( $_POST['sharing_icon'] ) )
[182] Fix | Delete
);
[183] Fix | Delete
[184] Fix | Delete
if ( $service ) {
[185] Fix | Delete
$this->output_service( $service->get_id(), $service );
[186] Fix | Delete
echo '<!--->';
[187] Fix | Delete
$service->button_style = 'icon-text';
[188] Fix | Delete
$this->output_preview( $service );
[189] Fix | Delete
[190] Fix | Delete
die( 0 );
[191] Fix | Delete
}
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
// Fail
[195] Fix | Delete
die( '1' );
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
/**
[199] Fix | Delete
* Delete a sharing service via AJAX.
[200] Fix | Delete
*
[201] Fix | Delete
* @return void
[202] Fix | Delete
*/
[203] Fix | Delete
public function ajax_delete_service() {
[204] Fix | Delete
if (
[205] Fix | Delete
isset( $_POST['_wpnonce'] )
[206] Fix | Delete
&& isset( $_POST['service'] )
[207] Fix | Delete
&& wp_verify_nonce(
[208] Fix | Delete
sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ),
[209] Fix | Delete
'sharing-options_' . sanitize_text_field( wp_unslash( $_POST['service'] ) )
[210] Fix | Delete
)
[211] Fix | Delete
) {
[212] Fix | Delete
$sharer = new Sharing_Service();
[213] Fix | Delete
$sharer->delete_service( sanitize_text_field( wp_unslash( $_POST['service'] ) ) );
[214] Fix | Delete
}
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
/**
[218] Fix | Delete
* Save changes to sharing settings via AJAX.
[219] Fix | Delete
*
[220] Fix | Delete
* @return void
[221] Fix | Delete
*/
[222] Fix | Delete
public function ajax_save_options() {
[223] Fix | Delete
if (
[224] Fix | Delete
isset( $_POST['_wpnonce'] )
[225] Fix | Delete
&& isset( $_POST['service'] )
[226] Fix | Delete
&& wp_verify_nonce(
[227] Fix | Delete
sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ),
[228] Fix | Delete
'sharing-options_' . sanitize_text_field( wp_unslash( $_POST['service'] ) )
[229] Fix | Delete
)
[230] Fix | Delete
) {
[231] Fix | Delete
$sharer = new Sharing_Service();
[232] Fix | Delete
$service = $sharer->get_service( sanitize_text_field( wp_unslash( $_POST['service'] ) ) );
[233] Fix | Delete
[234] Fix | Delete
if ( $service && $service instanceof Sharing_Advanced_Source ) {
[235] Fix | Delete
$service->update_options( $_POST );
[236] Fix | Delete
[237] Fix | Delete
$sharer->set_service( sanitize_text_field( wp_unslash( $_POST['service'] ) ), $service );
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
$this->output_service( $service->get_id(), $service, true );
[241] Fix | Delete
echo '<!--->';
[242] Fix | Delete
$service->button_style = 'icon-text';
[243] Fix | Delete
$this->output_preview( $service );
[244] Fix | Delete
die( 0 );
[245] Fix | Delete
}
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
* Display a preview of a sharing service.
[250] Fix | Delete
*
[251] Fix | Delete
* @param object $service Sharing service object.
[252] Fix | Delete
*
[253] Fix | Delete
* @return void
[254] Fix | Delete
*/
[255] Fix | Delete
public function output_preview( $service ) {
[256] Fix | Delete
$klasses = array( 'advanced', 'preview-item' );
[257] Fix | Delete
[258] Fix | Delete
if ( $service->button_style !== 'text' || $service->has_custom_button_style() ) {
[259] Fix | Delete
$klasses[] = 'preview-' . $service->get_class();
[260] Fix | Delete
$klasses[] = 'share-' . $service->get_class();
[261] Fix | Delete
if ( $service->is_deprecated() ) {
[262] Fix | Delete
$klasses[] = 'share-deprecated';
[263] Fix | Delete
}
[264] Fix | Delete
[265] Fix | Delete
if ( $service->get_class() !== $service->get_id() ) {
[266] Fix | Delete
$klasses[] = 'preview-' . $service->get_id();
[267] Fix | Delete
}
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
echo '<li class="' . esc_attr( implode( ' ', $klasses ) ) . '">';
[271] Fix | Delete
$service->display_preview();
[272] Fix | Delete
echo '</li>';
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
/**
[276] Fix | Delete
* Display a specific sharing service.
[277] Fix | Delete
*
[278] Fix | Delete
* @param int $id Service unique ID.
[279] Fix | Delete
* @param object $service Sharing service.
[280] Fix | Delete
* @param bool $show_dropdown Display a dropdown. Not in use at the moment.
[281] Fix | Delete
*
[282] Fix | Delete
* @return void
[283] Fix | Delete
*/
[284] Fix | Delete
public function output_service( $id, $service, $show_dropdown = false ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
[285] Fix | Delete
$title = '';
[286] Fix | Delete
$klasses = array( 'service', 'advanced', 'share-' . $service->get_class() );
[287] Fix | Delete
$displayed_klasses = implode( ' ', $klasses );
[288] Fix | Delete
[289] Fix | Delete
if ( $service->is_deprecated() ) {
[290] Fix | Delete
/* translators: %1$s is the name of a deprecated Sharing Service like "Google+" */
[291] Fix | Delete
$title = sprintf( __( 'The %1$s sharing service has shut down or discontinued support for sharing buttons. This sharing button is not displayed to your visitors and should be removed.', 'jetpack' ), $service->get_name() );
[292] Fix | Delete
$klasses[] = 'share-deprecated';
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
?>
[296] Fix | Delete
<li class="<?php echo esc_attr( $displayed_klasses ); ?>" id="<?php echo esc_attr( $service->get_id() ); ?>" tabindex="0" title="<?php echo esc_attr( $title ); ?>">
[297] Fix | Delete
<span class="options-left"><?php echo esc_html( $service->get_name() ); ?></span>
[298] Fix | Delete
<?php if ( str_starts_with( $service->get_id(), 'custom-' ) || $service->has_advanced_options() ) : ?>
[299] Fix | Delete
<span class="close"><a href="#" class="remove">&times;</a></span>
[300] Fix | Delete
<form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>">
[301] Fix | Delete
<input type="hidden" name="action" value="sharing_delete_service" />
[302] Fix | Delete
<input type="hidden" name="service" value="<?php echo esc_attr( $id ); ?>" />
[303] Fix | Delete
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'sharing-options_' . $id ) ); ?>" />
[304] Fix | Delete
</form>
[305] Fix | Delete
<?php endif; ?>
[306] Fix | Delete
</li>
[307] Fix | Delete
<?php
[308] Fix | Delete
}
[309] Fix | Delete
[310] Fix | Delete
/**
[311] Fix | Delete
* Display admin UI within a Jetpack header and footer.
[312] Fix | Delete
*
[313] Fix | Delete
* @return void
[314] Fix | Delete
*/
[315] Fix | Delete
public function wrapper_admin_page() {
[316] Fix | Delete
Jetpack_Admin_Page::wrap_ui( array( $this, 'management_page' ), array( 'is-wide' => true ) );
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
/**
[320] Fix | Delete
* Sharing settings inner page structure.
[321] Fix | Delete
*
[322] Fix | Delete
* @return void
[323] Fix | Delete
*/
[324] Fix | Delete
public function management_page() {
[325] Fix | Delete
[326] Fix | Delete
if ( ! function_exists( 'mb_stripos' ) ) {
[327] Fix | Delete
echo '<div id="message" class="updated fade"><h3>' . esc_html__( 'Warning! Multibyte support missing!', 'jetpack' ) . '</h3>';
[328] Fix | Delete
echo '<p>' . wp_kses(
[329] Fix | Delete
sprintf(
[330] Fix | Delete
/* Translators: placeholder is a link to a PHP support document. */
[331] Fix | Delete
__( 'This plugin will work without it, but multibyte support is used <a href="%s" rel="noopener noreferrer" target="_blank">if available</a>. You may see minor problems with Tweets and other sharing services.', 'jetpack' ),
[332] Fix | Delete
'https://www.php.net/manual/en/mbstring.installation.php'
[333] Fix | Delete
),
[334] Fix | Delete
array(
[335] Fix | Delete
'a' => array(
[336] Fix | Delete
'href' => array(),
[337] Fix | Delete
'rel' => array(),
[338] Fix | Delete
'target' => array(),
[339] Fix | Delete
),
[340] Fix | Delete
)
[341] Fix | Delete
) . '</p></div>';
[342] Fix | Delete
}
[343] Fix | Delete
[344] Fix | Delete
if ( isset( $_GET['update'] ) && 'saved' === $_GET['update'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- only used to display a message.
[345] Fix | Delete
echo '<div class="updated"><p>' . esc_html__( 'Settings have been saved', 'jetpack' ) . '</p></div>';
[346] Fix | Delete
}
[347] Fix | Delete
?>
[348] Fix | Delete
[349] Fix | Delete
<div class="wrap">
[350] Fix | Delete
<div class="icon32" id="icon-options-general"><br /></div>
[351] Fix | Delete
<h1><?php esc_html_e( 'Sharing Settings', 'jetpack' ); ?></h1>
[352] Fix | Delete
[353] Fix | Delete
<?php
[354] Fix | Delete
/**
[355] Fix | Delete
* Fires at the top of the admin sharing settings screen.
[356] Fix | Delete
*
[357] Fix | Delete
* @module sharedaddy
[358] Fix | Delete
*
[359] Fix | Delete
* @since 1.6.0
[360] Fix | Delete
*/
[361] Fix | Delete
do_action( 'pre_admin_screen_sharing' );
[362] Fix | Delete
?>
[363] Fix | Delete
[364] Fix | Delete
<?php
[365] Fix | Delete
$block_availability = Jetpack_Gutenberg::get_cached_availability();
[366] Fix | Delete
$is_block_available = (bool) isset( $block_availability['sharing-buttons'] ) && $block_availability['sharing-buttons']['available'];
[367] Fix | Delete
$is_block_theme = wp_is_block_theme();
[368] Fix | Delete
$show_block_message = $is_block_available && $is_block_theme;
[369] Fix | Delete
[370] Fix | Delete
// We either show old services config or the sharing block message.
[371] Fix | Delete
if ( current_user_can( 'manage_options' ) ) :
[372] Fix | Delete
$show_block_message ? $this->sharing_block_display() : $this->services_config_display();
[373] Fix | Delete
endif;
[374] Fix | Delete
?>
[375] Fix | Delete
</div>
[376] Fix | Delete
[377] Fix | Delete
<script type="text/javascript">
[378] Fix | Delete
var sharing_loading_icon = '<?php echo esc_js( admin_url( '/images/loading.gif' ) ); ?>';
[379] Fix | Delete
<?php
[380] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- we handle the nonce on the PHP side.
[381] Fix | Delete
if (
[382] Fix | Delete
isset( $_GET['create_new_service'] ) && isset( $_GET['name'] ) && isset( $_GET['url'] ) && isset( $_GET['icon'] )
[383] Fix | Delete
&& 'true' == $_GET['create_new_service'] // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
[384] Fix | Delete
) :
[385] Fix | Delete
?>
[386] Fix | Delete
jQuery(document).ready(function() {
[387] Fix | Delete
// Prefill new service box and then open it
[388] Fix | Delete
jQuery( '#new_sharing_name' ).val( '<?php echo esc_js( sanitize_text_field( wp_unslash( $_GET['name'] ) ) ); ?>' );
[389] Fix | Delete
jQuery( '#new_sharing_url' ).val( '<?php echo esc_js( sanitize_text_field( wp_unslash( $_GET['url'] ) ) ); ?>' );
[390] Fix | Delete
jQuery( '#new_sharing_icon' ).val( '<?php echo esc_js( sanitize_text_field( wp_unslash( $_GET['icon'] ) ) ); ?>' );
[391] Fix | Delete
jQuery( '#add-a-new-service' ).click();
[392] Fix | Delete
});
[393] Fix | Delete
<?php endif; ?>
[394] Fix | Delete
</script>
[395] Fix | Delete
<?php
[396] Fix | Delete
// phpcs:enable WordPress.Security.NonceVerification.Recommended
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
/**
[400] Fix | Delete
* Display services admin UI for settings.
[401] Fix | Delete
*
[402] Fix | Delete
* @return void
[403] Fix | Delete
*/
[404] Fix | Delete
public function services_config_display() {
[405] Fix | Delete
$sharer = new Sharing_Service();
[406] Fix | Delete
$enabled = $sharer->get_blog_services();
[407] Fix | Delete
$global = $sharer->get_global_options();
[408] Fix | Delete
[409] Fix | Delete
$shows = array_values( get_post_types( array( 'public' => true ) ) );
[410] Fix | Delete
array_unshift( $shows, 'index' );
[411] Fix | Delete
if ( ! isset( $global['sharing_label'] ) ) {
[412] Fix | Delete
$global['sharing_label'] = __( 'Share this:', 'jetpack' );
[413] Fix | Delete
}
[414] Fix | Delete
?>
[415] Fix | Delete
<div class="share_manage_options">
[416] Fix | Delete
<h2><?php esc_html_e( 'Sharing Buttons', 'jetpack' ); ?></h2>
[417] Fix | Delete
<p><?php esc_html_e( 'Add sharing buttons to your blog and allow your visitors to share posts with their friends.', 'jetpack' ); ?></p>
[418] Fix | Delete
[419] Fix | Delete
<div id="services-config">
[420] Fix | Delete
<table id="available-services">
[421] Fix | Delete
<tr>
[422] Fix | Delete
<td class="description">
[423] Fix | Delete
<h3><?php esc_html_e( 'Available Services', 'jetpack' ); ?></h3>
[424] Fix | Delete
<p><?php esc_html_e( "Drag and drop the services you'd like to enable into the box below.", 'jetpack' ); ?></p>
[425] Fix | Delete
<p><a href="#TB_inline?height=395&amp;width=600&amp;inlineId=new-service" class="thickbox" id="add-a-new-service"><?php esc_html_e( 'Add a new service', 'jetpack' ); ?></a></p>
[426] Fix | Delete
</td>
[427] Fix | Delete
<td class="services">
[428] Fix | Delete
<ul class="services-available" style="height: 100px;">
[429] Fix | Delete
<?php foreach ( $sharer->get_all_services_blog() as $id => $service ) : ?>
[430] Fix | Delete
<?php
[431] Fix | Delete
if ( ! isset( $enabled['all'][ $id ] ) ) {
[432] Fix | Delete
$this->output_service( $id, $service );
[433] Fix | Delete
}
[434] Fix | Delete
?>
[435] Fix | Delete
<?php endforeach; ?>
[436] Fix | Delete
</ul>
[437] Fix | Delete
<?php
[438] Fix | Delete
if ( ( new Status() )->is_private_site() ) {
[439] Fix | Delete
echo '<p><strong>' . esc_html__( 'Please note that your services have been restricted because your site is private.', 'jetpack' ) . '</strong></p>';
[440] Fix | Delete
}
[441] Fix | Delete
?>
[442] Fix | Delete
<br class="clearing" />
[443] Fix | Delete
</td>
[444] Fix | Delete
</tr>
[445] Fix | Delete
</table>
[446] Fix | Delete
[447] Fix | Delete
<table id="enabled-services">
[448] Fix | Delete
<tr>
[449] Fix | Delete
<td class="description">
[450] Fix | Delete
<h3>
[451] Fix | Delete
<?php esc_html_e( 'Enabled Services', 'jetpack' ); ?>
[452] Fix | Delete
<img src="<?php echo esc_url( admin_url( 'images/loading.gif' ) ); ?>" width="16" height="16" alt="loading" style="vertical-align: middle; display: none" />
[453] Fix | Delete
</h3>
[454] Fix | Delete
<p><?php esc_html_e( 'Services dragged here will appear individually.', 'jetpack' ); ?></p>
[455] Fix | Delete
</td>
[456] Fix | Delete
<td class="services" id="share-drop-target">
[457] Fix | Delete
<h2 id="drag-instructions"
[458] Fix | Delete
<?php
[459] Fix | Delete
if ( is_countable( $enabled['visible'] ) && count( $enabled['visible'] ) > 0 ) {
[460] Fix | Delete
echo ' style="display: none"';}
[461] Fix | Delete
?>
[462] Fix | Delete
><?php esc_html_e( 'Drag and drop available services here.', 'jetpack' ); ?></h2>
[463] Fix | Delete
[464] Fix | Delete
<ul class="services-enabled">
[465] Fix | Delete
<?php foreach ( $enabled['visible'] as $id => $service ) : ?>
[466] Fix | Delete
<?php $this->output_service( $id, $service, true ); ?>
[467] Fix | Delete
<?php endforeach; ?>
[468] Fix | Delete
[469] Fix | Delete
<li class="end-fix"></li>
[470] Fix | Delete
</ul>
[471] Fix | Delete
</td>
[472] Fix | Delete
<td id="hidden-drop-target" class="services">
[473] Fix | Delete
<p><?php esc_html_e( 'Services dragged here will be hidden behind a share button.', 'jetpack' ); ?></p>
[474] Fix | Delete
[475] Fix | Delete
<ul class="services-hidden">
[476] Fix | Delete
<?php foreach ( $enabled['hidden'] as $id => $service ) : ?>
[477] Fix | Delete
<?php $this->output_service( $id, $service, true ); ?>
[478] Fix | Delete
<?php endforeach; ?>
[479] Fix | Delete
<li class="end-fix"></li>
[480] Fix | Delete
</ul>
[481] Fix | Delete
</td>
[482] Fix | Delete
</tr>
[483] Fix | Delete
</table>
[484] Fix | Delete
[485] Fix | Delete
<table id="live-preview">
[486] Fix | Delete
<tr>
[487] Fix | Delete
<td class="description">
[488] Fix | Delete
<h3><?php esc_html_e( 'Live Preview', 'jetpack' ); ?></h3>
[489] Fix | Delete
</td>
[490] Fix | Delete
<td class="services">
[491] Fix | Delete
<h2 <?php echo ( is_countable( $enabled['all'] ) && count( $enabled['all'] ) > 0 ) ? ' style="display: none"' : ''; ?>><?php esc_html_e( 'Sharing is off. Add services above to enable.', 'jetpack' ); ?></h2>
[492] Fix | Delete
<div class="sharedaddy sd-sharing-enabled">
[493] Fix | Delete
<?php if ( is_countable( $enabled['all'] ) && count( $enabled['all'] ) > 0 ) : ?>
[494] Fix | Delete
<h3 class="sd-title"><?php echo esc_html( $global['sharing_label'] ); ?></h3>
[495] Fix | Delete
<?php endif; ?>
[496] Fix | Delete
<div class="sd-content">
[497] Fix | Delete
<ul class="preview">
[498] Fix | Delete
<?php foreach ( $enabled['visible'] as $id => $service ) : ?>
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function