[wp-cvs] wordpress/wp-includes classes.php,1.44,1.45

Ryan Boren rboren at users.sourceforge.net
Tue Jan 25 00:24:04 GMT 2005


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20490/wp-includes

Modified Files:
	classes.php 
Log Message:
Generate feed and trackback rules for pages. Bug 742.

Index: classes.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/classes.php,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** classes.php	21 Jan 2005 05:10:13 -0000	1.44
--- classes.php	25 Jan 2005 00:23:57 -0000	1.45
***************
*** 283,287 ****
  			$where .= " AND post_name = '" . $q['name'] . "'";
  		} else if ('' != $q['pagename']) {
! 			$q['pagename'] = sanitize_title($q['pagename']);
  			$q['name'] = $q['pagename'];
  			$where .= " AND post_name = '" . $q['pagename'] . "'";
--- 283,287 ----
  			$where .= " AND post_name = '" . $q['name'] . "'";
  		} else if ('' != $q['pagename']) {
! 			$q['pagename'] = sanitize_title(basename($q['pagename']));
  			$q['name'] = $q['pagename'];
  			$where .= " AND post_name = '" . $q['pagename'] . "'";
***************
*** 822,829 ****
  
  		$rewrite_rules = array();
  		if( is_array( $uris ) )
  			{
  				foreach ($uris as $uri => $pagename) {
! 					$rewrite_rules += array($uri . '/?$' => "index.php?pagename=" . urldecode($pagename));
  				}
  			}
--- 822,831 ----
  
  		$rewrite_rules = array();
+ 		$page_structure = '/%pagename%';
  		if( is_array( $uris ) )
  			{
  				foreach ($uris as $uri => $pagename) {
! 					$this->add_rewrite_tag('%pagename%', "($uri)", 'pagename=');
! 					$rewrite_rules += $this->generate_rewrite_rules($page_structure);
  				}
  			}
***************
*** 930,936 ****
  
  	function add_rewrite_tag($tag, $pattern, $query) {
! 		$this->rewritecode[] = $tag;
! 		$this->rewritereplace[] = $pattern;
! 		$this->queryreplace[] = $query;
  	}
  
--- 932,947 ----
  
  	function add_rewrite_tag($tag, $pattern, $query) {
! 		// If the tag already exists, replace the existing pattern and query for
! 		// that tag, otherwise add the new tag, pattern, and query to the end of
! 		// the arrays.
! 		$position = array_search($tag, $this->rewritecode);		
! 		if (FALSE !== $position && NULL !== $position) {
! 			$this->rewritereplace[$position] = $pattern;
! 			$this->queryreplace[$position] = $query;			
! 		} else {
! 			$this->rewritecode[] = $tag;
! 			$this->rewritereplace[] = $pattern;
! 			$this->queryreplace[] = $query;
! 		}
  	}
  
***************
*** 1005,1008 ****
--- 1016,1020 ----
  				$post = 0;
  				if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
+ 						|| strstr($struct, '%pagename%')
  						|| (strstr($struct, '%year%') &&  strstr($struct, '%monthnum%') && strstr($struct, '%day%') && strstr($struct, '%hour%') && strstr($struct, '%minute') && strstr($struct, '%second%'))) {
  					$post = 1;



More information about the cvs mailing list