Plugin rename

This commit is contained in:
2026-02-12 22:34:54 +01:00
parent 0e5be7b590
commit d303a55638
16 changed files with 279 additions and 282 deletions
+19 -19
View File
@@ -3,10 +3,10 @@ if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function mystat_infographic_page() {
function statpress_infographic_page() {
global $wpdb;
$table_activities = $wpdb->prefix . 'mystat_activities';
$table_categories = $wpdb->prefix . 'mystat_categories';
$table_activities = $wpdb->prefix . 'statpress_activities';
$table_categories = $wpdb->prefix . 'statpress_categories';
$current_year = isset( $_GET['year'] ) ? intval( $_GET['year'] ) : current_time( 'Y' );
@@ -71,13 +71,13 @@ function mystat_infographic_page() {
// Włączenie skryptów dla Chart.js
wp_enqueue_script( 'chart-js', 'https://cdn.jsdelivr.net/npm/chart.js', array(), null, true );
wp_register_script( 'mystat-infographic-chart-loader', false );
wp_enqueue_script( 'mystat-infographic-chart-loader' );
wp_register_script( 'statpress-infographic-chart-loader', false );
wp_enqueue_script( 'statpress-infographic-chart-loader' );
wp_add_inline_script(
'mystat-infographic-chart-loader',
'statpress-infographic-chart-loader',
'
document.addEventListener("DOMContentLoaded", function() {
const ctx = document.getElementById("mystatCategoryPieChart");
const ctx = document.getElementById("statpressCategoryPieChart");
if (!ctx) return;
new Chart(ctx, {
type: "pie",
@@ -114,7 +114,7 @@ function mystat_infographic_page() {
<div class="tablenav top">
<div class="alignleft actions">
<form method="get" style="display: flex; gap: 5px; align-items: center;">
<input type="hidden" name="page" value="mystat-infographic">
<input type="hidden" name="page" value="statpress-infographic">
<label for="filter-by-year" class="screen-reader-text">Filtruj według roku</label>
<select name="year" id="filter-by-year">
<?php foreach ( $available_years as $year_option ) : ?>
@@ -128,21 +128,21 @@ function mystat_infographic_page() {
<div class="postbox" style="margin-bottom: 20px;">
<div class="postbox-header"><h2 class="hndle">Statystyki Ogólne (wszystkie lata)</h2></div>
<div class="inside mystat-infographic-grid">
<div class="mystat-infographic-card"><h3>Dystans</h3><p><?php echo number_format( $overall_stats->total_distance, 2, ',', ' ' ); ?> km</p></div>
<div class="mystat-infographic-card"><h3>Czas</h3><p><?php echo esc_html( $overall_stats->total_duration ); ?></p></div>
<div class="mystat-infographic-card"><h3>Wznios</h3><p><?php echo number_format( $overall_stats->total_elevation_gain, 0, ',', ' ' ); ?> m</p></div>
<div class="mystat-infographic-card"><h3>Aktywności</h3><p><?php echo number_format( $overall_stats->total_activities, 0, ',', ' ' ); ?></p></div>
<div class="inside statpress-infographic-grid">
<div class="statpress-infographic-card"><h3>Dystans</h3><p><?php echo number_format( $overall_stats->total_distance, 2, ',', ' ' ); ?> km</p></div>
<div class="statpress-infographic-card"><h3>Czas</h3><p><?php echo esc_html( $overall_stats->total_duration ); ?></p></div>
<div class="statpress-infographic-card"><h3>Wznios</h3><p><?php echo number_format( $overall_stats->total_elevation_gain, 0, ',', ' ' ); ?> m</p></div>
<div class="statpress-infographic-card"><h3>Aktywności</h3><p><?php echo number_format( $overall_stats->total_activities, 0, ',', ' ' ); ?></p></div>
</div>
</div>
<div class="postbox" style="margin-bottom: 20px;">
<div class="postbox-header"><h2 class="hndle">Statystyki dla <?php echo esc_html( $current_year ); ?></h2></div>
<div class="inside mystat-infographic-grid">
<div class="mystat-infographic-card"><h3>Dystans</h3><p><?php echo number_format( $yearly_stats->total_distance, 2, ',', ' ' ); ?> km</p></div>
<div class="mystat-infographic-card"><h3>Czas</h3><p><?php echo esc_html( $yearly_stats->total_duration ); ?></p></div>
<div class="mystat-infographic-card"><h3>Wznios</h3><p><?php echo number_format( $yearly_stats->total_elevation_gain, 0, ',', ' ' ); ?> m</p></div>
<div class="mystat-infographic-card"><h3>Aktywności</h3><p><?php echo number_format( $yearly_stats->total_activities, 0, ',', ' ' ); ?></p></div>
<div class="inside statpress-infographic-grid">
<div class="statpress-infographic-card"><h3>Dystans</h3><p><?php echo number_format( $yearly_stats->total_distance, 2, ',', ' ' ); ?> km</p></div>
<div class="statpress-infographic-card"><h3>Czas</h3><p><?php echo esc_html( $yearly_stats->total_duration ); ?></p></div>
<div class="statpress-infographic-card"><h3>Wznios</h3><p><?php echo number_format( $yearly_stats->total_elevation_gain, 0, ',', ' ' ); ?> m</p></div>
<div class="statpress-infographic-card"><h3>Aktywności</h3><p><?php echo number_format( $yearly_stats->total_activities, 0, ',', ' ' ); ?></p></div>
</div>
</div>
@@ -150,7 +150,7 @@ function mystat_infographic_page() {
<div class="postbox-header"><h2 class="hndle">Rozkład Dystansu wg Kategorii w <?php echo esc_html( $current_year ); ?></h2></div>
<div class="inside">
<div style="position: relative; height:40vh; width:100%; max-width: 600px; margin: 0 auto;">
<canvas id="mystatCategoryPieChart"></canvas>
<canvas id="statpressCategoryPieChart"></canvas>
</div>
</div>
</div>