Merge lp:~quam-plures-core/quam-plures/qp-bug-498274 into lp:quam-plures

Proposed by Tilman Blumenbach
Status: Merged
Merged at revision: not available
Proposed branch: lp:~quam-plures-core/quam-plures/qp-bug-498274
Merge into: lp:quam-plures
Diff against target: 190 lines (+36/-21)
2 files modified
blogs/plugins/calendar_plugin/_calendar.plugin.php (+28/-20)
blogs/plugins/whosonline_plugin/_whosonline.plugin.php (+8/-1)
To merge this branch: bzr merge lp:~quam-plures-core/quam-plures/qp-bug-498274
Reviewer Review Type Date Requested Status
Yabs (community) Approve
Review via email: mp+16382@code.launchpad.net

Commit message

Fixed bug #498274: Added a reference to the instantiating plugin object to plugin helper classes so they can call the plugin's T_() method.

To post a comment you must log in.
Revision history for this message
Tilman Blumenbach (tblue) wrote :

This fixes bug #498274 by adding a reference to the calling Plugin class to the Calender class.

7391. By Tilman Blumenbach

Fixed fatal error in OnlineSessions::display_online_guests().

Revision history for this message
Yabs (yabs) wrote :

Eventually we'll want to rethink/work these plugins so solution is good enough for now

Type a snazy commit message in the box and I'll let it through ;)

