| @@ -96,9 +96,8 @@ | ||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return [ |
| 99 | 99 | 'id' => $this->campaign->get_id(), |
| 100 | - 'product_ids'=> $this->campaign->getWcProductsSelection(), | |
| 101 | 100 | 'actions' => $actions, |
| 102 | 101 | 'template' => $this->timer(), |
| 103 | 102 | 'methods' => $this->campaign->detectionMethods, |
| 104 | 103 | 'mode' => $this->campaign->get_mode_slug(), |
| @@ -226,19 +225,11 @@ | ||
| 226 | 225 | * @return string |
| 227 | 226 | */ |
| 228 | 227 | public function monthsBlock() |
| 229 | 228 | { |
| 230 | - $label = $this->campaign->labels[ 'months' ]; | |
| 229 | + $label = __( $this->campaign->labels[ 'months' ], 'hurrytimer' ); | |
| 231 | 230 | $label = apply_filters( 'hurryt_months_label', $label, $this->campaign->get_id() ); |
| 232 | - | |
| 233 | - $zero_padded = (bool)apply_filters('hurrytimer_zero_padded_digits', true, $this->campaign->get_id()); | |
| 234 | - | |
| 235 | - if( apply_filters('hurrytimer_auto_pluralize', false ) ){ | |
| 236 | - $label.='%!m'; | |
| 237 | - } | |
| 238 | - | |
| 239 | - $directive = $zero_padded ? "%m": "%-m"; | |
| 240 | - return $this->campaign->monthsVisibility === C::YES ? $this->block($directive , $label ) : ''; | |
| 231 | + return $this->campaign->monthsVisibility === C::YES ? $this->block( "%m", $label ) : ''; | |
| 241 | 232 | } |
| 242 | 233 | |
| 243 | 234 | |
| 244 | 235 | /** |
| @@ -247,9 +238,9 @@ | ||
| 247 | 238 | * @return string |
| 248 | 239 | */ |
| 249 | 240 | public function daysBlock() |
| 250 | 241 | { |
| 251 | - $label = $this->campaign->labels[ 'days' ]; | |
| 242 | + $label = __( $this->campaign->labels[ 'days' ], 'hurrytimer' ); | |
| 252 | 243 | |
| 253 | 244 | /** |
| 254 | 245 | * @deprecated Use `hurryt_days_label` instead. |
| 255 | 246 | */ |
| @@ -255,19 +246,15 @@ | ||
| 255 | 246 | */ |
| 256 | 247 | $label = apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_timer_days_label", |
| 257 | 248 | $label, $this->campaign ); |
| 258 | 249 | |
| 259 | - $zero_padded = (bool)apply_filters('hurrytimer_zero_padded_digits', true, $this->campaign->get_id()); | |
| 250 | + $directive = '%D'; | |
| 260 | 251 | |
| 261 | - $directive = $zero_padded ? '%D' : '%-D'; | |
| 262 | 252 | if ( $this->campaign->monthsVisibility == C::YES ) { |
| 263 | - $directive = $zero_padded ? '%n' : '%-n'; | |
| 253 | + $directive = '%n'; | |
| 264 | 254 | } |
| 265 | 255 | |
| 266 | 256 | $directive = apply_filters( 'hurryt_days_directive', $directive, $this->campaign->get_id() ); |
| 267 | - if( apply_filters('hurrytimer_auto_pluralize', false ) ){ | |
| 268 | - $label.='%!D'; | |
| 269 | - } | |
| 270 | 257 | $label = apply_filters( 'hurryt_days_label', $label, $this->campaign->get_id() ); |
| 271 | 258 | return $this->campaign->daysVisibility === C::YES ? $this->block( $directive, $label ) : ''; |
| 272 | 259 | |
| 273 | 260 | |
| @@ -279,9 +266,9 @@ | ||
| 279 | 266 | * @return string |
| 280 | 267 | */ |
| 281 | 268 | public function hoursBlock() |
| 282 | 269 | { |
| 283 | - $label = $this->campaign->labels[ 'hours' ]; | |
| 270 | + $label = __( $this->campaign->labels[ 'hours' ], 'hurrytimer' ); | |
| 284 | 271 | |
| 285 | 272 | /** |
| 286 | 273 | * @deprecated Use `hurryt_hours_label` instead. |
| 287 | 274 | */ |
| @@ -288,24 +275,11 @@ | ||
| 288 | 275 | |
| 289 | 276 | $label = apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_timer_hours_label", |
| 290 | 277 | $label, $this->campaign ); |
| 291 | 278 | |
| 292 | - | |
| 293 | - $zero_padded = (bool)apply_filters('hurrytimer_zero_padded_digits', true, $this->campaign->get_id()); | |
| 294 | - | |
| 295 | - $directive = $zero_padded ? '%H' : '%-H'; | |
| 296 | - | |
| 297 | - if ( $this->campaign->daysVisibility == C::NO ) { | |
| 298 | - $directive = $zero_padded ? '%I': '%-I'; | |
| 299 | - } | |
| 300 | - | |
| 301 | - if( apply_filters('hurrytimer_auto_pluralize', false ) ){ | |
| 302 | - $label.='%!H'; | |
| 303 | - } | |
| 304 | - | |
| 305 | 279 | $label = apply_filters( 'hurryt_hours_label', $label, $this->campaign->get_id() ); |
| 306 | 280 | |
| 307 | - return $this->campaign->hoursVisibility === C::YES ? $this->block($directive, $label ) : ''; | |
| 281 | + return $this->campaign->hoursVisibility === C::YES ? $this->block( "%H", $label ) : ''; | |
| 308 | 282 | |
| 309 | 283 | |
| 310 | 284 | } |
| 311 | 285 | |
| @@ -315,31 +289,18 @@ | ||
| 315 | 289 | * @return string |
| 316 | 290 | */ |
| 317 | 291 | public function minutesBlock() |
| 318 | 292 | { |
| 319 | - $label = $this->campaign->labels[ 'minutes' ]; | |
| 293 | + $label = __( $this->campaign->labels[ 'minutes' ], 'hurrytimer' ); | |
| 320 | 294 | |
| 321 | 295 | /** @deprecated Use `hurryt_minutes_label` instead. */ |
| 322 | 296 | $label = apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_timer_minutes_label", |
| 323 | 297 | $label, $this->campaign ); |
| 324 | 298 | |
| 325 | - | |
| 326 | - $zero_padded = (bool)apply_filters('hurrytimer_zero_padded_digits', true, $this->campaign->get_id()); | |
| 327 | - | |
| 328 | - $directive = $zero_padded ?'%M': '%-M'; | |
| 329 | - | |
| 330 | - if ( $this->campaign->hoursVisibility == C::NO ) { | |
| 331 | - $directive = $zero_padded ? '%N': '%-N'; | |
| 332 | - } | |
| 333 | - | |
| 334 | - if( apply_filters('hurrytimer_auto_pluralize', false ) ){ | |
| 335 | - $label.='%!M'; | |
| 336 | - } | |
| 337 | - | |
| 338 | 299 | $label = apply_filters( 'hurryt_minutes_label', $label, $this->campaign->get_id() ); |
| 339 | 300 | |
| 340 | 301 | return $this->campaign->minutesVisibility === C::YES |
| 341 | - ? $this->block( $directive, $label ) | |
| 302 | + ? $this->block( "%M", $label ) | |
| 342 | 303 | : ''; |
| 343 | 304 | |
| 344 | 305 | } |
| 345 | 306 | |
| @@ -350,31 +311,19 @@ | ||
| 350 | 311 | */ |
| 351 | 312 | public function secondsBlock() |
| 352 | 313 | { |
| 353 | 314 | |
| 354 | - $label = $this->campaign->labels[ 'seconds' ]; | |
| 315 | + $label = __( $this->campaign->labels[ 'seconds' ], 'hurrytimer' ); | |
| 316 | + | |
| 355 | 317 | |
| 356 | 318 | /** @deprecated Use `hurryt_seconds_label` instead. */ |
| 357 | 319 | $label = apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_timer_seconds_label", |
| 358 | 320 | $label, $this->campaign ); |
| 359 | 321 | |
| 360 | - | |
| 361 | - $zero_padded = (bool)apply_filters('hurrytimer_zero_padded_digits', true, $this->campaign->get_id()); | |
| 362 | - | |
| 363 | - $directive = $zero_padded ?'%S': '%-S'; | |
| 364 | - | |
| 365 | - if ( $this->campaign->minutesVisibility == C::NO ) { | |
| 366 | - $directive = $zero_padded ? '%T': '%-T'; | |
| 367 | - } | |
| 368 | - | |
| 369 | - if( apply_filters('hurrytimer_auto_pluralize', false ) ){ | |
| 370 | - $label.='%!S'; | |
| 371 | - } | |
| 372 | - | |
| 373 | 322 | $label = apply_filters( 'hurryt_seconds_label', $label, $this->campaign->get_id() ); |
| 374 | 323 | |
| 375 | 324 | return $this->campaign->secondsVisibility === C::YES |
| 376 | - ? $this->block( $directive, $label ) | |
| 325 | + ? $this->block( "%S", $label ) | |
| 377 | 326 | : ''; |
| 378 | 327 | |
| 379 | 328 | } |
| 380 | 329 | |
| @@ -406,23 +355,24 @@ | ||
| 406 | 355 | return ''; |
| 407 | 356 | } |
| 408 | 357 | |
| 409 | 358 | return '<div class="hurrytimer-timer-label ' . $this->legacyLabelClass() . '" >' |
| 410 | - . $text . '</div>'; | |
| 359 | + . __( $text, 'hurrytimer' ) . '</div>'; | |
| 411 | 360 | |
| 412 | 361 | } |
| 413 | 362 | |
| 414 | 363 | public function headline() |
| 415 | 364 | { |
| 416 | - $headline = $this->campaign->headline; | |
| 365 | + $headline = __( $this->campaign->headline, 'hurrytimer' ); | |
| 417 | 366 | |
| 418 | 367 | /** |
| 419 | 368 | * @deprecated Use `hurryt_campaign_headline` instead. |
| 420 | 369 | */ |
| 421 | - $headline = apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_headline", | |
| 422 | - $headline, $this->campaign); | |
| 370 | + $headline = __( apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_headline", | |
| 371 | + $headline, $this->campaign ), 'hurrytimer' ); | |
| 423 | 372 | |
| 424 | - $headline = apply_filters( "hurryt_campaign_headline", $headline, $this->campaign->get_id()); | |
| 373 | + $headline = __( apply_filters( "hurryt_campaign_headline", $headline, $this->campaign->get_id() ), | |
| 374 | + 'hurrytimer' ); | |
| 425 | 375 | |
| 426 | 376 | $headline = nl2br( Placeholder_Factory::parse( $headline, $this->campaign ) ); |
| 427 | 377 | |
| 428 | 378 | $headline = do_shortcode($headline); |
| @@ -444,10 +394,10 @@ | ||
| 444 | 394 | |
| 445 | 395 | $cta_url = $this->campaign->callToAction[ 'url' ]; |
| 446 | 396 | |
| 447 | 397 | /** @deprecated Use `hurryt_cta_text` instead. */ |
| 448 | - $cta_text = apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_cta_text", | |
| 449 | - $cta_text, $this->campaign ); | |
| 398 | + $cta_text = __( apply_filters( "hurryt_{$this->campaign->get_id()}_campaign_cta_text", | |
| 399 | + $cta_text, $this->campaign ), 'hurrytimer' ); | |
| 450 | 400 | |
| 451 | 401 | $cta_text = apply_filters('hurryt_cta_text', $cta_text, $this->campaign->get_id()); |
| 452 | 402 | |
| 453 | 403 | /** @deprecated Use `hurryt_cta_url` instead. */ |