AJAX
2 years ago
Admin_Page
2 years ago
Date_Range
2 years ago
Interval
2 years ago
Menu_Bar_Stats
2 years ago
Migrations
2 years ago
Models
2 years ago
Public_API
2 years ago
Rows
2 years ago
Statistics
2 years ago
Tables
2 years ago
Utils
2 years ago
Campaign_Builder.php
2 years ago
Capability_Manager.php
2 years ago
Chart.php
2 years ago
Chart_Geo.php
2 years ago
Cron_Manager.php
2 years ago
Current_Traffic_Finder.php
2 years ago
Dashboard_Options.php
2 years ago
Dashboard_Widget.php
2 years ago
Database_Manager.php
2 years ago
Email_Chart.php
2 years ago
Email_Reports.php
2 years ago
Empty_Report_Option.php
2 years ago
Env.php
2 years ago
Filters.php
2 years ago
Geo_Database_Background_Job.php
2 years ago
Geo_Database_Manager.php
2 years ago
Geoposition.php
2 years ago
Icon_Directory.php
2 years ago
Icon_Directory_Factory.php
2 years ago
Illuminate_Builder.php
2 years ago
Independent_Analytics.php
2 years ago
Interrupt.php
2 years ago
Known_Referrers.php
2 years ago
Plugin_Conflict_Detector.php
2 years ago
Query.php
2 years ago
Quick_Stats.php
2 years ago
REST_API.php
2 years ago
Real_Time.php
2 years ago
Report.php
2 years ago
Report_Finder.php
2 years ago
Report_Options_Parser.php
2 years ago
Resource_Identifier.php
2 years ago
Settings.php
2 years ago
Sort_Configuration.php
2 years ago
Track_Resource_Changes.php
2 years ago
View.php
2 years ago
View_Counter.php
2 years ago
Visitors_Over_Time_Finder.php
2 years ago
WP_Option_Cache_Bust.php
2 years ago
WooCommerce_Order.php
2 years ago
WooCommerce_Referrer_Meta_Box.php
2 years ago
Env.php
55 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP; |
| 4 | |
| 5 | /** @internal */ |
| 6 | class Env |
| 7 | { |
| 8 | public function is_free() : bool |
| 9 | { |
| 10 | return \IAWP_SCOPED\iawp_is_free(); |
| 11 | } |
| 12 | public function is_pro() : bool |
| 13 | { |
| 14 | return \IAWP_SCOPED\iawp_is_pro(); |
| 15 | } |
| 16 | public function is_white_labeled() : bool |
| 17 | { |
| 18 | return Capability_Manager::white_labeled(); |
| 19 | } |
| 20 | public function can_write() : bool |
| 21 | { |
| 22 | return Capability_Manager::can_edit(); |
| 23 | } |
| 24 | public static function get_page() : ?string |
| 25 | { |
| 26 | if (!\is_admin()) { |
| 27 | return null; |
| 28 | } |
| 29 | $page = $_GET['page'] ?? null; |
| 30 | $valid_pages = ['independent-analytics', 'independent-analytics-settings', 'independent-analytics-campaign-builder']; |
| 31 | if (\in_array($page, $valid_pages)) { |
| 32 | return $page; |
| 33 | } |
| 34 | return null; |
| 35 | } |
| 36 | public static function get_tab() : ?string |
| 37 | { |
| 38 | if (self::get_page() !== 'independent-analytics') { |
| 39 | return null; |
| 40 | } |
| 41 | if (\IAWP_SCOPED\iawp_is_pro()) { |
| 42 | $valid_tabs = ['views', 'referrers', 'geo', 'devices', 'campaigns', 'real-time']; |
| 43 | } else { |
| 44 | $valid_tabs = ['views', 'referrers', 'geo', 'devices']; |
| 45 | } |
| 46 | $default_tab = $valid_tabs[0]; |
| 47 | $tab = \array_key_exists('tab', $_GET) ? \sanitize_text_field($_GET['tab']) : \false; |
| 48 | $is_valid = \array_search($tab, $valid_tabs) != \false; |
| 49 | if (!$tab || !$is_valid) { |
| 50 | $tab = $default_tab; |
| 51 | } |
| 52 | return $tab; |
| 53 | } |
| 54 | } |
| 55 |