14 use GravityKit\GravityView\Foundation\ThirdParty\TrustedLogin\Admin as TrustedLoginAdmin;
15 use GravityKit\GravityView\Foundation\ThirdParty\TrustedLogin\Logging as TrustedLoginLogging;
16 use GravityKit\GravityView\Foundation\ThirdParty\TrustedLogin\Config as TrustedLoginConfig;
17 use GravityKit\GravityView\Foundation\ThirdParty\TrustedLogin\Client as TrustedLoginClient;
23 const ID =
'gk_foundation_trustedlogin';
57 $this->_trustedlogin_client =
new TrustedLoginClient(
61 LoggerFramework::get_instance()->error(
'Unable to initialize TrustedLogin client: ' . $e->getMessage() );
69 LoggerFramework::get_instance()->error(
'Unable to add TrustedLogin to the Foundation menu: ' . $e->getMessage() );
74 add_action(
'trustedlogin/' . self::ID .
'/logging/log', [ $this,
'log' ], 10, 4 );
75 add_filter(
'gk/foundation/integrations/helpscout/configuration', [ $this,
'add_tl_key_to_helpscout_beacon' ] );
86 if ( ! self::$_instance ) {
87 self::$_instance =
new self();
90 return self::$_instance;
103 $tl_config =
new TrustedLoginConfig( $this->
get_config() );
104 $tl_admin =
new TrustedLoginAdmin( $tl_config,
new TrustedLoginLogging( $tl_config ) );
106 $page_title = $menu_title = esc_html__(
'Grant Support Access',
'gk-gravityview' );
109 'page_title' => $page_title,
110 'menu_title' => $menu_title,
111 'capability' => $this->_capability,
113 'callback' => [ $tl_admin,
'print_auth_screen' ],
133 $capabilities = apply_filters(
'gk/foundation/integrations/trustedlogin/capabilities', [
135 'gravityview_full_access' => esc_html__(
'We need access to Views to provide great support.',
'gk-gravityview' ),
136 'gform_full_access' => esc_html__(
'We will need to see and edit the forms, entries, and Gravity Forms settings to debug issues.',
'gk-gravityview' ),
137 'install_plugins' => esc_html__(
'We may need to manage plugins in order to debug conflicts on your site and add related GravityView functionality.',
'gk-gravityview' ),
138 'update_plugins' =>
'',
139 'deactivate_plugins' =>
'',
140 'activate_plugins' =>
'',
143 'manage_woocommerce' => strtr(
144 esc_html_x(
"We don't need to see your [plugin] details to provide support (if [plugin] is enabled).",
'Placeholders inside [] are not to be translated.',
'gk-gravityview' ),
145 [
'plugin' =>
'WooCommerce' ]
147 'view_shop_reports' => strtr(
148 esc_html_x(
"We don't need to see your [plugin] details to provide support (if [plugin] is enabled).",
'Placeholders inside [] are not to be translated.',
'gk-gravityview' ),
149 [
'plugin' =>
'Easy Digital Downloads' ]
156 'api_key' => self::TL_API_KEY,
161 'role' =>
'administrator',
162 'caps' => $capabilities,
165 'threshold' =>
'warning',
168 'namespace' => self::ID,
169 'title' =>
'GravityKit',
170 'email' =>
'support+{hash}@gravitykit.com',
171 'website' =>
'https://www.gravitykit.com',
172 'support_url' =>
'https://www.gravitykit.com/support/',
173 'display_name' =>
'GravityKit Support',
174 'logo_url' => CoreHelpers::get_assets_url(
'gravitykit-logo.svg' ),
176 'register_assets' =>
true,
178 'css' => CoreHelpers::get_assets_url(
'trustedlogin/trustedlogin.css' ),
180 'webhook_url' =>
'https://hooks.zapier.com/hooks/catch/28670/bbyi3l4',
185 foreach ( $license_manager->get_licenses_data() as $license_data ) {
186 if (
Arr::get( $license_data,
'products' ) && ! $license_manager->is_expired_license(
Arr::get( $license_data,
'expiry' ) ) ) {
210 public function log( $message, $method =
'', $level =
'debug', $data = [] ) {
211 LoggerFramework::get_instance()->{$level}( $message );
224 Arr::set( $configuration,
'identify.tl_access_key', $this->_trustedlogin_client->get_access_key() );
226 return $configuration;
static set(&$array, $key, $value)
{}
static get_instance()
Returns class instance.
static get_instance()
Returns class instance.
static get( $array, $key, $default=null)
{}
add_tl_key_to_helpscout_beacon( $configuration)
Updates Help Scout beacon with TL access key.
add_gk_submenu_item()
Adds Settings submenu to the GravityKit top-level admin menu.
get_config()
Returns TrustedLogin configuration.
__construct()
Class constructor.
Logging framework for GravityKit.
log( $message, $method='', $level='debug', $data=[])
Overrides TL's internal logging with Foundation's logging.