* * with a reference to this script: * * * * @author Chris Dornfeld * @version $Id: gcalendar-wrapper.php 1571 2010-11-15 07:08:05Z dornfeld $ * @link http://www.unitz.com/gcalendar-wrapper/ */ /** * Set your color scheme below */ $calColorBgDark = '#ffffff'; // dark background color $calColorTextOnDark = '#000000'; // text appearing on top of dark bg color $calColorBgLight = '#ffffff'; // light background color $calColorTextOnLight = '#000000'; // text appearing on top of light bg color $calColorBgToday = '#ffffcc'; // background color for "today" box /** * Orange color scheme */ /* $calColorBgDark = '#ffa200'; $calColorTextOnDark = '#ffffff'; $calColorBgLight = '#ffeccb'; $calColorTextOnLight = '#000000'; $calColorBgToday = '#fef0ff'; */ /** * Purple color scheme */ /* $calColorBgDark = '#4b53a1'; $calColorTextOnDark = '#ffffff'; $calColorBgLight = '#d0cfff'; $calColorTextOnLight = '#000000'; $calColorBgToday = '#fff2cf'; */ /** * Green color scheme */ /* $calColorBgDark = '#336633'; $calColorTextOnDark = '#ffffff'; $calColorBgLight = '#ace0ac'; $calColorTextOnLight = '#003300'; $calColorBgToday = '#ffe5ac'; */ /** * Google Calendar default color scheme (simplified) */ /* $calColorBgDark = '#c3d9ff'; $calColorTextOnDark = '#000000'; $calColorBgLight = '#e8eef7'; $calColorTextOnLight = '#000000'; $calColorBgToday = '#ffffcc'; */ /** * For normal use, no changes are needed below this line */ define('GOOGLE_CALENDAR_BASE', 'https://www.google.com/'); define('GOOGLE_CALENDAR_EMBED_URL', GOOGLE_CALENDAR_BASE . 'calendar/embed'); /** * Prepare stylesheet customizations */ $calCustomStyle =<<'; /** * Construct calendar URL */ $calQuery = ''; if (isset($_SERVER['QUERY_STRING'])) { $calQuery = $_SERVER['QUERY_STRING']; } else if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $calQuery = $HTTP_SERVER_VARS['QUERY_STRING']; } $calUrl = GOOGLE_CALENDAR_EMBED_URL.'?'.$calQuery; /** * Retrieve calendar embedding code */ $calRaw = ''; if (in_array('curl', get_loaded_extensions())) { $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, $calUrl); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); // trust any SSL certificate (we're only retrieving public data) curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curlObj, CURLOPT_SSL_VERIFYHOST, FALSE); if (function_exists('curl_version')) { $curlVer = curl_version(); if (is_array($curlVer)) { if (!in_array('https', $curlVer['protocols'])) { trigger_error("Can't use https protocol with cURL to retrieve Google Calendar", E_USER_ERROR); } if (!empty($curlVer['version']) && version_compare($curlVer['version'], '7.15.2', '>=') && !ini_get('open_basedir') && !ini_get('safe_mode')) { // enable HTTP redirect following for cURL: // - CURLOPT_FOLLOWLOCATION is disabled when PHP is in safe mode // - cURL versions before 7.15.2 had a bug that lumped // redirected page content with HTTP headers // http://simplepie.org/support/viewtopic.php?id=1004 curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curlObj, CURLOPT_MAXREDIRS, 5); } } } $calRaw = curl_exec($curlObj); curl_close($curlObj); } else if (ini_get('allow_url_fopen')) { if (function_exists('stream_get_wrappers')) { if (!in_array('https', stream_get_wrappers())) { trigger_error("Can't use https protocol with fopen to retrieve Google Calendar", E_USER_ERROR); } } else if (!in_array('openssl', get_loaded_extensions())) { trigger_error("Can't use https protocol with fopen to retrieve Google Calendar", E_USER_ERROR); } // fopen should follow HTTP redirects in recent versions $fp = fopen($calUrl, 'r'); while (!feof($fp)) { $calRaw .= fread($fp, 8192); } fclose($fp); } else { trigger_error("Can't use cURL or fopen to retrieve Google Calendar", E_USER_ERROR); } /** * Insert BASE tag to accommodate relative paths */ $titleTag = ''; $baseTag = '<base href="'.GOOGLE_CALENDAR_EMBED_URL.'">'; $calCustomized = preg_replace("/".preg_quote($titleTag,'/')."/i", $baseTag.$titleTag, $calRaw); /** * Insert custom styles */ $headEndTag = '</head>'; $calCustomized = preg_replace("/".preg_quote($headEndTag,'/')."/i", $calCustomStyle.$headEndTag, $calCustomized); /** * Extract and modify calendar setup data */ $calSettingsPattern = "(\{\s*window\._init\(\s*)(\{.+\})(\s*\)\;\s*\})"; if (preg_match("/$calSettingsPattern/", $calCustomized, $matches)) { $calSettingsJson = $matches[2]; $pearJson = null; if (!function_exists('json_encode')) { // no built-in JSON support, attempt to use PEAR::Services_JSON library if (!class_exists('Services_JSON')) { require_once('Services/JSON.php'); } $pearJson = new Services_JSON(); } if (function_exists('json_decode')) { $calSettings = json_decode($calSettingsJson); } else { $calSettings = $pearJson->decode($calSettingsJson); } // set base URL to accommodate relative paths $calSettings->baseUrl = GOOGLE_CALENDAR_BASE; // splice in updated calendar setup data if (function_exists('json_encode')) { $calSettingsJson = json_encode($calSettings); } else { $calSettingsJson = $pearJson->encode($calSettings); } // prevent unwanted variable substitutions within JSON data // preg_quote() results in excessive escaping $calSettingsJson = str_replace('$', '\\$', $calSettingsJson); $calCustomized = preg_replace("/$calSettingsPattern/", "\\1$calSettingsJson\\3", $calCustomized); } /** * Show output */ header('Content-type: text/html'); print $calCustomized; <Div Align="center"><iframe src="https://calendar.google.com/calendar/embed?src=b6rdmuucssh7k6fonaifvkl8b4%40group.calendar.google.com&ctz=Asia/Tokyo" style="border: 0; text-align: center;" width="800" height="600" frameborder="0" scrolling="no"></iframe></Div> <p align="center" style="font-family: 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', 'メイリオ', Meiryo, Osaka, 'MS Pゴシック', 'MS PGothic', sans-serif; font-size: 14px;"><a href="index.html">TOP </a>   <a href="cafe.html">CAFE</a>   <a href="hyoutanlamp.html">ひょうたんLAMP</a>  <a href="gallary.html">GALLERY</a>   <a href="yoga.html">YOGA</a>  <a href="yokonoma.html">YOKONOMA</a>  <a href="shukuhaku.html">STAY</a>   <a href="http://kajiyakajiya.blog.fc2.com" target="_blank">BLOG</a>   <a href="http://www.flickr.com/photos/94954835@N02/" target="_blank">SNAP </a>  <a href="map.html">MAP</a></p> <p align="center" style="font-family: 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', 'メイリオ', Meiryo, Osaka, 'MS Pゴシック', 'MS PGothic', sans-serif; font-size: 12px;">Copyright © 2014 KAJIYA All Rights Reserved. </p><script type="text/javascript" src="http://users151.lolipop.jp/cnt/accnt.php?cnt_id=1973288&ac_id=LAA0339461&mode=total&type=text"></script> <p align="center"> </p> </div> </body> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-42204859-1', 'canatoha.com'); ga('send', 'pageview'); </script> </html>