PluginProbe
AdOpt | Easy Multi-Regulations Cookie Banner. / 1.0.3
AdOpt | Easy Multi-Regulations Cookie Banner. v1.0.3
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. 1.0.3, at index.php

149 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.3
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
30 register_setting(
31 'Adopt',
32 'chave_de_integracao',
33 array(
34 'sanitize_callback' => function ($value) {
35
36 $adpvalue = strip_tags($value);
37
38 if (empty($adpvalue)) {
39
40 add_settings_error(
41 'chave_de_integracao',
42 esc_attr('chave_de_integracao_erro'),
43 'Invalid disclaimer ID',
44 'error'
45 );
46 return;
47 }
48
49 $guid_regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i';
50 if (!preg_match($guid_regex, $adpvalue)) {
51 add_settings_error(
52 'chave_de_integracao',
53 esc_attr('chave_de_integracao_erro'),
54 'Invalid disclaimer ID format',
55 'error'
56 );
57 return;
58 }
59
60 if (array_key_exists('submit', $_POST)) {
61 AdpExecComand($adpvalue);
62 }
63 },
64 )
65 );
66
67 add_settings_section(
68 'minha_secao',
69 null,
70 function ($args) {
71 ?>
72 <div class="masthead-adopt">
73 <img class="masthead-logo-adopt" src="<?php echo esc_url(plugins_url('_inc/img/Logo-hirizontal-gradiente.png', __FILE__)); ?>" alt="adop" />
74 </div>
75
76 <div style="margin-top:4%" class="card-adopt">
77
78 <h2><span style="color:rgb(0, 221, 128)">AdOpt </span> Cookie Banner | Consent Management Platform. </h2>
79
80 <p>Not registered yet? Hit the link below to create your free account! <br>Already a user? We need the “Banner ID” you created for this website URL. </p>
81
82 <div style="margin-top:4%;">
83 <a href="https://dash.goadopt.io/register"><span class="btn">Click here</span></a>
84 </div>
85 </div>
86
87 <?php
88
89 },
90 'Adopt'
91 );
92
93 add_settings_field(
94 'chave_de_integracao',
95 'AdOpt Disclaimer ID',
96 function ($args) {
97 $options = get_option('chave_de_integracao');
98 ?>
99
100 <div class="adopt-box">
101 <input type="text" class="inputadopt" id="<?php echo esc_attr($args['label_for']); ?>" name="chave_de_integracao" value="<?php echo esc_attr(AdpExecComand(null)) ?>">
102 </div>
103
104 <?php
105 },
106 'Adopt',
107 'minha_secao',
108 [
109 'label_for' => 'chave_de_integracao_html_id',
110 'class' => 'classe-html-tr',
111 ]
112 );
113 }
114
115 add_action('admin_init', 'adopt_config');
116
117 function adopt_config_menu()
118 {
119 add_options_page(
120 null,
121 'Adopt',
122 'manage_options',
123 'minhas-configuracoes',
124 'adopt_config_html'
125 );
126 }
127
128
129 add_action('admin_menu', 'adopt_config_menu');
130
131
132 function adopt_config_html()
133 {
134 ?>
135 <div class="wrap">
136 <h1><?php echo esc_html(get_admin_page_title()); ?></h1>
137 <form action="options.php" method="post" id="form">
138
139 <?php
140 settings_fields('Adopt');
141 do_settings_sections('Adopt');
142
143 submit_button("Save your settings");
144 ?>
145 </form>
146 </div>
147 <?php
148 }
149