true ) ) : array( 'post', 'page' ) ; $title = apply_filters( 'A2A_SHARE_SAVE_meta_box_title', __( 'AddToAny', 'add-to-any' ) ); foreach( $post_types as $post_type ) { add_meta_box( 'A2A_SHARE_SAVE_meta', $title, 'A2A_SHARE_SAVE_meta_box_content', $post_type, 'advanced', 'high' ); } } function A2A_SHARE_SAVE_meta_box_content( $post ) { do_action( 'start_A2A_SHARE_SAVE_meta_box_content', $post ); $disabled = get_post_meta( $post->ID, 'sharing_disabled', true ); ?>
'1', // Modernly used for "Use CSS Stylesheet?" 'cache' => '-1', 'display_in_posts_on_front_page' => '1', 'display_in_posts_on_archive_pages' => '1', 'display_in_posts' => '1', 'display_in_pages' => '1', 'display_in_feed' => '1', 'show_title' => '-1', 'onclick' => '-1', 'button' => 'A2A_SVG_32', 'button_custom' => '', 'additional_js_variables' => '', 'button_text' => 'Share', 'display_in_excerpts' => '1', 'active_services' => Array(), ); $namespace = 'A2A_SHARE_SAVE_'; foreach ( $options as $option_name => $option_value ) { $old_option_name = $namespace . $option_name; $old_option_value = get_option( $old_option_name ); if( $old_option_value === false ) { // Default value $options[ $option_name ] = $option_value; } else { // Old value $options[ $option_name ] = $old_option_value; } delete_option( $old_option_name ); } update_option( 'addtoany_options', $options ); $deprecated_options = array( 'button_opens_new_window', 'hide_embeds', ); foreach ( $deprecated_options as $option_name ) { delete_option( $namespace . $option_name ); } } /** * Adds a WordPress pointer to Settings menu, so user knows where to configure AddToAny */ function A2A_SHARE_SAVE_enqueue_pointer_script_style( $hook_suffix ) { // Requires WP 3.3 if ( get_bloginfo( 'version' ) < '3.3' ) { return; } // Assume pointer shouldn't be shown $enqueue_pointer_script_style = false; // Get array list of dismissed pointers for current user and convert it to array $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); // Check if our pointer is not among dismissed ones if ( !in_array( 'addtoany_settings_pointer', $dismissed_pointers ) ) { $enqueue_pointer_script_style = true; // Add footer scripts using callback function add_action( 'admin_print_footer_scripts', 'A2A_SHARE_SAVE_pointer_print_scripts' ); } // Enqueue pointer CSS and JS files, if needed if ( $enqueue_pointer_script_style ) { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); } } if ( ! $A2A_SHARE_SAVE_options ) { // Only show the pointer when no AddToAny options have been set add_action( 'admin_enqueue_scripts', 'A2A_SHARE_SAVE_enqueue_pointer_script_style' ); } function A2A_SHARE_SAVE_pointer_print_scripts() { $pointer_content = '
To customize your AddToAny share buttons, click "AddToAny" in the Settings menu.
'; ?> $sitename ) { $service = substr( $sitename, 7 ); $active_services[] = $service; // AddToAny counter enabled? if ( in_array( $service, array( 'facebook', 'twitter', 'pinterest', 'linkedin', 'reddit' ) ) ) { $new_options['special_' . $service . '_options'] = array( 'show_count' => ( ( isset( $_POST['addtoany_' . $service . '_show_count'] ) && $_POST['addtoany_' . $service . '_show_count'] == '1') ? '1' : '-1' ) ); } } $new_options['active_services'] = $active_services; // Store special service options $new_options['special_facebook_like_options'] = array( 'verb' => ( ( isset( $_POST['addtoany_facebook_like_verb'] ) && $_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like' ) ); $new_options['special_twitter_tweet_options'] = array( 'show_count' => ( ( isset( $_POST['addtoany_twitter_tweet_show_count'] ) && $_POST['addtoany_twitter_tweet_show_count'] == '1' ) ? '1' : '-1' ) ); $new_options['special_google_plusone_options'] = array( 'show_count' => ( ( isset( $_POST['addtoany_google_plusone_show_count'] ) && $_POST['addtoany_google_plusone_show_count'] == '1' ) ? '1' : '-1' ) ); $new_options['special_google_plus_share_options'] = array( 'show_count' => ( ( isset( $_POST['addtoany_google_plus_share_show_count'] ) && $_POST['addtoany_google_plus_share_show_count'] == '1' ) ? '1' : '-1' ) ); $new_options['special_pinterest_pin_options'] = array( 'show_count' => ( ( isset( $_POST['addtoany_pinterest_pin_show_count'] ) && $_POST['addtoany_pinterest_pin_show_count'] == '1' ) ? '1' : '-1' ) ); } // Get all existing AddToAny options $existing_options = get_option( 'addtoany_options' ); // Merge $new_options into $existing_options to retain AddToAny options from all other screens/tabs if ( $existing_options ) { $new_options = array_merge( $existing_options, $new_options ); } update_option( 'addtoany_options', $new_options ); ?>