🐘 Day.php (Php) 2.1 KB 2016-05-21
PHP module for Day
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Period;
use Exception;
use Piwik\Date;
use Piwik\Period;
/**
*/
class Day extends Period
{
const PERIOD_ID = 1;
protected $label = 'day';
/**
* Returns the day of the period as a string
*
* @return string
*/
public function getPrettyString()
{
$out = $this->getDateStart()->toString();
return $out;
}
/**
* Returns the day of the period as a localized short string
*
* @return string
*/
public function getLocalizedShortString()
{
//"Mon 15 Aug"
$date = $this->getDateStart();
$out = $date->getLocalized(Date::DATE_FORMAT_DAY_MONTH);
return $out;
}
/**
* Returns the day of the period as a localized long string
*
* @return string
... [truncated, 64 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Day.php",
"description": "PHP module for Day",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "2.1 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/Day.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}
🐘 Factory.php (Php) 4.0 KB 2016-05-21
PHP module for Factory
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Period;
use Exception;
use Piwik\Date;
use Piwik\Period;
use Piwik\Piwik;
class Factory
{
/**
* Creates a new Period instance with a period ID and {@link Date} instance.
*
* _Note: This method cannot create {@link Period\Range} periods._
*
* @param string $period `"day"`, `"week"`, `"month"`, `"year"`, `"range"`.
* @param Date|string $date A date within the period or the range of dates.
* @param Date|string $timezone Optional timezone that will be used only when $period is 'range' or $date is 'last|previous'
* @throws Exception If `$strPeriod` is invalid.
* @return \Piwik\Period
*/
public static function build($period, $date, $timezone = 'UTC')
{
self::checkPeriodIsEnabled($period);
if (is_string($date)) {
if (Period::isMultiplePeriod($date, $period)
|| $period == 'range') {
return new Range($period, $date, $timezone);
}
$date = Date::factory($date);
}
switch ($period) {
case 'day':
return new Day($date);
break;
case 'week':
return new Week($date);
break;
case 'month':
... [truncated, 81 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Factory.php",
"description": "PHP module for Factory",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "4.0 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/Factory.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}
🐘 Month.php (Php) 2.9 KB 2016-05-21
PHP module for Month
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Period;
use Piwik\Date;
use Piwik\Period;
/**
*/
class Month extends Period
{
const PERIOD_ID = 3;
protected $label = 'month';
/**
* Returns the current period as a localized short string
*
* @return string
*/
public function getLocalizedShortString()
{
//"Aug 09"
$out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_MONTH_SHORT);
return $out;
}
/**
* Returns the current period as a localized long string
*
* @return string
*/
public function getLocalizedLongString()
{
//"August 2009"
$out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_MONTH_LONG);
return $out;
}
/**
* Returns the current period as a string
*
* @return string
*/
... [truncated, 77 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Month.php",
"description": "PHP module for Month",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "2.9 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/Month.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}
🐘 PeriodValidator.php (Php) 1.1 KB 2016-05-21
PHP module for PeriodValidator
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Period;
use Piwik\Config;
class PeriodValidator
{
/**
* @param string $period
* @return bool
*/
public function isPeriodAllowedForUI($period)
{
return in_array($period, $this->getPeriodsAllowedForUI());
}
/**
* @param string $period
* @return bool
*/
public function isPeriodAllowedForAPI($period)
{
return in_array($period, $this->getPeriodsAllowedForAPI());
}
/**
* @return string[]
*/
public function getPeriodsAllowedForUI()
{
$periodsAllowed = Config::getInstance()->General['enabled_periods_UI'];
return array_map('trim', explode(',', $periodsAllowed));
}
/**
* @return string[]
*/
public function getPeriodsAllowedForAPI()
{
$periodsAllowed = Config::getInstance()->General['enabled_periods_API'];
return array_map('trim', explode(',', $periodsAllowed));
... [truncated, 3 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "PeriodValidator.php",
"description": "PHP module for PeriodValidator",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "1.1 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/PeriodValidator.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}
🐘 Range.php (Php) 16.9 KB 2016-05-21
PHP module for Range
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Period;
use Exception;
use Piwik\Cache;
use Piwik\Common;
use Piwik\Container\StaticContainer;
use Piwik\Date;
use Piwik\Period;
/**
* Arbitrary date range representation.
*
* This class represents a period that contains a list of consecutive days as subperiods
* It is created when the **period** query parameter is set to **range** and is used
* to calculate the subperiods of multiple period requests (eg, when period=day and
* date=2007-07-24,2013-11-15).
*
* The range period differs from other periods mainly in that since it is arbitrary,
* range periods are not pre-archived by the cron core:archive command.
*
* @api
*/
class Range extends Period
{
const PERIOD_ID = 5;
protected $label = 'range';
protected $today;
/**
* @var null|Date
*/
protected $defaultEndDate;
/**
* Constructor.
*
* @param string $strPeriod The type of period each subperiod is. Either `'day'`, `'week'`,
* `'month'` or `'year'`.
* @param string $strDate The date range, eg, `'2007-07-24,2013-11-15'`.
* @param string $timezone The timezone to use, eg, `'UTC'`.
* @param bool|Date $today The date to use as _today_. Defaults to `Date::factory('today', $timzeone)`.
... [truncated, 479 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Range.php",
"description": "PHP module for Range",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "16.9 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/Range.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}
🐘 Week.php (Php) 2.0 KB 2016-05-21
PHP module for Week
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Period;
use Piwik\Period;
/**
*/
class Week extends Period
{
const PERIOD_ID = 2;
protected $label = 'week';
/**
* Returns the current period as a localized short string
*
* @return string
*/
public function getLocalizedShortString()
{
return $this->getTranslatedRange($this->getRangeFormat(true));
}
/**
* Returns the current period as a localized long string
*
* @return string
*/
public function getLocalizedLongString()
{
$string = $this->getTranslatedRange($this->getRangeFormat());
return $this->translator->translate('Intl_PeriodWeek') . " " . $string;
}
/**
* Returns the current period as a string
*
* @return string
*/
public function getPrettyString()
{
$dateStart = $this->getDateStart();
$dateEnd = $this->getDateEnd();
... [truncated, 42 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Week.php",
"description": "PHP module for Week",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "2.0 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/Week.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}
🐘 Year.php (Php) 2.0 KB 2016-05-21
PHP module for Year
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 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Period;
use Piwik\Date;
use Piwik\Period;
/**
*/
class Year extends Period
{
const PERIOD_ID = 4;
protected $label = 'year';
/**
* Returns the current period as a localized short string
*
* @return string
*/
public function getLocalizedShortString()
{
return $this->getLocalizedLongString();
}
/**
* Returns the current period as a localized long string
*
* @return string
*/
public function getLocalizedLongString()
{
//"2009"
$out = $this->getDateStart()->getLocalized(Date::DATE_FORMAT_YEAR);
return $out;
}
/**
* Returns the current period as a string
*
* @return string
*/
public function getPrettyString()
{
... [truncated, 53 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Year.php",
"description": "PHP module for Year",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "2.0 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/Year.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/Period/"
}