Changeset 1227
- Timestamp:
- 05/05/2004 07:34:41 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-permalink.php
r1203 r1227 26 26 update_option('permalink_structure', $_POST['permalink_structure']); 27 27 $permalink_structure = $_POST['permalink_structure']; 28 29 update_option('category_base', $_POST['category_base']); 30 $category_base = $_POST['category_base']; 28 31 } else { 29 32 $permalink_structure = get_settings('permalink_structure'); 33 $category_base = get_settings('category_base'); 30 34 } 31 35 … … 44 48 <h2><?php _e('Edit Permalink Structure') ?></h2> 45 49 <?php _e('<p>WordPress offers you the ability to create a custom URI structure for your permalinks and archives. The following “tags” are available:</p>')?> 46 <ul> 47 <li><code>%year%</code> --- <?php _e('The year of the post, 4 digits, for example <code>2004</code>') ?> </li> 48 <li><code>%monthnum%</code> --- <?php _e('Month of the year, for example <code>05</code>') ?></li> 49 <li><code>%day% </code>--- <?php _e('Day of the month, for example <code>28</code>') ?></li> 50 <li><code>%postname%</code> --- <?php _e('A sanitized version of the title of the post. So “This Is A Great Post!” becomes “<code>this-is-a-great-post</code>” in the URI') ?> </li> 51 <li><code>%post_id%</code> --- <?php _e('The unique ID # of the post, for example <code>423</code>') ?></li> 52 </ul> 50 51 <dl> 52 <dt><code>%year%</code></dt> 53 <dd> 54 <?php _e('The year of the post, 4 digits, for example <code>2004</code>') ?> 55 </dd> 56 <dt><code>%monthnum%</code></dt> 57 <dd> 58 <?php _e('Month of the year, for example <code>05</code>') ?> 59 </dd> 60 <dt><code>%day%</code></dt> 61 <dd> 62 <?php _e('Day of the month, for example <code>28</code>') ?> 63 </dd> 64 <dt><code>%hour%</code></dt> 65 <dd> 66 <?php _e('Hour of the day, for example <code>15</code>') ?> 67 </dd> 68 <dt><code>%minute%</code></dt> 69 <dd> 70 <?php _e('Minute of the hour, for example <code>43</code>') ?> 71 </dd> 72 <dt><code>%second%</code></dt> 73 <dd> 74 <?php _e('Second of the minute, for example <code>33</code>') ?> 75 </dd> 76 <dt><code>%postname%</code></dt> 77 <dd> 78 <?php _e('A sanitized version of the title of the post. So “This Is A Great Post!” becomes “<code>this-is-a-great-post</code>” in the URI') ?> 79 </dd> 80 <dt><code>%post_id%</code></dt> 81 <dd> 82 <?php _e('The unique ID # of the post, for example <code>423</code>') ?> 83 </dd> 84 </dl> 85 53 86 <?php _e('<p>So for example a value like:</p> 54 87 <p><code>/archives/%year%/%monthnum%/%day%/%postname%/</code> </p> … … 59 92 <p>If you use this option you can ignore the mod_rewrite rules. </p>') ?> 60 93 <form name="form" action="options-permalink.php" method="post"> 61 < ?php _e('<p>Use the template tags above to create a virtual site structure:</p>') ?>94 <p><?php _e('Use the template tags above to create a virtual site structure:') ?></p> 62 95 <p> 63 96 <input name="permalink_structure" type="text" style="width: 98%;" value="<?php echo $permalink_structure; ?>" /> 64 97 </p> 98 <p><?php _e('Enter a path without templates for your categories:') ?> FIXME[THIS WORDING MAKES NO SENSE]</p> 99 <p> 100 <input name="category_base" type="text" style="width: 98%;" value="<?php echo $category_base; ?>" /> 101 </p> 65 102 <p class="submit"> 66 103 <input type="submit" name="submit" value="<?php _e('Update Permalink Structure »') ?>"> -
trunk/wp-admin/upgrade-functions.php
r1206 r1227 804 804 } 805 805 806 // Option for category base 807 if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'category_base'")) { 808 $wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '', 8)"); 809 } 810 806 811 // Delete unused options 807 812 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file'); -
trunk/wp-blog-header.php
r1186 r1227 51 51 } 52 52 53 $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', ' name', 'category_name', 'feed', 'author_name');53 $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name'); 54 54 55 55 for ($i=0; $i<count($wpvarstoreset); $i += 1) { … … 133 133 $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 134 134 135 // if a month is specified in the querystring, load that month136 if ( $m != '') {137 $m = '' .intval($m);138 $where .= ' AND YEAR(post_date)=' .substr($m,0,4);135 // If a month is specified in the querystring, load that month 136 if ('' != $m) { 137 $m = '' . preg_replace('|[^0-9]|', '', $m); 138 $where .= ' AND YEAR(post_date)=' . substr($m, 0, 4); 139 139 if (strlen($m)>5) 140 $where .= ' AND MONTH(post_date)=' .substr($m,4,2);140 $where .= ' AND MONTH(post_date)=' . substr($m, 4, 2); 141 141 if (strlen($m)>7) 142 $where .= ' AND DAYOFMONTH(post_date)=' .substr($m,6,2);142 $where .= ' AND DAYOFMONTH(post_date)=' . substr($m, 6, 2); 143 143 if (strlen($m)>9) 144 $where .= ' AND HOUR(post_date .)='.substr($m,8,2);144 $where .= ' AND HOUR(post_date)=' . substr($m, 8, 2); 145 145 if (strlen($m)>11) 146 $where .= ' AND MINUTE(post_date)=' .substr($m,10,2);146 $where .= ' AND MINUTE(post_date)=' . substr($m, 10, 2); 147 147 if (strlen($m)>13) 148 $where .= ' AND SECOND(post_date)='.substr($m,12,2); 149 150 } 151 152 if ($year != '') { 148 $where .= ' AND SECOND(post_date)=' . substr($m, 12, 2); 149 } 150 151 if ('' != $hour) { 152 $hour = '' . intval($hour); 153 $where .= " AND HOUR(post_date)='$hour'"; 154 } 155 156 if ('' != $minute) { 157 $minute = '' . intval($minute); 158 $where .= " AND MINUTE(post_date)='$minute'"; 159 } 160 161 if ('' != $second) { 162 $second = '' . intval($second); 163 $where .= " AND SECOND(post_date)='$second'"; 164 } 165 166 if ('' != $year) { 153 167 $year = '' . intval($year); 154 168 $where .= " AND YEAR(post_date)='$year'"; 155 169 } 156 170 157 if ( $monthnum != '') {171 if ('' != $monthnum) { 158 172 $monthnum = '' . intval($monthnum); 159 173 $where .= " AND MONTH(post_date)='$monthnum'"; 160 174 } 161 175 162 if ( $day != '') {176 if ('' != $day) { 163 177 $day = '' . intval($day); 164 178 $where .= " AND DAYOFMONTH(post_date)='$day'"; 165 179 } 166 180 167 if ( $name != '') {181 if ('' != $name) { 168 182 $name = preg_replace('/[^a-z0-9-]/', '', $name); 169 183 $where .= " AND post_name = '$name'"; 170 184 } 171 185 172 if ( $w != '') {186 if ('' != $w) { 173 187 $w = ''.intval($w); 174 188 $where .= " AND WEEK(post_date, 1)='$w'"; -
trunk/wp-includes/functions.php
r1226 r1227 247 247 '%monthnum%', 248 248 '%day%', 249 '%hour%', 250 '%minute%', 251 '%second%', 249 252 '%postname%', 250 253 '%post_id%' … … 254 257 '([0-9]{1,2})?', 255 258 '([0-9]{1,2})?', 259 '([0-9]{1,2})?', 260 '([0-9]{1,2})?', 261 '([0-9]{1,2})?', 256 262 '([_0-9a-z-]+)?', 257 263 '([0-9]+)?' … … 283 289 if ($monthnum) $where .= " AND MONTH(post_date) = '" . intval($monthnum) . "'"; 284 290 if ($day) $where .= " AND DAYOFMONTH(post_date) = '" . intval($day) . "'"; 291 if ($hour) $where .= " AND HOUR(post_date) = '" . intval($hour) . "'"; 292 if ($minute) $where .= " AND MINUTE(post_date) = '" . intval($minute) . "'"; 293 if ($second) $where .= " AND SECOND(post_date) = '" . intval($second) . "'"; 285 294 if ($postname) $where .= " AND post_name = '" . $wpdb->escape($postname) . "' "; 286 295 … … 1188 1197 } 1189 1198 1190 $rewritecode = array( 1191 '%year%', 1192 '%monthnum%', 1193 '%day%', 1194 '%postname%', 1195 '%post_id%' 1196 ); 1197 1198 $rewritereplace = array( 1199 '([0-9]{4})?', 1200 '([0-9]{1,2})?', 1201 '([0-9]{1,2})?', 1202 '([_0-9a-z-]+)?', 1203 '([0-9]+)?' 1204 ); 1205 1206 $queryreplace = array ( 1207 'year=', 1208 'monthnum=', 1209 'day=', 1210 'name=', 1211 'p=' 1212 ); 1199 $rewritecode = 1200 array( 1201 '%year%', 1202 '%monthnum%', 1203 '%day%', 1204 '%hour%', 1205 '%minute%', 1206 '%second%', 1207 '%postname%', 1208 '%post_id%' 1209 ); 1210 1211 $rewritereplace = 1212 array( 1213 '([0-9]{4})?', 1214 '([0-9]{1,2})?', 1215 '([0-9]{1,2})?', 1216 '([0-9]{1,2})?', 1217 '([0-9]{1,2})?', 1218 '([0-9]{1,2})?', 1219 '([_0-9a-z-]+)?', 1220 '([0-9]+)?' 1221 ); 1222 1223 $queryreplace = 1224 array ( 1225 'year=', 1226 'monthnum=', 1227 'day=', 1228 'hour=', 1229 'minute=', 1230 'second=', 1231 'name=', 1232 'p=' 1233 ); 1213 1234 1214 1235 … … 1264 1285 // Code for nice categories and authors, currently not very flexible 1265 1286 $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); 1266 $catmatch = $front . 'category/';1287 $catmatch = get_settings( 'category_base' ) . '/'; 1267 1288 $catmatch = preg_replace('|^/+|', '', $catmatch); 1268 1289 -
trunk/wp-includes/template-functions-category.php
r1217 r1227 25 25 $link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID; 26 26 } else { 27 if ('' == $category_nicename) $category_nicename = $cache_categories[$category_id]->category_nicename; 28 // Get any static stuff from the front 27 $category_nicename = $cache_categories[$category_id]->cat_name; 28 $category_nicename = preg_replace( '|[^a-z0-9-]|i', '', $category_nicename ); 29 // Get any static stuff from the front 29 30 $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); 30 31 $link = get_settings('home') . $front . 'category/'; -
trunk/wp-includes/template-functions-links.php
r1203 r1227 51 51 '%monthnum%', 52 52 '%day%', 53 '%hour%', 54 '%minute%', 55 '%second%', 53 56 '%postname%', 54 57 '%post_id%' … … 61 64 date('m', $unixtime), 62 65 date('d', $unixtime), 66 date('H', $unixtime), 67 date('i', $unixtime), 68 date('s', $unixtime), 63 69 $post->post_name, 64 70 $post->ID … … 76 82 date('m', $unixtime), 77 83 date('d', $unixtime), 84 date('H', $unixtime), 85 date('i', $unixtime), 86 date('s', $unixtime), 78 87 $idpost->post_name, 79 88 $id
Note: See TracChangeset
for help on using the changeset viewer.