Changeset 34670 for trunk/src/wp-admin/includes/post.php
- Timestamp:
- 09/28/2015 08:09:19 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r34347 r34670 1288 1288 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); 1289 1289 1290 $view_link = false; 1291 $preview_target = ''; 1292 1290 1293 if ( current_user_can( 'read_post', $post->ID ) ) { 1291 $ptype = get_post_type_object( $post->post_type ); 1292 $view_post = $ptype->labels->view_item; 1293 } 1294 1295 if ( 'publish' == get_post_status( $post ) ) { 1296 $title = __('Click to edit this part of the permalink'); 1297 } else { 1298 $title = __('Temporary permalink. Click to edit this part.'); 1299 } 1300 1294 if ( 'draft' === $post->post_status ) { 1295 $draft_link = set_url_scheme( get_permalink( $post->ID ) ); 1296 $view_link = get_preview_post_link( $post, array(), $draft_link ); 1297 $preview_target = " target='wp-preview-{$post->ID}'"; 1298 } else { 1299 if ( 'publish' === $post->post_status ) { 1300 $view_link = get_permalink( $post ); 1301 } else { 1302 // Allow non-published (private, future) to be viewed at a pretty permalink. 1303 $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, urldecode( $permalink ) ); 1304 } 1305 } 1306 } 1307 1308 // Permalinks without a post/page name placeholder don't have anything to edit 1301 1309 if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { 1302 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n"; 1310 $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n"; 1311 1312 if ( false !== $view_link ) { 1313 $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $permalink . "</a>\n"; 1314 } else { 1315 $return .= '<span id="sample-permalink">' . $permalink . "</span>\n"; 1316 } 1317 1318 // Encourage a pretty permalink setting 1303 1319 if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) { 1304 1320 $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; … … 1319 1335 } 1320 1336 1321 $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';1337 $post_name_html = '<span id="editable-post-name">' . $post_name_abridged . '</span>'; 1322 1338 $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) ); 1323 1339 1324 $return = 1325 $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";1340 $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n"; 1341 $return .= '<span id="sample-permalink"><a href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $display_link . "</a></span>\n"; 1326 1342 $return .= '‎'; // Fix bi-directional text display defect in RTL languages. 1327 $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";1343 $return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js">' . __( 'Edit' ) . "</button></span>\n"; 1328 1344 $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n"; 1329 }1330 1331 if ( isset( $view_post ) ) {1332 if ( 'draft' == $post->post_status || 'pending' == $post->post_status ) {1333 $draft_link = set_url_scheme( get_permalink( $post->ID ) );1334 $preview_link = get_preview_post_link( $post, array(), $draft_link );1335 $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";1336 } else {1337 if ( 'publish' === $post->post_status ) {1338 // View Post button should always go to the saved permalink.1339 $pretty_permalink = get_permalink( $post );1340 } else {1341 // Allow non-published (private, future) to be viewed at a pretty permalink.1342 $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, urldecode( $permalink ) );1343 }1344 1345 $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>$view_post</a></span>\n";1346 }1347 1345 } 1348 1346
Note: See TracChangeset
for help on using the changeset viewer.