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
+17 -17
View File
@@ -3,9 +3,9 @@ if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function mystat_yearly_summary_page() {
function statpress_yearly_summary_page() {
global $wpdb;
$table_activities = $wpdb->prefix . 'mystat_activities';
$table_activities = $wpdb->prefix . 'statpress_activities';
$current_year = isset( $_GET['year'] ) ? intval( $_GET['year'] ) : current_time( 'Y' );
@@ -16,7 +16,7 @@ function mystat_yearly_summary_page() {
}
// --- GOALS SECTION ---
$table_goals = $wpdb->prefix . 'mystat_goals';
$table_goals = $wpdb->prefix . 'statpress_goals';
$goals_for_year = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM {$table_goals} WHERE year = %d ORDER BY name ASC",
@@ -103,8 +103,8 @@ function mystat_yearly_summary_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-chart-loader', false );
wp_enqueue_script( 'mystat-chart-loader' );
wp_register_script( 'statpress-chart-loader', false );
wp_enqueue_script( 'statpress-chart-loader' );
$chart_configs = array(
'distance' => array(
@@ -138,7 +138,7 @@ function mystat_yearly_summary_page() {
);
wp_add_inline_script(
'mystat-chart-loader',
'statpress-chart-loader',
'
document.addEventListener("DOMContentLoaded", function() {
const chartLabels = ' . json_encode( $chart_labels_js ) . ';
@@ -162,7 +162,7 @@ function mystat_yearly_summary_page() {
activeChart.destroy();
}
const config = chartConfigs[type];
const ctx = document.getElementById("mystatYearlyChart").getContext("2d");
const ctx = document.getElementById("statpressYearlyChart").getContext("2d");
activeChart = new Chart(ctx, {
type: "bar",
data: {
@@ -198,7 +198,7 @@ function mystat_yearly_summary_page() {
<div class="alignleft actions">
<label for="filter-by-year" class="screen-reader-text">Filtruj według roku</label>
<form method="get" style="display: flex; gap: 5px; align-items: center;">
<input type="hidden" name="page" value="mystat-yearly-summary">
<input type="hidden" name="page" value="statpress-yearly-summary">
<select name="year" id="filter-by-year">
<?php foreach ( $available_years as $year_option ) : ?>
<option value="<?php echo esc_attr( $year_option ); ?>" <?php selected( $current_year, $year_option ); ?>><?php echo esc_html( $year_option ); ?></option>
@@ -213,10 +213,10 @@ function mystat_yearly_summary_page() {
<div class="postbox" style="margin-bottom: 20px;">
<div class="postbox-header"><h2 class="hndle">Cele na <?php echo esc_html( $current_year ); ?></h2></div>
<div class="inside">
<ul class="mystat-goals-list">
<ul class="statpress-goals-list">
<?php
foreach ( $goals_for_year as $goal ) :
$progress = mystat_get_goal_progress( $goal );
$progress = statpress_get_goal_progress( $goal );
$percentage = min( 100, $progress['percentage'] );
$target_formatted = '';
@@ -232,13 +232,13 @@ function mystat_yearly_summary_page() {
$current_formatted = (int) $progress['current_value'];
}
?>
<li class="mystat-goal-item">
<div class="mystat-goal-info">
<li class="statpress-goal-item">
<div class="statpress-goal-info">
<strong><?php echo esc_html( $goal->name ); ?></strong>
<small><?php echo $current_formatted; ?> / <?php echo $target_formatted; ?> (<?php echo round( $percentage, 1 ); ?>%)</small>
</div>
<div class="mystat-progress-bar-container">
<div class="mystat-progress-bar" style="width: <?php echo esc_attr( $percentage ); ?>%;"></div>
<div class="statpress-progress-bar-container">
<div class="statpress-progress-bar" style="width: <?php echo esc_attr( $percentage ); ?>%;"></div>
</div>
</li>
<?php endforeach; ?>
@@ -246,8 +246,8 @@ function mystat_yearly_summary_page() {
</div>
</div>
<style>
.mystat-goals-list { list-style: none; margin: 0; padding: 0; } .mystat-goal-item { margin-bottom: 15px; } .mystat-goal-info { display: flex; justify-content: space-between; margin-bottom: 5px; }
.mystat-progress-bar-container { background: #eee; border-radius: 4px; height: 18px; width: 100%; overflow: hidden; } .mystat-progress-bar { background: #3498db; height: 100%; border-radius: 4px; transition: width 0.5s ease-in-out; text-align: center; color: white; font-size: 11px; line-height: 18px; }
.statpress-goals-list { list-style: none; margin: 0; padding: 0; } .statpress-goal-item { margin-bottom: 15px; } .statpress-goal-info { display: flex; justify-content: space-between; margin-bottom: 5px; }
.statpress-progress-bar-container { background: #eee; border-radius: 4px; height: 18px; width: 100%; overflow: hidden; } .statpress-progress-bar { background: #3498db; height: 100%; border-radius: 4px; transition: width 0.5s ease-in-out; text-align: center; color: white; font-size: 11px; line-height: 18px; }
</style>
<?php endif; ?>
@@ -261,7 +261,7 @@ function mystat_yearly_summary_page() {
<a href="#activities" class="nav-tab">Aktywności</a>
</nav>
<div style="position: relative; height:40vh; width:100%;">
<canvas id="mystatYearlyChart"></canvas>
<canvas id="statpressYearlyChart"></canvas>
</div>
</div>
</div>