Plugin Directory

Changeset 344056


Ignore:
Timestamp:
02/11/2011 02:35:41 PM (15 years ago)
Author:
burtadem
Message:
 
Location:
wordpress-title-cloud/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wordpress-title-cloud/trunk/readme.txt

    r344013 r344056  
    55Requires at least: 3.0
    66Tested up to: 3.0.5
    7 Stable tag: 0.9.1
     7Stable tag: 0.9.3
    88
    99Act as a tag cloud but instead of showing tag, it shows the title of pages.
     
    3232== Changelog ==
    3333
     34= 0.9.3=
     35*Adding Classes
     36*Lots of revisions
     37
    3438= 0.9.1 =
    3539*Fix Duplicated entries
  • wordpress-title-cloud/trunk/wp-titlecloud.php

    r344007 r344056  
    22/**
    33 * @package Wordpress Title Cloud
    4  * @version 0.9.1
     4 * @version 0.9.3
    55 */
    66/*
     
    99Description: An Idea of Displaying texts as tag cloud using your page titles.
    1010Author: Burt Adem
    11 Version: 0.9.1
     11Version: 0.9.3
    1212Author URI: http://burtadem.com/
    1313*/
    14 
    15 function cloud_visit($id){
    16     $visits=get_post_meta($id, "bezoekers",true);
    17     if($visits){
    18     if( $visits==0){
    19     }else{
    20         $visits++;
    21         update_post_meta($id, "bezoekers", $visits);
    22     }
    23     }else{
    24     add_post_meta($id, "bezoekers", 1);
    25     }
    26 }
     14include('wordpress-title-cloud.php'); 
     15$oTitleCloud = new wordpress_title_cloud();
    2716
    2817function wpttlcloud_headHook(){
    29  if(is_page()){ 
    30         global $post;
    31         cloud_visit($post->ID);
    32   }
     18 if(is_page()){global $post,$oTitleCloud;$oTitleCloud->cloud_visit($post->ID); }
    3319}
    3420add_action('wp_head', 'wpttlcloud_headHook');
    3521function cloud_rs(){
    36     global $wpdb;
    37     $aMin = $wpdb->get_row("SELECT MIN(meta_value) as min FROM $wpdb->postmeta WHERE meta_key ='bezoekers' and meta_value!='0'", ARRAY_A);
    38     $min=$aMin['min'];
    39     $oMax= $wpdb->get_results("SELECT meta_value as maxv FROM $wpdb->postmeta WHERE meta_key ='bezoekers'");
    40     $mx=1;
    41     foreach($oMax as $mItem){
    42         if(trim($mItem->maxv)>$mx){
    43 
    44             $mx=$mItem->maxv;
    45         }
    46     }
    47     $max=$mx;
    48  
    49     $querystr = "
    50         SELECT wposts.post_title as title,wposts.ID as ID,wpostmeta.meta_value as meta_value
    51         FROM $wpdb->posts wposts
    52         LEFT JOIN $wpdb->postmeta wpostmeta
    53         ON wposts.ID = wpostmeta.post_id
    54         WHERE wpostmeta.meta_key = 'bezoekers'
    55         AND wpostmeta.meta_value != '0'
    56         AND wposts.post_type = 'page'
    57         ORDER BY wposts.post_date DESC
    58         ";
    59 
    60         $pageposts = $wpdb->get_results($querystr, OBJECT);
    61          $r="";
    62         foreach($pageposts as $x){
    63             $f=$x->meta_value;
    64             $fontsize=12 * ($f/ $max) + 8;
    65             $r.="<a href='". get_permalink( $x->ID )."' style='font-size:{$fontsize}px' rel='{$x->ID}-{$f}' title='{$x->title}' >".$x->title."</a>, ";
    66         }
    67     echo "<div id=\"footer-cloud\">".substr($r,0,-2)."</div>";
     22    global $oTitleCloud;
     23    $oTitleCloud->show_cloud();
    6824
    6925}
    70     function titlecloud_admin() { 
    71      include('wp-titlecloudadmin.php'); 
    72     } 
    7326
    74    function tc_admin_actions() { 
    75         add_options_page("Wordpress Title Cloud", "Title Cloud", 1, "wp-titlecloudadmin", "titlecloud_admin"); 
    76     } 
    77      
    78    add_action('admin_menu', 'tc_admin_actions'); 
     27
     28function titlecloud_admin() { 
     29 include('wp-titlecloudadmin.php'); 
     30
     31
     32function tc_admin_actions() { 
     33    add_options_page("Wordpress Title Cloud", "Title Cloud", 1, "wp-titlecloudadmin", "titlecloud_admin"); 
     34
     35 
     36add_action('admin_menu', 'tc_admin_actions'); 
    7937
    8038$area=get_option('wp-titlecloud_area');
     
    8240add_action($area, 'cloud_rs');
    8341}
    84 
    85 
    86 
    87 function titlecloudy_css() {
    88     // This makes sure that the posinioning is also good for right-to-left languages
    89     $style=get_option('wp-titlecloud_style');
    90     echo "
    91     <style type='text/css'>
    92         $style
    93     </style>
    94     ";
     42function cloud_css(){
     43    global $oTitleCloud;
     44     $oTitleCloud->titlecloudy_css();
    9545}
    9646
    97 add_action('wp_head', 'titlecloudy_css');
     47add_action('wp_head','cloud_css');
    9848
    9949
  • wordpress-title-cloud/trunk/wp-titlecloudadmin.php

    r344000 r344056  
    22       if($_POST['txtHidden'] == 'Y') { 
    33           //Form data sent 
    4             $area = $_POST['ddlSelection']; 
    5             $stylings= $_POST['stylings']; 
     4            $area = $_POST['ddlSelection'];
     5            $excludes=$_POST['txtExcludes'];
     6           
     7           
     8             
     9            $aProperty=array();
     10           
     11            $aProperty['font']=$_POST['txtFont'];
     12            $aProperty['color']=$_POST['txtColor'];
     13            $aProperty['smallest']=$_POST['txtSmallest'];
     14            $aProperty['largest']=$_POST['txtLargest'];
     15           
    616            update_option('wp-titlecloud_area', $area);
    7            
    8             update_option('wp-titlecloud_style', $stylings);           
     17            update_option('wp-titlecloud_excludes', $excludes);
     18            update_option('wp-titlecloud_styles',json_encode($aProperty));
     19            $jdata=json_encode($aProperty);
     20            $oProperty=json_decode($jdata);                         
    921           ?> 
    1022           <div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div> 
     
    1325           //Normal page display 
    1426           $area=get_option('wp-titlecloud_area');
    15            $stylings=get_option('wp-titlecloud_style');
     27           $excludes=get_option('wp-titlecloud_excludes');
     28           $oProperty= json_decode(get_option('wp-titlecloud_styles'));
    1629       } 
    1730       
     
    2437       <form name="oscimp_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> 
    2538           <input type="hidden" name="txtHidden" value="Y"> 
    26            <?php    echo "<h4>" . __( 'OSCommerce Database Settings', 'titlecloud_admin' ) . "</h4>"; ?> 
     39           <?php    echo "<h4>" . __( 'wordpress Title Cloud Display Settings', 'titlecloud_admin' ) . "</h4>"; ?> 
    2740           <p>
    2841                select area to display:
     
    3043                <option value="none">None</option>
    3144                <option value="wp_footer"  <?php echo( $area=="wp_footer")?"selected='selected'":"" ?>>Footer</option>
    32                 </select>
     45                </select><br />
     46                select pages to exclude: <input type="text" name="txtExcludes" value="<?php echo $excludes ?>" size="30" /> (e.g  1,2,4)
    3347           </p> 
    3448           <p>
    3549           <h2>Style options</h2>               
    36             <textarea name="stylings" rows="10" cols="60"><?php echo $stylings;?></textarea>
     50            color : <input type="text" value="<?php echo $oProperty->color ?>" name="txtColor" /> e.g: blue, #cccccc, #000<br />
     51            font :
     52                    <select name="txtFont">
     53                    <option value="Verdana" <?php echo ($oProperty->font=='Verdana')?'selected':'' ?>>Verdana</option>
     54                    <option value="Arial" <?php echo ($oProperty->font=='Arial')?'selected':'' ?>>Arial</option>
     55                    </select>
     56                    <br />
     57                    Smallest font size : <input type="text" size="3" value="<?php echo $oProperty->smallest ?>" name="txtSmallest" /> px. <br />
     58                    Largest font size : <input type="text" size="3" value="<?php echo $oProperty->largest ?>" name="txtLargest" /> px. <br />
     59                    <br />                   
    3760           </p><p>
    3861           <input type="submit" name="Submit" value="<?php _e('Update Options', 'titlecloud_admin' ) ?>" />  </p>
Note: See TracChangeset for help on using the changeset viewer.