process_requests(); } } public function process_requests() { if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'sharing-options' ) ) { $sharer = new Sharing_Service(); $sharer->set_global_options( $_POST ); /** * Fires when updating sharing settings. * * @module sharedaddy * * @since 1.1.0 */ do_action( 'sharing_admin_update' ); wp_safe_redirect( admin_url( 'options-general.php?page=sharing&update=saved' ) ); die(); } } public function subscription_menu( $user ) { if ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) { $active = Jetpack::get_active_modules(); if ( ! in_array( 'publicize', $active ) && ! current_user_can( 'manage_options' ) ) { return; } } add_submenu_page( 'options-general.php', __( 'Sharing Settings', 'jetpack' ), __( 'Sharing', 'jetpack' ), 'publish_posts', 'sharing', array( &$this, 'management_page' ) ); } public function ajax_save_services() { if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'sharing-options' ) && isset( $_POST['hidden'] ) && isset( $_POST['visible'] ) ) { $sharer = new Sharing_Service(); $sharer->set_blog_services( explode( ',', $_POST['visible'] ), explode( ',', $_POST['hidden'] ) ); die(); } } public function ajax_new_service() { if ( isset( $_POST['_wpnonce'] ) && isset( $_POST['sharing_name'] ) && isset( $_POST['sharing_url'] ) && isset( $_POST['sharing_icon'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'sharing-new_service' ) ) { $sharer = new Sharing_Service(); if ( $service = $sharer->new_service( stripslashes( $_POST['sharing_name'] ), stripslashes( $_POST['sharing_url'] ), stripslashes( $_POST['sharing_icon'] ) ) ) { $this->output_service( $service->get_id(), $service ); echo ''; $service->button_style = 'icon-text'; $this->output_preview( $service ); die(); } } // Fail die( '1' ); } public function ajax_delete_service() { if ( isset( $_POST['_wpnonce'] ) && isset( $_POST['service'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'sharing-options_' . $_POST['service'] ) ) { $sharer = new Sharing_Service(); $sharer->delete_service( $_POST['service'] ); } } public function ajax_save_options() { if ( isset( $_POST['_wpnonce'] ) && isset( $_POST['service'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'sharing-options_' . $_POST['service'] ) ) { $sharer = new Sharing_Service(); $service = $sharer->get_service( $_POST['service'] ); if ( $service && $service instanceof Sharing_Advanced_Source ) { $service->update_options( $_POST ); $sharer->set_service( $_POST['service'], $service ); } $this->output_service( $service->get_id(), $service, true ); echo ''; $service->button_style = 'icon-text'; $this->output_preview( $service ); die(); } } public function output_preview( $service ) { $klasses = array( 'advanced', 'preview-item' ); if ( $service->button_style != 'text' || $service->has_custom_button_style() ) { $klasses[] = 'preview-' . $service->get_class(); $klasses[] = 'share-' . $service->get_class(); if ( $service->get_class() != $service->get_id() ) { $klasses[] = 'preview-' . $service->get_id(); } } echo '
  • '; $service->display_preview(); echo '
  • '; } public function output_service( $id, $service, $show_dropdown = false ) { ?>
  • get_name() ); ?> get_id(), 'custom-' ) || $service->has_advanced_options() ) : ?> ×
  • get_blog_services(); $global = $sharer->get_global_options(); $shows = array_values( get_post_types( array( 'public' => true ) ) ); array_unshift( $shows, 'index' ); if ( false == function_exists( 'mb_stripos' ) ) { echo '

    ' . __( 'Warning! Multibyte support missing!', 'jetpack' ) . '

    '; echo '

    ' . sprintf( __( 'This plugin will work without it, but multibyte support is used if available. You may see minor problems with Tweets and other sharing services.', 'jetpack' ), 'http://www.php.net/manual/en/mbstring.installation.php' ) . '

    '; } if ( isset( $_GET['update'] ) && $_GET['update'] == 'saved' ) { echo '

    ' . __( 'Settings have been saved', 'jetpack' ) . '

    '; } if ( ! isset( $global['sharing_label'] ) ) { $global['sharing_label'] = __( 'Share this:', 'jetpack' ); } ?>

      get_all_services_blog() as $id => $service ) : ?> output_service( $id, $service ); } ?>
    ' . __( 'Please note that your services have been restricted because your site is private.', 'jetpack' ) . '

    '; } ?>

    loading

    0 ) { echo ' style="display: none"';} ?>>

      $service ) : ?> output_service( $id, $service, true ); ?>

      $service ) : ?> output_service( $id, $service, true ); ?>

    0 ) ? ' style="display: none"' : ''; ?>>


    ' ); ?> ' ); ?>
    labels->name; } ?> '; } ?>