¥

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'blogs/plugins/calendar_plugin/_calendar.plugin.php'
2--- blogs/plugins/calendar_plugin/_calendar.plugin.php 2009-12-16 13:53:18 +0000
3+++ blogs/plugins/calendar_plugin/_calendar.plugin.php 2009-12-19 15:03:13 +0000
4@@ -377,6 +377,11 @@
5 var $params = array( );
6
7 /**
8+ * A reference to the Calendar plugin class.
9+ */
10+ var $Plugin;
11+
12+ /**
13 * Calendar::Calendar(-)
14 *
15 * Constructor
16@@ -388,7 +393,7 @@
17 */
18 function Calendar( $m = '', $params = array() )
19 {
20- global $localtimenow;
21+ global $localtimenow, $Plugins;
22
23 $this->dbtable = 'T_items__item';
24 $this->dbprefix = 'post_';
25@@ -397,6 +402,9 @@
26 // OBJECT THAT WILL BE USED TO CONSTRUCT THE WHERE CLAUSE:
27 $this->ItemQuery = new ItemQuery( $this->dbtable, $this->dbprefix, $this->dbIDname ); // COPY!!
28
29+ // Create a reference to the calling Plugin:
30+ $this->Plugin = & $Plugins->get_by_code( 'evo_Calr' );
31+
32 $localyearnow = date( 'Y', $localtimenow );
33 $localmonthnow = date( 'm', $localtimenow );
34
35@@ -483,10 +491,10 @@
36 * - set to '' (empty) to disable
37 * - %d gets replaced with the number of posts on that day/month
38 */
39- $this->postcount_month_atitle = $this->T_('%d posts'); // in archive links title tag
40- $this->postcount_month_atitle_one = $this->T_('1 post'); // -- " -- [for single post]
41- $this->postcount_year_atitle = $this->T_('%d posts'); // in archive links title tag
42- $this->postcount_year_atitle_one = $this->T_('1 post'); // in archive links title tag
43+ $this->postcount_month_atitle = $this->Plugin->T_('%d posts'); // in archive links title tag
44+ $this->postcount_month_atitle_one = $this->Plugin->T_('1 post'); // -- " -- [for single post]
45+ $this->postcount_year_atitle = $this->Plugin->T_('%d posts'); // in archive links title tag
46+ $this->postcount_year_atitle_one = $this->Plugin->T_('1 post'); // in archive links title tag
47 /**#@-*/
48
49 // Link type:
50@@ -633,7 +641,7 @@
51
52 if( $this->linktomontharchive )
53 { // chosen month with link to archives
54- echo $this->archive_link( $text, $this->T_('View monthly archive'), $this->year, $this->month );
55+ echo $this->archive_link( $text, $this->Plugin->T_('View monthly archive'), $this->year, $this->month );
56 }
57 else
58 {
59@@ -661,22 +669,22 @@
60
61 for( $i = locale_startofweek(), $j = $i + 7; $i < $j; $i = $i + 1)
62 {
63- echo str_replace('[abbr]', $this->T_($weekday[($i % 7)]), $this->headercellstart);
64+ echo str_replace('[abbr]', $this->Plugin->T_($weekday[($i % 7)]), $this->headercellstart);
65 switch( $this->headerdisplay )
66 {
67 case 'e':
68 // e => 'F'
69- echo $this->T_($weekday_letter[($i % 7)]);
70+ echo $this->Plugin->T_($weekday_letter[($i % 7)]);
71 break;
72
73 case 'l':
74 // l (lowercase l) => 'Friday'
75- echo $this->T_($weekday[($i % 7)]);
76+ echo $this->Plugin->T_($weekday[($i % 7)]);
77 break;
78
79 default: // Backward compatibility: any non emty value will display this
80 // D => 'Fri'
81- echo $this->T_($weekday_abbrev[($i % 7)]);
82+ echo $this->Plugin->T_($weekday_abbrev[($i % 7)]);
83 }
84
85 echo $this->headercellend;
86@@ -705,7 +713,7 @@
87 else
88 {
89 echo '<td colspan="'.( $this->mode == 'month' ? '3' : '2' ).'" class="center">'
90- .$this->archive_link( $this->T_('Current'), '', date('Y'), ( $this->mode == 'month' ? date('m') : NULL ) )
91+ .$this->archive_link( $this->Plugin->T_('Current'), '', date('Y'), ( $this->mode == 'month' ? date('m') : NULL ) )
92 .'</td>';
93 }
94 echo '<td colspan="'.( ( $this->mode == 'month' ? 2 : 1 ) + (int)$this->today_is_visible ).'" id="next">';
95@@ -746,17 +754,17 @@
96 {
97 $title = '';
98 }
99- echo $this->archive_link( $this->T_($month_abbrev[ zeroise($i, 2) ]), $title, $this->year, $i );
100+ echo $this->archive_link( $this->Plugin->T_($month_abbrev[ zeroise($i, 2) ]), $title, $this->year, $i );
101 }
102 elseif( $this->month == $i )
103 { // current month
104 echo $this->todaycellstart;
105- echo $this->T_($month_abbrev[ zeroise($i, 2) ]);
106+ echo $this->Plugin->T_($month_abbrev[ zeroise($i, 2) ]);
107 }
108 else
109 {
110 echo $this->cellstart;
111- echo $this->T_($month_abbrev[ zeroise($i, 2) ]);
112+ echo $this->Plugin->T_($month_abbrev[ zeroise($i, 2) ]);
113 }
114 echo $this->cellend;
115 if( $i == 4 || $i == 8 )
116@@ -978,8 +986,8 @@
117 { // We have a link to display:
118 $r[] = $this->archive_link( '&lt;&lt;', sprintf(
119 ( $this->mode == 'month'
120- ? /* Calendar link title to a month in a previous year */ $this->T_('Previous year (%04d-%02d)')
121- : /* Calendar link title to a previous year */ $this->T_('Previous year (%04d)') ),
122+ ? /* Calendar link title to a month in a previous year */ $this->Plugin->T_('Previous year (%04d-%02d)')
123+ : /* Calendar link title to a previous year */ $this->Plugin->T_('Previous year (%04d)') ),
124 $prev_year_year, $prev_year_month ), $prev_year_year, ($this->mode == 'month') ? $prev_year_month : NULL ) ;
125 }
126
127@@ -1029,7 +1037,7 @@
128
129 if( !empty($prev_month_year) )
130 { // We have a link to display:
131- $r[] = $this->archive_link( '&lt;', sprintf( $this->T_('Previous month (%04d-%02d)'), $prev_month_year, $prev_month_month ), $prev_month_year, $prev_month_month );
132+ $r[] = $this->archive_link( '&lt;', sprintf( $this->Plugin->T_('Previous month (%04d-%02d)'), $prev_month_year, $prev_month_month ), $prev_month_year, $prev_month_month );
133 }
134 break;
135
136@@ -1082,7 +1090,7 @@
137
138 if( !empty($next_month_year) )
139 { // We have a link to display:
140- $r[] = $this->archive_link( '&gt;', sprintf( $this->T_('Next month (%04d-%02d)'), $next_month_year, $next_month_month ), $next_month_year, $next_month_month );
141+ $r[] = $this->archive_link( '&gt;', sprintf( $this->Plugin->T_('Next month (%04d-%02d)'), $next_month_year, $next_month_month ), $next_month_year, $next_month_month );
142 }
143
144
145@@ -1134,8 +1142,8 @@
146 { // We have a link to display:
147 $r[] = $this->archive_link( '&gt;&gt;', sprintf(
148 ( $this->mode == 'month'
149- ? /* Calendar link title to a month in a following year */ $this->T_('Next year (%04d-%02d)')
150- : /* Calendar link title to a following year */ $this->T_('Next year (%04d)') ),
151+ ? /* Calendar link title to a month in a following year */ $this->Plugin->T_('Next year (%04d-%02d)')
152+ : /* Calendar link title to a following year */ $this->Plugin->T_('Next year (%04d)') ),
153 $next_year_year, $next_year_month ), $next_year_year, ($this->mode == 'month') ? $next_year_month : NULL );
154 }
155 }
156
157=== modified file 'blogs/plugins/whosonline_plugin/_whosonline.plugin.php'
158--- blogs/plugins/whosonline_plugin/_whosonline.plugin.php 2009-12-16 13:53:18 +0000
159+++ blogs/plugins/whosonline_plugin/_whosonline.plugin.php 2009-12-19 15:03:13 +0000
160@@ -168,6 +168,10 @@
161
162 var $_initialized = false;
163
164+ /**
165+ * A reference to the whosonline_plugin.
166+ */
167+ var $Plugin;
168
169 /**
170 * Constructor.
171@@ -176,7 +180,10 @@
172 */
173 function OnlineSessions( $timeout_online_user = 300 )
174 {
175+ global $Plugins;
176+
177 $this->_timeout_online_user = $timeout_online_user;
178+ $this->Plugin = & $Plugins->get_by_code( 'evo_WhosOnline' );
179 }
180
181
182@@ -324,7 +331,7 @@
183
184 $r = $params['list_start'];
185 $r .= $params['item_start'];
186- $r .= $this->T_('Guest Users:').' ';
187+ $r .= $this->Plugin->T_('Guest Users:').' ';
188 $r .= $this->_count_guests;
189 $r .= $params['item_end'];
190 $r .= $params['list_end'];;

Subscribers

People subscribed via source and target branches