Simplify access to object members that need initialization
This commit is contained in:
parent
c10e944504
commit
03e3e9c25d
2 changed files with 30 additions and 11 deletions
|
@ -37,15 +37,12 @@ class calendar extends rcube_plugin
|
|||
public $task = '?(?!logout).*';
|
||||
public $rc;
|
||||
public $lib;
|
||||
public $driver;
|
||||
public $resources_dir;
|
||||
public $home; // declare public to be used in other classes
|
||||
public $urlbase;
|
||||
public $timezone;
|
||||
public $timezone_offset;
|
||||
public $gmt_offset;
|
||||
|
||||
public $ical;
|
||||
public $ui;
|
||||
|
||||
public $defaults = array(
|
||||
|
@ -60,6 +57,9 @@ class calendar extends rcube_plugin
|
|||
'calendar_allow_invite_shared' => false,
|
||||
);
|
||||
|
||||
private $ical;
|
||||
private $itip;
|
||||
private $driver;
|
||||
private $ics_parts = array();
|
||||
|
||||
|
||||
|
@ -2239,12 +2239,11 @@ class calendar extends rcube_plugin
|
|||
if ($part->ctype_parameters['charset'])
|
||||
$charset = $part->ctype_parameters['charset'];
|
||||
$headers = $imap->get_message_headers($uid);
|
||||
}
|
||||
|
||||
if ($part) {
|
||||
$events = $this->get_ical()->import($part, $charset);
|
||||
|
||||
$error_msg = $this->gettext('errorimportingevent');
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
// successfully parsed events?
|
||||
if (!empty($events) && ($event = $events[$index])) {
|
||||
|
@ -2569,4 +2568,24 @@ class calendar extends rcube_plugin
|
|||
return base64_encode($this->rc->user->get_username() . ':' . $source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic getter for public access to protected members
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
switch ($name) {
|
||||
case 'ical':
|
||||
return $this->get_ical();
|
||||
|
||||
case 'itip':
|
||||
return $this->load_itip();
|
||||
|
||||
case 'driver':
|
||||
$this->load_driver();
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -888,7 +888,7 @@ class calendar_ui
|
|||
{
|
||||
if ($this->cal->event) {
|
||||
return html::div($attrib,
|
||||
$this->cal->load_itip()->itip_object_details_table($this->cal->event, $this->cal->gettext('itipinvitation')) .
|
||||
$this->cal->itip->itip_object_details_table($this->cal->event, $this->cal->itip->gettext('itipinvitation')) .
|
||||
$this->cal->invitestatus
|
||||
);
|
||||
}
|
||||
|
@ -905,12 +905,12 @@ class calendar_ui
|
|||
'name' => $attrib['iname'],
|
||||
'class' => 'button',
|
||||
'rel' => $method,
|
||||
'value' => $this->rc->gettext('itip' . $method, 'libcalendaring'),
|
||||
'value' => $this->cal->itip->gettext('itip' . $method),
|
||||
));
|
||||
}
|
||||
|
||||
return html::div($attrib,
|
||||
html::div('label', $this->rc->gettext('acceptinvitation', 'libcalendaring')) .
|
||||
html::div('label', $this->cal->itip->gettext('acceptinvitation')) .
|
||||
html::div('rsvp-buttons', $buttons));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue