PluginProbe
Independent Analytics – WordPress Analytics Plugin / 2.13.5
Independent Analytics – WordPress Analytics Plugin v2.13.5
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / IAWP / Email_Reports / Interval_Factory.php
Interval_Factory.php
33 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IAWP\Email_Reports;
4
5 /** @internal */
6 class Interval_Factory
7 {
8 public static function from_option() : \IAWP\Email_Reports\Interval
9 {
10 $interval_id = \get_option('iawp_email_report_interval', 'monthly');
11 switch ($interval_id) {
12 case 'daily':
13 return \IAWP\Email_Reports\Interval_Factory::daily();
14 case 'weekly':
15 return \IAWP\Email_Reports\Interval_Factory::weekly();
16 default:
17 return \IAWP\Email_Reports\Interval_Factory::monthly();
18 }
19 }
20 public static function daily() : \IAWP\Email_Reports\Interval
21 {
22 return new \IAWP\Email_Reports\Interval(['id' => 'daily', 'relative_date_range_id' => 'TODAY', 'datetime_format_pattern' => 'l, M jS', 'chart_title' => \__('Hourly Views', 'independent-analytics')]);
23 }
24 public static function weekly() : \IAWP\Email_Reports\Interval
25 {
26 return new \IAWP\Email_Reports\Interval(['id' => 'weekly', 'relative_date_range_id' => 'THIS_WEEK', 'datetime_prefix' => \__('Week of', 'independent-analytics'), 'datetime_format_pattern' => 'l, M jS', 'chart_title' => \__('Daily Views', 'independent-analytics')]);
27 }
28 public static function monthly() : \IAWP\Email_Reports\Interval
29 {
30 return new \IAWP\Email_Reports\Interval(['id' => 'monthly', 'relative_date_range_id' => 'THIS_MONTH', 'datetime_format_pattern' => 'F Y', 'chart_title' => \__('Daily Views', 'independent-analytics')]);
31 }
32 }
33