Explain that the permalink is temporary for autosave generated permalinks, fixes #7733

git-svn-id: http://svn.automattic.com/wordpress/trunk@11928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-09-14 02:06:33 +00:00
parent 0bef493958
commit 3709397168
2 changed files with 11 additions and 7 deletions

View File

@ -920,7 +920,7 @@ function postbox_classes( $id, $page ) {
* @param unknown_type $name * @param unknown_type $name
* @return unknown * @return unknown
*/ */
function get_sample_permalink($id, $title=null, $name = null) { function get_sample_permalink($id, $title = null, $name = null) {
$post = &get_post($id); $post = &get_post($id);
if (!$post->ID) { if (!$post->ID) {
return array('', ''); return array('', '');
@ -981,8 +981,13 @@ function get_sample_permalink($id, $title=null, $name = null) {
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
$post = &get_post($id); $post = &get_post($id);
list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
if ( 'publish' == $post->post_status )
if ( 'publish' == $post->post_status ) {
$view_post = 'post' == $post->post_type ? __('View Post') : __('View Page'); $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page');
$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%') ) { if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n";
@ -996,15 +1001,14 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
return $return; return $return;
} }
$title = __('Click to edit this part of the permalink'); if ( function_exists('mb_strlen') ) {
if (function_exists('mb_strlen')) { if ( mb_strlen($post_name) > 30 ) {
if (mb_strlen($post_name) > 30) {
$post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14); $post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);
} else { } else {
$post_name_abridged = $post_name; $post_name_abridged = $post_name;
} }
} else { } else {
if (strlen($post_name) > 30) { if ( strlen($post_name) > 30 ) {
$post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14); $post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
} else { } else {
$post_name_abridged = $post_name; $post_name_abridged = $post_name;

View File

@ -275,7 +275,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add_data( 'slug', 'group', 1 ); $scripts->add_data( 'slug', 'group', 1 );
$scripts->localize( 'slug', 'slugL10n', array( $scripts->localize( 'slug', 'slugL10n', array(
'requestFile' => admin_url('admin-ajax.php'), 'requestFile' => admin_url('admin-ajax.php'),
'save' => __('Save'), 'save' => __('OK'),
'cancel' => __('Cancel'), 'cancel' => __('Cancel'),
'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};' 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
) ); ) );