PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.4
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.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.6.4, at classes/Controllers/TrustedLogin.php

117 lines 3.4 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 add_action( 'admin_menu', [ $this, 'admin_menu' ] );
30 add_action( 'init', [ $this, 'initiate_trustedlogin' ] );
31 }
32
33 /**
34 * Hooks.
35 *
36 * @return void
37 */
38 public function initiate_trustedlogin() {
39
40 $config = [
41 'auth' => [
42 'api_key' => 'f97f5be6e02d1565',
43 'license_key' => $this->container->get( 'license' )->get_license_key(),
44 ],
45 'vendor' => [
46 'namespace' => 'content-control',
47 'title' => 'Content Control',
48 'display_name' => 'Content Control Support',
49 'logo_url' => $this->container->get_url( 'assets/images/logo.svg' ),
50 'email' => 'support+{hash}@contentcontrolplugin.com',
51 'website' => 'https://contentcontrolplugin.com?utm_campaign=grant-access&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=grant-access-title-link',
52 'support_url' => 'https://contentcontrolplugin.com/support/?utm_campaign=grant-access&utm_source=plugin-settings-page&utm_medium=plugin-ui&utm_content=support-footer-link',
53 ],
54 'role' => 'administrator',
55 'caps' => [
56 'add' => [
57 $this->container->get_permission( 'manage_settings' ) => __( 'This allows us to check your global restrictions and plugin settings.', 'content-control' ),
58 $this->container->get_permission( 'edit_block_controls' ) => __( 'This allows us to check your block control settings.', 'content-control' ),
59 ],
60 'remove' => [
61 'delete_published_pages' => 'Your published posts cannot and will not be deleted by support staff',
62 'manage_woocommerce' => 'We don\'t need to manage your shop!',
63 ],
64 ],
65 'decay' => WEEK_IN_SECONDS,
66 'menu' => [
67 'slug' => false,
68 ],
69 'logging' => [
70 'enabled' => false,
71 ],
72 'require_ssl' => false,
73 'webhook' => [
74 'url' => null,
75 'debug_data' => false,
76 'create_ticket' => false,
77 ],
78 'paths' => [
79 'js' => $this->container->get_url( 'vendor-prefixed/trustedlogin/client/src/assets/trustedlogin.js' ),
80 'css' => $this->container->get_url( 'dist/settings-page.css' ),
81 ],
82 ];
83
84 try {
85 new Client(
86 new Config( $config )
87 );
88 } catch ( \Exception $exception ) {
89 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
90 \error_log( $exception->getMessage() );
91 }
92 }
93
94 /**
95 * Admin menu.
96 *
97 * @return void
98 */
99 public function admin_menu() {
100 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
101 if ( ! isset( $_GET['page'] ) || 'grant-content-control-access' !== $_GET['page'] ) {
102 return;
103 }
104
105 add_options_page(
106 __( 'Content Control Support Access', 'content-control' ),
107 __( 'Content Control Support Access', 'content-control' ),
108 $this->container->get_permission( 'manage_settings' ),
109 'grant-content-control-access',
110 function () {
111 // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
112 do_action( 'trustedlogin/content-control/auth_screen' );
113 }
114 );
115 }
116 }
117