Changeset 2958
- Timestamp:
- 10/20/2005 08:48:32 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r2937 r2958 670 670 671 671 } 672 } else { 673 $error = __('File not found'); 672 674 } 673 675 -
trunk/wp-admin/image-uploading.php
r2936 r2958 136 136 $imagedata['hwstring_small'] = "height='$uheight' width='$uwidth'"; 137 137 $imagedata['file'] = $file; 138 139 if ( false == add_post_meta($id, 'imagedata', $imagedata) ) 140 die("failed to add_post_meta"); 138 $imagedata['thumb'] = "thumb-$filename"; 139 140 add_post_meta($id, 'imagedata', $imagedata); 141 142 if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) { 143 if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 ) 144 $error = wp_create_thumbnail($file, 128); 145 elseif ( $imagedata['height'] > 96 ) 146 $error = wp_create_thumbnail($file, 96); 147 } 141 148 142 149 header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&last=true"); … … 193 200 $images_html = ''; 194 201 $images_style = ''; 202 $images_script = ''; 195 203 if ( count($images) > 0 ) { 196 204 $images = array_slice( $images, 0, $num ); 205 $__delete = __('DELETE'); 206 $__subpost_on = __('SUBPOST <strong>ON</strong>'); 207 $__subpost_off = __('SUBPOST <strong>OFF</strong>'); 208 $__thumbnail_on = __('THUMBNAIL <strong>ON</strong>'); 209 $__thumbnail_off = __('THUMBNAIL <strong>OFF</strong>'); 210 $__no_thumbnail = __('<del>THUMBNAIL</del>'); 211 $__close = __('CLOSE'); 212 $__confirmdelete = __('Delete this photo from the server?'); 213 $__nothumb = __('There is no thumbnail associated with this photo.'); 214 $images_script .= "subposton = '$__subpost_on';\nsubpostoff = '$__subpost_off';\n"; 215 $images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n"; 197 216 foreach ( $images as $key => $image ) { 198 $image = array_merge($image, get_post_meta($image['ID'], 'imagedata', true) ); 217 $meta = get_post_meta($image['ID'], 'imagedata', true); 218 if (!is_array($meta)) { 219 wp_delete_object($image['ID']); 220 continue; 221 } 222 $image = array_merge($image, $meta); 223 if ( ($image['width'] > 128 || $image['height'] > 96) && !empty($image['thumb']) && file_exists(dirname($image['file']).'/'.$image['thumb']) ) { 224 $src = str_replace(basename($image['guid']), '', $image['guid']) . $image['thumb']; 225 $images_script .= "src".$i."a = '$src';\nsrc".$i."b = '".$image['guid']."';\n"; 226 $thumb = 'true'; 227 $thumbtext = $__thumbnail_on; 228 } else { 229 $src = $image['guid']; 230 $thumb = 'false'; 231 $thumbtext = $__no_thumbnail; 232 } 199 233 list($image['uwidth'], $image['uheight']) = get_udims($image['width'], $image['height']); 200 $uwidth_sum += 128; //$image['uwidth']; 234 $height_width = 'height="'.$image['uheight'].'" width="'.$image['uwidth'].'"'; 235 $uwidth_sum += 128; 201 236 $xpadding = (128 - $image['uwidth']) / 2; 202 237 $ypadding = (96 - $image['uheight']) / 2; 203 238 $object = $image['ID']; 204 239 $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n"; 240 $href = get_subpost_link($object); 241 $images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n"; 205 242 $images_html .= <<<HERE 206 243 <div id='target$i' class='imagewrap left'> 207 244 <div id='popup$i' class='popup'> 208 <a onclick='return confirm("Delete this photo from the server?")' href='image-uploading.php?action=delete&object=$object&all=$all&start=$start&post=$post'>DELETE</a> 209 <a onclick="popup.style.display='none';return false;" href="javascript:void()">CANCEL</a> 245 <a id="L$i" onclick="toggleLink($i);return false;" href="javascript:void();">$__subpost_on</a> 246 <a id="I$i" onclick="if($thumb)toggleImage($i);else alert('$__nothumb');return false;" href="javascript:void();">$thumbtext</a> 247 <a onclick="return confirm('$__confirmdelete')" href="image-uploading.php?action=delete&object=$object&all=$all&start=$start&post=$post">$__delete</a> 248 <a onclick="popup.style.display='none';return false;" href="javascript:void()">$__close</a> 210 249 </div> 211 <a id= 'link$i' class='imagelink' href='{$image['guid']}' onclick='imagePopup($i);return false;' title='{$image['post_title']}'>212 <img id='image$i' src=' {$image['guid']}' alt='{$image['post_title']}' {$image['hwstring_small']}/>250 <a id="link$i" class="imagelink" href="$href" onclick="imagePopup($i);return false;" title="{$image['post_title']}"> 251 <img id='image$i' src='$src' alt='{$image['post_title']}' $height_width /> 213 252 </a> 214 253 </div> … … 232 271 <meta http-equiv="imagetoolbar" content="no" /> 233 272 <script type="text/javascript"> 273 /* Define any variables we'll need, such as alternate URLs. */ 274 <?php echo $images_script; ?> 275 234 276 function validateImageName() { 235 277 /* This is more for convenience than security. Server-side validation is very thorough.*/ … … 259 301 popup = false; 260 302 } 303 function toggleLink(n) { 304 o=document.getElementById('link'+n); 305 oi=document.getElementById('L'+n); 306 if ( oi.innerHTML == subposton ) { 307 o.href = eval('href'+n+'b'); 308 oi.innerHTML = subpostoff; 309 } else { 310 o.href = eval('href'+n+'a'); 311 oi.innerHTML = subposton; 312 } 313 } 314 function toggleImage(n) { 315 o = document.getElementById('image'+n); 316 oi = document.getElementById('I'+n); 317 if ( oi.innerHTML == thumbnailon ) { 318 o.src = eval('src'+n+'b'); 319 oi.innerHTML = thumbnailoff; 320 } else { 321 o.src = eval('src'+n+'a'); 322 oi.innerHTML = thumbnailon; 323 } 324 } 261 325 </script> 262 326 <style type="text/css"> … … 370 434 } 371 435 .popup { 372 margin: 23px 9px;373 padding: 5px;436 margin: 4px 4px; 437 padding: 3px; 374 438 position: absolute; 375 width: 1 00px;376 height: 40px;439 width: 114px; 440 height: 82px; 377 441 display: none; 378 442 background-color: rgb(223, 232, 241); … … 382 446 } 383 447 .popup a, .popup a:visited, .popup a:active { 384 margin-bottom: 3px;385 448 background-color: transparent; 386 449 display: block; … … 390 453 } 391 454 .popup a:hover { 392 margin-bottom: 3px;393 455 background-color: #fff; 394 456 color: #000; -
trunk/wp-commentsrss2.php
r2627 r2958 33 33 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 34 34 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id' 35 AND $wpdb->comments.comment_approved = '1' AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'static')35 AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status IN ('publish', 'static', 'object') 36 36 AND post_date < '".date("Y-m-d H:i:59")."' 37 37 ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') ); … … 40 40 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 41 41 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 42 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'static')42 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status IN ('publish', 'static', 'object') 43 43 AND $wpdb->comments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."' 44 44 ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') ); -
trunk/wp-content/themes/default/footer.php
r2945 r2958 16 16 17 17 <?php wp_footer(); ?> 18 18 <?php echo $GLOBALS['dump_bot']; ?> 19 19 </body> 20 20 </html> -
trunk/wp-content/themes/default/header.php
r2615 r2958 49 49 </head> 50 50 <body> 51 51 <?php echo $GLOBALS['dump_top']; ?> 52 52 <div id="page"> 53 53 -
trunk/wp-includes/classes.php
r2938 r2958 30 30 var $is_comments_popup = false; 31 31 var $is_admin = false; 32 var $is_ object = false;32 var $is_subpost = false; 33 33 34 34 function init_query_flags() { … … 50 50 $this->is_paged = false; 51 51 $this->is_admin = false; 52 $this->is_ object = false;52 $this->is_subpost = false; 53 53 } 54 54 … … 91 91 $qv['p'] = (int) $qv['p']; 92 92 93 if ( ('' != $qv['subpost']) || $qv['subpost_id'] ) { 94 $this->is_single = true; 95 $this->is_subpost = true; 96 } 97 93 98 if ('' != $qv['name']) { 94 99 $this->is_single = true; … … 97 102 } elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) { 98 103 // If year, month, day, hour, minute, and second are set, a single 99 104 // post is being queried. 100 105 $this->is_single = true; 101 106 } elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) { … … 209 214 } 210 215 211 if ( ! ($this->is_ archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {216 if ( ! ($this->is_subpost || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) { 212 217 $this->is_home = true; 213 218 } … … 336 341 $q['name'] = $q['pagename']; 337 342 $where .= " AND post_name = '" . $q['pagename'] . "'"; 338 } 339 343 } elseif ('' != $q['subpost']) { 344 $q['subpost'] = sanitize_title($q['subpost']); 345 $q['name'] = $q['subpost']; 346 $where .= " AND post_name = '" . $q['subpost'] . "'"; 347 } 340 348 341 349 if ( (int) $q['w'] ) { … … 346 354 if ( intval($q['comments_popup']) ) 347 355 $q['p'] = intval($q['comments_popup']); 356 357 // If a subpost is requested by number, let it supercede any post number. 358 if ( ($q['subpost_id'] != '') && (intval($q['subpost_id']) != 0) ) 359 $q['p'] = (int) $q['subpost_id']; 348 360 349 361 // If a post number is specified, load that post … … 517 529 } 518 530 519 if ($this->is_page) { 531 if ( $this->is_subpost ) { 532 $where .= ' AND (post_status = "object")'; 533 } elseif ($this->is_page) { 520 534 $where .= ' AND (post_status = "static")'; 521 535 } elseif ($this->is_single) { … … 530 544 } 531 545 532 if (! $this->is_ object )546 if (! $this->is_subpost ) 533 547 $where .= ' AND post_status != "object"'; 534 548 … … 576 590 // Check post status to determine if post should be displayed. 577 591 if ($this->is_single) { 578 if ('publish' != $this->posts[0]->post_status) { 592 $status = get_post_status($this->posts[0]); 593 if ('publish' != $status) { 579 594 if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) { 580 595 // User must be logged in to view unpublished posts. 581 596 $this->posts = array(); 582 597 } else { 583 if ('draft' == $ this->posts[0]->post_status) {598 if ('draft' == $status) { 584 599 // User must have edit permissions on the draft to preview. 585 600 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) 586 601 $this->posts = array(); 587 } elseif ('private' == $ this->posts[0]->post_status) {602 } elseif ('private' == $status) { 588 603 if ($this->posts[0]->post_author != $user_ID) 589 604 $this->posts = array(); … … 822 837 var $queryreplace = 823 838 array ( 824 825 826 827 828 829 830 831 832 833 834 835 836 839 'year=', 840 'monthnum=', 841 'day=', 842 'hour=', 843 'minute=', 844 'second=', 845 'name=', 846 'p=', 847 'category_name=', 848 'author_name=', 849 'pagename=', 850 's=' 851 ); 837 852 838 853 var $feeds = array ('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 846 861 847 862 function using_index_permalinks() { 848 863 if (empty($this->permalink_structure)) { 849 864 return false; 850 851 852 853 854 855 865 } 866 867 // If the index is not in the permalink, we're using mod_rewrite. 868 if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) { 869 return true; 870 } 856 871 857 872 return false; 858 873 } 859 874 … … 866 881 867 882 function preg_index($number) { 868 869 870 871 883 $match_prefix = '$'; 884 $match_suffix = ''; 885 886 if (! empty($this->matches)) { 872 887 $match_prefix = '$' . $this->matches . '['; 873 888 $match_suffix = ']'; 874 875 876 889 } 890 891 return "$match_prefix$number$match_suffix"; 877 892 } 878 893 … … 898 913 } 899 914 900 915 if (empty($this->permalink_structure)) { 901 916 $this->date_structure = ''; 902 917 return false; … … 974 989 } 975 990 976 991 if (empty($this->permalink_structure)) { 977 992 $this->category_structure = ''; 978 993 return false; … … 994 1009 } 995 1010 996 1011 if (empty($this->permalink_structure)) { 997 1012 $this->author_structure = ''; 998 1013 return false; … … 1009 1024 } 1010 1025 1011 1026 if (empty($this->permalink_structure)) { 1012 1027 $this->search_structure = ''; 1013 1028 return false; … … 1024 1039 } 1025 1040 1026 1041 if (empty($this->permalink_structure)) { 1027 1042 $this->page_structure = ''; 1028 1043 return false; … … 1039 1054 } 1040 1055 1041 1056 if (empty($this->permalink_structure)) { 1042 1057 $this->feed_structure = ''; 1043 1058 return false; … … 1054 1069 } 1055 1070 1056 1071 if (empty($this->permalink_structure)) { 1057 1072 $this->comment_feed_structure = ''; 1058 1073 return false; … … 1159 1174 $trackbackquery = $trackbackindex . '?' . $query . '&tb=1'; 1160 1175 $match = rtrim($match, '/'); 1176 $submatchbase = str_replace(array('(',')'),'',$match); 1177 $sub1 = $submatchbase . '/([^/]+)/'; 1178 $sub1tb = $sub1 . $trackbackregex; 1179 $sub1feed = $sub1 . $feedregex; 1180 $sub1feed2 = $sub1 . $feedregex2; 1181 $sub1 .= '?$'; 1182 $sub2 = $submatchbase . '/subpost/([^/]+)/'; 1183 $sub2tb = $sub2 . $trackbackregex; 1184 $sub2feed = $sub2 . $feedregex; 1185 $sub2feed2 = $sub2 . $feedregex2; 1186 $sub2 .= '?$'; 1187 $subquery = $index . '?subpost=' . $this->preg_index(1); 1188 $subtbquery = $subquery . '&tb=1'; 1189 $subfeedquery = $subquery . '&feed=' . $this->preg_index(2); 1161 1190 $match = $match . '(/[0-9]+)?/?$'; 1162 1191 $query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1); … … 1169 1198 1170 1199 if ($post) { 1171 $rewrite = array($trackbackmatch => $trackbackquery) + $rewrite; 1200 $rewrite = array($trackbackmatch => $trackbackquery) + $rewrite + 1201 array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery) + 1202 array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery); 1172 1203 } 1173 1204 } … … 1232 1263 do_action('generate_rewrite_rules', array(&$this)); 1233 1264 $this->rules = apply_filters('rewrite_rules_array', $this->rules); 1265 1234 1266 return $this->rules; 1235 1267 } … … 1330 1362 1331 1363 class WP { 1332 var $public_query_vars = array('m', 'p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');1364 var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'subpost', 'subpost_id'); 1333 1365 1334 1366 var $private_query_vars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging'); … … 1398 1430 // If the requesting file is the anchor of the match, prepend it 1399 1431 // to the path info. 1400 if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0) ) {1432 if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request)) { 1401 1433 $request_match = $req_uri . '/' . $request; 1434 die("$request_match $match<br />"); 1402 1435 } 1403 1436 -
trunk/wp-includes/functions.php
r2956 r2958 1385 1385 } 1386 1386 1387 function is_subpost () { 1388 global $wp_query; 1389 1390 return $wp_query->is_subpost; 1391 } 1392 1387 1393 function is_archive () { 1388 1394 global $wp_query; … … 1870 1876 } 1871 1877 1878 function get_subpost_template() { 1879 global $posts; 1880 $type = explode('/', $posts[0]->post_type); 1881 if ( $template = get_query_template($type[0]) ) 1882 return $template; 1883 elseif ( $template = get_query_template($type[1]) ) 1884 return $template; 1885 elseif ( $template = get_query_template("$type[0]_$type[1]") ) 1886 return $template; 1887 else 1888 return get_query_template('subpost'); 1889 } 1890 1872 1891 function get_comments_popup_template() { 1873 1892 if ( file_exists( TEMPLATEPATH . '/comments-popup.php') ) -
trunk/wp-includes/template-functions-links.php
r2952 r2958 45 45 if ( $post->post_status == 'static' ) 46 46 return get_page_link($post->ID); 47 elseif ($post->post_status == 'object') 48 return get_subpost_link($post->ID); 47 49 48 50 $permalink = get_settings('permalink_structure'); … … 101 103 } 102 104 105 function get_subpost_link($id = false) { 106 global $post, $wp_rewrite; 107 108 $link = false; 109 110 if (! $id) { 111 $id = $post->ID; 112 } 113 114 $object = get_post($id); 115 if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) ) { 116 $parent = get_post($object->post_parent); 117 $parentlink = get_permalink($object->post_parent); 118 if (! strstr($parentlink, '?') ) 119 $link = trim($parentlink, '/') . '/' . $object->post_name . '/'; 120 } 121 122 if (! $link ) { 123 $link = get_bloginfo('home') . "/?subpost_id=$id"; 124 } 125 126 return apply_filters('object_link', $link, $id); 127 } 128 103 129 function get_year_link($year) { 104 130 global $wp_rewrite; … … 184 210 get_currentuserinfo(); 185 211 186 if ( !user_can_edit_post($user_ID, $post->ID) )212 if ( !user_can_edit_post($user_ID, $post->ID) || is_subpost() ) { 187 213 return; 214 } 188 215 189 216 $location = get_settings('siteurl') . "/wp-admin/post.php?action=edit&post=$post->ID"; … … 208 235 global $post, $wpdb; 209 236 210 if ( !is_single() ) 237 if( !is_single() || is_subpost() ) 238 return null; 239 240 $current_post_date = $post->post_date; 241 242 $join = ''; 243 if ( $in_same_cat ) { 244 $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id "; 245 $cat_array = get_the_category($post->ID); 246 $join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID); 247 for ( $i = 1; $i < (count($cat_array)); $i++ ) { 248 $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); 249 } 250 $join .= ')'; 251 } 252 253 $sql_exclude_cats = ''; 254 if ( !empty($excluded_categories) ) { 255 $blah = explode('and', $excluded_categories); 256 foreach ( $blah as $category ) { 257 $category = intval($category); 258 $sql_exclude_cats .= " AND post_category != $category"; 259 } 260 } 261 262 return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1"); 263 } 264 265 function get_next_post($in_same_cat = false, $excluded_categories = '') { 266 global $post, $wpdb; 267 268 if( !is_single() || is_subpost() ) 211 269 return null; 212 270 … … 233 291 } 234 292 235 return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1");236 }237 238 function get_next_post($in_same_cat = false, $excluded_categories = '') {239 global $post, $wpdb;240 241 if ( !is_single() )242 return null;243 244 $current_post_date = $post->post_date;245 246 $join = '';247 if ( $in_same_cat ) {248 $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";249 $cat_array = get_the_category($post->ID);250 $join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);251 for ( $i = 1; $i < (count($cat_array)); $i++ ) {252 $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);253 }254 $join .= ')';255 }256 257 $sql_exclude_cats = '';258 if ( !empty($excluded_categories) ) {259 $blah = explode('and', $excluded_categories);260 foreach ( $blah as $category ) {261 $category = intval($category);262 $sql_exclude_cats .= " AND post_category != $category";263 }264 }265 266 293 $now = current_time('mysql'); 267 294 … … 271 298 272 299 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 273 $post = get_previous_post($in_same_cat, $excluded_categories); 300 if ( is_subpost() ) { 301 $post = & get_post($GLOBALS['post']->post_parent); 302 $pre = __('Belongs to '); 303 } else { 304 $post = get_previous_post($in_same_cat, $excluded_categories); 305 $pre = ''; 306 } 307 308 if ( !$post ) 309 return; 310 311 $title = apply_filters('the_title', $post->post_title, $post); 312 $string = '<a href="'.get_permalink($post->ID).'">'; 313 $link = str_replace('%title', $title, $link); 314 $link = $pre . $string . $link . '</a>'; 315 316 $format = str_replace('%link', $link, $format); 317 echo $format; 318 } 319 320 function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { 321 $post = get_next_post($in_same_cat, $excluded_categories); 274 322 275 323 if ( !$post ) … … 282 330 $format = str_replace('%link', $link, $format); 283 331 284 echo $format; 285 } 286 287 function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { 288 $post = get_next_post($in_same_cat, $excluded_categories); 289 290 if ( !$post ) 291 return; 292 293 $title = apply_filters('the_title', $post->post_title, $post); 294 $string = '<a href="'.get_permalink($post->ID).'">'; 295 $link = str_replace('%title', $title, $link); 296 $link = $string . $link . '</a>'; 297 $format = str_replace('%link', $link, $format); 298 299 echo $format; 332 echo $format; 300 333 } 301 334 -
trunk/wp-includes/template-functions-post.php
r2955 r2958 439 439 } 440 440 441 function prepend_object($content) { 442 global $post; 443 444 $p = '<p class="subpostobject">'; 445 446 if ( '' != $post->guid ) { 447 if ( substr($post->post_type, 0, 6) == 'image/' ) 448 $p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="subpostimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>'; 449 else 450 $p .= __('Attachment') . ' (' . $post->post_type . ')'; 451 } else { 452 $p .= __('Missing attachment'); 453 } 454 455 $p .= '</p>'; 456 457 return "$p\n$content"; 458 } 441 459 ?> -
trunk/wp-includes/template-loader.php
r2735 r2958 1 1 <?php 2 3 2 if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { 4 3 do_action('template_redirect'); … … 18 17 include(get_home_template()); 19 18 exit; 19 } else if ( is_subpost() && get_subpost_template() ) { 20 include(get_subpost_template()); 21 exit; 20 22 } else if ( is_single() && get_single_template() ) { 23 if ( is_subpost() ) 24 add_filter('the_content', 'prepend_object'); 21 25 include(get_single_template()); 22 26 exit; 23 27 } else if ( is_page() && get_page_template() ) { 28 if ( is_subpost() ) 29 add_filter('the_content', 'prepend_object'); 24 30 include(get_page_template()); 25 31 exit;
Note: See TracChangeset
for help on using the changeset viewer.