PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.6.2
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.6.2
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
← All changes | includes/functions.php +31 -32 2.10.02.6.2 View file →
@@ -7,9 +7,10 @@
7 7 * Returns WooCommerce stock status as array.
8 8 *
9 9 * @return array
10 10 */
11 - function hurryt_wc_stock_statuses() {
11 + function hurryt_wc_stock_statuses()
12 + {
12 13 return [
13 14 [
14 15 'name' => __('In stock', 'hurrytimer'),
15 16 'id' => \Hurrytimer\C::WC_IN_STOCK,
@@ -32,9 +33,10 @@
32 33 * Returns supported conditions.
33 34 *
34 35 * @return array
35 36 */
36 - function hurryt_wc_conditions() {
37 + function hurryt_wc_conditions()
38 + {
37 39 return (new \Hurrytimer\ConditionalLogic())->addRule([
38 40 'key' => 'stock_status',
39 41 'name' => __('Stock status', 'hurrytimer'),
40 42 'operators' => ['==', '!='],
@@ -74,9 +76,10 @@
74 76 * Return WP timezone string/offset.
75 77 *
76 78 * @return mixed|string|void
77 79 */
78 - function hurryt_tz() {
80 + function hurryt_tz()
81 + {
79 82 $tz_string = get_option('timezone_string');
80 83 if (!empty($tz_string)) {
81 84 return $tz_string;
82 85 }
@@ -95,9 +98,10 @@
95 98 * Get current page ID.
96 99 *
97 100 * @return int|mixed
98 101 */
99 - function hurryt_current_page_id() {
102 + function hurryt_current_page_id()
103 + {
100 104 $object_id = get_queried_object_id();
101 105 if (!hurryt_is_woocommerce_activated()) {
102 106 return $object_id;
103 107 }
@@ -141,9 +145,10 @@
141 145 * Returns true if WC is active.
142 146 *
143 147 * @return bool
144 148 */
145 - function hurryt_is_woocommerce_activated() {
149 + function hurryt_is_woocommerce_activated()
150 + {
146 151 return class_exists('woocommerce');
147 152 }
148 153 }
149 154
@@ -152,9 +157,10 @@
152 157 * Returns plugin settings array.
153 158 *
154 159 * @return array
155 160 */
156 - function hurryt_settings() {
161 + function hurryt_settings()
162 + {
157 163 $defaults = ['disable_actions' => 0];
158 164
159 165 return wp_parse_args(get_option('hurryt_settings', []), $defaults);
160 166 }
@@ -166,9 +172,10 @@
166 172 * @param $id
167 173 *
168 174 * @return Campaign
169 175 */
170 - function hurryt_get_campaign($id) {
176 + function hurryt_get_campaign($id)
177 + {
171 178 $campaign = new Campaign($id);
172 179 $campaign->loadSettings();
173 180
174 181 return $campaign;
@@ -175,9 +182,10 @@
175 182 }
176 183 }
177 184
178 185 if (!function_exists('hurryt_is_admin_area')) {
179 - function hurryt_is_admin_area() {
186 + function hurryt_is_admin_area()
187 + {
180 188 global $wp;
181 189 wp_parse_str($wp->query_string, $params);
182 190
183 191 return is_admin()
@@ -194,9 +202,10 @@
194 202
195 203 /**
196 204 * Parse campaigns shortcodes in the given string content.
197 205 */
198 - function hurryt_parse_campaigns($content) {
206 + function hurryt_parse_campaigns($content)
207 + {
199 208 $pattern = get_shortcode_regex();
200 209 $tag = 'hurrytimer';
201 210 $ids = [];
202 211 if (
@@ -223,9 +232,10 @@
223 232 if (!function_exists('hurryt_count_active_campaigns')) {
224 233 /**
225 234 * Returns published campaigns.
226 235 */
227 - function hurryt_count_active_campaigns() {
236 + function hurryt_count_active_campaigns()
237 + {
228 238
229 239 /** @var object $count */
230 240 $count = wp_count_posts(HURRYT_POST_TYPE);
231 241
@@ -236,24 +246,23 @@
236 246
237 247 /**
238 248 * Return all WooCommerce coupons.
239 249 * @param string $status
240 - * @access private
241 - * @internal
242 250 * @return array
243 251 */
244 -function hurryt_get_wc_coupons($status = 'any') {
252 +function hurryt_get_wc_coupons($status = 'publish')
253 +{
245 254
246 255 return get_posts([
247 256 'post_type' => 'shop_coupon',
248 257 'post_status' => $status,
249 - 'no_found_rows' => true,
250 - 'numberposts' => 30
258 + 'posts_per_page' => -1
251 259 ]);
252 260 }
253 261
254 262
255 -function hurryt_wc_coupon_name($coupon_id) {
263 +function hurryt_wc_coupon_name($coupon_id)
264 +{
256 265 if (!function_exists('wc_get_coupon_types')) {
257 266 return '';
258 267 }
259 268
@@ -267,9 +276,10 @@
267 276 /**
268 277 * Return the current timezone string.
269 278 * @return string
270 279 */
271 -function hurryt_current_timezone_string() {
280 +function hurryt_current_timezone_string()
281 +{
272 282 $current_offset = get_option('gmt_offset');
273 283 $tzstring = get_option('timezone_string');
274 284
275 285 if (false !== strpos($tzstring, 'Etc/GMT')) {
@@ -288,9 +298,10 @@
288 298 return $tzstring;
289 299 }
290 300
291 301
292 -function hurrytimer_is_elementor_edit_mode() {
302 +function hurrytimer_is_elementor_edit_mode()
303 +{
293 304 try {
294 305 return class_exists('\Elementor\Plugin') && \Elementor\Plugin::$instance->editor->is_edit_mode();
295 306 } catch (\Exception $e) {
296 307 return false;
@@ -296,9 +307,10 @@
296 307 return false;
297 308 }
298 309 }
299 310
300 -function hurrytimer_is_elementor_preview_mode() {
311 +function hurrytimer_is_elementor_preview_mode()
312 +{
301 313 try {
302 314 return class_exists('\Elementor\Plugin') && \Elementor\Plugin::$instance->preview->is_preview_mode();
303 315 } catch (\Exception $e) {
304 316 return false;
@@ -303,17 +315,4 @@
303 315 } catch (\Exception $e) {
304 316 return false;
305 317 }
306 318 }
307 -
308 -
309 -function hurrytimer_allow_unfiltered_html() {
310 -
311 - $allow_unfiltered_html = current_user_can('unfiltered_html');
312 -
313 - /**
314 - * Filters whether the current user is allowed to save unfiltered HTML.
315 - *
316 - * @param bool allow_unfiltered_html The result.
317 - */
318 - return apply_filters( 'hurrytimer/allow_unfiltered_html', $allow_unfiltered_html );
319 -}