function ADDTOANY_SHARE_SAVE_KIT($args = false) { global $_addtoany_counter; $_addtoany_counter++; if (!isset($args['html_container_open'])) { $args['html_container_open'] = '<div class="a2a_kit a2a_target addtoany_list" id="wpa2a_' . $_addtoany_counter . '">'; $args['is_kit'] = TRUE; } if (!isset($args['html_container_close'])) { $args['html_container_close'] = "</div>"; } // Close container element in ADDTOANY_SHARE_SAVE_BUTTON, not prematurely in ADDTOANY_SHARE_SAVE_ICONS $html_container_close = $args['html_container_close']; // Cache for _BUTTON unset($args['html_container_close']); // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON if (!isset($args['html_wrap_open'])) { $args['html_wrap_open'] = ""; } if (!isset($args['html_wrap_close'])) { $args['html_wrap_close'] = ""; } $kit_html = ADDTOANY_SHARE_SAVE_ICONS($args); $args['html_container_close'] = $html_container_close; // Re-set because unset above for _ICONS unset($args['html_container_open']); // Avoid passing to ADDTOANY_SHARE_SAVE_BUTTON since set in _ICONS $kit_html .= ADDTOANY_SHARE_SAVE_BUTTON($args); if (isset($args['output_later']) && $args['output_later']) { return $kit_html; } else { echo $kit_html; } }
function ADDTOANY_SHARE_SAVE_KIT($args = false) { global $_addtoany_counter; $_addtoany_counter++; $options = get_option('addtoany_options'); // If universal button disabled, and not manually disabled through args if (isset($options['button']) && $options['button'] == 'NONE' && !isset($args['no_universal_button'])) { // Pass this setting on to ADDTOANY_SHARE_SAVE_BUTTON // (and only via this ADDTOANY_SHARE_SAVE_KIT function because it is used for automatic placement) $args['no_universal_button'] = true; } // Custom icons enabled? $custom_icons = isset($options['custom_icons']) && $options['custom_icons'] == 'url' && isset($options['custom_icons_url']) ? true : false; // Set a2a_kit_size_## class name unless "icon_size" is set to '16' or custom icons are enabled if ($custom_icons) { $icon_size = ''; // a2a_kit_size_32 if no icon size, or no_small_icons arg is true } elseif (!isset($options['icon_size']) || isset($args['no_small_icons']) && true == $args['no_small_icons']) { $icon_size = ' a2a_kit_size_32'; // a2a_kit_size_16 } elseif (isset($options['icon_size']) && $options['icon_size'] == '16') { $icon_size = ''; // a2a_kit_size_## custom icon size } else { $icon_size = ' a2a_kit_size_' . $options['icon_size'] . ''; } $kit_additional_classes = ''; $kit_style = ''; // Add additional classNames to .a2a_kit if (isset($args['kit_additional_classes'])) { // Append space and className(s) $kit_additional_classes .= ' ' . $args['kit_additional_classes']; } // Add addtoany_list className unless disabled (for floating buttons) if (!isset($args['no_addtoany_list_classname'])) { $kit_additional_classes .= ' addtoany_list'; } // Add style attribute if set if (isset($args['kit_style'])) { $kit_style = ' style="' . $args['kit_style'] . '"'; } if (!isset($args['html_container_open'])) { $args['html_container_open'] = '<div class="a2a_kit' . $icon_size . $kit_additional_classes . ' a2a_target"'; $args['html_container_open'] .= ' id="wpa2a_' . $_addtoany_counter . '"'; // ID is later removed by JS (for AJAX) $args['html_container_open'] .= $kit_style; $args['html_container_open'] .= '>'; $args['is_kit'] = true; } if (!isset($args['html_container_close'])) { $args['html_container_close'] = "</div>"; } // Close container element in ADDTOANY_SHARE_SAVE_BUTTON, not prematurely in ADDTOANY_SHARE_SAVE_ICONS $html_container_close = $args['html_container_close']; // Cache for _BUTTON unset($args['html_container_close']); // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON if (!isset($args['html_wrap_open'])) { $args['html_wrap_open'] = ""; } if (!isset($args['html_wrap_close'])) { $args['html_wrap_close'] = ""; } $kit_html = ADDTOANY_SHARE_SAVE_ICONS($args); $args['html_container_close'] = $html_container_close; // Re-set because unset above for _ICONS unset($args['html_container_open']); // Avoid passing to ADDTOANY_SHARE_SAVE_BUTTON since set in _ICONS $kit_html .= ADDTOANY_SHARE_SAVE_BUTTON($args); if (isset($args['output_later']) && $args['output_later']) { return $kit_html; } else { echo $kit_html; } }
<a href="<?php the_permalink(); ?> " rel="bookmark" title="Read full article on <?php the_title(); ?> " class="more">Read full article</a> » <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments'); ?> <?php echo '<ul class="addtoany_list">'; if (function_exists('ADDTOANY_SHARE_SAVE_ICONS')) { ADDTOANY_SHARE_SAVE_ICONS(array("html_wrap_open" => "<li>", "html_wrap_close" => "</li>")); } if (function_exists('ADDTOANY_SHARE_SAVE_BUTTON')) { ADDTOANY_SHARE_SAVE_BUTTON(array("html_wrap_open" => "<li>", "html_wrap_close" => "</li>")); } echo '</ul>'; ?> </p> </div> </div> <?php } ?>
function ADDTOANY_SHARE_SAVE_KIT($args = false) { global $_addtoany_counter; $_addtoany_counter++; $options = get_option('addtoany_options'); // If universal button disabled, and not manually disabled through args if ($options['button'] == 'NONE' && !isset($args['no_universal_button'])) { // Pass this setting on to ADDTOANY_SHARE_SAVE_BUTTON // (and only via this ADDTOANY_SHARE_SAVE_KIT function because it is used for automatic placement) $args['no_universal_button'] = true; } // Set a2a_kit_size_## class name unless "icon_size" is set to '16' if (!$options['icon_size']) { $icon_size = ' a2a_kit_size_32'; } elseif ($options['icon_size'] == '16') { $icon_size = ''; } else { $icon_size = ' a2a_kit_size_' . $options['icon_size'] . ''; } if (!isset($args['html_container_open'])) { $args['html_container_open'] = '<div class="a2a_kit' . $icon_size . ' a2a_target addtoany_list" id="wpa2a_' . $_addtoany_counter . '">'; // ID is later removed by JS (for AJAX) $args['is_kit'] = true; } if (!isset($args['html_container_close'])) { $args['html_container_close'] = "</div>"; } // Close container element in ADDTOANY_SHARE_SAVE_BUTTON, not prematurely in ADDTOANY_SHARE_SAVE_ICONS $html_container_close = $args['html_container_close']; // Cache for _BUTTON unset($args['html_container_close']); // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON if (!isset($args['html_wrap_open'])) { $args['html_wrap_open'] = ""; } if (!isset($args['html_wrap_close'])) { $args['html_wrap_close'] = ""; } $kit_html = ADDTOANY_SHARE_SAVE_ICONS($args); $args['html_container_close'] = $html_container_close; // Re-set because unset above for _ICONS unset($args['html_container_open']); // Avoid passing to ADDTOANY_SHARE_SAVE_BUTTON since set in _ICONS $kit_html .= ADDTOANY_SHARE_SAVE_BUTTON($args); if (isset($args['output_later']) && $args['output_later']) { return $kit_html; } else { echo $kit_html; } }
function A2A_SHARE_SAVE_to_bottom_of_content($content) { $is_feed = is_feed(); if ((strpos($content, '<!--sharesave-->') === false || strpos($content, '<!--nosharesave-->') !== false) && (!is_page() && get_option('A2A_SHARE_SAVE_display_in_posts') == '-1' || is_home() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page') == '-1' || is_category() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page') == '-1' || is_tag() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page') == '-1' || is_date() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page') == '-1' || is_author() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page') == '-1' || is_search() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page') == '-1' || ($is_feed && get_option('A2A_SHARE_SAVE_display_in_feed') == '-1' || is_page() && get_option('A2A_SHARE_SAVE_display_in_pages') == '-1' || strpos($content, '<!--nosharesave-->') !== false))) { return $content; } $icons_args = array("output_later" => true, "html_wrap_open" => $is_feed ? "" : "<li>", "html_wrap_close" => $is_feed ? " " : "</li>"); $A2A_SHARE_SAVE_options = array("output_later" => true, "html_wrap_open" => $is_feed ? "" : "<li>", "html_wrap_close" => $is_feed ? "" : "</li>"); if (!$is_feed) { $container_wrap_open = '<div class="addtoany_share_save_container"><ul class="addtoany_list">'; $container_wrap_close = '</ul></div>'; } //$content .= $container_wrap_open.ADDTOANY_SHARE_SAVE_ICONS( $icons_args ).ADDTOANY_SHARE_SAVE_BUTTON( $A2A_SHARE_SAVE_options ).$container_wrap_close; $content .= $container_wrap_open . ADDTOANY_SHARE_SAVE_ICONS($icons_args) . $container_wrap_close; return $content; }
function ADDTOANY_SHARE_SAVE_KIT($args = array()) { $options = get_option('addtoany_options'); $linkname = isset($args['linkname']) ? $args['linkname'] : false; $linkurl = isset($args['linkurl']) ? $args['linkurl'] : false; $linkmedia = isset($args['linkmedia']) ? $args['linkmedia'] : false; $use_current_page = isset($args['use_current_page']) ? $args['use_current_page'] : false; $args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl, $linkmedia, $use_current_page)); // linkname_enc, etc. $defaults = array('output_later' => false, 'icon_size' => isset($options['icon_size']) ? $options['icon_size'] : '32'); $args = wp_parse_args($args, $defaults); extract($args); // If universal button disabled, and not manually disabled through args if (isset($options['button']) && $options['button'] == 'NONE' && !isset($args['no_universal_button'])) { // Pass this setting on to ADDTOANY_SHARE_SAVE_BUTTON // (and only via this ADDTOANY_SHARE_SAVE_KIT function because it is used for automatic placement) $args['no_universal_button'] = true; } // Custom icons enabled? $custom_icons = isset($options['custom_icons']) && $options['custom_icons'] == 'url' && isset($options['custom_icons_url']) ? true : false; $kit_additional_classes = ''; $kit_data_media = empty($linkmedia) ? '' : ' data-a2a-media="' . $linkmedia . '"'; $kit_data_title = empty($linkname) || $use_current_page ? '' : ' data-a2a-title="' . $linkname . '"'; $kit_data_url = empty($linkurl) || $use_current_page ? '' : ' data-a2a-url="' . $linkurl . '"'; $kit_style = ''; // Add additional classNames to .a2a_kit if (!empty($args['kit_additional_classes'])) { // Append space and className(s) $kit_additional_classes .= ' ' . $args['kit_additional_classes']; } // Set a2a_kit_size_## class name unless "icon_size" is set to '16' if ($custom_icons) { // If vertical style (.a2a_vertical_style) if (strpos($kit_additional_classes, 'a2a_vertical_style') !== false) { // Use width (if specified) for .a2a_kit_size_## class name to size default service counters $icon_size_classname = isset($options['custom_icons_width']) ? ' a2a_kit_size_' . $options['custom_icons_width'] : ''; } else { // Use height (if specified) for .a2a_kit_size_## class name to size default service counters $icon_size_classname = isset($options['custom_icons_height']) ? ' a2a_kit_size_' . $options['custom_icons_height'] : ''; } // a2a_kit_size_32 if no icon size, or no_small_icons arg is true } elseif (empty($icon_size) || isset($args['no_small_icons']) && true == $args['no_small_icons']) { $icon_size_classname = ' a2a_kit_size_32'; // a2a_kit_size_16 } elseif ($icon_size == '16') { $icon_size_classname = ''; // a2a_kit_size_## custom icon size } elseif (!empty($icon_size)) { $icon_size_classname = ' a2a_kit_size_' . $icon_size; } // Add addtoany_list className unless disabled (for floating buttons) if (!isset($args['no_addtoany_list_classname'])) { $kit_additional_classes .= ' addtoany_list'; } // Add style attribute if set if (isset($args['kit_style'])) { $kit_style = ' style="' . $args['kit_style'] . '"'; } if (!isset($args['html_container_open'])) { $args['html_container_open'] = '<div class="a2a_kit' . $icon_size_classname . $kit_additional_classes . '"' . $kit_data_url . $kit_data_title . $kit_data_media . $kit_style . '>'; $args['is_kit'] = true; } if (!isset($args['html_container_close'])) { $args['html_container_close'] = "</div>"; } // Close container element in ADDTOANY_SHARE_SAVE_BUTTON, not prematurely in ADDTOANY_SHARE_SAVE_ICONS $html_container_close = $args['html_container_close']; // Cache for _BUTTON unset($args['html_container_close']); // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON if (!isset($args['html_wrap_open'])) { $args['html_wrap_open'] = ""; } if (!isset($args['html_wrap_close'])) { $args['html_wrap_close'] = ""; } $kit_html = ADDTOANY_SHARE_SAVE_ICONS($args); $args['html_container_close'] = $html_container_close; // Re-set because unset above for _ICONS unset($args['html_container_open']); // Avoid passing to ADDTOANY_SHARE_SAVE_BUTTON since set in _ICONS $kit_html .= ADDTOANY_SHARE_SAVE_BUTTON($args); if (true == $output_later) { return $kit_html; } else { echo $kit_html; } }