added additional plugins

This commit is contained in:
Rodolfo Martinez 2025-12-12 19:05:48 -05:00
parent c85895d306
commit 00e60ec1b7
132 changed files with 27514 additions and 0 deletions

View file

@ -0,0 +1,12 @@
<?php
/**
* Silence is golden.
*
* Prevent direct access to this file.
*
* @package WordPress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

View file

@ -0,0 +1,106 @@
<?php
/**
* Consent Logs View
*/
if (!defined('ABSPATH')) {
exit;
}
global $wpdb;
$table_name = $wpdb->prefix . 'mgc_consent_logs';
// Get logs with pagination
$per_page = 50;
$page = isset($_GET['paged']) ? absint($_GET['paged']) : 1;
$offset = ($page - 1) * $per_page;
$logs = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM $table_name ORDER BY consent_date DESC LIMIT %d OFFSET %d",
$per_page,
$offset
)
);
$total_logs = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
$total_pages = ceil($total_logs / $per_page);
?>
<div class="wrap mgc-admin-wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<div class="mgc-panel">
<div class="mgc-panel-header">
<h3><?php _e('Consent Logs', 'maple-gdpr-cookies'); ?></h3>
</div>
<div class="mgc-panel-body">
<p><?php printf(__('Total logs: %d', 'maple-gdpr-cookies'), $total_logs); ?></p>
<?php if (!empty($logs)) : ?>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th><?php _e('Date', 'maple-gdpr-cookies'); ?></th>
<th><?php _e('User', 'maple-gdpr-cookies'); ?></th>
<th><?php _e('IP Address', 'maple-gdpr-cookies'); ?></th>
<th><?php _e('Consent Type', 'maple-gdpr-cookies'); ?></th>
<th><?php _e('Categories', 'maple-gdpr-cookies'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($logs as $log) : ?>
<tr>
<td><?php echo esc_html($log->consent_date); ?></td>
<td>
<?php
if ($log->user_id) {
$user = get_userdata($log->user_id);
echo $user ? esc_html($user->display_name) : __('Unknown', 'maple-gdpr-cookies');
} else {
echo __('Guest', 'maple-gdpr-cookies');
}
?>
</td>
<td><?php echo esc_html($log->ip_address); ?></td>
<td>
<span class="mgc-consent-<?php echo esc_attr($log->consent_type); ?>">
<?php echo esc_html(ucfirst($log->consent_type)); ?>
</span>
</td>
<td>
<?php
$categories = json_decode($log->categories, true);
if (!empty($categories) && is_array($categories)) {
echo esc_html(implode(', ', $categories));
} else {
echo __('N/A', 'maple-gdpr-cookies');
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if ($total_pages > 1) : ?>
<div class="tablenav">
<div class="tablenav-pages">
<?php
echo paginate_links(array(
'base' => add_query_arg('paged', '%#%'),
'format' => '',
'prev_text' => __('&laquo;'),
'next_text' => __('&raquo;'),
'total' => $total_pages,
'current' => $page
));
?>
</div>
</div>
<?php endif; ?>
<?php else : ?>
<p><?php _e('No consent logs found.', 'maple-gdpr-cookies'); ?></p>
<?php endif; ?>
</div>
</div>
</div>

View file

@ -0,0 +1,172 @@
<?php
/**
* Admin Settings View
*/
if (!defined('ABSPATH')) {
exit;
}
?>
<div class="wrap mgc-admin-wrap">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<?php settings_errors('mgc_messages'); ?>
<form method="post" action="">
<?php wp_nonce_field('mgc_settings_nonce'); ?>
<!-- General Settings Panel -->
<div class="mgc-panel">
<div class="mgc-panel-header">
<h3><?php _e('General Settings', 'maple-gdpr-cookies'); ?></h3>
</div>
<div class="mgc-panel-body">
<div class="mgc-form-row">
<label>
<input type="checkbox" name="mgc_enabled" value="1" <?php checked(get_option('mgc_enabled', true), true); ?>>
<?php _e('Enable Cookie Notice', 'maple-gdpr-cookies'); ?>
</label>
</div>
<div class="mgc-form-row">
<label for="mgc_notice_text"><?php _e('Notice Text', 'maple-gdpr-cookies'); ?></label>
<textarea id="mgc_notice_text" name="mgc_notice_text" rows="4"><?php echo esc_textarea(get_option('mgc_notice_text')); ?></textarea>
</div>
<div class="mgc-form-row">
<label for="mgc_accept_button_text"><?php _e('Accept Button Text', 'maple-gdpr-cookies'); ?></label>
<input type="text" id="mgc_accept_button_text" name="mgc_accept_button_text" value="<?php echo esc_attr(get_option('mgc_accept_button_text')); ?>">
</div>
<div class="mgc-form-row">
<label for="mgc_reject_button_text"><?php _e('Reject Button Text', 'maple-gdpr-cookies'); ?></label>
<input type="text" id="mgc_reject_button_text" name="mgc_reject_button_text" value="<?php echo esc_attr(get_option('mgc_reject_button_text')); ?>">
</div>
<div class="mgc-form-row">
<label for="mgc_privacy_policy_url"><?php _e('Privacy Policy URL', 'maple-gdpr-cookies'); ?></label>
<input type="url" id="mgc_privacy_policy_url" name="mgc_privacy_policy_url" value="<?php echo esc_url(get_option('mgc_privacy_policy_url')); ?>">
</div>
<div class="mgc-form-row">
<label for="mgc_cookie_expiry"><?php _e('Cookie Expiry (days)', 'maple-gdpr-cookies'); ?></label>
<input type="number" id="mgc_cookie_expiry" name="mgc_cookie_expiry" value="<?php echo esc_attr(get_option('mgc_cookie_expiry', 365)); ?>" min="1" max="365">
</div>
</div>
</div>
<!-- Appearance Panel -->
<div class="mgc-panel">
<div class="mgc-panel-header">
<h3><?php _e('Appearance', 'maple-gdpr-cookies'); ?></h3>
</div>
<div class="mgc-panel-body">
<div class="mgc-form-row">
<label for="mgc_position"><?php _e('Position', 'maple-gdpr-cookies'); ?></label>
<select id="mgc_position" name="mgc_position">
<option value="bottom" <?php selected(get_option('mgc_position', 'bottom'), 'bottom'); ?>><?php _e('Bottom', 'maple-gdpr-cookies'); ?></option>
<option value="top" <?php selected(get_option('mgc_position'), 'top'); ?>><?php _e('Top', 'maple-gdpr-cookies'); ?></option>
<option value="center" <?php selected(get_option('mgc_position'), 'center'); ?>><?php _e('Center Modal', 'maple-gdpr-cookies'); ?></option>
</select>
</div>
<div class="mgc-form-row">
<label for="mgc_theme"><?php _e('Theme', 'maple-gdpr-cookies'); ?></label>
<select id="mgc_theme" name="mgc_theme">
<option value="light" <?php selected(get_option('mgc_theme', 'light'), 'light'); ?>><?php _e('Light', 'maple-gdpr-cookies'); ?></option>
<option value="dark" <?php selected(get_option('mgc_theme'), 'dark'); ?>><?php _e('Dark', 'maple-gdpr-cookies'); ?></option>
</select>
</div>
<div class="mgc-form-row">
<label for="mgc_button_color"><?php _e('Button Color', 'maple-gdpr-cookies'); ?></label>
<select id="mgc_button_color" name="mgc_button_color">
<option value="black" <?php selected(get_option('mgc_button_color', 'blue'), 'black'); ?>><?php _e('Black', 'maple-gdpr-cookies'); ?></option>
<option value="dark-grey" <?php selected(get_option('mgc_button_color', 'blue'), 'dark-grey'); ?>><?php _e('Dark Grey', 'maple-gdpr-cookies'); ?></option>
<option value="blue" <?php selected(get_option('mgc_button_color', 'blue'), 'blue'); ?>><?php _e('Blue', 'maple-gdpr-cookies'); ?></option>
<option value="red" <?php selected(get_option('mgc_button_color', 'blue'), 'red'); ?>><?php _e('Red', 'maple-gdpr-cookies'); ?></option>
<option value="green" <?php selected(get_option('mgc_button_color', 'blue'), 'green'); ?>><?php _e('Green', 'maple-gdpr-cookies'); ?></option>
</select>
<p class="description"><?php _e('Select the color for all cookie notice buttons.', 'maple-gdpr-cookies'); ?></p>
</div>
<div class="mgc-form-row">
<label for="mgc_custom_button_color"><?php _e('Custom Button Color', 'maple-gdpr-cookies'); ?></label>
<input type="text" id="mgc_custom_button_color" name="mgc_custom_button_color" value="<?php echo esc_attr(get_option('mgc_custom_button_color', '')); ?>" placeholder="#3498db" pattern="^#[a-fA-F0-9]{6}$" maxlength="7">
<p class="description"><?php _e('Enter a hex color code (e.g., #3498db). If set, this overrides the dropdown selection above.', 'maple-gdpr-cookies'); ?></p>
</div>
<div class="mgc-form-row">
<label for="mgc_custom_button_hover_color"><?php _e('Custom Button Hover Color', 'maple-gdpr-cookies'); ?></label>
<input type="text" id="mgc_custom_button_hover_color" name="mgc_custom_button_hover_color" value="<?php echo esc_attr(get_option('mgc_custom_button_hover_color', '')); ?>" placeholder="#2980b9" pattern="^#[a-fA-F0-9]{6}$" maxlength="7">
<p class="description"><?php _e('Enter a hex color code for button hover state (e.g., #2980b9). If set, this overrides the default hover color.', 'maple-gdpr-cookies'); ?></p>
</div>
<div class="mgc-form-row">
<label for="mgc_custom_css"><?php _e('Custom CSS', 'maple-gdpr-cookies'); ?></label>
<textarea id="mgc_custom_css" name="mgc_custom_css" rows="10" placeholder=".mgc-notice { /* your styles */ }"><?php echo esc_textarea(get_option('mgc_custom_css')); ?></textarea>
</div>
<div class="mgc-form-row">
<label><?php _e('Preference Display Type', 'maple-gdpr-cookies'); ?></label>
<p class="description" style="margin-bottom: 10px;"><?php _e('Choose how users can access cookie preferences after giving consent (GDPR requirement for easy withdrawal).', 'maple-gdpr-cookies'); ?></p>
<label style="display: block; margin-bottom: 8px;">
<input type="radio" name="mgc_preference_display_type" value="icon" <?php checked(get_option('mgc_preference_display_type', 'icon'), 'icon'); ?>>
<?php _e('Floating Cookie Icon - A circular button with cookie icon in the bottom-left corner', 'maple-gdpr-cookies'); ?>
</label>
<label style="display: block; margin-bottom: 8px;">
<input type="radio" name="mgc_preference_display_type" value="footer" <?php checked(get_option('mgc_preference_display_type', 'icon'), 'footer'); ?>>
<?php _e('Footer Text Link - A small "Cookie Preferences" link in the bottom-left corner', 'maple-gdpr-cookies'); ?>
</label>
<label style="display: block; margin-bottom: 10px;">
<input type="radio" name="mgc_preference_display_type" value="neither" <?php checked(get_option('mgc_preference_display_type', 'icon'), 'neither'); ?>>
<?php _e('Neither - I will use the shortcode instead', 'maple-gdpr-cookies'); ?>
</label>
<div style="background: #f0f0f1; padding: 12px; border-left: 4px solid #2271b1; margin-top: 15px;">
<strong><?php _e('Shortcode Option:', 'maple-gdpr-cookies'); ?></strong>
<p style="margin: 5px 0;"><?php _e('You can also place a cookie preferences link anywhere using the shortcode:', 'maple-gdpr-cookies'); ?></p>
<code style="background: #fff; padding: 4px 8px; border-radius: 3px; display: inline-block; font-size: 13px;">[mgc_cookie_preferences]</code>
<p style="margin: 10px 0 5px 0; font-size: 13px;"><?php _e('Customize the text:', 'maple-gdpr-cookies'); ?></p>
<code style="background: #fff; padding: 4px 8px; border-radius: 3px; display: inline-block; font-size: 13px;">[mgc_cookie_preferences text="Manage Cookies"]</code>
<p style="margin: 10px 0 0 0; font-size: 12px; color: #666;"><?php _e('Perfect for adding to your footer widget, pages, or posts.', 'maple-gdpr-cookies'); ?></p>
</div>
</div>
</div>
</div>
<!-- Advanced Settings Panel -->
<div class="mgc-panel">
<div class="mgc-panel-header">
<h3><?php _e('Advanced Settings', 'maple-gdpr-cookies'); ?></h3>
</div>
<div class="mgc-panel-body">
<div class="mgc-form-row">
<label>
<input type="checkbox" name="mgc_enable_logging" value="1" <?php checked(get_option('mgc_enable_logging', true), true); ?>>
<?php _e('Enable Consent Logging', 'maple-gdpr-cookies'); ?>
</label>
<p class="description"><?php _e('Log all consent decisions for GDPR compliance.', 'maple-gdpr-cookies'); ?></p>
</div>
<div class="mgc-form-row">
<label>
<input type="checkbox" name="mgc_show_reject_button" value="1" <?php checked(get_option('mgc_show_reject_button', true), true); ?>>
<?php _e('Show Reject Button', 'maple-gdpr-cookies'); ?>
</label>
</div>
<div class="mgc-form-row">
<label>
<input type="checkbox" name="mgc_show_settings_button" value="1" <?php checked(get_option('mgc_show_settings_button', true), true); ?>>
<?php _e('Show Settings Button', 'maple-gdpr-cookies'); ?>
</label>
</div>
</div>
</div>
<div class="mgc-save-button">
<?php submit_button(__('Save Settings', 'maple-gdpr-cookies'), 'primary', 'mgc_save_settings'); ?>
</div>
</form>
</div>