public function getOutput()
 {
     /* Load language  */
     $this->registry->class_localization->loadLanguageFile(array('public_calendar'));
     /* Load calendar library */
     require_once IPSLib::getAppDir('calendar') . '/modules_public/calendar/calendars.php';
     $cal = new public_calendar_calendar_calendars($this->registry);
     $cal->makeRegistryShortcuts($this->registry);
     /* Get current month and year */
     $a = explode(',', gmdate('Y,n,j,G,i,s', time() + $this->registry->class_localization->getTimeOffset()));
     $this->now_date = array('year' => $a[0], 'mon' => $a[1]);
     /* Setup language arrays */
     $cal->month_words = array($this->lang->words['M_1'], $this->lang->words['M_2'], $this->lang->words['M_3'], $this->lang->words['M_4'], $this->lang->words['M_5'], $this->lang->words['M_6'], $this->lang->words['M_7'], $this->lang->words['M_8'], $this->lang->words['M_9'], $this->lang->words['M_10'], $this->lang->words['M_11'], $this->lang->words['M_12']);
     if (!$this->settings['ipb_calendar_mon']) {
         $cal->day_words = array($this->lang->words['D_0'], $this->lang->words['D_1'], $this->lang->words['D_2'], $this->lang->words['D_3'], $this->lang->words['D_4'], $this->lang->words['D_5'], $this->lang->words['D_6']);
     } else {
         $cal->day_words = array($this->lang->words['D_1'], $this->lang->words['D_2'], $this->lang->words['D_3'], $this->lang->words['D_4'], $this->lang->words['D_5'], $this->lang->words['D_6'], $this->lang->words['D_0']);
     }
     /* Return calendar */
     return "<div id='mini_calendars' class='calendar_wrap'>" . $cal->getMiniCalendar($this->now_date['mon'], $this->now_date['year']) . '</div><br />';
 }
 /**
  * Execute the plugin and return the HTML to show on the page.  
  * Can be called from ACP or front end, so the plugin needs to setup any appropriate lang files, skin files, etc.
  *
  * @access	public
  * @param	array 				Block data
  * @return	string				Block HTML to display or cache
  */
 public function executePlugin($block)
 {
     $config = unserialize($block['block_config']);
     //-----------------------------------------
     // Grab calendar class
     //-----------------------------------------
     require_once IPSLib::getAppDir('calendar') . '/modules_public/calendar/calendars.php';
     $calendar = new public_calendar_calendar_calendars($this->registry);
     $calendar->makeRegistryShortcuts($this->registry);
     //-----------------------------------------
     // Load lang and templs
     //-----------------------------------------
     $this->lang->loadLanguageFile(array('public_calendar'), 'calendar');
     //-----------------------------------------
     // DO some set up
     //-----------------------------------------
     $calendar->calendar_id = $config['custom']['calendar'];
     if (!count($this->caches['calendars'])) {
         $cache = array();
         $this->DB->build(array('select' => 'c.*', 'from' => array('cal_calendars' => 'c'), 'add_join' => array(array('select' => 'p.*', 'from' => array('permission_index' => 'p'), 'where' => "p.perm_type='calendar' AND perm_type_id=c.cal_id", 'type' => 'left'))));
         $this->DB->execute();
         while ($cal = $this->DB->fetch()) {
             $cache[$cal['cal_id']] = $cal;
         }
         $this->cache->setCache('calendars', $cache, array('array' => 1, 'deletefirst' => 1));
     }
     /* Calendar Cache */
     if (count($this->caches['calendars']) and is_array($this->caches['calendars'])) {
         foreach ($this->caches['calendars'] as $cal_id => $cal) {
             $selected = "";
             /* Got a perm */
             if (!$this->registry->permissions->check('view', $cal)) {
                 continue;
             }
             if ($cal['cal_id'] == $calendar->calendar_id) {
                 $calendar->calendar = $cal;
                 $selected = " selected='selected'";
             }
             $calendar->calendar_cache[$cal['cal_id']] = $cal;
         }
     }
     if (!$calendar->calendar) {
         if (count($calendar->calendar_cache)) {
             $tmp_resort = $calendar->calendar_cache;
             ksort($tmp_resort);
             reset($tmp_resort);
             $default_calid = key($tmp_resort);
             $calendar->calendar_id = $default_calid;
             $calendar->calendar = $tmp_resort[$default_calid];
             unset($tmp_resort);
         }
     }
     $calendar->calendarBuildPermissions();
     if (!is_array($calendar->calendar) or !count($calendar->calendar) or !$calendar->can_read) {
         return '';
     }
     //-----------------------------------------
     // Finally, build up the lang arrays
     //-----------------------------------------
     $calendar->month_words = array($this->lang->words['M_1'], $this->lang->words['M_2'], $this->lang->words['M_3'], $this->lang->words['M_4'], $this->lang->words['M_5'], $this->lang->words['M_6'], $this->lang->words['M_7'], $this->lang->words['M_8'], $this->lang->words['M_9'], $this->lang->words['M_10'], $this->lang->words['M_11'], $this->lang->words['M_12']);
     if (!$this->settings['ipb_calendar_mon']) {
         $calendar->day_words = array($this->lang->words['D_0'], $this->lang->words['D_1'], $this->lang->words['D_2'], $this->lang->words['D_3'], $this->lang->words['D_4'], $this->lang->words['D_5'], $this->lang->words['D_6']);
     } else {
         $calendar->day_words = array($this->lang->words['D_1'], $this->lang->words['D_2'], $this->lang->words['D_3'], $this->lang->words['D_4'], $this->lang->words['D_5'], $this->lang->words['D_6'], $this->lang->words['D_0']);
     }
     //-----------------------------------------
     // What now?
     //-----------------------------------------
     $a = explode(',', gmdate('Y,n,j,G,i,s', time() + $this->lang->getTimeOffset()));
     $now_date = array('year' => $a[0], 'mon' => $a[1], 'mday' => $a[2], 'hours' => $a[3], 'minutes' => $a[4], 'seconds' => $a[5]);
     $content = $calendar->getMiniCalendar($now_date['mon'], $now_date['year']);
     $pluginConfig = $this->returnPluginInfo();
     $templateBit = $pluginConfig['templateBit'] . '_' . $block['block_id'];
     return $this->registry->getClass('output')->getTemplate('ccs')->{$templateBit}($content);
 }