Use strpos instead of strstr where ever possible, for speed. Props rob1n. fixes #3920
git-svn-id: http://svn.automattic.com/wordpress/trunk@4990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
00f7071af4
commit
3320dd1380
4
app.php
4
app.php
|
@ -192,7 +192,7 @@ class AtomParser {
|
|||
$this->in_content = array();
|
||||
} else {
|
||||
$endtag = $this->ns_to_prefix($name);
|
||||
if(strstr($this->in_content[count($this->in_content)-1], "<$endtag")) {
|
||||
if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false)
|
||||
array_push($this->in_content, "/>");
|
||||
} else {
|
||||
array_push($this->in_content, "</$endtag>");
|
||||
|
@ -220,7 +220,7 @@ class AtomParser {
|
|||
#print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n";
|
||||
if(!empty($this->in_content)) {
|
||||
// handle self-closing tags (case: text node found, need to close element started)
|
||||
if(strstr($this->in_content[count($this->in_content)-1], "<")) {
|
||||
if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) {
|
||||
array_push($this->in_content, ">");
|
||||
}
|
||||
array_push($this->in_content, $this->xml_escape($data));
|
||||
|
|
|
@ -1143,7 +1143,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
|
|||
if ( $markerdata ) {
|
||||
$state = true;
|
||||
foreach ( $markerdata as $n => $markerline ) {
|
||||
if ( strstr( $markerline, "# BEGIN {$marker}" ))
|
||||
if (strpos($markerline, '# BEGIN ' . $marker) !== false)
|
||||
$state = false;
|
||||
if ( $state ) {
|
||||
if ( $n + 1 < count( $markerdata ) )
|
||||
|
@ -1151,7 +1151,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
|
|||
else
|
||||
fwrite( $f, "{$markerline}" );
|
||||
}
|
||||
if ( strstr( $markerline, "# END {$marker}" ) ) {
|
||||
if (strpos($markerline, '# END ' . $marker) !== false) {
|
||||
fwrite( $f, "# BEGIN {$marker}\n" );
|
||||
if ( is_array( $insertion ))
|
||||
foreach ( $insertion as $insertline )
|
||||
|
@ -1189,11 +1189,11 @@ function extract_from_markers( $filename, $marker ) {
|
|||
{
|
||||
$state = false;
|
||||
foreach ( $markerdata as $markerline ) {
|
||||
if ( strstr( $markerline, "# END {$marker}" ))
|
||||
if (strpos($markerline, '# END ' . $marker) !== false)
|
||||
$state = false;
|
||||
if ( $state )
|
||||
$result[] = $markerline;
|
||||
if ( strstr( $markerline, "# BEGIN {$marker}" ))
|
||||
if (strpos($markerline, '# BEGIN ' . $marker) !== false)
|
||||
$state = true;
|
||||
}
|
||||
}
|
||||
|
@ -1766,7 +1766,8 @@ function browse_happy() {
|
|||
<p id="bh" style="text-align: center;"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></p>
|
||||
';
|
||||
}
|
||||
if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ))
|
||||
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
|
||||
add_action( 'admin_footer', 'browse_happy' );
|
||||
|
||||
function documentation_link( $for ) {
|
||||
|
@ -1927,11 +1928,11 @@ function wp_import_cleanup( $id ) {
|
|||
function wp_import_upload_form( $action ) {
|
||||
$size = strtolower( ini_get( 'upload_max_filesize' ) );
|
||||
$bytes = 0;
|
||||
if ( strstr( $size, 'k' ) )
|
||||
if (strpos($size, 'k') !== false)
|
||||
$bytes = $size * 1024;
|
||||
if ( strstr( $size, 'm' ) )
|
||||
if (strpos($size, 'm') !== false)
|
||||
$bytes = $size * 1024 * 1024;
|
||||
if ( strstr( $size, 'g' ) )
|
||||
if (strpos($size, 'g') !== false)
|
||||
$bytes = $size * 1024 * 1024 * 1024;
|
||||
?>
|
||||
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
|
||||
|
|
|
@ -22,9 +22,9 @@ function xfn_check($class, $value = '', $type = 'check') {
|
|||
}
|
||||
|
||||
if ('' == $value) {
|
||||
if ('family' == $class && !strstr($link_rel, 'child') && !strstr($link_rel, 'parent') && !strstr($link_rel, 'sibling') && !strstr($link_rel, 'spouse') && !strstr($link_rel, 'kin')) echo ' checked="checked"';
|
||||
if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
|
||||
if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
|
||||
if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
|
||||
if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
|
||||
if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
|
||||
if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -941,7 +941,7 @@ class AtomParser {
|
|||
$this->in_content = array();
|
||||
} else {
|
||||
$endtag = $this->ns_to_prefix($name);
|
||||
if(strstr($this->in_content[count($this->in_content)-1], "<$endtag")) {
|
||||
if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false) {
|
||||
array_push($this->in_content, "/>");
|
||||
} else {
|
||||
array_push($this->in_content, "</$endtag>");
|
||||
|
@ -969,7 +969,7 @@ class AtomParser {
|
|||
#print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n";
|
||||
if(!empty($this->in_content)) {
|
||||
// handle self-closing tags (case: text node found, need to close element started)
|
||||
if(strstr($this->in_content[count($this->in_content)-1], "<")) {
|
||||
if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) {
|
||||
array_push($this->in_content, ">");
|
||||
}
|
||||
array_push($this->in_content, $this->xml_escape($data));
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
// The URL of the item's file
|
||||
$menu[0] = array(__('Dashboard'), 'read', 'index.php');
|
||||
|
||||
if ( strstr($_SERVER['REQUEST_URI'], 'edit-pages.php') )
|
||||
if (strpos($_SERVER['REQUEST_URI'], 'edit-pages.php') !== false)
|
||||
$menu[5] = array(__('Write'), 'edit_pages', 'page-new.php');
|
||||
else
|
||||
$menu[5] = array(__('Write'), 'edit_posts', 'post-new.php');
|
||||
if ( strstr($_SERVER['REQUEST_URI'], 'page-new.php') )
|
||||
if (strpos($_SERVER['REQUEST_URI'], 'page-new.php') !== false)
|
||||
$menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php');
|
||||
else
|
||||
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
|
||||
|
|
|
@ -148,7 +148,7 @@ foreach ( (array) $options as $option) :
|
|||
<th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
|
||||
<td>";
|
||||
|
||||
if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
|
||||
if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
|
||||
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />";
|
||||
|
||||
echo "</td>
|
||||
|
|
|
@ -148,8 +148,8 @@ case 'delete':
|
|||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strstr($sendback, 'page.php')) $sendback = get_option('siteurl') .'/wp-admin/page.php';
|
||||
elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
|
||||
if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.php';
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
wp_redirect($sendback);
|
||||
exit();
|
||||
|
|
|
@ -160,8 +160,8 @@ case 'delete':
|
|||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strstr($sendback, 'post.php')) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
|
||||
elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
|
||||
if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
wp_redirect($sendback);
|
||||
exit();
|
||||
|
|
|
@ -52,7 +52,7 @@ default:
|
|||
if ( ! current_user_can('edit_files') )
|
||||
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
|
||||
|
||||
if ( strstr( $file, 'wp-config.php' ) )
|
||||
if (strpos($file, 'wp-config.php') !== false)
|
||||
wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
|
||||
|
||||
update_recently_edited($file);
|
||||
|
|
|
@ -922,7 +922,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
|
|||
|
||||
if ($oldfile == 'index.php') { // Check to make sure it's not a new index
|
||||
$index = implode('', file("$oldpath/$oldfile"));
|
||||
if ( strstr( $index, 'WP_USE_THEMES' ) ) {
|
||||
if (strpos($index, 'WP_USE_THEMES') !== false) {
|
||||
if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
|
||||
return false;
|
||||
continue; // Don't copy anything
|
||||
|
@ -994,12 +994,12 @@ function make_site_theme_from_default($theme_name, $template) {
|
|||
$f = fopen("$site_dir/style.css", 'w');
|
||||
|
||||
foreach ($stylelines as $line) {
|
||||
if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
|
||||
elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
|
||||
elseif (strstr($line, "Description:")) $line = "Description: Your theme";
|
||||
elseif (strstr($line, "Version:")) $line = "Version: 1";
|
||||
elseif (strstr($line, "Author:")) $line = "Author: You";
|
||||
fwrite($f, "{$line}\n");
|
||||
if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
|
||||
elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
|
||||
elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
|
||||
elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
|
||||
elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
|
||||
fwrite($f, $line . "\n");
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
if (! isset($wp_did_header)):
|
||||
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
|
||||
if ( strstr( $_SERVER['PHP_SELF'], 'wp-admin') ) $path = '';
|
||||
if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
|
||||
else $path = 'wp-admin/';
|
||||
|
||||
require_once( dirname(__FILE__) . '/wp-includes/classes.php');
|
||||
|
|
|
@ -25,7 +25,7 @@ function kubrick_header_image() {
|
|||
}
|
||||
|
||||
function kubrick_upper_color() {
|
||||
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
||||
if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
|
||||
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
||||
return $q['upper'];
|
||||
} else
|
||||
|
@ -33,7 +33,7 @@ function kubrick_upper_color() {
|
|||
}
|
||||
|
||||
function kubrick_lower_color() {
|
||||
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
||||
if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
|
||||
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
||||
return $q['lower'];
|
||||
} else
|
||||
|
|
|
@ -120,14 +120,14 @@ class WP {
|
|||
}
|
||||
|
||||
// If req_uri is empty or if it is a request for ourself, unset error.
|
||||
if ( empty($request) || $req_uri == $self || strstr($_SERVER['PHP_SELF'], 'wp-admin/') ) {
|
||||
if (empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) {
|
||||
if (isset($_GET['error']))
|
||||
unset($_GET['error']);
|
||||
|
||||
if (isset($error))
|
||||
unset($error);
|
||||
|
||||
if ( isset($perma_query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') )
|
||||
if (isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false)
|
||||
unset($perma_query_vars);
|
||||
|
||||
$this->did_permalink = false;
|
||||
|
|
|
@ -239,7 +239,7 @@ function trackback_url( $display = true ) {
|
|||
|
||||
function trackback_rdf($timezone = 0) {
|
||||
global $id;
|
||||
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) {
|
||||
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
||||
|
|
|
@ -165,7 +165,7 @@ function the_category_rss($type = 'rss') {
|
|||
|
||||
function html_type_rss() {
|
||||
$type = get_bloginfo('html_type');
|
||||
if ( strstr( $type, 'xhtml' ) )
|
||||
if (strpos($type, 'xhtml') !== false)
|
||||
$type = 'xhtml';
|
||||
else
|
||||
$type = 'html';
|
||||
|
|
|
@ -29,10 +29,9 @@ function wptexturize($text) {
|
|||
if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag
|
||||
// static strings
|
||||
$curl = str_replace($static_characters, $static_replacements, $curl);
|
||||
|
||||
// regular expressions
|
||||
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
|
||||
} elseif ( strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd') || strstr($curl, '<style') || strstr($curl, '<script') ) {
|
||||
} elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
|
||||
$next = false;
|
||||
} else {
|
||||
$next = true;
|
||||
|
@ -78,7 +77,7 @@ function wpautop($pee, $br = 1) {
|
|||
}
|
||||
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
|
||||
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
|
||||
if ( strstr( $pee, '<pre' ) )
|
||||
if (strpos($pee, '<pre') !== false)
|
||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
|
||||
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
|
||||
|
||||
|
@ -658,7 +657,7 @@ function convert_smilies($text) {
|
|||
|
||||
function is_email($user_email) {
|
||||
$chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i";
|
||||
if(strstr($user_email, '@') && strstr($user_email, '.')) {
|
||||
if (strpos($user_email, '@') !== false && strpos($user_email, '.') !== false) {
|
||||
if (preg_match($chars, $user_email)) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1072,7 +1071,7 @@ function clean_url( $url, $protocols = null ) {
|
|||
$strip = array('%0d', '%0a');
|
||||
$url = str_replace($strip, '', $url);
|
||||
$url = str_replace(';//', '://', $url);
|
||||
$url = (!strstr($url, '://')) ? 'http://'.$url : $url;
|
||||
$url = (strpos($url, '://') === false) ? 'http://'.$url : $url;
|
||||
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
|
||||
if ( !is_array($protocols) )
|
||||
$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
|
||||
|
|
|
@ -780,7 +780,7 @@ function add_query_arg() {
|
|||
$protocol = '';
|
||||
}
|
||||
|
||||
if ( strstr($uri, '?') ) {
|
||||
if (strpos($uri, '?') !== false) {
|
||||
$parts = explode('?', $uri, 2);
|
||||
if ( 1 == count($parts) ) {
|
||||
$base = '?';
|
||||
|
@ -789,7 +789,7 @@ function add_query_arg() {
|
|||
$base = $parts[0] . '?';
|
||||
$query = $parts[1];
|
||||
}
|
||||
} else if ( !empty($protocol) || strstr($uri, '/') ) {
|
||||
} elseif (!empty($protocol) || strpos($uri, '/') !== false) {
|
||||
$base = $uri . '?';
|
||||
$query = '';
|
||||
} else {
|
||||
|
@ -1337,7 +1337,7 @@ function wp_die( $message, $title = '' ) {
|
|||
if ( empty($title) )
|
||||
$title = __('WordPress › Error');
|
||||
|
||||
if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
|
||||
if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
|
||||
$admin_dir = '';
|
||||
else
|
||||
$admin_dir = 'wp-admin/';
|
||||
|
|
|
@ -554,9 +554,7 @@ function get_calendar($initial = true) {
|
|||
$daywithpost = array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') )
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
|
||||
$ak_title_separator = "\n";
|
||||
else
|
||||
$ak_title_separator = ', ';
|
||||
|
|
|
@ -70,7 +70,7 @@ function get_permalink($id = 0) {
|
|||
$unixtime = strtotime($post->post_date);
|
||||
|
||||
$category = '';
|
||||
if ( strstr($permalink, '%category%') ) {
|
||||
if (strpos($permalink, '%category%') !== false) {
|
||||
$cats = get_the_category($post->ID);
|
||||
$category = $cats[0]->category_nicename;
|
||||
if ( $parent=$cats[0]->category_parent )
|
||||
|
@ -158,7 +158,7 @@ function get_attachment_link($id = false) {
|
|||
$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
|
||||
else
|
||||
$parentlink = get_permalink( $object->post_parent );
|
||||
if (! strstr($parentlink, '?') )
|
||||
if (strpos($parentlink, '?') === false)
|
||||
$link = trim($parentlink, '/') . '/' . $object->post_name . '/';
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ function check_admin_referer($action = -1) {
|
|||
$adminurl = strtolower(get_option('siteurl')).'/wp-admin';
|
||||
$referer = strtolower(wp_get_referer());
|
||||
if ( !wp_verify_nonce($_REQUEST['_wpnonce'], $action) &&
|
||||
!(-1 == $action && strstr($referer, $adminurl)) ) {
|
||||
!(-1 == $action && strpos($referer, $adminurl) !== false))
|
||||
wp_nonce_ays($action);
|
||||
die();
|
||||
}
|
||||
|
|
|
@ -1198,9 +1198,9 @@ function generate_page_uri_index() {
|
|||
//
|
||||
|
||||
function is_local_attachment($url) {
|
||||
if ( !strstr($url, get_bloginfo('url') ) )
|
||||
if (strpos($url, get_bloginfo('url')) === false)
|
||||
return false;
|
||||
if ( strstr($url, get_bloginfo('url') . '/?attachment_id=') )
|
||||
if (strpos($url, get_bloginfo('url') . '/?attachment_id=') !== false)
|
||||
return true;
|
||||
if ( $id = url_to_postid($url) ) {
|
||||
$post = & get_post($id);
|
||||
|
|
|
@ -29,7 +29,7 @@ function &query_posts($query) {
|
|||
function is_admin () {
|
||||
global $wp_query;
|
||||
|
||||
return ( $wp_query->is_admin || strstr($_SERVER['REQUEST_URI'], 'wp-admin/') );
|
||||
return ($wp_query->is_admin || (strpos($_SERVER['REQUEST_URI'], 'wp-admin/') !== false));
|
||||
}
|
||||
|
||||
function is_archive () {
|
||||
|
@ -510,7 +510,7 @@ class WP_Query {
|
|||
if (empty($qv['cat']) || ($qv['cat'] == '0')) {
|
||||
$this->is_category = false;
|
||||
} else {
|
||||
if (stristr($qv['cat'],'-')) {
|
||||
if (strpos($qv['cat'], '-') !== false) {
|
||||
$this->is_category = false;
|
||||
} else {
|
||||
$this->is_category = true;
|
||||
|
@ -557,7 +557,7 @@ class WP_Query {
|
|||
$this->is_preview = true;
|
||||
}
|
||||
|
||||
if (strstr($_SERVER['PHP_SELF'], 'wp-admin/')) {
|
||||
if (strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) {
|
||||
$this->is_admin = true;
|
||||
}
|
||||
|
||||
|
@ -850,7 +850,7 @@ class WP_Query {
|
|||
$in_cats = $out_cats = $out_posts = '';
|
||||
foreach ( $cat_array as $cat ) {
|
||||
$cat = intval($cat);
|
||||
$in = strstr($cat, '-') ? false : true;
|
||||
$in = (strpos($cat, '-') !== false) ? false : true;
|
||||
$cat = trim($cat, '-');
|
||||
if ( $in )
|
||||
$in_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
|
@ -918,7 +918,7 @@ class WP_Query {
|
|||
} else {
|
||||
$q['author'] = ''.urldecode($q['author']).'';
|
||||
$q['author'] = addslashes_gpc($q['author']);
|
||||
if (stristr($q['author'], '-')) {
|
||||
if (strpos($q['author'], '-') !== false) {
|
||||
$eq = '!=';
|
||||
$andor = 'AND';
|
||||
$q['author'] = explode('-', $q['author']);
|
||||
|
@ -938,7 +938,7 @@ class WP_Query {
|
|||
// Author stuff for nice URLs
|
||||
|
||||
if ('' != $q['author_name']) {
|
||||
if (stristr($q['author_name'],'/')) {
|
||||
if (strpos($q['author_name'], '/') !== false) {
|
||||
$q['author_name'] = explode('/',$q['author_name']);
|
||||
if ($q['author_name'][count($q['author_name'])-1]) {
|
||||
$q['author_name'] = $q['author_name'][count($q['author_name'])-1];#no trailing slash
|
||||
|
|
|
@ -591,11 +591,11 @@ class WP_Rewrite {
|
|||
//individual post. Do this by checking it contains at least one of 1) post name,
|
||||
//2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
|
||||
//minute all present). Set these flags now as we need them for the endpoints.
|
||||
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%'))) {
|
||||
if (strpos($struct, '%postname%') !== false || strpos($struct, '%post_id%') !== false
|
||||
|| strpos($struct, '%pagename%') !== false
|
||||
|| (strpos($struct, '%year%') !== false && strpos($struct, '%monthnum%') !== false && strpos($struct, '%day%') !== false && strpos($struct, '%hour%') !== false && strpos($struct, '%minute%') !== false && strpos($struct, '%second%') !== false)) {
|
||||
$post = true;
|
||||
if ( strstr($struct, '%pagename%') )
|
||||
if (strpos($struct, '%pagename%') !== false)
|
||||
$page = true;
|
||||
}
|
||||
|
||||
|
@ -809,7 +809,7 @@ class WP_Rewrite {
|
|||
//nada.
|
||||
}
|
||||
|
||||
if (strstr($query, $this->index)) {
|
||||
if (strpos($query, $this->index) !== false) {
|
||||
$rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
|
||||
} else {
|
||||
$rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n";
|
||||
|
|
|
@ -32,8 +32,8 @@ elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozill
|
|||
$is_IE = ( $is_macIE || $is_winIE );
|
||||
|
||||
// Server detection
|
||||
$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0;
|
||||
$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
|
||||
$is_apache ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? 1 : 0;
|
||||
$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? 1 : 0;
|
||||
|
||||
// if the config file does not provide the smilies array, let's define it here
|
||||
if (!isset($wpsmiliestrans)) {
|
||||
|
|
|
@ -372,7 +372,7 @@ class wpdb {
|
|||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
|
||||
if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
|
||||
$admin_dir = '';
|
||||
else
|
||||
$admin_dir = 'wp-admin/';
|
||||
|
|
|
@ -40,7 +40,7 @@ if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'],
|
|||
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
|
||||
|
||||
// Fix for Dreamhost and other PHP as CGI hosts
|
||||
if ( strstr( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) )
|
||||
if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
|
||||
unset($_SERVER['PATH_INFO']);
|
||||
|
||||
// Fix empty PHP_SELF
|
||||
|
@ -140,8 +140,8 @@ include_once(ABSPATH . WPINC . '/streams.php');
|
|||
include_once(ABSPATH . WPINC . '/gettext.php');
|
||||
require_once (ABSPATH . WPINC . '/l10n.php');
|
||||
|
||||
if ( !is_blog_installed() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {
|
||||
if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
|
||||
if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
|
||||
if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
|
||||
$link = 'install.php';
|
||||
else
|
||||
$link = 'wp-admin/install.php';
|
||||
|
@ -172,11 +172,11 @@ require (ABSPATH . WPINC . '/version.php');
|
|||
require (ABSPATH . WPINC . '/deprecated.php');
|
||||
require (ABSPATH . WPINC . '/script-loader.php');
|
||||
|
||||
if (!strstr($_SERVER['PHP_SELF'], 'install.php')) :
|
||||
if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
|
||||
// Used to guarantee unique hash cookies
|
||||
$cookiehash = md5(get_option('siteurl'));
|
||||
define('COOKIEHASH', $cookiehash);
|
||||
endif;
|
||||
}
|
||||
|
||||
if ( !defined('USER_COOKIE') )
|
||||
define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH);
|
||||
|
|
Loading…
Reference in New Issue