ActiveDonationFormsData.php
5 years ago
DonationData.php
5 years ago
DonationFormsData.php
5 years ago
DonationMetricsData.php
5 years ago
EditedDonationFormsData.php
5 years ago
GivePluginSettingsData.php
5 years ago
PluginsData.php
4 years ago
ServerData.php
5 years ago
ThemeData.php
5 years ago
WebsiteData.php
5 years ago
WebsiteInfoData.php
5 years ago
WebsiteData.php
53 lines
| 1 | <?php |
| 2 | namespace Give\Tracking\TrackingData; |
| 3 | |
| 4 | use Give\Tracking\Contracts\TrackData; |
| 5 | |
| 6 | /** |
| 7 | * Class WebsiteData |
| 8 | * |
| 9 | * Represents the website data. |
| 10 | * |
| 11 | * @since 2.10.0 |
| 12 | * @package Give\Tracking\TrackingData |
| 13 | */ |
| 14 | class WebsiteData implements TrackData { |
| 15 | |
| 16 | /** |
| 17 | * Returns the collection data. |
| 18 | * |
| 19 | * @since 2.10.0 |
| 20 | * |
| 21 | * @return array The collection data. |
| 22 | */ |
| 23 | public function get() { |
| 24 | global $wp_version; |
| 25 | |
| 26 | $data = [ |
| 27 | 'site_title' => get_option( 'blogname' ), |
| 28 | 'wp_version' => $wp_version, |
| 29 | 'givewp_version' => GIVE_VERSION, |
| 30 | 'home_url' => untrailingslashit( home_url() ), |
| 31 | 'admin_url' => untrailingslashit( admin_url() ), |
| 32 | 'is_multisite' => absint( is_multisite() ), |
| 33 | 'site_language' => get_bloginfo( 'language' ), |
| 34 | 'install_date' => $this->getPluginInstallDate(), |
| 35 | ]; |
| 36 | |
| 37 | return array_merge( $data, ( new ServerData() )->get() ); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Returns plugin install date |
| 42 | * |
| 43 | * @since 2.10.0 |
| 44 | * @return int |
| 45 | */ |
| 46 | private function getPluginInstallDate() { |
| 47 | $confirmationPageID = give_get_option( 'success_page' ); |
| 48 | |
| 49 | return strtotime( get_post_field( 'post_date', $confirmationPageID, 'db' ) ); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 |