Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Page stats
- *
- * A custom page template without sidebar.
- *
- * The "Template Name:" bit above allows this to be selectable
- * from a dropdown menu on the edit page screen.
- *
- * @package WordPress
- * @subpackage Twenty_Ten
- * @since Twenty Ten 1.0
- */
- get_header(); ?>
- <!-- main content: primary + sidebar(s) -->
- <div id="main">
- <div id="main-inside" class="clear-block">
- <!-- primary content -->
- <div id="primary-content">
- <div class="blocks" style="margin:auto auto;">
- <?php do_action('mystique_before_primary'); ?>
- <?php
- $args=array(
- 'orderby' => 'name',
- 'order' => 'ASC'
- );
- $lien_stats_img="https://chart.googleapis.com/chart?";
- $type_charts="cht=p3";
- $taille_chart="chs=400x400";
- $data_chart="chd=t:";
- $nom_chart="chdl=";
- $categories=get_categories($args);
- foreach($categories as $category) {
- //echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
- //echo '<p> Description:'. $category->description . '</p>';
- //echo '<p> Post Count: '. $category->count . '</p>';
- $data_chart.=$category->count.',';
- $nom_chart.=$category->name.'|';
- }
- $data_chart=substr($data_chart, 0, -1);
- $nom_chart=substr($nom_chart, 0, -1);
- $lien_stats=$lien_stats_img.$type_charts."&".$taille_chart."&".$data_chart."&".$nom_chart."&chdlp=b";
- echo '<div align=center><img src="'.$lien_stats.'"></div>';
- ?>
- <?php
- //query_posts('showposts=60','&orderby=title&order=asc');
- query_posts( 'posts_per_page=-1'.'&orderby=title&order=asc');
- $tableau_pays=array();
- $tableau_pays_cpt=array();
- $lien_stats_img="https://chart.googleapis.com/chart?";
- $type_charts="cht=map:fixed=-60,-170,80,-175";
- $taille_chart="chs=600x350";
- $nom_chart="chld=";
- $data_chart="chd=t:";
- $legende_chart="chdl=";
- $titre_chart="chtt=Statistiques+par+Pays";
- $etiquette_charts='chm=';
- $couleur_chart="chco=";
- while ( have_posts() ) : the_post(); ?>
- <?php
- $values = get_post_custom_values("dvd_pays");
- //if (isset($values[0])) {}
- $pays="";
- if(strpos($values[0],"/") || strpos($values[0],",")) {
- if(strpos($values[0],"/")) $pays_tab=explode("/",$values[0]);
- if(strpos($values[0],",")) $pays_tab=explode(",",$values[0]);
- for($j=0;$j<count($pays_tab);$j++) {
- //$key=array_search(trim($pays[$j]),$tableau_pays);
- $pays="";
- if(strtolower(trim($pays_tab[$j]))=="france") $pays="FR";
- if(strtolower(trim($pays_tab[$j]))=="usa" || strtolower(trim($pays_tab[$j]))=="us" || strtolower(trim($pays_tab[$j]))=="etats-unis") $pays="US";
- if(strtolower(trim($pays_tab[$j]))=="allemagne") $pays="DE";
- if(strtolower(trim($pays_tab[$j]))=="australie") $pays="AU";
- if(strtolower(trim($pays_tab[$j]))=="irlande") $pays="IE";
- if(strtolower(trim($pays_tab[$j]))=="royaume-uni") $pays="GB";
- if(strtolower(trim($pays_tab[$j]))=="hong-kong") $pays="HK";
- if(strtolower(trim($pays_tab[$j]))=="japon") $pays="JP";
- if(strtolower(trim($pays_tab[$j]))=="italie") $pays="IT";
- if(strtolower(trim($pays_tab[$j]))=="espagne") $pays="ES";
- if(strtolower(trim($pays_tab[$j]))=="canada") $pays="CA";
- if(strtolower(trim($pays_tab[$j]))=="belgique") $pays="BE";
- if(strtolower(trim($pays_tab[$j]))=="nouvelle-zélande") $pays="NZ";
- //if(strlen($pays)<1) echo $pays_tab[$j]."<br>";
- $key=array_search($pays,$tableau_pays);
- if($key==false) {
- $i++;
- $tableau_pays[$i]=trim($pays);
- $tableau_pays_cpt[$i]=1;
- //echo "i : ".$i;
- } else {
- //ce genre est deja enregistré dans le tableau a l'index key
- $tableau_pays_cpt[$key]++;
- }
- }
- }else {
- //$key=array_search(trim($values[0]),$tableau_pays);
- if(strtolower(trim($values[0]))=="france") $pays="FR";
- if(strtolower(trim($values[0]))=="usa" || strtolower(trim($values[0]))=="us" || strtolower(trim($values[0]))=="etats-unis") $pays="US";
- if(strtolower(trim($values[0]))=="allemagne") $pays="DE";
- if(strtolower(trim($values[0]))=="australie") $pays="AU";
- if(strtolower(trim($values[0]))=="irlande") $pays="IE";
- if(strtolower(trim($values[0]))=="royaume-uni") $pays="GB";
- if(strtolower(trim($values[0]))=="hong-kong") $pays="HK";
- if(strtolower(trim($values[0]))=="japon") $pays="JP";
- if(strtolower(trim($values[0]))=="italie") $pays="IT";
- if(strtolower(trim($values[0]))=="espagne") $pays="ES";
- if(strtolower(trim($values[0]))=="canada") $pays="CA";
- if(strtolower(trim($values[0]))=="belgique") $pays="BE";
- if(strtolower(trim($values[0]))=="nouvelle-zélande") $pays="NZ";
- //if(strlen($pays)<1) echo $values[0]."<br>";
- $key=array_search(trim($pays),$tableau_pays);
- //echo $key;
- if($key==false) {
- $i++;
- $tableau_pays[$i]=$pays;
- $tableau_pays_cpt[$i]=1;
- //echo "i : ".$i;
- } else {
- //ce genre est deja enregistré dans le tableau a l'index key
- $tableau_pays_cpt[$key]++;
- }
- //echo $values[0].'<br>';
- }
- //$titre=get_the_title(get_the_ID());
- endwhile;
- //echo count($tableau_pays);
- for($j=1;$j<=count($tableau_pays);$j++) {
- //echo "<div class='cat '>".$tableau_pays[$j]."(".$tableau_pays_cpt[$j].")</div>";
- $data_chart.=$tableau_pays_cpt[$j].',';
- $nom_chart.=$tableau_pays[$j].'|';
- $index=$j-1;
- $etiquette_charts.="f".$tableau_pays[$j]."(".$tableau_pays_cpt[$j].")".',000000,0,'.$index.',10|';
- $legende_chart.=$tableau_pays[$j].'|';
- $a = DecHex(mt_rand(0,15)); $b = DecHex(mt_rand(0,15)); $c = DecHex(mt_rand(0,15)); $d = DecHex(mt_rand(0,15)); $e = DecHex(mt_rand(0,15)); $f = DecHex(mt_rand(0,15)); $hexac = $a . $b . $c . $d . $e . $f;
- $couleur_chart.=$hexac.'|';
- }
- $data_chart=substr($data_chart, 0, -1);
- $nom_chart=substr($nom_chart, 0, -1);
- $legende_chart=substr($legende_chart, 0, -1);
- $couleur_chart=substr($couleur_chart, 0, -1);
- $etiquette_charts=substr($etiquette_charts, 0, -1);
- $lien_stats=$lien_stats_img.$taille_chart."&".$type_charts."&".$nom_chart."&".$etiquette_charts."&".$legende_chart."&".$couleur_chart."&".$titre_chart."&chma=0,110,0,0";
- echo '<div align=center><img src="'.$lien_stats.'"></div>';
- ?>
- <?php do_action('mystique_after_primary'); ?>
- </div>
- </div>
- <!-- /primary content -->
- <?php get_sidebar(); ?>
- </div>
- </div>
- <!-- /main content -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement