chore: archive A-WP-Notes v3.0.2 — minimalist parallel fork

Imports the v3.0.2 line of A-WP-Notes as it existed on M5 at:
  Local Sites/wordpress/public/wp-content/plugins/a-wp-notes/

This is a deliberately minimal parallel fork of the plugin, distinct
from the v1.2.0 line in ranger/a-wp-notes. It carries only the core
note-taking functionality:

  wp-notes.php                       — plugin bootstrap + admin UI
  inc/wp-notes-display.php           — note rendering
  inc/wp-notes-about.php             — About page
  inc/wp-notes-feedback.php          — feedback module
  inc/wp-notes-styles.php            — style enqueues
  inc/wp-notes-updater.php           — self-hosted updater stub
  inc/admin-bar.php                  — admin bar integration
  js/wp-notes-feedback.js            — feedback front-end
  js/Chart.js                        — charting (bundled)
  assets/wp-notes-banner.jpg         — plugin banner

The AI ecosystem (chat, personalities, MCP), speed-test system, OS info
pages, and the bulk of the v1.2.0 / v2.0.x feature surface are
intentionally absent — this fork was created by copying the plugin to a
second WP install and trimming back to a lighter baseline.

Archived for comparison and parallel-line testing. No further development
is planned on this line; the active line continues at v1.2.0 in
ranger/a-wp-notes.
This commit is contained in:
2026-05-22 16:43:03 +01:00
commit 433de27d9b
11 changed files with 2733 additions and 0 deletions
+111
View File
@@ -0,0 +1,111 @@
<?php
// inc/admin-bar.php
if (!defined('ABSPATH')) {
exit;
}
// Add admin bar styles
add_action('admin_head', 'wp_notes_admin_bar_styles');
add_action('wp_head', 'wp_notes_admin_bar_styles');
function wp_notes_admin_bar_styles() {
?>
<style>
#wp-admin-bar-wp-notes .count {
display: inline-block;
padding: 1px 6px;
border-radius: 9px;
background-color: #ca4a1f;
color: #fff;
font-size: 11px;
line-height: 1.6;
margin-left: 5px;
vertical-align: middle;
}
</style>
<?php
}
add_action('wp_admin_bar_menu', 'wp_notes_admin_bar_menu', 10);
/**
* Adds items to the WordPress admin bar.
* Uses standard WordPress capabilities
*/
function wp_notes_admin_bar_menu($wp_admin_bar) {
// Use standard WordPress capabilities
if (current_user_can('edit_posts')) {
// Get note count
$notes = get_option('wp_notes', array());
$count = count($notes);
// Main WP Notes menu item
$wp_admin_bar->add_node(array(
'id' => 'wp-notes',
'title' => sprintf('WP Notes <span class="count">%d</span>', $count),
'href' => admin_url('admin.php?page=wp-notes'),
));
// Add New Note submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-new-note',
'title' => 'New Note',
'href' => admin_url('admin.php?page=wp-notes#new-note'),
'parent' => 'wp-notes'
));
}
// Add About submenu
if (current_user_can('manage_options')) {
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-about',
'title' => 'About',
'href' => admin_url('admin.php?page=wp-notes-about'),
'parent' => 'wp-notes'
));
// Add Settings submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-settings',
'title' => 'Settings',
'href' => admin_url('admin.php?page=wp-notes-settings'),
'parent' => 'wp-notes',
));
}
// Add Import/Export submenu (for admins)
if (current_user_can('manage_options')) {
$export_url = add_query_arg('action', 'export', admin_url('admin.php?page=wp-notes'));
$export_nonce_url = wp_nonce_url($export_url, 'wp_notes_export_action', 'wp_notes_export_nonce');
// Add export submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-export',
'title' => 'Export Notes',
'href' => $export_nonce_url,
'parent' => 'wp-notes'
));
// Add import submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-import',
'title' => 'Import Notes',
'href' => add_query_arg('section', 'import', admin_url('admin.php?page=wp-notes')),
'parent' => 'wp-notes'
));
}
// Add update check for admins
if (current_user_can('manage_options')) {
$update_check_url = add_query_arg('check_update', '1', admin_url('admin.php?page=wp-notes'));
$update_check_nonce_url = wp_nonce_url($update_check_url, 'wp_notes_check_update_action', 'wp_notes_check_update_nonce');
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-update',
'title' => 'Check Updates',
'href' => $update_check_nonce_url,
'parent' => 'wp-notes'
));
}
}
+216
View File
@@ -0,0 +1,216 @@
<?php
// wp-notes-about.php
/**
* Function to display the "About" page for WP Notes plugin.
*/
function wp_notes_about_page() {
?>
<div class="wrap" style="display: flex; gap: 20px;">
<!-- Left Section: About Content (70%) -->
<div style="flex: 0 0 70%;">
<h1>Welcome to WP Notes About Page v <?php echo esc_html(WP_NOTES_VERSION); ?></h1>
<div class="wp-notes-welcome" style="background: #fff; padding: 20px; margin: 20px 0; border: 1px solid #ccc;">
<p>WP Notes is your task management solution for WordPress. Keep track of your todos, collaborate with team members, and never lose important notes.</p>
<div id="header" style="display: none; margin-top: 10px;">
</div>
</div>
<style>
/* Hides most plugin notices */
.notice, .updated, .error {
display: none !important;
}
</style>
<!-- About and Versions Section -->
<h1>About WP Notes v <?php echo esc_html(WP_NOTES_VERSION); ?></h1>
<div class="wp-notes-welcome" style="background: #fff; padding: 20px; margin: 20px 0; border: 1px solid #ccc;">
<button onclick="toggleSection('about-section')" style="background: #0073aa; color: #fff; border: none; padding: 8px 12px; cursor: pointer;">
Toggle About Section
</button>
<div id="about-section" style="margin-top: 10px; display: none;">
<!-- Content for About and Versions -->
<h2>About WP Notes</h2>
<p>
Thank you for using WP Notes! This plugin helps you manage your WordPress tasks and notes efficiently.
Keep track of your todo's, mark them as complete, and export your data for safekeeping. I made this
plugin for my website to log my daily tasks and notes as a logbook for my clients, so they can see the work
done by me or you and so PAY, as every task is important and the customers need to know what I've done.
</p>
<ul>
<li>Log all your tasks and jobs so prove work is being done.</li>
<li>As you can see, this plugin is very flexible and can be used for a wide range of WordPress users.</li>
<li>I hope you find it useful too.</li>
</ul>
<h1>What WP Notes Offers</h1>
<p>WP Notes is a versatile plugin that caters to a wide range of users:</p>
<p>We're excited to offer our plugin to our customers.</p>
<p>WP Notes is a versatile plugin that caters to a wide range of users:</p>
<p>We have several features for you to choose from:</p>
<ul>
<li><strong>Freelancers and site developers</strong> tracking work done on client sites.</li>
<li><strong>Teams</strong> wanting to document changes or keep a changelog in the dashboard.</li>
<li><strong>WordPress power users</strong> wanting a straightforward dashboard notes system.</li>
<li><strong>Small businesses</strong> needing a simple task management solution for WordPress.</li>
<li><strong>Students</strong> wanting to keep track of their daily tasks to prove work is being done.</li>
<li><strong>Teachers</strong> wanting to keep track of their students' progress with Email Notifications.</li>
</ul>
<p>
<li><strong>If you have any questions or feedback</strong>, feel free to reach out to us. Enjoy your note-taking experience!</li>
</p>
<p>
<li><strong>Join our community</strong> and unlock the full potential of WP Notes.</li>
</p>
</div>
</div>
<p>
<!-- About and Versions Section -->
<h1>Version History v <?php echo esc_html(WP_NOTES_VERSION); ?></h1>
<div class="wp-notes-versions" style="background: #fff; padding: 20px; margin: 20px 0; border: 1px solid #ccc;">
<button onclick="toggleSection('version-section')" style="background: #0073aa; color: #fff; border: none; padding: 8px 12px; cursor: pointer;">
Toggle Version Section
</button>
<div id="version-section" style="margin-top: 10px; display: none;">
<h3>Version 2.0.3 (Current)</h3>
<ul>
<li>Added Error Logging: Introduced a comprehensive error logging system to capture plugin-related errors. The logs are now viewable within the admin bar for easy troubleshooting.</li>
<li>Added Welcome Section and Version history</li>
<li>Added Image to main menu</li>
<li>Edit Function is now working</li>
<li>Popup notification with "Saved" status added</li>
<li>Error controls incorporated into code for stability</li>
<li>Enhanced `wp-config.php` for error capturing</li>
<li>Ability to restore older notes</li>
<li>Displays "Created by," "Modified by," and "Edited by" fields</li>
<li>Improved task-tracking feature with a dashboard interface</li>
<li>Added color, font, and size customization for notes</li>
<li>Added edit and mark-as-done functions</li>
<li>AJAX-based updates for smoother note editing</li>
<li>Added Create WP Note into Tools in admin bar</li>
<li>Added Create WP Note into Wp-Notes in admin bar</li>
<li>Added Activity Chart for activity tracking in admin bar Still needs Work</li>
</ul>
<div class="wp-notes-header" style="margin-bottom: 30px;">
<img src="<?php echo esc_url(WP_NOTES_URL); ?>assets/wp-notes-banner.jpg"
style="max-width: 1200px; width: 100%; height: auto; margin-bottom: 20px;"
alt="WP Notes Banner">
</div>
<p>
<h3>Version 2.0.4 (New) Additions</h3>
<ul>
<li>Ability to Export and Import Notes from a JSON file or a CSV file</li>
<li>Email notification when a note is marked as complete</li>
<li>Email the Notes Owner when a note is marked as complete</li>
<li>Email the current user's email when a note is created</li>
<li>Email notification when a note is edited</li>
<li>Enhanced `wp-config.php` for error capturing</li>
<li>Ability to close sections such as What's New, Version 2.0.3, and the Welcome Section</li>
<li>Welcome popup message to greet users</li>
<li>A page for ChatGPT API support, including other options like Claude-API</li>
<li>Add Emoji Support and icons</li>
</ul>
<h3>Version 2.0.2</h3>
<ul>
<li>Added user attribution for notes</li>
<li>Enhanced timestamp functionality</li>
<li>Added email export option</li>
<li>Improved dashboard widget synchronization</li>
<li>Added welcome section and version history</li>
</ul>
<h3>Version 2.0.1</h3>
<ul>
<li>Enhanced admin bar integration</li>
<li>Added timestamp to notes</li>
<li>Improved data preservation</li>
</ul>
<h3>Version 2.0.0</h3>
<ul>
<li>Initial release with basic note functionality</li>
<li>Dashboard widget integration</li>
<li>Note styling options</li>
</ul>
<br>
<!-- Buy Me a Coffee Button -->
<a href="https://www.buymeacoffee.com/davidkeanek" target="_blank">
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=davidkeanek&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" alt="Buy me a coffee">
</a>
</div>
</div>
</div>
<!-- Right Section: Feedback Box (30%) -->
<div style="flex: 0 0 30%; padding: 20px; border: 1px solid #ddd; background: #f9f9f9;">
<h2>Leave Feedback</h2>
<!-- Social Buttons -->
<button style="background-color: black; color: white; padding: 10px 20px; border: none; margin: 5px; border-radius: 5px; cursor: pointer;">
✖️ Post
</button>
<button style="background-color: #FF0000; color: white; padding: 10px 20px; border: none; margin: 5px; border-radius: 5px; cursor: pointer;">
🔴 YouTube 1K
</button>
<a href="https://github.com/davidtkeane/wp-notes" target="_blank" style="text-decoration: none;">
<button style="background-color: #24292e; color: white; padding: 10px 20px; border: none; margin: 5px; border-radius: 5px; cursor: pointer;">
🐙 GitHub
</button>
</a>
<!-- Feedback Options -->
<form id="wp-notes-feedback-options" style="margin-top: 20px;">
<label><input type="radio" name="feedback" value="improve"> I have ideas to improve this plugin</label><br>
<label><input type="radio" name="feedback" value="help"> I need help with this plugin</label><br>
<input type="submit" value="Submit Feedback" style="background: #0073aa; color: #fff; border: none; padding: 8px 12px; cursor: pointer; margin-top: 10px;">
</form>
<br>
<!-- Buy Me a Coffee Button -->
<a href="https://www.buymeacoffee.com/davidkeanek" target="_blank">
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=davidkeanek&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" alt="Buy me a coffee">
</a>
<br>
</div>
</div>
<!-- JavaScript to toggle About section -->
<script>
/**
* Function to toggle the display of a section.
* @param {string} sectionId - The ID of the section to toggle.
*/
function toggleSection(sectionId) {
var section = document.getElementById(sectionId);
if (section) {
if (section.style.display === "none") {
section.style.display = "block";
} else {
section.style.display = "none";
}
} else {
console.error("Element with ID " + sectionId + " not found.");
}
}
// JavaScript to handle feedback form toggling
document.getElementById('wp-notes-feedback-options').addEventListener('submit', function(e) {
e.preventDefault();
var feedbackType = document.querySelector('input[name="feedback"]:checked').value;
if (feedbackType === 'improve') {
toggleSection('feedback-form-improve');
} else if (feedbackType === 'help') {
toggleSection('feedback-form-help');
}
});
</script>
<?php
}
?>
+117
View File
@@ -0,0 +1,117 @@
<?php
// inc/wp-notes-display.php
if (!defined('ABSPATH')) {
exit;
}
/**
* Display notes list with consistent styling and functionality
*
* @param string $type Either 'active' or 'completed'
* @return void
*/
function wp_notes_display_notes($type = 'active') {
// Get notes and validate user permissions
if (!current_user_can('edit_posts')) {
return;
}
$notes = ($type === 'active') ? get_option('wp_notes', array()) : get_option('wp_done_notes', array());
$page_anchor = ($type === 'active') ? '#active-notes' : '#completed-notes';
$section_title = ($type === 'active') ? 'Active Notes' : 'Completed Notes';
if (empty($notes)) {
echo '<div class="wp-notes-empty notice notice-info">';
echo '<p>' . esc_html__('No ' . ($type === 'active' ? 'active' : 'completed') . ' notes found.', 'a-wp-notes') . '</p>';
echo '</div>';
return;
}
// Section header with status count
$status_class = ($type === 'active') ? 'status-active' : 'status-completed';
echo '<div class="wp-notes-section">';
echo '<h2 class="wp-notes-section-title">';
echo '<span class="' . $status_class . '">' . esc_html($section_title) . '</span>';
echo '<span class="note-count">(' . count($notes) . ')</span>';
echo '</h2>';
echo '<div class="wp-notes-list" id="' . esc_attr($type . '-notes') . '">';
echo '<table class="wp-list-table widefat fixed striped has-hover">';
echo '<thead><tr>';
echo '<th scope="col" class="manage-column column-cb check-column">';
echo '<input type="checkbox" id="select-all-' . esc_attr($type) . '" />';
echo '</th>';
echo '<th scope="col" class="manage-column column-primary">' . esc_html__('Note', 'a-wp-notes') . '</th>';
echo '<th scope="col" class="manage-column">' . esc_html__('Author', 'a-wp-notes') . '</th>';
echo '<th scope="col" class="manage-column">' . esc_html__('Created', 'a-wp-notes') . '</th>';
if ($type === 'completed') {
echo '<th scope="col" class="manage-column">' . esc_html__('Completed By', 'a-wp-notes') . '</th>';
echo '<th scope="col" class="manage-column">' . esc_html__('Completed On', 'a-wp-notes') . '</th>';
}
echo '<th scope="col" class="manage-column">' . esc_html__('Actions', 'a-wp-notes') . '</th>';
echo '</tr></thead><tbody>';
foreach ($notes as $key => $note) {
$text = esc_html($note['text']);
$color = esc_attr($note['color'] ?? '#000000');
$size = esc_attr($note['size'] ?? '14');
$font = esc_attr($note['font'] ?? 'Arial');
$timestamp = esc_html($note['timestamp'] ?? current_time('mysql'));
$author = esc_html($note['author_name'] ?? 'Unknown');
echo '<tr>';
echo '<td><input type="checkbox" name="note_ids[]" value="' . esc_attr($key) . '" class="note-checkbox" /></td>';
echo '<td style="color: ' . $color . '; font-size: ' . $size . 'px; font-family: ' . $font . ';">' . $text . '</td>';
echo '<td>' . $author . '</td>';
echo '<td>' . $timestamp . '</td>';
if ($type === 'completed') {
echo '<td>' . esc_html($note['completed_by'] ?? 'Unknown') . '</td>';
echo '<td>' . esc_html($note['completed_on'] ?? 'Unknown') . '</td>';
}
echo '<td class="actions">';
if ($type === 'active') {
echo '<button type="button" class="button edit-note" data-note-id="' . esc_attr($key) . '">' .
esc_html__('Edit', 'a-wp-notes') . '</button> ';
echo '<form method="post" style="display:inline;">';
echo '<input type="hidden" name="note_id" value="' . esc_attr($key) . '">';
echo '<button type="submit" name="mark_done" class="button">' .
esc_html__('Mark as Done', 'a-wp-notes') . '</button>';
echo '</form>';
} else {
echo '<form method="post" style="display:inline;">';
echo '<input type="hidden" name="note_id" value="' . esc_attr($key) . '">';
echo '<button type="submit" name="restore_note" class="button">' .
esc_html__('Restore', 'a-wp-notes') . '</button>';
echo '</form>';
}
echo '</td></tr>';
// Edit form (for active notes only)
if ($type === 'active') {
echo '<tr id="edit-note-' . esc_attr($key) . '" style="display:none;"><td colspan="6">';
echo '<form class="edit-note-form" data-note-id="' . esc_attr($key) . '">';
wp_nonce_field('wp_notes_nonce', '_wpnonce');
echo '<input type="hidden" name="note_id" value="' . esc_attr($key) . '">';
echo '<textarea name="new_text" class="large-text">' . esc_textarea($text) . '</textarea><br>';
echo '<div class="formatting-options">';
echo '<input type="color" name="edit_color" value="' . esc_attr($color) . '">';
echo '<input type="number" name="edit_size" value="' . esc_attr($size) . '" min="8" max="72">';
echo '<select name="edit_font">';
echo '<option value="Arial" ' . selected('Arial', $font, false) . '>Arial</option>';
echo '<option value="Helvetica" ' . selected('Helvetica', $font, false) . '>Helvetica</option>';
echo '<option value="Times New Roman" ' . selected('Times New Roman', $font, false) . '>Times New Roman</option>';
echo '<option value="Verdana" ' . selected('Verdana', $font, false) . '>Verdana</option>';
echo '</select>';
echo '</div>';
echo '<button type="submit" class="button button-primary">' . esc_html__('Save', 'a-wp-notes') . '</button>';
echo '<button type="button" class="button cancel-edit">' . esc_html__('Cancel', 'a-wp-notes') . '</button>';
echo '</form>';
echo '</td></tr>';
}
}
echo '</tbody></table></div>';
}
+161
View File
@@ -0,0 +1,161 @@
<?php
/**
* Feedback Form for WP Notes Plugin
*
* This file contains the HTML and AJAX handling for the feedback form.
*/
// Enqueue Feedback Form Script
function wp_notes_enqueue_feedback_script() {
wp_enqueue_script('wp-notes-feedback', WP_NOTES_URL . 'js/wp-notes-feedback.js', array('jquery'), null, true);
wp_localize_script('wp-notes-feedback', 'wp_notes_feedback_vars', array(
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('wp_notes_feedback_nonce')
));
}
add_action('admin_enqueue_scripts', 'wp_notes_enqueue_feedback_script');
// Feedback Form HTML
function wp_notes_feedback_form() {
?>
<div id="feedback-form-improve" style="display: none;">
<h2>Leave Feedback</h2>
<form id="wp-notes-feedback-form" method="post">
<label for="feedback_name">Your Name:</label><br>
<input type="text" id="feedback_name" name="feedback_name" required><br><br>
<label for="feedback_email">Your Email:</label><br>
<input type="email" id="feedback_email" name="feedback_email" required><br><br>
<label for="feedback_message">Your Feedback:</label><br>
<textarea id="feedback_message" name="feedback_message" rows="5" required></textarea><br><br>
<input type="submit" value="Submit Feedback" class="button button-primary">
</form>
</div>
<div id="feedback-form-help" style="display: none;">
<h2>Need Help?</h2>
<form id="wp-notes-help-form" method="post">
<label for="help_name">Your Name:</label><br>
<input type="text" id="help_name" name="help_name" required><br><br>
<label for="help_email">Your Email:</label><br>
<input type="email" id="help_email" name="help_email" required><br><br>
<label for="help_message">Your Message:</label><br>
<textarea id="help_message" name="help_message" rows="5" required></textarea><br><br>
<input type="submit" value="Submit Help Request" class="button button-primary">
</form>
</div>
<?php
}
// Handle Feedback Form Submission
function wp_notes_submit_feedback() {
// 1. Nonce Check (already good)
if (!check_ajax_referer('wp_notes_feedback_nonce', 'nonce', false)) {
wp_send_json_error('Invalid nonce.');
return;
}
// 2. Capability Check (e.g., any logged-in user can submit feedback)
if (!current_user_can('read')) { // 'read' is a basic capability for any logged-in user
wp_send_json_error('You do not have permission to submit feedback.', 403);
return;
}
// Validate required fields
$required_fields = ['feedback_name', 'feedback_email', 'feedback_message'];
foreach ($required_fields as $field) {
if (!isset($_POST[$field]) || empty($_POST[$field])) {
wp_send_json_error("Missing required field: $field");
return;
}
}
// 3. Sanitize and validate data (already good)
$name = sanitize_text_field($_POST['feedback_name']);
$email = sanitize_email($_POST['feedback_email']);
$message = sanitize_textarea_field($_POST['feedback_message']);
// Save feedback to database or send via email
$feedback = array(
'name' => $name,
'email' => $email,
'message' => $message,
'timestamp' => current_time('mysql')
);
// Example: Save feedback to an option
$feedbacks = get_option('wp_notes_feedbacks', array());
$feedbacks[] = $feedback;
update_option('wp_notes_feedbacks', $feedbacks);
// Example: Send feedback via email
$to = 'david@icanhelp.ie';
$subject = 'WP Notes Feedback';
$body = "Name: $name\nEmail: $email\nMessage: $message";
$headers = array('Content-Type: text/plain; charset=UTF-8');
wp_mail($to, $subject, $body, $headers);
wp_send_json_success('Feedback submitted successfully.');
}
add_action('wp_ajax_wp_notes_submit_feedback', 'wp_notes_submit_feedback');
// Handle Help Form Submission
function wp_notes_submit_help() {
// 1. Nonce Check (already good)
if (!check_ajax_referer('wp_notes_feedback_nonce', 'nonce', false)) {
wp_send_json_error('Invalid nonce.');
return;
}
// 2. Capability Check (e.g., any logged-in user can request help)
if (!current_user_can('read')) { // 'read' is a basic capability for any logged-in user
wp_send_json_error('You do not have permission to submit a help request.', 403);
return;
}
// Validate required fields
$required_fields = ['help_name', 'help_email', 'help_message'];
foreach ($required_fields as $field) {
if (!isset($_POST[$field]) || empty($_POST[$field])) {
wp_send_json_error("Missing required field: $field");
return;
}
}
// 3. Sanitize and validate data (already good)
$name = sanitize_text_field($_POST['help_name']);
$email = sanitize_email($_POST['help_email']);
$message = sanitize_textarea_field($_POST['help_message']);
// Save help request to database or send via email
$help_request = array(
'name' => $name,
'email' => $email,
'message' => $message,
'timestamp' => current_time('mysql')
);
// Example: Save help request to an option
$help_requests = get_option('wp_notes_help_requests', array());
$help_requests[] = $help_request;
update_option('wp_notes_help_requests', $help_requests);
// Example: Send help request via email
$to = 'david@icanhelp.ie';
$subject = 'WP Notes Help Request';
$body = "Name: $name\nEmail: $email\nMessage: $message";
$headers = array('Content-Type: text/plain; charset=UTF-8');
wp_mail($to, $subject, $body, $headers);
wp_send_json_success('Help request submitted successfully.');
}
add_action('wp_ajax_wp_notes_submit_help', 'wp_notes_submit_help');
?>
+213
View File
@@ -0,0 +1,213 @@
<?php
// inc/wp-notes-styles.php
if (!defined('ABSPATH')) {
exit;
}
/**
* Add required styles for WP Notes
*/
function wp_notes_admin_styles() {
?>
<style>
/* Notes List Container */
.wp-notes-active,
.wp-notes-completed {
margin: 20px 0;
}
/* Section Headers */
.wp-notes-section {
margin-bottom: 2em;
}
.wp-notes-section-title {
display: flex;
align-items: center;
gap: 10px;
color: #23282d;
font-size: 1.3em;
margin: 1.5em 0 1em;
padding-bottom: 0.5em;
border-bottom: 1px solid #ccd0d4;
}
/* Status Indicators */
.status-active,
.status-completed {
padding: 4px 8px;
border-radius: 4px;
font-size: 0.9em;
font-weight: normal;
}
.status-active {
background: #e5f5fa;
color: #0071a1;
}
.status-completed {
background: #dff0d8;
color: #3c763d;
}
.note-count {
color: #666;
font-size: 0.8em;
font-weight: normal;
}
/* Note Items */
.wp-notes-list table {
border-spacing: 0;
width: 100%;
margin-bottom: 2em;
border: 1px solid #ccd0d4;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
border-radius: 4px;
}
/* Table Hover Effects */
.wp-notes-list table.has-hover tr:hover td {
background-color: #f8f9fa;
}
/* Table Header */
.wp-notes-list th {
font-weight: 600;
text-align: left;
padding: 8px 10px;
}
/* Table Cells */
.wp-notes-list td {
padding: 12px 10px;
vertical-align: top;
}
/* Actions Column */
.wp-notes-list .column-actions {
text-align: right;
white-space: nowrap;
}
/* Edit Form */
.wp-notes-edit-form {
background: #f8f9fa;
padding: 15px;
border: 1px solid #e2e4e7;
border-radius: 4px;
margin-top: 10px;
}
/* Form Fields */
.wp-notes-formatting {
display: flex;
gap: 15px;
flex-wrap: wrap;
align-items: center;
margin: 10px 0;
padding: 12px;
background: #f8f9fa;
border-radius: 4px;
border: 1px solid #e2e4e7;
}
.wp-notes-formatting input[type="color"] {
padding: 0;
width: 40px;
height: 30px;
border: 1px solid #ddd;
}
.wp-notes-formatting input[type="number"] {
width: 70px;
}
.wp-notes-formatting select {
min-width: 120px;
}
.format-option {
display: flex;
align-items: center;
gap: 5px;
}
/* Emoji Picker */
.emoji-picker-container {
position: relative;
display: inline-block;
}
.emoji-picker-dropdown {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
background: white;
border: 1px solid #ccd0d4;
border-radius: 4px;
padding: 10px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.emoji-list {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 5px;
}
.emoji-option {
font-size: 20px;
padding: 5px;
cursor: pointer;
background: none;
border: none;
border-radius: 4px;
transition: background-color 0.2s;
}
.emoji-option:hover {
background-color: #f0f0f1;
}
/* Note Status Indicators */
.note-status {
display: inline-block;
padding: 2px 8px;
border-radius: 12px;
font-size: 12px;
line-height: 1.4;
}
.note-status-active {
background: #e5f5fa;
color: #0071a1;
}
.note-status-completed {
background: #dff0d8;
color: #3c763d;
}
/* Responsive Design */
@media screen and (max-width: 782px) {
.wp-notes-formatting {
flex-direction: column;
align-items: flex-start;
}
.wp-notes-list td {
padding: 8px 10px;
}
.column-actions {
text-align: left;
}
}
</style>
<?php
}
add_action('admin_head', 'wp_notes_admin_styles');
+51
View File
@@ -0,0 +1,51 @@
<?php
// Add this to your main plugin file
require plugin_dir_path(__FILE__) . 'vendor/plugin-update-checker/plugin-update-checker.php';
// Include update checker - Assuming the 'vendor' directory is at the plugin root
// WP_NOTES_PATH is defined in your main plugin file (wp-notes.php)
// and points to the plugin's root directory.
require WP_NOTES_PATH . 'vendor/plugin-update-checker/plugin-update-checker.php';
function wp_notes_setup_updater() {
if (!class_exists('YahnisElsts\PluginUpdateChecker\v5\PucFactory')) {
return;
}
$myUpdateChecker = YahnisElsts\PluginUpdateChecker\v5\PucFactory::buildUpdateChecker(
'https://github.com/your-username/wp-notes/', // Change this to your GitHub repository
__FILE__,
'wp-notes'
);
// Optional: Set the branch that contains the stable release
$myUpdateChecker->setBranch('main');
}
add_action('init', 'wp_notes_setup_updater');
// Add update checking functionality
function wp_notes_check_for_updates() {
// Check if the 'check_update' GET parameter is set and the user has the capability to manage plugin options.
if (isset($_GET['check_update']) && $_GET['check_update'] === '1' && current_user_can('manage_a_wp_notes_options')) {
// Verify the nonce. The nonce name 'a_wp_notes_check_update_nonce' and action 'a_wp_notes_check_update_action'
// should match what's generated in admin-bar.php.
if (!isset($_GET['a_wp_notes_check_update_nonce']) || !wp_verify_nonce(sanitize_key($_GET['a_wp_notes_check_update_nonce']), 'a_wp_notes_check_update_action')) {
wp_die('Nonce verification failed!', 'Error', array('response' => 403));
}
// Trigger a manual update check
wp_clean_plugins_cache();
wp_update_plugins();
add_settings_error(
'wp_notes',
'update_check',
'Update check completed.',
'updated'
);
}
}
add_action('admin_init', 'wp_notes_check_for_updates');
// Note: For the PucFactory::buildUpdateChecker, the second argument `__FILE__` currently refers to
// `wp-notes-updater.php`. For the library to work correctly, this should typically be the path
// to your main plugin file (e.g., `WP_PLUGIN_DIR . '/a-wp-notes/a-wp-notes.php'`).
// This is a setup detail for the update checker rather than a direct security fix from this review.