aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-05-19 03:45:07 +0000
committerChad Little <clittle@users.sourceforge.net>2004-05-19 03:45:07 +0000
commit0696d5967469f46c14bf1cdbc8c9ed0ad3fe3aff (patch)
tree47101492ee8db3d9f6c1c0128783e8a5734fd307
parentafcfa0c4ab39291d30ded5e111c5537698e7c84e (diff)
downloadphpicalendar-0696d5967469f46c14bf1cdbc8c9ed0ad3fe3aff.tar.gz
phpicalendar-0696d5967469f46c14bf1cdbc8c9ed0ad3fe3aff.tar.bz2
phpicalendar-0696d5967469f46c14bf1cdbc8c9ed0ad3fe3aff.zip
Code optimization: Specifically replace each language variable instead of
looking for any.
-rw-r--r--day.php27
-rw-r--r--functions/template.php9
-rw-r--r--includes/event.php4
-rw-r--r--month.php19
-rw-r--r--templates/default/sidebar.tpl4
-rw-r--r--week.php17
-rw-r--r--year.php9
7 files changed, 73 insertions, 16 deletions
diff --git a/day.php b/day.php
index 9dc3e82..6228bc4 100644
--- a/day.php
+++ b/day.php
@@ -74,9 +74,34 @@ $page->replace_tags(array(
'list_weeks' => $list_weeks,
'list_jumps' => $list_jumps,
'legend' => $list_calcolors,
- 'style_select' => $style_select
+ 'style_select' => $style_select,
+ 'l_goprint' => $lang['l_goprint'],
+ 'l_preferences' => $lang['l_preferences'],
+ 'l_calendar' => $lang['l_calendar'],
+ 'l_legend' => $lang['l_legend'],
+ 'l_tomorrows' => $lang['l_tomorrows'],
+ 'l_jump' => $lang['l_jump'],
+ 'l_todo' => $lang['l_todo'],
+ 'l_day' => $lang['l_day'],
+ 'l_week' => $lang['l_week'],
+ 'l_month' => $lang['l_month'],
+ 'l_year' => $lang['l_year'],
+ 'l_powered_by' => $lang['l_powered_by'],
+ 'l_subscribe' => $lang['l_subscribe'],
+ 'l_download' => $lang['l_download'],
+ 'l_this_site_is' => $lang['l_this_site_is']
));
+if ($allow_login == 'yes') {
+ $page->replace_tags(array(
+ 'l_invalid_login' => $lang['l_invalid_login'],
+ 'l_password' => $lang['l_password'],
+ 'l_username' => $lang['l_username'],
+ 'l_login' => $lang['l_login'],
+ 'l_logout' => $lang['l_logout']
+ ));
+}
+
$page->draw_day($this->page);
$page->tomorrows_events($this->page);
$page->get_vtodo($this->page);
diff --git a/functions/template.php b/functions/template.php
index 1ad8e3f..6d7134c 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -785,7 +785,7 @@ class Page {
}
} while ($whole_month == TRUE);
- $return = preg_replace('!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is', $weekday_loop, $template_p);
+ $return = str_replace('<!-- loop weekday on -->'.$match1[1].'<!-- loop weekday off -->', $weekday_loop, $template_p);
$return = preg_replace('!<\!-- loop monthweeks on -->(.*)<\!-- loop monthweeks off -->!is', $middle, $return);
$return = str_replace('{MONTH_TITLE}', $month_title, $return);
$return = str_replace('{CAL}', $cal, $return);
@@ -909,16 +909,11 @@ class Page {
}
}
- // Replace any languages
- foreach ($lang as $tag => $data) {
- $this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page);
- }
-
$php_ended = @getmicrotime();
$generated = number_format(($php_ended-$php_started),3);
$this->page = str_replace('{GENERATED}', $generated, $this->page);
if ($enable_rss != 'yes') {
- $this->page = preg_replace('!<\!-- switch rss_powered on -->(.*)<\!-- switch rss_powered off -->!is', '', $this->page);
+ $this->page = preg_replace('!<\!-- switch rss_powered on -->(.*)<\!-- switch rss_powered off -->!is', '', $this->page);
} else {
$this->page = str_replace('{BASE}', BASE, $this->page);
}
diff --git a/includes/event.php b/includes/event.php
index fb22ba2..8a79572 100644
--- a/includes/event.php
+++ b/includes/event.php
@@ -32,7 +32,7 @@ if ($start == '' && $end == '' && (isset($start) && isset($end))) {
}
if ($description) $description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",'<a target="_new" href="\0">\0</a>',$description);
-if ($organizer) {
+if (is_array($organizer)) {
$i=0;
$display .= $organizer_lang . ' - ';
foreach ($organizer as $val) {
@@ -41,7 +41,7 @@ if ($organizer) {
}
$organizer = substr($organizers,0,-2);
}
-if ($attendee) {
+if (is_array($attendee)) {
$i=0;
$display .= $attendee_lang . ' - ';
foreach ($attendee as $val) {
diff --git a/month.php b/month.php
index c45eb78..45b15ea 100644
--- a/month.php
+++ b/month.php
@@ -48,7 +48,6 @@ $list_jumps = list_jumps();
$list_calcolors = list_calcolors();
$page = new Page(BASE.'templates/'.$template.'/month.tpl');
-
$page->replace_tags(array(
'header' => BASE.'templates/'.$template.'/header.tpl',
'footer' => BASE.'templates/'.$template.'/footer.tpl',
@@ -76,7 +75,23 @@ $page->replace_tags(array(
'list_weeks' => $list_weeks,
'legend' => $list_calcolors,
'current_view' => $current_view,
- 'style_select' => $style_select
+ 'style_select' => $style_select,
+ 'l_goprint' => $lang['l_goprint'],
+ 'l_preferences' => $lang['l_preferences'],
+ 'l_calendar' => $lang['l_calendar'],
+ 'l_legend' => $lang['l_legend'],
+ 'l_tomorrows' => $lang['l_tomorrows'],
+ 'l_jump' => $lang['l_jump'],
+ 'l_todo' => $lang['l_todo'],
+ 'l_day' => $lang['l_day'],
+ 'l_week' => $lang['l_week'],
+ 'l_month' => $lang['l_month'],
+ 'l_year' => $lang['l_year'],
+ 'l_subscribe' => $lang['l_subscribe'],
+ 'l_download' => $lang['l_download'],
+ 'l_this_months' => $lang['l_this_months'],
+ 'l_powered_by' => $lang['l_powered_by'],
+ 'l_this_site_is' => $lang['l_this_site_is']
));
$page->monthbottom($this->page);
diff --git a/templates/default/sidebar.tpl b/templates/default/sidebar.tpl
index 761c916..c7ebe0a 100644
--- a/templates/default/sidebar.tpl
+++ b/templates/default/sidebar.tpl
@@ -15,11 +15,11 @@
</tr>
<!-- switch invalid_login off -->
<tr>
- <td bgcolor="#FFFFFF" align="left" valign="middle"><div style="padding-left: 5px; padding-top: 5px;">Username:</div></td>
+ <td bgcolor="#FFFFFF" align="left" valign="middle"><div style="padding-left: 5px; padding-top: 5px;">{L_USERNAME}:</div></td>
<td bgcolor="#FFFFFF" align="right" valign="middle"><div style="padding-right: 5px; padding-top: 5px;"><input type="text" name="username" size="10" /></div></td>
</tr>
<tr>
- <td bgcolor="#FFFFFF" align="left" valign="middle"><div style="padding-left: 5px; padding-bottom: 5px;">Password:</div></td>
+ <td bgcolor="#FFFFFF" align="left" valign="middle"><div style="padding-left: 5px; padding-bottom: 5px;">{L_PASSWORD}:</div></td>
<td bgcolor="#FFFFFF" align="right" valign="middle"><div style="padding-right: 5px; padding-bottom: 5px;"><input type="password" name="password" size="10" /></div></td>
</tr>
</table>
diff --git a/week.php b/week.php
index effa298..c9b3d38 100644
--- a/week.php
+++ b/week.php
@@ -79,7 +79,22 @@ $page->replace_tags(array(
'list_weeks' => $list_weeks,
'list_jumps' => $list_jumps,
'legend' => $list_calcolors,
- 'style_select' => $style_select
+ 'style_select' => $style_select,
+ 'l_goprint' => $lang['l_goprint'],
+ 'l_preferences' => $lang['l_preferences'],
+ 'l_calendar' => $lang['l_calendar'],
+ 'l_legend' => $lang['l_legend'],
+ 'l_tomorrows' => $lang['l_tomorrows'],
+ 'l_jump' => $lang['l_jump'],
+ 'l_todo' => $lang['l_todo'],
+ 'l_day' => $lang['l_day'],
+ 'l_week' => $lang['l_week'],
+ 'l_month' => $lang['l_month'],
+ 'l_year' => $lang['l_year'],
+ 'l_subscribe' => $lang['l_subscribe'],
+ 'l_download' => $lang['l_download'],
+ 'l_powered_by' => $lang['l_powered_by'],
+ 'l_this_site_is' => $lang['l_this_site_is']
));
$page->draw_week($this->page);
diff --git a/year.php b/year.php
index 5fff3d7..8d85723 100644
--- a/year.php
+++ b/year.php
@@ -34,7 +34,14 @@ $page->replace_tags(array(
'event_js' => '',
'this_year' => $this_year,
'next_year' => $next_year,
- 'prev_year' => $prev_year
+ 'prev_year' => $prev_year,
+ 'l_day' => $lang['l_day'],
+ 'l_week' => $lang['l_week'],
+ 'l_month' => $lang['l_month'],
+ 'l_year' => $lang['l_year'],
+ 'l_powered_by' => $lang['l_powered_by'],
+ 'l_this_site_is' => $lang['l_this_site_is']
+
));
$page->output();

© 2014-2024 Faster IT GmbH | imprint | privacy policy