| Server IP : 167.99.224.18 / Your IP : 216.73.216.136 Web Server : Apache/2.4.41 (Ubuntu) System : Linux wordpress-ubuntu-s-1vcpu-1gb-nyc1-01 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.0.25 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins-old/matomo/classes/WpMatomo/Admin/ |
Upload File : |
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
* @package matomo
*/
namespace WpMatomo\Admin;
use WpMatomo\Settings;
use WpMatomo\Capabilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // if accessed directly
}
class Marketplace {
/**
* @var Settings
*/
private $settings;
public function __construct( Settings $settings ) {
$this->settings = $settings;
}
public function show() {
$settings = $this->settings;
$valid_tabs = [];
$active_tab = '';
if ( ! is_plugin_active( MATOMO_MARKETPLACE_PLUGIN_NAME ) ) {
$valid_tabs = [ 'marketplace' ];
$active_tab = 'marketplace';
if ( $this->can_user_manage() ) {
if ( current_user_can( 'install_plugins' ) ) {
$valid_tabs[] = 'install';
}
$valid_tabs[] = 'subscriptions';
}
if ( isset( $_GET['tab'] )
&& in_array( $_GET['tab'], $valid_tabs, true )
) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$active_tab = wp_unslash( $_GET['tab'] );
}
if ( 'install' === $active_tab || 'subscriptions' === $active_tab ) {
$marketplace_setup_wizard = new MarketplaceSetupWizard();
}
}
$matomo_currency = $this->get_currency_based_on_timezone();
include dirname( __FILE__ ) . '/views/marketplace.php';
}
private function can_user_manage() {
// only someone who can activate plugins is allowed to manage subscriptions
if ( $this->is_multisite() ) {
return is_super_admin();
}
return current_user_can( Capabilities::KEY_SUPERUSER );
}
private function is_multisite() {
return function_exists( 'is_multisite' ) && is_multisite();
}
private function get_currency_based_on_timezone() {
if ( ! function_exists( 'wp_timezone' ) ) {
return 'EUR';
}
$timezone = \wp_timezone();
$now = new \DateTime( 'now', $timezone );
$offset = $now->getOffset() / 3600;
// if timezone is not european, use USD
if ( $offset >= 0 && $offset <= 4 ) {
return 'EUR';
} else {
return 'USD';
}
}
}