function jetpack_extras_sharing_permalink($url, $post_id, $button) { if ($button != 'twitter') { return $url; } if (function_exists('wpme_get_shortlink')) { $global = get_option('jetpack_extras-options', array()); if ($global['use_wpme']) { $url = wpme_get_shortlink($post_id); } } return $url; }
/** * Convert a link to WP.me * @param string $link The link, before shortening * @return string The link, after shortening through wp.me */ function ppp_apply_wpme($link) { if (class_exists('Jetpack') && Jetpack::is_module_active('shortlinks')) { $id = url_to_postid($link); $result = wpme_get_shortlink($id); if (!empty($result)) { return $result; } else { return $link; } } return $link; }
function wpme_get_shortlink_handler($shortlink, $id, $context, $allow_slugs) { return wpme_get_shortlink($id, $context, $allow_slugs); }
private function _get_shortlink($permalink, $post_id, $options) { $shortlink = $permalink; if ($options['shorten']) { if ($options['tinyurl'][0]) { $shortlink = $this->_get_TinyURL($permalink, self::TWEET_TINYURL_URL); } elseif ($options['bitly'][0]) { $shortlink = $this->_get_bitly($permalink, self::TWEET_BITLY_URL, $options['bitly'][1], $options['bitly'][2]); } elseif ($options['jmp'][0]) { $shortlink = $this->_get_bitly($permalink, self::TWEET_JMP_URL, $options['jmp'][1], $options['jmp'][2]); } elseif ($options['isgd'][0]) { $shortlink = $this->_get_TinyURL(rawurlencode($permalink), self::TWEET_ISGD_URL); } elseif ($options['other_tinyurl'][0]) { $shortlink = $this->_get_TinyURL($permalink, $options['other_tinyurl'][1]); } elseif (function_exists('get_shortlink')) { $shortlink = get_shortlink($post_id); } elseif (function_exists('wpme_get_shortlink')) { $shortlink = wpme_get_shortlink($post_id); } else { $shortlink = $this->_get_TinyURL($permalink); } } return $this->_chk_url($shortlink) ? $shortlink : $permalink; }