mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784
git-svn-id: https://develop.svn.wordpress.org/trunk@8572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -157,7 +157,7 @@ function url_to_postid($url) {
|
||||
global $wp;
|
||||
parse_str($query, $query_vars);
|
||||
$query = array();
|
||||
foreach ( $query_vars as $key => $value ) {
|
||||
foreach ( (array) $query_vars as $key => $value ) {
|
||||
if ( in_array($key, $wp->public_query_vars) )
|
||||
$query[$key] = $value;
|
||||
}
|
||||
@@ -390,7 +390,7 @@ class WP_Rewrite {
|
||||
$front = $this->front;
|
||||
preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
|
||||
$tok_index = 1;
|
||||
foreach ($tokens[0] as $token) {
|
||||
foreach ( (array) $tokens[0] as $token) {
|
||||
if ( ($token == '%post_id%') && ($tok_index <= 3) ) {
|
||||
$front = $front . 'date/';
|
||||
break;
|
||||
@@ -574,7 +574,7 @@ class WP_Rewrite {
|
||||
function generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) {
|
||||
//build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/?
|
||||
$feedregex2 = '';
|
||||
foreach ($this->feeds as $feed_name) {
|
||||
foreach ( (array) $this->feeds as $feed_name) {
|
||||
$feedregex2 .= $feed_name . '|';
|
||||
}
|
||||
$feedregex2 = '(' . trim($feedregex2, '|') . ')/?$';
|
||||
@@ -589,7 +589,7 @@ class WP_Rewrite {
|
||||
//build up an array of endpoint regexes to append => queries to append
|
||||
if ($endpoints) {
|
||||
$ep_query_append = array ();
|
||||
foreach ($this->endpoints as $endpoint) {
|
||||
foreach ( (array) $this->endpoints as $endpoint) {
|
||||
//match everything after the endpoint name, but allow for nothing to appear there
|
||||
$epmatch = $endpoint[1] . '(/(.*))?/?$';
|
||||
//this will be appended on to the rest of the query for each dir
|
||||
@@ -688,7 +688,7 @@ class WP_Rewrite {
|
||||
|
||||
//do endpoints
|
||||
if ($endpoints) {
|
||||
foreach ($ep_query_append as $regex => $ep) {
|
||||
foreach ( (array) $ep_query_append as $regex => $ep) {
|
||||
//add the endpoints on if the mask fits
|
||||
if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) {
|
||||
$rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2);
|
||||
@@ -745,7 +745,7 @@ class WP_Rewrite {
|
||||
$subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
|
||||
|
||||
//do endpoints for attachments
|
||||
if (! empty($endpoint) ) { foreach ($ep_query_append as $regex => $ep) {
|
||||
if ( !empty($endpoint) ) { foreach ( (array) $ep_query_append as $regex => $ep ) {
|
||||
if ($ep[0] & EP_ATTACHMENT) {
|
||||
$rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
|
||||
$rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
|
||||
@@ -893,7 +893,7 @@ class WP_Rewrite {
|
||||
$rules .= "RewriteBase $home_root\n";
|
||||
|
||||
//add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
|
||||
foreach ($this->non_wp_rules as $match => $query) {
|
||||
foreach ( (array) $this->non_wp_rules as $match => $query) {
|
||||
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
|
||||
$match = str_replace('.+?', '.+', $match);
|
||||
|
||||
@@ -914,7 +914,7 @@ class WP_Rewrite {
|
||||
"RewriteCond %{REQUEST_FILENAME} -d\n" .
|
||||
"RewriteRule ^.*$ - [S=$num_rules]\n";
|
||||
|
||||
foreach ($rewrite as $match => $query) {
|
||||
foreach ( (array) $rewrite as $match => $query) {
|
||||
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
|
||||
$match = str_replace('.+?', '.+', $match);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user