Changeset 344056
- Timestamp:
- 02/11/2011 02:35:41 PM (15 years ago)
- Location:
- wordpress-title-cloud/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (2 diffs)
-
wp-titlecloud.php (modified) (3 diffs)
-
wp-titlecloudadmin.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wordpress-title-cloud/trunk/readme.txt
r344013 r344056 5 5 Requires at least: 3.0 6 6 Tested up to: 3.0.5 7 Stable tag: 0.9. 17 Stable tag: 0.9.3 8 8 9 9 Act as a tag cloud but instead of showing tag, it shows the title of pages. … … 32 32 == Changelog == 33 33 34 = 0.9.3= 35 *Adding Classes 36 *Lots of revisions 37 34 38 = 0.9.1 = 35 39 *Fix Duplicated entries -
wordpress-title-cloud/trunk/wp-titlecloud.php
r344007 r344056 2 2 /** 3 3 * @package Wordpress Title Cloud 4 * @version 0.9. 14 * @version 0.9.3 5 5 */ 6 6 /* … … 9 9 Description: An Idea of Displaying texts as tag cloud using your page titles. 10 10 Author: Burt Adem 11 Version: 0.9. 111 Version: 0.9.3 12 12 Author URI: http://burtadem.com/ 13 13 */ 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 } 14 include('wordpress-title-cloud.php'); 15 $oTitleCloud = new wordpress_title_cloud(); 27 16 28 17 function 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); } 33 19 } 34 20 add_action('wp_head', 'wpttlcloud_headHook'); 35 21 function 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(); 68 24 69 25 } 70 function titlecloud_admin() {71 include('wp-titlecloudadmin.php');72 }73 26 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 28 function titlecloud_admin() { 29 include('wp-titlecloudadmin.php'); 30 } 31 32 function tc_admin_actions() { 33 add_options_page("Wordpress Title Cloud", "Title Cloud", 1, "wp-titlecloudadmin", "titlecloud_admin"); 34 } 35 36 add_action('admin_menu', 'tc_admin_actions'); 79 37 80 38 $area=get_option('wp-titlecloud_area'); … … 82 40 add_action($area, 'cloud_rs'); 83 41 } 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 "; 42 function cloud_css(){ 43 global $oTitleCloud; 44 $oTitleCloud->titlecloudy_css(); 95 45 } 96 46 97 add_action('wp_head', 'titlecloudy_css');47 add_action('wp_head','cloud_css'); 98 48 99 49 -
wordpress-title-cloud/trunk/wp-titlecloudadmin.php
r344000 r344056 2 2 if($_POST['txtHidden'] == 'Y') { 3 3 //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 6 16 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); 9 21 ?> 10 22 <div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div> … … 13 25 //Normal page display 14 26 $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')); 16 29 } 17 30 … … 24 37 <form name="oscimp_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> 25 38 <input type="hidden" name="txtHidden" value="Y"> 26 <?php echo "<h4>" . __( ' OSCommerce DatabaseSettings', 'titlecloud_admin' ) . "</h4>"; ?>39 <?php echo "<h4>" . __( 'wordpress Title Cloud Display Settings', 'titlecloud_admin' ) . "</h4>"; ?> 27 40 <p> 28 41 select area to display: … … 30 43 <option value="none">None</option> 31 44 <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) 33 47 </p> 34 48 <p> 35 49 <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 /> 37 60 </p><p> 38 61 <input type="submit" name="Submit" value="<?php _e('Update Options', 'titlecloud_admin' ) ?>" /> </p>
Note: See TracChangeset
for help on using the changeset viewer.