function get_shr_like_buttonset($position) { $trace = debug_backtrace(); $deprecation = new ShareaholicDeprecation('get_shr_like_buttonset'); $deprecation->push($trace[0]['file'], $trace[0]['line']); $settings = ShareaholicUtilities::get_settings(); $page_type = ShareaholicUtilities::page_type(); switch ($position) { case 'Top': $id = isset($settings['location_name_ids']["{$page_type}_above_content"]) ? $settings['location_name_ids']["{$page_type}_above_content"] : NULL; break; case 'Bottom': $id = isset($settings['location_name_ids']["{$page_type}_below_content"]) ? $settings['location_name_ids']["{$page_type}_below_content"] : NULL; break; } echo ShareaholicPublic::canvas($id, 'share_buttons'); }
/** * Draws an individual canvas given a specific location * id and app. The app isn't strictly necessary, but is * being kept for now for backwards compatability. * This method was private, but was made public to be accessed * by the shortcode static function in global_functions.php. * * @param string $id the location id for configuration * @param string $app the type of app * @param string $title the title of URL * @param string $link url * @param string $summary summary text for URL */ public static function canvas($id, $app, $title = NULL, $link = NULL, $summary = NULL) { global $post, $wp_query; $page_type = ShareaholicUtilities::page_type(); $is_list_page = $page_type == 'index' || $page_type == 'category'; $loop_start = did_action('loop_start'); $loop_end = did_action('loop_end'); $in_loop = $loop_start > $loop_end ? TRUE : FALSE; $link = trim($link); // Use the $post object to get the title, link, and summary only if the // title, link or summary is not provided AND one of the following is true: // - we are on a non list page // - we are in the wordpress loop if (trim($title) == NULL && (!$is_list_page || $in_loop)) { $title = htmlspecialchars($post->post_title, ENT_QUOTES); } if (trim($link) == NULL && (!$is_list_page || $in_loop)) { $link = get_permalink($post->ID); } if (trim($summary) == NULL && (!$is_list_page || $in_loop)) { $summary = htmlspecialchars(strip_tags(strip_shortcodes($post->post_excerpt)), ENT_QUOTES); } $canvas = "<div class='shareaholic-canvas'\n data-app-id='{$id}'\n data-app='{$app}'\n data-title='{$title}'\n data-link='{$link}'\n data-summary='{$summary}'></div>"; return trim(preg_replace('/\\s+/', ' ', $canvas)); }