PATH:
home
/
lab2454c
/
gemition.com
/
wp-content
/
themes
/
igpma
<?php /** * Template Name: Spot Price Test */ get_header(); ?> <div class="body__container__wrapp body__container__wrapp__inner "> <div class="container-fluid"> <div class="marquee"> <div class="marquee__content"> <?php $json_previous = file_get_contents('https://api.kyotounit.com/?action=get_co2_sector_emissions_previous'); $data_previous = json_decode($json_previous, TRUE); $json_latest = file_get_contents('https://api.kyotounit.com/?action=get_co2_sector_emissions_latest'); $data_latest = json_decode($json_latest, TRUE); $current_date = date("d") - 1; $previous_three = $current_date - 2; $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-' . $previous_three; $json_previous_three = file_get_contents($url); $data_previous_three = json_decode($json_previous_three, TRUE); $result = array(); echo '<ul class="list-inline">'; foreach ($data_latest as $what => $value) { $kyoto_unit_difference = number_format(($value['kyoto_unit'] - $data_previous[$what]['kyoto_unit']), 2); $sector_unit_difference = $value['sector_unit'] - $data_previous[$what]['sector_unit']; echo "<li> <span class='sector'>{$value['sector']}</span>"; if ($kyoto_unit_difference > 0) { echo " <span class='kyoto__unit'>{$value['kyoto_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/up.png' ></span>"; } elseif ($kyoto_unit_difference < 0) { echo " <span class='kyoto__unit'>{$value['kyoto_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/down.png'></span>"; } else { $kyoto_unit_difference_three = number_format(($value['kyoto_unit'] - $data_previous_three[$what]['kyoto_unit']), 2); if ($kyoto_unit_difference_three > 0) { echo " <span class='kyoto__unit'>{$value['kyoto_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/up.png' ></span>"; } elseif ($kyoto_unit_difference_three < 0) { echo " <span class='kyoto__unit'>{$value['kyoto_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/down.png' ></span>"; }else { echo "<span class='kyoto__unit'>{$value['kyoto_unit']}</span>"; } } if ($sector_unit_difference > 0) { echo " <span class='sector__unit'>{$value['sector_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/up.png'></i></span>"; } elseif ($sector_unit_difference < 0) { echo " <span class='sector__unit'>{$value['sector_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/down.png'></span>"; } else { $sector_unit_difference_three = $value['sector_unit'] - $data_previous_three[$what]['sector_unit']; if ($sector_unit_difference_three > 0) { echo " <span class='sector__unit'>{$value['sector_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/up.png' ></span>"; }elseif ($sector_unit_difference_three < 0) { echo " <span class='sector__unit'>{$value['sector_unit']}<img src='https://carbonbullion.com/wp-content/uploads/2022/09/down.png' ></span>"; } else { echo " <span class='sector__unit'>{$value['sector_unit']}</span>"; } } echo " </li>"; } echo '</ul>'; ?> </div> </div> </div> <div class="spot__price__main"> <!-- <div class="carbon__bullion__price__graph"> <div class="container-xl"> <div class="graph__inner"> <img src="<?php //the_field('price_image'); ?>" alt="" /> </div> </div> </div> --> <div class="carbon__bullion__price__graph"> <div class="container-xl"> <div class="graph__inner"> <div class="m-4 chart__graph"> <ul class="nav nav-tabs" id="myTab"> <li class="nav-item"> <a href="#energy" class="nav-link active" data-bs-toggle="tab">Energy</a> </li> <li class="nav-item"> <a href="#industrial" class="nav-link" data-bs-toggle="tab">Industrial</a> </li> <li class="nav-item"> <a href="#waste" class="nav-link" data-bs-toggle="tab">Waste</a> </li> <li class="nav-item"> <a href="#afolu" class="nav-link" data-bs-toggle="tab">AFOLU</a> </li> <li class="nav-item"> <a href="#transport" class="nav-link" data-bs-toggle="tab">Transport</a> </li> </ul> <div class="tab-content"> <div class="tab-pane fade show active" id="energy"> <?php $array_energy = []; function curl_test($url) { $cSession = curl_init(); //step2 curl_setopt($cSession, CURLOPT_URL, $url); curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); curl_setopt($cSession, CURLOPT_HEADER, false); //step3 $result = curl_exec($cSession); //step4 curl_close($cSession); //step5 return $result; } $current_date = date("d") - 1; $start_date = $current_date - 7; for ($i = $start_date; $i <= $current_date; $i++) { if ($i < 10) { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-0' . $i; } else { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-' . $i; } $data = json_decode(curl_test($url)); if ($data) { foreach ($data as $key => $value) { if ($value->sector == 'Energy') { $kyoto = $value->kyoto_unit; $date = date('M j', strtotime($value->date)); $arr_add = array('kyoto' => $kyoto, 'date' => $date); } } array_push($array_energy, $arr_add); } } ?> <canvas id='canvas_energy'></canvas> </div> <div class="tab-pane fade" id="industrial"> <?php $array_industrial = []; function curl_test1($url) { $cSession = curl_init(); //step2 curl_setopt($cSession, CURLOPT_URL, $url); curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); curl_setopt($cSession, CURLOPT_HEADER, false); //step3 $result = curl_exec($cSession); //step4 curl_close($cSession); //step5 return $result; } $current_date = date("d") - 1; $start_date = $current_date - 7; for ($i = $start_date; $i <= $current_date; $i++) { if ($i < 10) { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-0' . $i; } else { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-' . $i; } $data = json_decode(curl_test1($url)); if ($data) { foreach ($data as $key => $value) { if ($value->sector == 'Industrial processes') { $kyoto = $value->kyoto_unit; $date = date('M j', strtotime($value->date)); $arr_add = array('kyoto' => $kyoto, 'date' => $date); } } array_push($array_industrial, $arr_add); } } ?> <canvas id='canvas_industrial'></canvas> </div> <div class="tab-pane fade" id="waste"> <?php $array_waste = []; function curl_test2($url) { $cSession = curl_init(); //step2 curl_setopt($cSession, CURLOPT_URL, $url); curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); curl_setopt($cSession, CURLOPT_HEADER, false); //step3 $result = curl_exec($cSession); //step4 curl_close($cSession); //step5 return $result; } $current_date = date("d") - 1; $start_date = $current_date - 7; for ($i = $start_date; $i <= $current_date; $i++) { if ($i < 10) { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-0' . $i; } else { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-' . $i; } $data = json_decode(curl_test($url)); if ($data) { foreach ($data as $key => $value) { if ($value->sector == 'Waste') { $kyoto = $value->kyoto_unit; $date = date('M j', strtotime($value->date)); $arr_add = array('kyoto' => $kyoto, 'date' => $date); } } array_push($array_waste, $arr_add); } } ?> <canvas id='canvas_waste'></canvas> </div> <div class="tab-pane fade" id="afolu"> <?php $array_afolu = []; function curl_test3($url) { $cSession = curl_init(); //step2 curl_setopt($cSession, CURLOPT_URL, $url); curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); curl_setopt($cSession, CURLOPT_HEADER, false); //step3 $result = curl_exec($cSession); //step4 curl_close($cSession); //step5 return $result; } $current_date = date("d") - 1; $start_date = $current_date - 7; for ($i = $start_date; $i <= $current_date; $i++) { if ($i < 10) { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-0' . $i; } else { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-' . $i; } $data = json_decode(curl_test($url)); if ($data) { foreach ($data as $key => $value) { if ($value->sector == 'Agriculture, Forestry & Land Use (AFOLU)') { $kyoto = $value->kyoto_unit; $date = date('M j', strtotime($value->date)); $arr_add = array('kyoto' => $kyoto, 'date' => $date); } } array_push($array_afolu, $arr_add); } } ?> <canvas id='canvas_afolu'></canvas> </div> <div class="tab-pane fade" id="transport"> <?php $array_transport = []; function curl_test4($url) { $cSession = curl_init(); //step2 curl_setopt($cSession, CURLOPT_URL, $url); curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); curl_setopt($cSession, CURLOPT_HEADER, false); //step3 $result = curl_exec($cSession); //step4 curl_close($cSession); //step5 return $result; } $current_date = date("d") - 1; $start_date = $current_date - 7; for ($i = $start_date; $i <= $current_date; $i++) { if ($i < 10) { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-0' . $i; } else { $url = 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-' . $i; } $data = json_decode(curl_test($url)); if ($data) { foreach ($data as $key => $value) { if ($value->sector == 'Transport') { $kyoto = $value->kyoto_unit; $date = date('M j', strtotime($value->date)); $arr_add = array('kyoto' => $kyoto, 'date' => $date); } } array_push($array_transport, $arr_add); } } ?> <canvas id='canvas_transport'></canvas> </div> </div> </div> </div> </div> </div> <div class="world__curbon__price"> <div class="container-xl"> <?php if (get_field('carbon_price_heading')) : ?> <h3><?php the_field('carbon_price_heading'); ?></h3> <?php endif; ?> <?php if (have_rows('carbon_prices')) : ?> <ul> <?php while (have_rows('carbon_prices')) : the_row(); ?> <li><a href="link"><?php the_sub_field('price_name'); ?></a></li> <?php endwhile; ?> </ul> <?php endif; ?> </div> </div> <div class="product__wrapp"> <div class="product__list__main"> <div class="container-xl"> <div class="owl-carousel owl-theme products__wrapp"> <?php $j = 1; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'product', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => -1, 'taxonomy' => 'product_cat', 'paged' => $paged ); $products = new WP_Query($args); if ($products->have_posts()) : while ($products->have_posts()) : $products->the_post(); ?> <div class="item team__card"> <div class="product__item"> <div class="thumb__wrapper"> <a href="<?php the_permalink(); ?>"> <div class="image__box"> <?php if (has_post_thumbnail($products->post->ID)) echo get_the_post_thumbnail($products->post->ID, 'shop_catalog'); else echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />'; ?> </div> </a> <a href="<?php the_permalink(); ?>" class="loop__product__link"> <h3 class="product__title"><?php the_title(); ?></h3> </a> <div class="product__descraption"> <?php the_excerpt(); ?> </div> </div> </div> </div> <?php endwhile; endif; wp_reset_query(); ?> </div> </div> </div> </div> <?php if (have_rows('spot_about_section')) : while (have_rows('spot_about_section')) : the_row(); ?> <div class="two__col__full__wrapp"> <div class="container-xl"> <div class="inner__content__wrap"> <div class="inner__content__holder"> <div class="container-xl"> <div class="row align-items-center"> <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 order-xl-2 order-lg-2 order-md-2 order-sm-2"> <div class="image__box"> <img src="<?php the_sub_field('about_image'); ?>" alt="" /> </div> </div> <div class="col-xl-6 col-lg-6 col-md-6 col-sm-6"> <?php the_sub_field('about_spot_price'); ?> <?php the_sub_field('subscribe_form_shortcode'); ?> </div> </div> </div> </div> </div> </div> </div> <?php endwhile; endif; ?> </div> </div> <!-- </div> --> <script> var jsonfile_energy = { "jsonarray": <?php echo json_encode($array_energy); ?> } var data_energy = jsonfile_energy.jsonarray.map(function(e) { return e.kyoto; }); var labels_energy = jsonfile_energy.jsonarray.map(function(e) { return e.date; }); //var ctx = canvas.getContext('2d'); var ctx_energy = document.getElementById("canvas_energy").getContext("2d"); var config_energy = { type: 'line', data: { labels: labels_energy, datasets: [{ label: 'Graph Line', data: data_energy, backgroundColor: 'rgba(245, 226, 121, 1)' }] }, options: { scales: { yAxes: [{ position: 'right' }] } } }; var chart = new Chart(ctx_energy, config_energy); //// --------------- Industrial var jsonfile_industrial = { "jsonarray": <?php echo json_encode($array_industrial); ?> } var data_industrial = jsonfile_industrial.jsonarray.map(function(e) { return e.kyoto; }); var labels_industrial = jsonfile_industrial.jsonarray.map(function(e) { return e.date; }); //var ctx = canvas.getContext('2d'); var ctx_industrial = document.getElementById("canvas_industrial").getContext("2d"); var config_industrial = { type: 'line', data: { labels: labels_industrial, datasets: [{ label: 'Graph Line', data: data_industrial, backgroundColor: 'rgba(245, 226, 121, 1)' }] }, options: { scales: { yAxes: [{ position: 'right' }] } } }; var ctx_industrial = document.getElementById("canvas_industrial").getContext("2d"); var chart_industrial = new Chart(ctx_industrial, config_industrial); jQuery('a[href="#industrial"]').on('shown.bs.tab', function() { chart_industrial.update(); }); //// --------------- waste var jsonfile_waste = { "jsonarray": <?php echo json_encode($array_waste); ?> } var data_waste = jsonfile_waste.jsonarray.map(function(e) { return e.kyoto; }); var labels_waste = jsonfile_waste.jsonarray.map(function(e) { return e.date; }); //var ctx = canvas.getContext('2d'); var ctx_waste = document.getElementById("canvas_waste").getContext("2d"); var config_waste = { type: 'line', data: { labels: labels_waste, datasets: [{ label: 'Graph Line', data: data_waste, backgroundColor: 'rgba(245, 226, 121, 1)' }] }, options: { scales: { yAxes: [{ position: 'right' }] } } }; var ctx_waste = document.getElementById("canvas_waste").getContext("2d"); var chart_waste = new Chart(ctx_waste, config_waste); jQuery('a[href="#waste"]').on('shown.bs.tab', function() { chart_waste.update(); }); //// --------------- afolu var jsonfile_afolu = { "jsonarray": <?php echo json_encode($array_afolu); ?> } var data_afolu = jsonfile_afolu.jsonarray.map(function(e) { return e.kyoto; }); var labels_afolu = jsonfile_afolu.jsonarray.map(function(e) { return e.date; }); //var ctx = canvas.getContext('2d'); var ctx_afolu = document.getElementById("canvas_afolu").getContext("2d"); var config_afolu = { type: 'line', data: { labels: labels_afolu, datasets: [{ label: 'Graph Line', data: data_afolu, backgroundColor: 'rgba(245, 226, 121, 1)' }] }, options: { scales: { yAxes: [{ position: 'right' }] } } }; var ctx_afolu = document.getElementById("canvas_afolu").getContext("2d"); var chart_afolu = new Chart(ctx_afolu, config_afolu); jQuery('a[href="#afolu"]').on('shown.bs.tab', function() { chart_afolu.update(); }); //// --------------- transport var jsonfile_transport = { "jsonarray": <?php echo json_encode($array_transport); ?> } var data_transport = jsonfile_transport.jsonarray.map(function(e) { return e.kyoto; }); var labels_transport = jsonfile_transport.jsonarray.map(function(e) { return e.date; }); //var ctx = canvas.getContext('2d'); var ctx_transport = document.getElementById("canvas_transport").getContext("2d"); var config_transport = { type: 'line', data: { labels: labels_transport, datasets: [{ label: 'Graph Line', data: data_transport, backgroundColor: 'rgba(245, 226, 121, 1)' }] }, options: { scales: { yAxes: [{ position: 'right' }] } } }; var ctx_transport = document.getElementById("canvas_transport").getContext("2d"); var chart_transport = new Chart(ctx_transport, config_transport); jQuery('a[href="#transport"]').on('shown.bs.tab', function() { chart_transport.update(); }); </script> <?php get_footer(); ?>
[-] template-knowledge.php
[edit]
[+]
woocommerce
[-] template-option.php
[edit]
[-] template-othercomm.php
[edit]
[-] footer-widget.php
[edit]
[-] search.php
[edit]
[-] template-spot-price copy 1.php
[edit]
[-] index.php
[edit]
[-] page.php
[edit]
[-] searchform.php
[edit]
[+]
..
[-] template-faq.php
[edit]
[-] sidebar.php
[edit]
[-] template-sector.php
[edit]
[-] rtl.css
[edit]
[-] template-indexes.php
[edit]
[-] blank-page-with-container.php
[edit]
[-] template-globalgem.php
[edit]
[-] template-investment.php
[edit]
[-] single.php
[edit]
[-] footer.php
[edit]
[-] template-about.php
[edit]
[-] template-home.php
[edit]
[-] template-spot-price.php
[edit]
[-] .DS_Store
[edit]
[-] template-insight.php
[edit]
[-] template-partner.php
[edit]
[-] blank-page.php
[edit]
[-] left-sidebar.php
[edit]
[-] header.php
[edit]
[-] style.css
[edit]
[-] 404.php
[edit]
[-] readme.txt
[edit]
[-] template-spot-price copy 1.php.zip
[edit]
[-] single-attachment.php
[edit]
[-] woocommerce11.php
[edit]
[-] screenshot.png
[edit]
[-] template-stocks.php
[edit]
[-] custom-editor-style.css
[edit]
[-] functions.php
[edit]
[-] archive.php
[edit]
[-] fullwidth.php
[edit]
[+]
template-parts
[-] comments.php
[edit]
[-] template-sponsor.php
[edit]
[-] template-contact.php
[edit]
[+]
inc
[-] template-blog.php
[edit]