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