summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-10-22 15:14:46 +0000
committerDries Buytaert <dries@buytaert.net>2005-10-22 15:14:46 +0000
commitf6764cfbd8dcdedd05263711a41fcedb72dda2ab (patch)
tree88f659fea364fc50d3173da0c5a8bdbc28be8557 /themes
parent07ecb2abb0206484a77acbf5ba767af856d99520 (diff)
downloadbrdo-f6764cfbd8dcdedd05263711a41fcedb72dda2ab.tar.gz
brdo-f6764cfbd8dcdedd05263711a41fcedb72dda2ab.tar.bz2
- Patch #30930 by m3avrck/deekayen: cured PHP5 warnings.
Diffstat (limited to 'themes')
-rw-r--r--themes/engines/phptemplate/phptemplate.engine22
1 files changed, 13 insertions, 9 deletions
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
index 0f4585c0f..3c8280960 100644
--- a/themes/engines/phptemplate/phptemplate.engine
+++ b/themes/engines/phptemplate/phptemplate.engine
@@ -60,7 +60,7 @@ function _phptemplate_callback($hook, $variables = array(), $file = NULL) {
$variables = array_merge($variables, _phptemplate_variables($hook, $variables));
}
- if ($variables['template_file']) {
+ if (isset($variables['template_file'])) {
$file = $variables['template_file'];
}
@@ -86,13 +86,13 @@ function _phptemplate_callback($hook, $variables = array(), $file = NULL) {
function _phptemplate_default_variables($hook, $variables) {
global $theme;
static $count = array();
- $count[$hook] = is_int($count[$hook]) ? $count[$hook] : 1;
+ $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1;
$variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even';
$variables['id'] = $count[$hook]++;
global $sidebar_indicator;
if ($hook == 'block') {
- $count['block_counter'][$sidebar_indicator] = is_int($count['block_counter'][$sidebar_indicator]) ? $count['block_counter'][$sidebar_indicator] : 1;
+ $count['block_counter'][$sidebar_indicator] = isset($count['block_counter'][$sidebar_indicator]) && is_int($count['block_counter'][$sidebar_indicator]) ? $count['block_counter'][$sidebar_indicator] : 1;
$variables['block_zebra'] = ($count['block_counter'][$sidebar_indicator] % 2) ? 'odd' : 'even';
$variables['block_id'] = $count['block_counter'][$sidebar_indicator]++;
}
@@ -104,7 +104,7 @@ function _phptemplate_default_variables($hook, $variables) {
// This pre-loading is necessary because phptemplate uses variable names different from
// the region names, e.g., 'sidebar_left' instead of 'left'.
if (!in_array($region, array('left', 'right', 'footer'))) {
- $variables[$region] .= theme('blocks', $region);
+ isset($variables[$region]) ? $variables[$region] .= theme('blocks', $region) : $variables[$region] = theme('blocks', $region);
}
}
}
@@ -118,6 +118,10 @@ function _phptemplate_default_variables($hook, $variables) {
return $variables;
}
+/**
+ * @return
+ * Array of template features
+ */
function phptemplate_features() {
return array(
'logo',
@@ -194,7 +198,7 @@ function phptemplate_page($content) {
'layout' => $layout,
'logo' => theme_get_setting('logo'),
'messages' => theme('status_messages'),
- 'mission' => $mission,
+ 'mission' => isset($mission) ? $mission : '',
'onload_attributes' => theme('onload_attribute'),
'primary_links' => theme_get_setting('primary_links'),
'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''),
@@ -263,7 +267,7 @@ function phptemplate_comment($comment, $links = 0) {
'comment' => $comment,
'content' => $comment->comment,
'date' => format_date($comment->timestamp),
- 'links' => $links ? theme('links', $links) : '',
+ 'links' => isset($links) ? theme('links', $links) : '',
'new' => $comment->new ? t('new') : '',
'picture' => theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '',
'submitted' => t('Submitted by %a on %b.',
@@ -309,7 +313,7 @@ function phptemplate_box($title, $content, $region = 'main') {
* A suggested template file to use.
*/
function _phptemplate_default($hook, $variables, $file = NULL) {
- if ($file && file_exists(path_to_theme() . "/$file.tpl.php")) {
+ if (!empty($file) && file_exists(path_to_theme() . "/$file.tpl.php")) {
$file = path_to_theme() . "/$file.tpl.php";
}
else {
@@ -328,8 +332,8 @@ function _phptemplate_default($hook, $variables, $file = NULL) {
}
}
- if ($file) {
- extract($variables, EXTR_SKIP); // Extract the vars to local namespace
+ if (isset($file)) {
+ extract($variables, EXTR_SKIP); // Extract the variables to a local namespace
ob_start(); // Start output buffering
include "./$file"; // Include the file
$contents = ob_get_contents(); // Get the contents of the buffer