| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/konzalta/www/data-visualization/wp-content/plugins/budget-mtaani/includes/ |
Upload File : |
<?php
if (!defined('ABSPATH')) {
exit;
}
function budget_mtaani_overview_shortcode() {
budget_mtaani_enqueue();
$overview = budget_mtaani_load_json('overview.json');
ob_start();
?>
<section class="bm-section bm-overview bm-mtaani-hero">
<div class="bm-kicker">Budget Mtaani</div>
<h2>Budget ya Kenya 2025/26, kwa lugha ya kawaida</h2>
<p class="bm-lede">Hapa tunageuza maneno magumu ya budget kuwa maswali ya maisha: chakula, shule, matibabu, barabara, county yako na ushuru wa mfukoni.</p>
<div class="bm-note"><strong>Swali kuu:</strong> Hii pesa inanihusu aje?</div>
<div class="bm-card-grid">
<?php foreach ($overview as $item): ?>
<article class="bm-card bm-big-card">
<span class="bm-label"><?php echo esc_html($item['label']); ?></span>
<strong><?php echo esc_html($item['value']); ?></strong>
<p><?php echo esc_html($item['story']); ?></p>
</article>
<?php endforeach; ?>
</div>
</section>
<?php
return ob_get_clean();
}
add_shortcode('budget_mtaani_overview', 'budget_mtaani_overview_shortcode');
function budget_mtaani_simple_mode_shortcode() {
budget_mtaani_enqueue();
$allocations = budget_mtaani_load_json('allocations.json');
ob_start();
?>
<section class="bm-section">
<div class="bm-kicker">Simple Mode</div>
<h2>Budget kwa lugha ya mtaa</h2>
<p class="bm-lede">Badala ya kuanza na jargon, tunaanza na maisha ya kawaida. Kila kadi inaonyesha eneo la maisha, pesa iliyotengwa, na swali la mwananchi.</p>
<div class="bm-life-grid">
<?php foreach ($allocations as $item): ?>
<article class="bm-life-card">
<div class="bm-icon"><?php echo esc_html($item['icon'] ?? '💰'); ?></div>
<div>
<span class="bm-label"><?php echo esc_html($item['label']); ?></span>
<h3><?php echo esc_html($item['simple_title'] ?? $item['label']); ?></h3>
<strong><?php echo esc_html('Ksh ' . $item['ksh_billion'] . 'B'); ?></strong>
<p><?php echo esc_html($item['plain_explanation'] ?? $item['story']); ?></p>
<p class="bm-question">Swali: <?php echo esc_html($item['citizen_question'] ?? $item['question']); ?></p>
</div>
</article>
<?php endforeach; ?>
</div>
</section>
<?php
return ob_get_clean();
}
add_shortcode('budget_mtaani_simple_mode', 'budget_mtaani_simple_mode_shortcode');
function budget_mtaani_ksh100_shortcode() {
budget_mtaani_enqueue();
return '<section class="bm-section"><div class="bm-kicker">Ksh 100 note</div><h2>Kama budget yote ingekuwa Ksh 100...</h2><p class="bm-lede">Billions ni nyingi sana kuelewa haraka. Hapa tunapunguza budget yote iwe kama noti ya Ksh 100 ili kila mtu aone pesa inaenda wapi.</p><div class="bm-chart-wrap"><canvas id="bmKsh100Chart"></canvas></div><div id="bmKsh100Legend" class="bm-legend"></div></section>';
}
add_shortcode('budget_mtaani_ksh100', 'budget_mtaani_ksh100_shortcode');
function budget_mtaani_ksh100_plain_shortcode() {
budget_mtaani_enqueue();
return '<section class="bm-section"><div class="bm-kicker">Plain Ksh 100</div><h2>Ksh 100 inaenda wapi?</h2><p class="bm-lede">Toleo rahisi la kushare WhatsApp: kila mstari unaonyesha takriban shilingi ngapi kati ya Ksh 100 zinaenda kwa eneo fulani.</p><div id="bmKsh100Plain" class="bm-ksh100-plain"></div></section>';
}
add_shortcode('budget_mtaani_ksh100_plain', 'budget_mtaani_ksh100_plain_shortcode');
function budget_mtaani_allocations_shortcode() {
budget_mtaani_enqueue();
return '<section class="bm-section"><div class="bm-kicker">Pesa inaenda wapi?</div><h2>Maeneo yanayopewa pesa nyingi zaidi</h2><p class="bm-lede">Hii chart inaonyesha maeneo makubwa ya matumizi, lakini majibu muhimu ni yale ya kawaida: shule, afya, county, barabara, chakula na mikopo.</p><div class="bm-chart-wrap bm-tall"><canvas id="bmAllocationsChart"></canvas></div></section>';
}
add_shortcode('budget_mtaani_allocations', 'budget_mtaani_allocations_shortcode');
function budget_mtaani_story_cards_shortcode() {
budget_mtaani_enqueue();
$stories = budget_mtaani_load_json('stories.json');
ob_start();
?>
<section class="bm-section">
<div class="bm-kicker">Story Cards</div>
<h2>Budget kwa macho ya mwananchi</h2>
<p class="bm-lede">Hizi ni hadithi fupi za kuonyesha vile budget inaweza kugusa maisha ya watu wa kawaida.</p>
<div class="bm-story-grid">
<?php foreach ($stories as $story): ?>
<article class="bm-story-card">
<div class="bm-avatar"><?php echo esc_html($story['icon']); ?></div>
<h3><?php echo esc_html($story['persona']); ?></h3>
<p><?php echo esc_html($story['story']); ?></p>
<div class="bm-tags">
<?php foreach ($story['touchpoints'] as $tag): ?>
<span><?php echo esc_html($tag); ?></span>
<?php endforeach; ?>
</div>
<p class="bm-question"><?php echo esc_html($story['question']); ?></p>
<button class="bm-copy" type="button" data-copy="<?php echo esc_attr($story['whatsapp_summary']); ?>">Copy WhatsApp summary</button>
</article>
<?php endforeach; ?>
</div>
</section>
<?php
return ob_get_clean();
}
add_shortcode('budget_mtaani_story_cards', 'budget_mtaani_story_cards_shortcode');
function budget_mtaani_pocket_impact_shortcode() {
budget_mtaani_enqueue();
return '<section class="bm-section"><div class="bm-kicker">Mfuko wa Mwananchi</div><h2>Ni nini inaweza kugusa mfuko wako?</h2><p class="bm-lede">Chagua eneo la maisha uone budget inasema nini kwa lugha rahisi.</p><div id="bmPocketImpact" class="bm-pocket-grid"></div></section>';
}
add_shortcode('budget_mtaani_pocket_impact', 'budget_mtaani_pocket_impact_shortcode');
function budget_mtaani_county_explorer_shortcode() {
budget_mtaani_enqueue();
return '<section class="bm-section"><div class="bm-kicker">County yako</div><h2>County yako imepata ngapi?</h2><p class="bm-lede">Tafuta county yako uone mgao wake wa equitable share na nafasi yake ukilinganisha na counties zingine.</p><input class="bm-search" id="bmCountySearch" type="search" placeholder="Andika county, mfano: Mombasa"><div id="bmCountyResult" class="bm-county-result"></div><div class="bm-table-wrap"><table class="bm-table" id="bmCountyTable"><thead><tr><th>County</th><th>Pesa</th><th>Rank</th></tr></thead><tbody></tbody></table></div></section>';
}
add_shortcode('budget_mtaani_counties', 'budget_mtaani_county_explorer_shortcode');
function budget_mtaani_county_card_shortcode($atts) {
budget_mtaani_enqueue();
$atts = shortcode_atts(['county' => ''], $atts, 'budget_mtaani_county_card');
return '<section class="bm-section bm-mini-section"><div class="bm-kicker">County Card</div><div id="bmCountyCard" data-county="' . esc_attr($atts['county']) . '"></div></section>';
}
add_shortcode('budget_mtaani_county_card', 'budget_mtaani_county_card_shortcode');
function budget_mtaani_tax_shortcode() {
budget_mtaani_enqueue();
return '<section class="bm-section"><div class="bm-kicker">Ushuru</div><h2>Ushuru mpya kwa lugha rahisi</h2><p class="bm-lede">Hii si legal advice. Ni tafsiri rahisi ya tax measures ili mwananchi ajue ni nini kinaweza kugusa biashara, mshahara, bidhaa au huduma za digital.</p><div id="bmTaxMeasures" class="bm-tax-list"></div></section>';
}
add_shortcode('budget_mtaani_tax_measures', 'budget_mtaani_tax_shortcode');