function pical_coming_schedule_show_tpl($options)
 {
     global $xoopsConfig, $xoopsDB;
     $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
     $maxitem = empty($options[1]) ? 10 : intval($options[1]);
     $now_cid = empty($options[2]) ? 0 : intval($options[2]);
     $untildays = empty($options[4]) ? 0 : intval($options[4]);
     // setting physical & virtual paths
     $mod_path = XOOPS_ROOT_PATH . "/modules/{$mydirname}";
     $mod_url = XOOPS_URL . "/modules/{$mydirname}";
     // defining class of piCal
     if (!class_exists('piCal_xoops')) {
         require_once "{$mod_path}/class/piCal.php";
         require_once "{$mod_path}/class/piCal_xoops.php";
     }
     // creating an instance of piCal
     $cal = new piCal_xoops(date('Y-n-j'), $xoopsConfig['language'], true);
     $cal->use_server_TZ = true;
     // cid による絞り込み
     $cal->now_cid = $now_cid;
     // setting properties of piCal
     $cal->conn = $xoopsDB->conn;
     include "{$mod_path}/include/read_configs.php";
     $cal->base_url = $mod_url;
     $cal->base_path = $mod_path;
     $cal->images_url = "{$mod_url}/images/{$skin_folder}";
     $cal->images_path = "{$mod_path}/images/{$skin_folder}";
     $block = $cal->get_blockarray_coming_event("{$mod_url}/index.php", $maxitem, true, $untildays);
     return $block;
 }
 function pical_after_schedule_show_tpl($options)
 {
     global $xoopsConfig, $xoopsDB;
     $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
     $maxitem = empty($options[1]) ? 10 : intval($options[1]);
     $now_cid = empty($options[2]) ? 0 : intval($options[2]);
     $untildays = empty($options[4]) ? 0 : intval($options[4]);
     // setting physical & virtual paths
     $mod_path = XOOPS_ROOT_PATH . "/modules/{$mydirname}";
     $mod_url = XOOPS_URL . "/modules/{$mydirname}";
     // defining class of piCal
     if (!class_exists('piCal_xoops')) {
         require_once "{$mod_path}/class/piCal.php";
         require_once "{$mod_path}/class/piCal_xoops.php";
     }
     // creating an instance of piCal
     $cal = new piCal_xoops("", $xoopsConfig['language'], true);
     // cid による絞り込み
     $cal->now_cid = $now_cid;
     // setting properties of piCal
     $cal->conn = $xoopsDB->conn;
     include "{$mod_path}/include/read_configs.php";
     $cal->base_url = $mod_url;
     $cal->base_path = $mod_path;
     $cal->images_url = "{$mod_url}/images/{$skin_folder}";
     $cal->images_path = "{$mod_path}/images/{$skin_folder}";
     // ブロック配列の自分自身を書き換える title に %s を含めること
     if (defined('XOOPS_CUBE_LEGACY')) {
         $GLOBALS['pical_after_schedule_title_parameter'] = sprintf(_PICAL_FMT_MD, $cal->month_short_names[date('n', $cal->unixtime)], $cal->date_short_names[date('j', $cal->unixtime)]);
     } else {
         if (substr(XOOPS_VERSION, 6, 3) == '2.2') {
             $title_fmt = $GLOBALS['pical_blockinstance_object']->getVar('title');
             $GLOBALS['pical_blockinstance_object']->setVar('title', sprintf($title_fmt, sprintf(_PICAL_FMT_MD, $cal->month_short_names[date('n', $cal->unixtime)], $cal->date_short_names[date('j', $cal->unixtime)])));
         } else {
             global $block_arr, $i;
             if (is_object($block_arr[$i])) {
                 $title_fmt = $block_arr[$i]->getVar('title');
                 $title = sprintf($title_fmt, sprintf(_PICAL_FMT_MD, $cal->month_short_names[date('n', $cal->unixtime)], $cal->date_short_names[date('j', $cal->unixtime)]));
                 $block_arr[$i]->setVar('title', $title);
             }
         }
     }
     $block = $cal->get_blockarray_coming_event("{$mod_url}/index.php", $maxitem, false, $untildays);
     return $block;
 }
// defining class of piCal
require_once "{$mod_path}/class/piCal.php";
require_once "{$mod_path}/class/piCal_xoops.php";
// creating an instance of piCal
$cal = new piCal_xoops(date('Y-n-j'), $xoopsConfig['language'], true);
$cal->use_server_TZ = true;
// ignoring cid from GET
// $cal->now_cid = 0 ;
// setting properties of piCal
$cal->conn = $xoopsDB->conn;
include "{$mod_path}/include/read_configs.php";
$cal->base_url = $mod_url;
$cal->base_path = $mod_path;
$cal->images_url = "{$mod_url}/images/{$skin_folder}";
$cal->images_path = "{$mod_path}/images/{$skin_folder}";
$block = $cal->get_blockarray_coming_event("{$mod_url}/index.php", 10, true);
//mb_http_output( 'UTF-8' ) ;
//ob_start( 'mb_output_handler' ) ;
ob_start('xoops_utf8_encode');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<rss version=\"2.0\">\n  <channel>\n    <title>" . $xoopsModule->getVar('name') . ' - ' . htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES) . "</title>\n    <link>{$mod_url}/</link>\n    <description>" . htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES) . "</description>\n    <lastBuildDate>" . formatTimestamp(time(), 'r') . "</lastBuildDate>\n    <webMaster>" . $xoopsConfig['adminmail'] . "</webMaster>\n    <editor>" . $xoopsConfig['adminmail'] . "</editor>\n    <category>Calendar</category>\n    <generator>piCal for XOOPS</generator>\n    <language>" . _LANGCODE . "</language>\n";
foreach ($block['events'] as $event) {
    $start = date("n/j G:i", $event['start']);
    $summary = pical_get_escaped4xml($event['summary']);
    $description = pical_get_escaped4xml($event['description']);
    echo "\n    <item>\n      <title>{$start} {$summary}</title>\n      <link>{$mod_url}/?event_id={$event['id']}</link>\n      <description>{$description}</description>\n    </item>\n";
    //      <pubDate>".formatTimestamp($event['start'],'r')."</pubDate>
}
echo "\n  </channel>\n</rss>\n";
function pical_get_escaped4xml($text)
{
    return htmlspecialchars(str_replace(array('&#039;', '&quot;', '&lt;', '&gt;'), array("'", '"', '<', '>'), $text), ENT_QUOTES);