PluginProbe
AdOpt | Easy Multi-Regulations Cookie Banner. / trunk
AdOpt | Easy Multi-Regulations Cookie Banner. vtrunk
trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
adopt / index.php

index.php in AdOpt | Easy Multi-Regulations Cookie Banner. trunk, at index.php

146 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Adopt
4 Author: Adopt
5 Author URI: https://goadopt.io/
6 Version: 1.0.9
7 Description: Safe and Intuitive cookie banner in a complete Consent Management Platform. Thousands of companies trust their visitors' consents to AdOpt. Start now and get full website compliance for privacy regulations like GDPR, CCPA, LGPD…
8 Text Domain: adopt
9 */
10 if (!function_exists('add_action')) {
11 echo __('O plugin não pode ser passado direto', 'adopt');
12 exit;
13 }
14
15 register_activation_hook(__FILE__, 'Adp_activate');
16 register_deactivation_hook(__FILE__, 'Adp_desactivate');
17
18 require_once('includes/activate.php');
19 require_once('includes/ConfigTags.php');
20
21 add_action('wp_head', 'Adp_wpbHook_javascript');
22
23 $dir = plugin_dir_url(__FILE__);
24 wp_enqueue_style( 'adopt-stylesheet', $dir . 'includes/style.css');
25
26 function adopt_config()
27 {
28
29 add_settings_section(
30 'minha_secao',
31 null,
32 function ($args) {
33 ?>
34 <div class="masthead-adopt">
35 <img class="masthead-logo-adopt" src="<?php echo esc_url(plugins_url('_inc/img/Logo-hirizontal-gradiente.png', __FILE__)); ?>" alt="adop" />
36 </div>
37
38
39 <div class="card-adopt">
40 <h2>
41 <span style="color:rgb(0, 221, 128)">AdOpt</span> Cookie Banner | Consent Management
42 Platform.
43 </h2>
44 <p>
45 Not registered yet? Click the link below to create your free account.
46 Already a user? <br />Please provide the <b>Disclaimer ID</b> you
47 created for this website's URL.
48 </p>
49
50 <div class="btn-container">
51 <a target='_blank' href="https://dash.goadopt.io/register" class="btn" ><b>Create an Account</b></a
52 >
53 </div>
54 <div class="documentation-link">
55 <a target='_blank' href="https://goadopt.io/en/support/integrations/wordpress/adopt-cookie-banner-wordpress/">Documentation</a>
56 </div>
57 </div>
58
59
60 <?php
61
62 },
63 'Adopt'
64 );
65
66 register_setting(
67 'Adopt',
68 'chave_de_integracao',
69 array(
70 'sanitize_callback' => function ($value) {
71 $adpvalue = strip_tags($value);
72 $guid_regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i';
73
74 if (!preg_match($guid_regex, $adpvalue)) {
75 add_settings_error(
76 'chave_de_integracao',
77 esc_attr('chave_de_integracao_erro'),
78 'Invalid disclaimer ID format',
79 'error'
80 );
81 } else {
82 AdpExecComand($adpvalue);
83 }
84 return $adpvalue;
85
86 },
87 )
88 );
89
90
91 add_settings_field(
92 'chave_de_integracao',
93 'AdOpt Disclaimer ID',
94 function ($args) {
95 $options = get_option('chave_de_integracao');
96 ?>
97
98 <div class="adopt-box">
99 <input type="text" class="inputadopt" id="<?php echo esc_attr($args['label_for']); ?>" name="chave_de_integracao" value="<?php echo esc_attr(AdpExecComand(null)) ?>">
100 </div>
101
102 <?php
103 },
104 'Adopt',
105 'minha_secao',
106 [
107 'label_for' => 'chave_de_integracao_html_id',
108 'class' => 'classe-html-tr',
109 ]
110 );
111 }
112
113 add_action('admin_init', 'adopt_config');
114
115 function adopt_config_menu()
116 {
117 add_options_page(
118 null,
119 'Adopt',
120 'manage_options',
121 'minhas-configuracoes',
122 'adopt_config_html'
123 );
124 }
125
126
127 add_action('admin_menu', 'adopt_config_menu');
128
129
130 function adopt_config_html()
131 {
132 ?>
133 <div class="wrap">
134 <h1><?php echo esc_html(get_admin_page_title()); ?></h1>
135 <form action="options.php" method="post" id="form">
136
137 <?php
138 settings_fields('Adopt');
139 do_settings_sections('Adopt');
140 submit_button("Save your settings");
141 ?>
142 </form>
143 </div>
144 <?php
145 }
146