-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathMslsOptionsQueryDay.php
62 lines (49 loc) · 1.28 KB
/
MslsOptionsQueryDay.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace lloc\Msls;
use lloc\Msls\Query\DatePostsCounterQuery;
/**
* MslsOptionsQueryDay
*
* @package Msls
*/
class MslsOptionsQueryDay extends MslsOptionsQuery {
protected int $year;
protected int $monthnum;
protected int $day;
public function __construct( MslsSqlCacher $sql_cache ) {
parent::__construct( $sql_cache );
$params = self::get_params();
$this->year = $params['year'];
$this->monthnum = $params['monthnum'];
$this->day = $params['day'];
}
public static function get_params(): array {
return array(
'year' => get_query_var( 'year' ),
'monthnum' => get_query_var( 'monthnum' ),
'day' => get_query_var( 'day' ),
);
}
/**
* Check if the array has a non-empty item which has $language as a key
*
* @param string $language
*
* @return bool
*/
public function has_value( string $language ): bool {
if ( ! isset( $this->arr[ $language ] ) ) {
$query_callable = new DatePostsCounterQuery( $this->sql_cache );
$this->arr[ $language ] = $query_callable( $this->year, $this->monthnum, $this->day );
}
return (bool) $this->arr[ $language ];
}
/**
* Get current link
*
* @return string
*/
public function get_current_link() {
return get_day_link( $this->year, $this->monthnum, $this->day );
}
}