@@ 111-122 (lines=12) @@ | ||
108 | return apply_filters( 'jetpack_holiday_snow_option_name', 'jetpack_holiday_snow_enabled' ); |
|
109 | } |
|
110 | ||
111 | function jetpack_show_holiday_snow_option() { |
|
112 | // Always show snow option if a custom snow season has been set. |
|
113 | if ( has_filter( 'jetpack_is_holiday_snow_season' ) ) { |
|
114 | return true; |
|
115 | } |
|
116 | ||
117 | $today = time(); |
|
118 | $first_option_day = mktime( 0, 0, 0, 11, 24 ); // Nov 24 |
|
119 | $last_option_day = mktime( 0, 0, 0, 1, 4 ); // Jan 4 |
|
120 | ||
121 | return ( $today >= $first_option_day || $today < $last_option_day ); |
|
122 | } |
|
123 | ||
124 | function jetpack_is_holiday_snow_season() { |
|
125 | $today = time(); |
|
@@ 124-145 (lines=22) @@ | ||
121 | return ( $today >= $first_option_day || $today < $last_option_day ); |
|
122 | } |
|
123 | ||
124 | function jetpack_is_holiday_snow_season() { |
|
125 | $today = time(); |
|
126 | $first_snow_day = mktime( 0, 0, 0, 12, 1 ); |
|
127 | $last_snow_day = mktime( 0, 0, 0, 1, 4 ); |
|
128 | ||
129 | $snow = ( $today >= $first_snow_day || $today < $last_snow_day ); |
|
130 | ||
131 | /** |
|
132 | * Filter whether it's winter or not. |
|
133 | * |
|
134 | * You can use this filter if, for example, you live in the |
|
135 | * Southern Hemisphere. In that case, the dates for winter |
|
136 | * above are incorrect for your location. |
|
137 | * |
|
138 | * @module theme-tools |
|
139 | * |
|
140 | * @since 2.1.0 |
|
141 | * |
|
142 | * @param bool $snow True if it's snow season, false if not. |
|
143 | */ |
|
144 | return apply_filters( 'jetpack_is_holiday_snow_season', $snow ); |
|
145 | } |
|
146 | ||
147 | jetpack_maybe_holiday_snow(); |
|
148 |