Kronolith::unsubscribeRemoteCalendar PHP 메소드

unsubscribeRemoteCalendar() 공개 정적인 메소드

Unsubscribes from a remote calendar.
public static unsubscribeRemoteCalendar ( string $url ) : array
$url string The calendar URL.
리턴 array Hash with the deleted calendar's information.
    public static function unsubscribeRemoteCalendar($url)
    {
        $url = trim($url);
        if (!strlen($url)) {
            return false;
        }
        $remote_calendars = unserialize($GLOBALS['prefs']->getValue('remote_cals'));
        $remote_calendar = null;
        foreach ($remote_calendars as $key => $calendar) {
            if ($calendar['url'] == $url) {
                $remote_calendar = $calendar;
                unset($remote_calendars[$key]);
                break;
            }
        }
        if (!$remote_calendar) {
            throw new Kronolith_Exception(_("The remote calendar was not found."));
        }
        $GLOBALS['prefs']->setValue('remote_cals', serialize($remote_calendars));
        return $remote_calendar;
    }

Usage Example

예제 #1
0
 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
     }
     return Kronolith::unsubscribeRemoteCalendar($this->_vars->get('url'));
 }
All Usage Examples Of Kronolith::unsubscribeRemoteCalendar