get_sample_permalink_html

The timeline below displays how wordpress function get_sample_permalink_html has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|WP_Post $post      Post ID or post object.
 * @param string|null $new_title Optional. New title. Default null.
 * @param string|null $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($post, $new_title = null, $new_slug = null)
{
    $post = get_post($post);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status || empty($post->post_name)) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit.
    if (!str_contains($permalink, '%postname%') && !str_contains($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting.
        if (!get_option('permalink_structure') && current_user_can('manage_options') && !('page' === get_option('show_on_front') && get_option('page_on_front') == $post->ID)) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small">' . __('Change Permalink Structure') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int         $post_id   Post ID.
     * @param string|null $new_title New sample permalink title.
     * @param string|null $new_slug  New sample permalink slug.
     * @param WP_Post     $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 6.1

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|WP_Post $post      Post ID or post object.
 * @param string|null $new_title Optional. New title. Default null.
 * @param string|null $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($post, $new_title = null, $new_slug = null)
{
    $post = get_post($post);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status || empty($post->post_name)) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit.
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting.
        if (!get_option('permalink_structure') && current_user_can('manage_options') && !('page' === get_option('show_on_front') && get_option('page_on_front') == $post->ID)) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small">' . __('Change Permalink Structure') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 5.9

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|WP_Post $id        Post ID or post object.
 * @param string|null $new_title Optional. New title. Default null.
 * @param string|null $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status || empty($post->post_name)) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit.
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting.
        if (!get_option('permalink_structure') && current_user_can('manage_options') && !('page' === get_option('show_on_front') && get_option('page_on_front') == $id)) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 5.5

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status || empty($post->post_name)) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit.
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting.
        if (!get_option('permalink_structure') && current_user_can('manage_options') && !('page' === get_option('show_on_front') && get_option('page_on_front') == $id)) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 5.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status || empty($post->post_name)) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit.
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting.
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && get_option('page_on_front') == $id)) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 4.7

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status || empty($post->post_name)) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 4.6

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (mb_strlen($post_name) > 34) {
            $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filters the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 5.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: .10

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 4.5

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $view_link = get_preview_post_link($post);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $draft_link = set_url_scheme(get_permalink($post->ID));
            $view_link = get_preview_post_link($post, array(), $draft_link);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 4.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $draft_link = set_url_scheme(get_permalink($post->ID));
            $view_link = get_preview_post_link($post, array(), $draft_link);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, urldecode($permalink));
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . $view_link . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $draft_link = set_url_scheme(get_permalink($post->ID));
            $view_link = get_preview_post_link($post, array(), $draft_link);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 4.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $draft_link = set_url_scheme(get_permalink($post->ID));
            $view_link = get_preview_post_link($post, array(), $draft_link);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, urldecode($permalink));
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . $view_link . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: .10

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $draft_link = set_url_scheme(get_permalink($post->ID));
            $view_link = get_preview_post_link($post, array(), $draft_link);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, $permalink);
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $display_link = urldecode($view_link);
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . esc_html($display_link) . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 4.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    $view_link = false;
    $preview_target = '';
    if (current_user_can('read_post', $post->ID)) {
        if ('draft' === $post->post_status) {
            $draft_link = set_url_scheme(get_permalink($post->ID));
            $view_link = get_preview_post_link($post, array(), $draft_link);
            $preview_target = " target='wp-preview-{$post->ID}'";
        } else if ('publish' === $post->post_status || 'attachment' === $post->post_type) {
            $view_link = get_permalink($post);
        } else {
            // Allow non-published (private, future) to be viewed at a pretty permalink.
            $view_link = str_replace(array('%pagename%', '%postname%'), $post->post_name, urldecode($permalink));
        }
    }
    // Permalinks without a post/page name placeholder don't have anything to edit
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        if (false !== $view_link) {
            $return .= '<a id="sample-permalink" href="' . esc_url($view_link) . '"' . $preview_target . '>' . $view_link . "</a>\n";
        } else {
            $return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
        }
        // Encourage a pretty permalink setting
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 34) {
                $post_name_abridged = mb_substr($post_name, 0, 16) . '&hellip;' . mb_substr($post_name, -16);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 34) {
            $post_name_abridged = substr($post_name, 0, 16) . '&hellip;' . substr($post_name, -16);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink"><a href="' . esc_url($view_link) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __('Edit permalink') . '">' . __('Edit') . "</button></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     * @since 4.4.0 Added `$post` parameter.
     *
     * @param string  $return    Sample permalink HTML markup.
     * @param int     $post_id   Post ID.
     * @param string  $new_title New sample permalink title.
     * @param string  $new_slug  New sample permalink slug.
     * @param WP_Post $post      Post object.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post);
    return $return;
}

WordPress Version: 3.5

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 3.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 3.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 3.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .10

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 4.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 2.9

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 2.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 2.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 2.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .10

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . esc_url($pretty_permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 4.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $pretty_permalink = str_replace(array('%pagename%', '%postname%'), $post_name, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            if (empty($pretty_permalink)) {
                $pretty_permalink = $permalink;
            }
            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 1.5

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .40

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 1.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 1.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 1.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .12

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html(urldecode($permalink)));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 4.1

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int    $id        Post ID or post object.
 * @param string $new_title Optional. New title. Default null.
 * @param string $new_slug  Optional. New slug. Default null.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, urldecode($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 0.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 0.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 0.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .12

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 0.1

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen')) {
            if (mb_strlen($post_name) > 30) {
                $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
            } else {
                $post_name_abridged = $post_name;
            }
        } else if (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 4.0

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
    } else {
        if (function_exists('mb_strlen') && mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } elseif (strlen($post_name) > 30) {
            $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n";
        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
        $return .= '&lrm;';
        // Fix bi-directional text display defect in RTL languages.
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    }
    if (isset($view_post)) {
        if ('draft' == $post->post_status) {
            $preview_link = set_url_scheme(get_permalink($post->ID));
            /** This filter is documented in wp-admin/includes/meta-boxes.php */
            $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post);
            $return .= "<span id='view-post-btn'><a href='" . esc_url($preview_link) . "' class='button button-small' target='wp-preview-{$post->ID}'>{$view_post}</a></span>\n";
        } else {
            $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
    }
    /**
     * Filter the sample permalink HTML markup.
     *
     * @since 2.9.0
     *
     * @param string      $return    Sample permalink HTML markup.
     * @param int|WP_Post $id        Post object or ID.
     * @param string      $new_title New sample permalink title.
     * @param string      $new_slug  New sample permalink slug.
     */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 9.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        /**
         * Filter the sample permalink HTML markup.
         *
         * @since 2.9.0
         *
         * @param string      $return    Sample permalink HTML markup.
         * @param int|WP_Post $id        Post object or ID.
         * @param string      $new_title New sample permalink title.
         * @param string      $new_slug  New sample permalink slug.
         */
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    /** This filter is documented in wp-admin/includes/post.php */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .13

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        /**
         * Filter the sample permalink HTML markup.
         *
         * @since 2.9.0
         *
         * @param string      $return    Sample permalink HTML markup.
         * @param int|WP_Post $id        Post object or ID.
         * @param string      $new_title New sample permalink title.
         * @param string      $new_slug  New sample permalink slug.
         */
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, esc_html($permalink));
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url(get_permalink($post)) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    /** This filter is documented in wp-admin/includes/post.php */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 3.9

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if (current_user_can('read_post', $post->ID)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
    }
    if ('publish' == get_post_status($post)) {
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        /**
         * Filter the sample permalink HTML markup.
         *
         * @since 2.9.0
         *
         * @param string      $return    Sample permalink HTML markup.
         * @param int|WP_Post $id        Post object or ID.
         * @param string      $new_title New sample permalink title.
         * @param string      $new_slug  New sample permalink slug.
         */
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . get_permalink($post) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    /** This filter is documented in wp-admin/includes/post.php */
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 8.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 8.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 8.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .15

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 7.5

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .40

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 7.4

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .30

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 7.3

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .20

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 7.2

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: .15

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . esc_html($permalink) . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='" . esc_url($permalink) . "' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html($post_name_abridged) . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, esc_html($permalink));
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . esc_html($post_name) . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='" . esc_url($view_link) . "' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}

WordPress Version: 3.7

/**
 * Returns the HTML of the sample permalink slug editor.
 *
 * @since 2.5.0
 *
 * @param int|object $id Post ID or post object.
 * @param string $new_title Optional. New title.
 * @param string $new_slug Optional. New slug.
 * @return string The HTML of the sample permalink slug editor.
 */
function get_sample_permalink_html($id, $new_title = null, $new_slug = null)
{
    $post = get_post($id);
    if (!$post) {
        return '';
    }
    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    if ('publish' == get_post_status($post)) {
        $ptype = get_post_type_object($post->post_type);
        $view_post = $ptype->labels->view_item;
        $title = __('Click to edit this part of the permalink');
    } else {
        $title = __('Temporary permalink. Click to edit this part.');
    }
    if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
        if ('' == get_option('permalink_structure') && current_user_can('manage_options') && !('page' == get_option('show_on_front') && $id == get_option('page_on_front'))) {
            $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
        }
        if (isset($view_post)) {
            $return .= "<span id='view-post-btn'><a href='{$permalink}' class='button button-small'>{$view_post}</a></span>\n";
        }
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
        return $return;
    }
    if (function_exists('mb_strlen')) {
        if (mb_strlen($post_name) > 30) {
            $post_name_abridged = mb_substr($post_name, 0, 14) . '&hellip;' . mb_substr($post_name, -14);
        } else {
            $post_name_abridged = $post_name;
        }
    } else if (strlen($post_name) > 30) {
        $post_name_abridged = substr($post_name, 0, 14) . '&hellip;' . substr($post_name, -14);
    } else {
        $post_name_abridged = $post_name;
    }
    $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    $display_link = str_replace(array('%pagename%', '%postname%'), $post_name_html, $permalink);
    $view_link = str_replace(array('%pagename%', '%postname%'), $post_name, $permalink);
    $return = '<strong>' . __('Permalink:') . "</strong>\n";
    $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    $return .= '&lrm;';
    // Fix bi-directional text display defect in RTL languages.
    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    if (isset($view_post)) {
        $return .= "<span id='view-post-btn'><a href='{$view_link}' class='button button-small'>{$view_post}</a></span>\n";
    }
    $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    return $return;
}