Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
@ -1,4 +0,0 @@
|
|||||||
WordPress Admin Credentials:
|
|
||||||
URL: http://localhost/wp-admin
|
|
||||||
Username: admin
|
|
||||||
Password: PpYiO9qT2dFIXqmA
|
|
||||||
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 49 KiB |
@ -1,75 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Plugin Name: Construction Dashboard
|
|
||||||
* Description: Provides core functionality for the construction management dashboard, including custom post types for Projects and Site Logs, and the dark theme.
|
|
||||||
* Version: 1.0.0
|
|
||||||
* Author: Flatlogic AI Engineer
|
|
||||||
* License: GPL-2.0-or-later
|
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
* Text Domain: construction-dashboard
|
|
||||||
*/
|
|
||||||
|
|
||||||
// If this file is called directly, abort.
|
|
||||||
if ( ! defined( 'WPINC' ) ) {
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('init', function() {
|
|
||||||
register_post_type('project', [
|
|
||||||
'labels' => [
|
|
||||||
'name' => 'Projects',
|
|
||||||
'singular_name' => 'Project',
|
|
||||||
'add_new' => 'Add New Project',
|
|
||||||
'edit_item' => 'Edit Project',
|
|
||||||
],
|
|
||||||
'public' => true,
|
|
||||||
'show_in_rest' => true,
|
|
||||||
'menu_icon' => 'dashicons-hammer',
|
|
||||||
'supports' => ['title', 'editor', 'thumbnail', 'custom-fields'],
|
|
||||||
'has_archive' => true,
|
|
||||||
]);
|
|
||||||
|
|
||||||
register_post_type('site_log', [
|
|
||||||
'labels' => [
|
|
||||||
'name' => 'Site Logs',
|
|
||||||
'singular_name' => 'Site Log',
|
|
||||||
'add_new' => 'Add New Log',
|
|
||||||
'edit_item' => 'Edit Log',
|
|
||||||
],
|
|
||||||
'public' => true,
|
|
||||||
'show_in_rest' => true,
|
|
||||||
'menu_icon' => 'dashicons-camera',
|
|
||||||
'supports' => ['title', 'editor', 'thumbnail'],
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Inject Dark Theme Styles
|
|
||||||
add_action('wp_head', function() {
|
|
||||||
?>
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--wp--preset--color--background: #121212 !important;
|
|
||||||
--wp--preset--color--text: #e0e0e0 !important;
|
|
||||||
--wp--preset--color--primary: #ffd700 !important;
|
|
||||||
}
|
|
||||||
body { background-color: #121212 !important; color: #e0e0e0 !important; }
|
|
||||||
.wp-block-post-title, h1, h2, h3, .wp-block-heading { color: #ffd700 !important; }
|
|
||||||
.dashboard-widget {
|
|
||||||
background: #1e1e1e;
|
|
||||||
padding: 24px;
|
|
||||||
border-radius: 12px;
|
|
||||||
border: 1px solid #333;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0,0,0,0.3);
|
|
||||||
}
|
|
||||||
.dashboard-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
/* Sidebar Simulation / Header Styling */
|
|
||||||
header { border-bottom: 1px solid #333; margin-bottom: 40px; padding-bottom: 20px; }
|
|
||||||
.wp-block-navigation a { color: #ffd700 !important; }
|
|
||||||
</style>
|
|
||||||
<?php
|
|
||||||
});
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Plugin Name: Flatlogic URL Preserver
|
|
||||||
* Description: Automatically attaches fl_project to all links on the page.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
||||||
|
|
||||||
// Function to fetch the ID once per request
|
|
||||||
function fl_get_env_project_id() {
|
|
||||||
static $cached_id = null;
|
|
||||||
if ($cached_id !== null) return $cached_id;
|
|
||||||
|
|
||||||
$cached_id = getenv('PROJECT_ID');
|
|
||||||
|
|
||||||
if (!$cached_id) {
|
|
||||||
$envPath = ABSPATH . '../.env';
|
|
||||||
if (file_exists($envPath)) {
|
|
||||||
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
|
||||||
foreach ($lines as $line) {
|
|
||||||
if (strpos(trim($line), 'PROJECT_ID=') === 0) {
|
|
||||||
$cached_id = trim(str_replace('PROJECT_ID=', '', $line), "\"' ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $cached_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The core function to modify the URL
|
|
||||||
function fl_append_project_param( $url ) {
|
|
||||||
$pid = fl_get_env_project_id();
|
|
||||||
if ( ! $pid || empty( $url ) || strpos( $url, '#' ) === 0 ) {
|
|
||||||
return $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only append if it's an internal link
|
|
||||||
if ( strpos( $url, home_url() ) === 0 || ( strpos( $url, '/' ) === 0 && strpos( $url, '//' ) !== 0 ) ) {
|
|
||||||
return add_query_arg( 'fl_project', $pid, $url );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply to all link filters
|
|
||||||
$filters = [
|
|
||||||
'post_link', 'page_link', 'post_type_link',
|
|
||||||
'term_link', 'attachment_link',
|
|
||||||
'author_link', 'category_link', 'tag_link'
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ( $filters as $f ) {
|
|
||||||
add_filter( $f, 'fl_append_project_param' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Special case: Navigation Menus
|
|
||||||
add_filter( 'nav_menu_link_attributes', function( $atts ) {
|
|
||||||
if ( isset( $atts['href'] ) ) {
|
|
||||||
$atts['href'] = fl_append_project_param( $atts['href'] );
|
|
||||||
}
|
|
||||||
return $atts;
|
|
||||||
}, 10, 1 );
|
|
||||||