mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Some style cleanup. Category base and additional URI options from Jay McCarthy.
git-svn-id: https://develop.svn.wordpress.org/trunk@1227 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -246,6 +246,9 @@ function url_to_postid($url = '') {
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
'%day%',
|
||||
'%hour%',
|
||||
'%minute%',
|
||||
'%second%',
|
||||
'%postname%',
|
||||
'%post_id%'
|
||||
);
|
||||
@@ -253,6 +256,9 @@ function url_to_postid($url = '') {
|
||||
'([0-9]{4})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([_0-9a-z-]+)?',
|
||||
'([0-9]+)?'
|
||||
);
|
||||
@@ -282,6 +288,9 @@ function url_to_postid($url = '') {
|
||||
if ($year) $where .= " AND YEAR(post_date) = '" . intval($year) . "'";
|
||||
if ($monthnum) $where .= " AND MONTH(post_date) = '" . intval($monthnum) . "'";
|
||||
if ($day) $where .= " AND DAYOFMONTH(post_date) = '" . intval($day) . "'";
|
||||
if ($hour) $where .= " AND HOUR(post_date) = '" . intval($hour) . "'";
|
||||
if ($minute) $where .= " AND MINUTE(post_date) = '" . intval($minute) . "'";
|
||||
if ($second) $where .= " AND SECOND(post_date) = '" . intval($second) . "'";
|
||||
if ($postname) $where .= " AND post_name = '" . $wpdb->escape($postname) . "' ";
|
||||
|
||||
// Run the query to get the post ID:
|
||||
@@ -1187,29 +1196,41 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
||||
}
|
||||
}
|
||||
|
||||
$rewritecode = array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
'%day%',
|
||||
'%postname%',
|
||||
'%post_id%'
|
||||
);
|
||||
$rewritecode =
|
||||
array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
'%day%',
|
||||
'%hour%',
|
||||
'%minute%',
|
||||
'%second%',
|
||||
'%postname%',
|
||||
'%post_id%'
|
||||
);
|
||||
|
||||
$rewritereplace = array(
|
||||
'([0-9]{4})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([_0-9a-z-]+)?',
|
||||
'([0-9]+)?'
|
||||
);
|
||||
$rewritereplace =
|
||||
array(
|
||||
'([0-9]{4})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([0-9]{1,2})?',
|
||||
'([_0-9a-z-]+)?',
|
||||
'([0-9]+)?'
|
||||
);
|
||||
|
||||
$queryreplace = array (
|
||||
'year=',
|
||||
'monthnum=',
|
||||
'day=',
|
||||
'name=',
|
||||
'p='
|
||||
);
|
||||
$queryreplace =
|
||||
array (
|
||||
'year=',
|
||||
'monthnum=',
|
||||
'day=',
|
||||
'hour=',
|
||||
'minute=',
|
||||
'second=',
|
||||
'name=',
|
||||
'p='
|
||||
);
|
||||
|
||||
|
||||
$match = str_replace('/', '/?', $permalink_structure);
|
||||
@@ -1263,7 +1284,7 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
||||
|
||||
// Code for nice categories and authors, currently not very flexible
|
||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||
$catmatch = $front . 'category/';
|
||||
$catmatch = get_settings( 'category_base' ) . '/';
|
||||
$catmatch = preg_replace('|^/+|', '', $catmatch);
|
||||
|
||||
$catfeedmatch = $catmatch . '(.*)/' . $feedregex;
|
||||
|
||||
Reference in New Issue
Block a user