Changeset 1868 for trunk/wp-includes/template-functions-links.php
- Timestamp:
- 11/19/2004 08:54:16 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/template-functions-links.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-links.php
r1860 r1868 106 106 } 107 107 108 function get_year_link($year) { 109 global $querystring_start, $querystring_equal; 110 if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); 111 $yearlink = get_year_permastruct(); 112 if (!empty($yearlink)) { 113 $yearlink = str_replace('%year%', $year, $yearlink); 114 return get_settings('home') . $yearlink; 115 } else { 116 return get_settings('home') .'/'. get_settings('blogfilename') .$querystring_start.'m'.$querystring_equal.$year; 117 } 118 } 119 108 120 function get_month_link($year, $month) { 109 121 global $querystring_start, $querystring_equal; 110 122 if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); 111 123 if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600)); 112 if ('' != get_settings('permalink_structure')) { 113 $permalink = get_settings('permalink_structure'); 114 115 // If the permalink structure does not contain year and month, make 116 // one that does. 117 if (! (strstr($permalink, '%year%') && strstr($permalink, '%monthnum%')) 118 || preg_match('/%category%.*(%year%|%monthnum%|%day%)/', $permalink)) { 119 $front = substr($permalink, 0, strpos($permalink, '%')); 120 $permalink = $front . '%year%/%monthnum%/'; 121 } 122 123 $off = strpos($permalink, '%monthnum%'); 124 $offset = $off + 11; 125 $monthlink = substr($permalink, 0, $offset); 126 if ('/' != substr($monthlink, -1)) $monthlink = substr($monthlink, 0, -1); 124 $monthlink = get_month_permastruct(); 125 if (!empty($monthlink)) { 127 126 $monthlink = str_replace('%year%', $year, $monthlink); 128 127 $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); 129 $monthlink = str_replace('%post_id%', '', $monthlink);130 $monthlink = str_replace('%category%', '', $monthlink);131 128 return get_settings('home') . $monthlink; 132 129 } else { … … 140 137 if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600)); 141 138 if (!$day) $day = gmdate('j', time()+(get_settings('gmt_offset') * 3600)); 142 if ('' != get_settings('permalink_structure')) { 143 $permalink = get_settings('permalink_structure'); 144 145 // If the permalink structure does not contain year, month, and day, 146 // make one that does. 147 if (! (strstr($permalink, '%year%') && strstr($permalink, '%monthnum%')&& strstr($permalink, '%day%')) 148 || preg_match('/%category%.*(%year%|%monthnum%|%day%)/', $permalink)) { 149 $front = substr($permalink, 0, strpos($permalink, '%')); 150 $permalink = $front . '%year%/%monthnum%/%day%/'; 151 } 152 153 $off = strpos($permalink, '%day%'); 154 $offset = $off + 6; 155 $daylink = substr($permalink, 0, $offset); 156 if ('/' != substr($daylink, -1)) $daylink = substr($daylink, 0, -1); 139 140 $daylink = get_day_permastruct(); 141 if (!empty($daylink)) { 157 142 $daylink = str_replace('%year%', $year, $daylink); 158 143 $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); 159 144 $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); 160 $daylink = str_replace('%post_id%', '', $daylink);161 $daylink = str_replace('%category%', '', $daylink);162 145 return get_settings('home') . $daylink; 163 146 } else {
Note: See TracChangeset
for help on using the changeset viewer.