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:
@@ -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>';
|
||||
}
|
||||
Reference in New Issue
Block a user