3667b7a154
David's call after a short discussion about WordPress.org marketplace considerations. WP.org's trademark policy historically discourages plugins implying official endorsement via a "WP" prefix and has been known to request rename during submission review. Dropping it now makes the name cleaner AND sidesteps that future hurdle if/when the plugin lands on the marketplace. CHANGES All user-facing brand mentions: WP Logbook → Logbook across: - Plugin header (Plugin Name + docblock) - Admin menu top-level - Admin sidebar submenu label still "My Log" (already prefix-free) - Admin bar count menu - Dashboard widget title - Settings page H1 - Main page H1 - About page intro card + "What Logbook does" card heading - Email feedback subject + body intro - Legacy feedback.php subject lines - error_log() prefix [WP Logbook] → [Logbook] - Updater panel description text - styles.php docblock VERSION - wp-notes.php header Version: 3.3.0 → 3.3.1 - WP_NOTES_VERSION constant: 3.3.0 → 3.3.1 - About page version-history card gets new top entry for v3.3.1 with green "latest" pill; v3.3.0 demoted to previous entry - CHANGELOG header line tracks the full naming lineage now: A-WP-Notes (≤v3.1.0) → WP Logbook (v3.2.0-v3.3.0) → Logbook (v3.3.1+) NOTABLY NOT CHANGED - Historical CHANGELOG entries for v3.2.0 still say "WP Logbook" — that was the correct name at the time, rewriting would be revisionist. - Same zero-migration commitment: internal function names, constants, DB option keys, user_meta keys, file paths, plugin slug 'wp-notes', and text domain 'a-wp-notes' all unchanged. - Pure user-facing string change. No data migration, no behaviour change. Existing installs see "Logbook" appear on next page refresh. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 Logbook menu item
|
|
$wp_admin_bar->add_node(array(
|
|
'id' => 'wp-notes',
|
|
'title' => sprintf('Logbook <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'
|
|
));
|
|
}
|
|
}
|