Changeset 1031446
- Timestamp:
- 11/24/2014 12:46:20 AM (11 years ago)
- Location:
- biz-calendar/trunk
- Files:
-
- 4 edited
-
admin-ui.php (modified) (2 diffs)
-
biz-calendar.php (modified) (4 diffs)
-
calendar.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
biz-calendar/trunk/admin-ui.php
r686770 r1031446 22 22 add_settings_field('id_chk_fri', '金曜日', array(&$this,'setting_chk_fri'), $this->file_path, 'fixed_holiday'); 23 23 add_settings_field('id_chk_sat', '土曜日', array(&$this,'setting_chk_sat'), $this->file_path, 'fixed_holiday'); 24 add_settings_field('id_chk_holiday', '祝日を定休日にする', array(&$this,'setting_chk_holiday'), $this->file_path, 'fixed_holiday');25 24 26 25 add_settings_section('temp_holiday', '臨時休営業日', array(&$this,'text_temp_holiday'), $this->file_path); … … 88 87 function setting_chk_sat() { 89 88 $this->setting_chk( "sat" ); 90 }91 92 function setting_chk_holiday() {93 $this->setting_chk( "holiday" );94 89 } 95 90 -
biz-calendar/trunk/biz-calendar.php
r867425 r1031446 4 4 Plugin URI: http://residentbird.main.jp/bizplugin/ 5 5 Description: 営業日・イベントカレンダーをウィジェットに表示するプラグインです。 6 Version: 1.6. 06 Version: 1.6.1 7 7 Author:WordPress Biz Plugin 8 8 Author URI: http://residentbird.main.jp/bizplugin/ … … 14 14 class BC 15 15 { 16 const VERSION = "1. 6.0";16 const VERSION = "1.7.0"; 17 17 const SHORTCODE = "showpostlist"; 18 18 const OPTIONS = "bizcalendar_options"; … … 69 69 "fri" => "", 70 70 "sat" => "on", 71 "holiday" => "on",72 71 "temp_holidays" =>"2013-01-02\n2013-01-03\n", 73 72 "temp_weekdays" =>"", 74 73 "eventdays" =>"", 75 74 "event_url" =>"", 76 "holiday_cache" =>"",77 "holiday_cache_date" =>"",78 75 "month_limit" =>"制限なし", 79 76 "nextmonthlimit" =>"12", … … 138 135 } 139 136 $options = get_option( 'bizcalendar_options' ); 140 if ( isset($options['holiday']) && $options["holiday"] == 'on'){141 $options = $this->getHolidays($options);142 }143 137 echo "<div id='biz_calendar'></div>"; 144 138 echo $after_widget; 145 }146 147 public function getHolidays( $options ){148 if ( $this->hasCache( $options) ){149 return $options;150 }151 152 $year = date_i18n('Y');153 //1-3月は前年の祝日を取得する154 $mon = date_i18n('n');155 if ( $mon < 4){156 $year -= 1;157 }158 159 $url = sprintf(160 'http://www.google.com/calendar/feeds/%s/public/full-noattendees?start-min=%s&start-max=%s&max-results=%d&alt=json' ,161 'outid3el0qkcrsuf89fltf7a4qbacgt9@import.calendar.google.com' , // 'japanese@holiday.calendar.google.com' ,162 $year.'-04-01' , // 取得開始日163 ($year + 1).'-03-31' , // 取得終了日164 50 // 最大取得数165 );166 167 $results = file_get_contents($url);168 if ( !isset($results) ){169 return $options;170 }171 $results = json_decode($results, true);172 $holidays = array();173 foreach ($results['feed']['entry'] as $val ) {174 $date = $val['gd$when'][0]['startTime'];175 $title = $val['title']['$t'];176 $holidays[$date] = $title;177 }178 ksort($holidays);179 180 //キャッシュを更新する181 $options["holiday_cache"] = $holidays;182 $options["holiday_cache_date"] = date_i18n( "Y/m");183 update_option('bizcalendar_options', $options);184 return $options;185 }186 187 private function hasCache($options){188 if( !isset($options["holiday_cache"]) || !isset($options["holiday_cache_date"])){189 return false;190 }191 if ( $options["holiday_cache_date"] != date_i18n( "Y/m") ){192 return false;193 }194 return true;195 139 } 196 140 -
biz-calendar/trunk/calendar.js
r686770 r1031446 206 206 } 207 207 208 // 祝日209 if (isHoliday(fulldate)) {210 return "HOLIDAY";211 }212 208 return "WEEKDAY"; 213 }214 215 var isHoliday = function(fulldate) {216 if (currentSetting.options["holiday"] == "off") {217 return false;218 }219 holidays = currentSetting.options["holiday_cache"];220 if (holidays != undefined && holidays[fulldate] != null) {221 return true;222 }223 return false;224 209 } 225 210 -
biz-calendar/trunk/readme.txt
r867425 r1031446 4 4 Tags: calendar,event,widget 5 5 Requires at least: 3.4 6 Tested up to: 3.87 Stable tag: 1. 6.06 Tested up to: 4.0.1 7 Stable tag: 1.7.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 19 19 20 20 * 曜日を指定して定休日に設定できます 21 * 祝日を自動的に定休日に設定できます22 * Google calendar APIから祝日情報を取得しています。Google calendar APIが使用できない環境では利用できません23 21 * 臨時休業日・臨時営業日を登録できます 24 22 * イベント開催日、urlを設定できます … … 38 36 39 37 == Changelog == 38 39 = 1.7.0 = 40 * Google Calendar API Ver.2終了に伴い、祝日を自動的に定休日に設定する機能を廃止しました 40 41 41 42 = 1.6.0 =
Note: See TracChangeset
for help on using the changeset viewer.