PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.0.4
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.0.4
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
content-control / classes / Controllers / TrustedLogin.php

TrustedLogin.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More 2.0.4, at classes/Controllers/TrustedLogin.php

113 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * TrustedLogin.
4 *
5 * @copyright (c) 2023, Code Atlantic LLC.
6 *
7 * @package ContentControl
8 */
9
10 namespace ContentControl\Controllers;
11
12 use ContentControl\Base\Controller;
13 use ContentControl\Vendor\TrustedLogin\Client;
14 use ContentControl\Vendor\TrustedLogin\Config;
15
16 defined( 'ABSPATH' ) || exit;
17
18 /**
19 * TrustedLogin.
20 *
21 * @package ContentControl
22 */
23 class TrustedLogin extends Controller {
24
25 /**
26 * TrustedLogin init.
27 */
28 public function init() {
29 $this->hooks();
30
31 $config = [
32 'auth' => [
33 'api_key' => 'f97f5be6e02d1565',
34 'license_key' => $this->container->get( 'license' )->get_license_key(),
35 ],
36 'vendor' => [
37 'namespace' => 'content-control',
38 'title' => 'Content Control',
39 'display_name' => 'Content Control Support',
40 'logo_url' => $this->container->get_url( 'assets/images/logo.svg' ),
41 'email' => 'support+{hash}@contentcontrolplugin.com',
42 'website' => 'https://contentcontrolplugin.com?utm_campaign=grant-access&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=grant-access-title-link',
43 'support_url' => 'https://contentcontrolplugin.com/support/?utm_campaign=grant-access&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=support-footer-link',
44 ],
45 'role' => 'administrator',
46 'caps' => [
47 'add' => [
48 $this->container->get_permission( 'manage_settings' ) => __( 'This allows us to check your global restrictions and plugin settings.', 'content-control' ),
49 $this->container->get_permission( 'edit_block_controls' ) => __( 'This allows us to check your block control settings.', 'content-control' ),
50 ],
51 'remove' => [
52 'delete_published_pages' => 'Your published posts cannot and will not be deleted by support staff',
53 'manage_woocommerce' => 'We don\'t need to manage your shop!',
54 ],
55 ],
56 'decay' => WEEK_IN_SECONDS,
57 'menu' => [
58 'slug' => false,
59 ],
60 'logging' => [
61 'enabled' => false,
62 ],
63 'require_ssl' => false,
64 'webhook' => [
65 'url' => null,
66 'debug_data' => false,
67 'create_ticket' => false,
68 ],
69 'paths' => [
70 'js' => $this->container->get_url( 'vendor-prefixed/trustedlogin/client/src/assets/trustedlogin.js' ),
71 'css' => $this->container->get_url( 'dist/settings-page.css' ),
72 ],
73 ];
74
75 try {
76 new Client(
77 new Config( $config )
78 );
79 } catch ( \Exception $exception ) {
80 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
81 \error_log( $exception->getMessage() );
82 }
83 }
84
85 /**
86 * Hooks.
87 */
88 public function hooks() {
89 add_action( 'admin_menu', [ $this, 'admin_menu' ] );
90 }
91
92 /**
93 * Admin menu.
94 */
95 public function admin_menu() {
96 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
97 if ( ! isset( $_GET['page'] ) || 'grant-content-control-access' !== $_GET['page'] ) {
98 return;
99 }
100
101 add_options_page(
102 __( 'Content Control Support Access', 'content-control' ),
103 __( 'Content Control Support Access', 'content-control' ),
104 $this->container->get_permission( 'manage_settings' ),
105 'grant-content-control-access',
106 function () {
107 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
108 do_action( 'trustedlogin/content-control/auth_screen' );
109 }
110 );
111 }
112 }
113