summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-11-01 19:51:06 +0000
committerDries Buytaert <dries@buytaert.net>2008-11-01 19:51:06 +0000
commit424250196a65b48919de50b2a3327f67c076e0d3 (patch)
tree83b9cae1c024bd391d15f8faeee7595985fca4d7
parent4a6243aff27d5f26189e0e9eff2039fe0cdbb754 (diff)
downloadbrdo-424250196a65b48919de50b2a3327f67c076e0d3.tar.gz
brdo-424250196a65b48919de50b2a3327f67c076e0d3.tar.bz2
- Patch #279516 by c960657: removed many PHP4-isms. Great patch.
-rw-r--r--includes/unicode.inc6
-rw-r--r--modules/aggregator/aggregator.module8
-rw-r--r--modules/comment/comment.module3
-rw-r--r--modules/filter/filter.module9
-rw-r--r--modules/node/node.module4
-rw-r--r--modules/openid/openid.inc18
6 files changed, 10 insertions, 38 deletions
diff --git a/includes/unicode.inc b/includes/unicode.inc
index 96611d14d..f54ce1f1f 100644
--- a/includes/unicode.inc
+++ b/includes/unicode.inc
@@ -42,12 +42,6 @@ function _unicode_check() {
// Set the standard C locale to ensure consistent, ASCII-only string handling.
setlocale(LC_CTYPE, 'C');
- // Check for outdated PCRE library
- // Note: we check if U+E2 is in the range U+E0 - U+E1. This test returns TRUE on old PCRE versions.
- if (preg_match('/[à-á]/u', 'â')) {
- return array(UNICODE_ERROR, $t('The PCRE library in your PHP installation is outdated. This will cause problems when handling Unicode text. If you are running PHP 4.3.3 or higher, make sure you are using the PCRE library supplied by PHP. Please refer to the <a href="@url">PHP PCRE documentation</a> for more information.', array('@url' => 'http://www.php.net/pcre')));
- }
-
// Check for mbstring extension
if (!function_exists('mb_strlen')) {
return array(UNICODE_SINGLEBYTE, $t('Operations on Unicode strings are emulated on a best-effort basis. Install the <a href="@url">PHP mbstring extension</a> for improved Unicode support.', array('@url' => 'http://www.php.net/mbstring')));
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 104e2146e..d918022ec 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -695,9 +695,7 @@ function aggregator_refresh($feed) {
}
if (!empty($image['LINK']) && !empty($image['URL']) && !empty($image['TITLE'])) {
- // TODO: we should really use theme_image() here, but that only works with
- // local images. It won't work with images fetched with a URL unless PHP version > 5.
- $image = '<a href="' . check_url($image['LINK']) . '" class="feed-image"><img src="' . check_url($image['URL']) . '" alt="' . check_plain($image['TITLE']) . '" /></a>';
+ $image = l(theme('image', $image['URL'], $image['TITLE']), $image['LINK'], array('html' => TRUE));
}
else {
$image = '';
@@ -864,9 +862,9 @@ function aggregator_parse_feed(&$data, $feed) {
}
}
- $timestamp = strtotime($date); // As of PHP 5.1.0, strtotime returns FALSE on failure instead of -1.
+ $timestamp = strtotime($date);
- if ($timestamp <= 0) {
+ if ($timestamp === FALSE) {
$timestamp = aggregator_parse_w3cdtf($date); // Aggregator_parse_w3cdtf() returns FALSE on failure.
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 341767aa3..7644e0f9e 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1134,8 +1134,7 @@ function comment_validate($edit) {
comment_invoke_comment($edit, 'validate');
if (isset($edit['date'])) {
- // As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
- if (strtotime($edit['date']) <= 0) {
+ if (strtotime($edit['date']) === FALSE) {
form_set_error('date', t('You have to specify a valid date.'));
}
}
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 39c905189..8366216b4 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -977,7 +977,7 @@ function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite',
/**
* Processes an HTML tag.
*
- * @param @m
+ * @param $m
* An array with various meaning depending on the value of $store.
* If $store is TRUE then the array contains the allowed tags.
* If $store is FALSE then the array has one element, the HTML tag to process.
@@ -1025,10 +1025,9 @@ function _filter_xss_split($m, $store = FALSE) {
}
// Is there a closing XHTML slash at the end of the attributes?
- // In PHP 5.1.0+ we could count the changes, currently we need a separate match
- $xhtml_slash = preg_match('%\s?/\s*$%', $attrlist) ? ' /' : '';
- $attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist);
-
+ $attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist, -1, $count);
+ $xhtml_slash = $count ? ' /' : '';
+
// Clean up attributes
$attr2 = implode(' ', _filter_xss_attributes($attrlist));
$attr2 = preg_replace('/[<>]/', '', $attr2);
diff --git a/modules/node/node.module b/modules/node/node.module
index 2101c671e..5c4bc884a 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -842,8 +842,8 @@ function node_validate($node, $form = array()) {
form_set_error('name', t('The username %name does not exist.', array('%name' => $node->name)));
}
- // Validate the "authored on" field. As of PHP 5.1.0, strtotime returns FALSE instead of -1 upon failure.
- if (!empty($node->date) && strtotime($node->date) <= 0) {
+ // Validate the "authored on" field.
+ if (!empty($node->date) && strtotime($node->date) === FALSE) {
form_set_error('date', t('You have to specify a valid date.'));
}
}
diff --git a/modules/openid/openid.inc b/modules/openid/openid.inc
index a6d369067..959a95a9f 100644
--- a/modules/openid/openid.inc
+++ b/modules/openid/openid.inc
@@ -446,21 +446,3 @@ function _openid_get_params($str) {
}
return $data;
}
-
-/**
- * Provide bcpowmod support for PHP4.
- */
-if (!function_exists('bcpowmod')) {
- function bcpowmod($base, $exp, $mod) {
- $square = bcmod($base, $mod);
- $result = 1;
- while (bccomp($exp, 0) > 0) {
- if (bcmod($exp, 2)) {
- $result = bcmod(bcmul($result, $square), $mod);
- }
- $square = bcmod(bcmul($square, $square), $mod);
- $exp = bcdiv($exp, 2);
- }
- return $result;
- }
-}