433de27d9b
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.
112 lines
3.4 KiB
PHP
112 lines
3.4 KiB
PHP
<?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'
|
|
));
|
|
}
|
|
}
|