Plugin Directory

Changeset 380802


Ignore:
Timestamp:
05/04/2011 03:26:20 PM (15 years ago)
Author:
Billyben
Message:
 
Location:
billyben-rings/trunk
Files:
8 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • billyben-rings/trunk/BillyBenRing/BillyBenRing.php

    r377905 r380802  
    33Plugin Name: BillyBenRing
    44Plugin URI: http://www.etherocliquecite.eu
    5 Description: BillyBenRing for my own personnal link/cat/bm
     5Description: BillyBenRing display your links, tag and/or categories by a circlar sideBar widget, with full or arrowed circles. Fully customizable.
    66Author: Billyben
    7 Version: 1
     7Version: 2.1.1
    88Author URI: http://asblog.etherocliquecite.eu
    99*/
    1010
    1111/* inclu les utilitaires */
    12 include("elm/utilsClasse.php");//fct util
    13 include("elm/WPMenuBBR.php");//description du menu
     12include_once("elm/utilsClasse.php");//fct util
     13include_once("elm/bbr_widget_class.php");//la classe du widget
     14include_once("elm/bbr_bd_manager.php");// les fonction de gestion de la bd
     15include_once("elm/bbr_options_class.php");// les fonction de gestion de la bd
     16
     17// les variables globales
     18$bbr_new_version = '2.1.1';
     19if (!defined('BBR_VERSION_KEY'))define('BBR_VERSION_KEY', 'bbr_version');
     20if (!defined('BBR_VERSION_NUM'))define('BBR_VERSION_NUM', $bbr_new_version);
     21if (!defined('BBR_TEXT_DOMAIN'))define('BBR_TEXT_DOMAIN', 'bbr_widget_text');
     22// on met à jour la table selon la version
     23function bbr_check_version(){
     24    global $bbr_new_version;
     25    if (!get_option('bbr_version') ||(get_option('bbr_version') != $bbr_new_version&&get_option('bbr_version') !="2.1.0")) {
     26        //bbr_create_database_table();
     27        bbr_fill_table_with_older_version();
     28        add_option('bbr_version', $bbr_new_version);
     29    }
     30}
     31function bbr_create_option_page(){
     32    $page=new bbr_Theme_Options(); 
     33
     34}
     35//
    1436function bbr_install () {
     37    bbr_check_version();
    1538    $options=get_option('bbr_options');
    1639    $options= bbr_init_options($options);
    17     add_option('bbr_options', $options);   
     40    update_option('bbr_options', $options);
    1841}
    1942function bbr_uninstall(){
    20     delete_option('bbr_options');
    21 }
    22  
    23 function bbr_get_FlashCode()
    24 {
    25   // pour le swfObjet
    26   $options=get_option('bbr_options');
    27   $wSize=$options['width'];
    28   $hSize=$options['height'];
    29   $path=get_bloginfo('wpurl')."/wp-content/plugins/BillyBenRing/" ;
    30   // creation des flash var
    31   $flashVar['ringSize']=$options['ringSize'];
    32   $flashVar['firstRingSize']=$options['firstRingSize'];
    33   $flashVar['transparent']=$options['transparent'];
    34   if(!$options['transparent'])$flashVar['bgColor']=$options['bgColor'];
    35   $flashVar['txtOffColor']= $options['txtOffColor'];
    36   $flashVar['txtOnColor']= $options['txtOnColor'];
    37   $flashVar['overGlowColor']= $options['overGlowColor'];
    38   $flashVar['deltaRing']= $options['deltaRing'];
    39   $flashVar['RingCrop']= $options['RingCrop'];
    40   $flashVar['startAlign']=$options['startAlign'];
    41   $flashVar['xmlString']=bbr_getXML_String();
    42   $flashVar['startAngle']=$options['startAngle'];
    43   $flashVar['decalAngle']=$options['decalAngle'];
    44   $flashVar['textAlign']= $options['textAlign'];
    45   // le code html
    46   $flashHTML="";
    47   $flashHTML.='<script type="text/javascript" src="'.$path.'elm/js/swfobject.js"></script>
    48         <script type="text/javascript">
    49             var flashvars ={};';
    50         foreach ($flashVar as $key=>$value){
    51                 $flashHTML.='flashvars.'.$key.'="'.$value.'";';
    52             }
    53     $flashHTML.='var params = {allowScriptAccess:"always"};
    54             params.scale="exactfit";';
    55     if($options['transparent']){
    56             $flashHTML.='params.wmode="transparent";';
    57     }else{     
    58     $flashHTML.='params.bgcolor="#'.$options['bgColor'].'";';
    59     }
    60     $flashHTML.='var attributes = {};
    61             attributes.align = "middle";
    62             attributes.id = "flashContentId";
    63             swfobject.embedSWF("'.$path.'BillyBenRing.swf", "flashContentId", "'.$wSize.'", "'.$hSize.'", "10.0.0", false, flashvars, params, attributes);';
    64    
    65         $flashHTML.='</script>';
    66     $flashHTML.=' <div id="flashContentId">';
    67      $flashHTML.='<div id="myAlternativeContent">     
    68             <a href="http://www.adobe.com/go/getflashplayer">
    69                 <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    70             </a>
    71         </div></div>';   
    72      return $flashHTML;
     43    //delete_option('bbr_options');
    7344}
    7445
    75 // construction du xml de retour
    76 function bbr_getXML_String(){
    77     $options=get_option('bbr_options');
    78     $xmlStr="<DATA>";
    79     // si des liens
    80     if($options['displayLink']){   
    81         $cats = bbr_get_bookmark_arr();
    82         $catsId=bbr_get_bookmark_tag_arr();
    83         foreach (  $cats as $catName=>$bookmarks ) {
    84             $catStr=($options['displayLinkTag'])?'cat="'.$catName.'" catColor="'.$options["link_cat_id_".$catsId[$catName]].'" ':' ';
    85           foreach($bookmarks as $bm){
    86                $xmlStr.='<ring type="link" '.$catStr.' url="'.$bm->link_url.'" color="'.$options["link_id_".$bm->link_id].'">'.$bm->link_name.'</ring>';
    87             }         
    88          }         
    89     }   
    90     // si catégory 
    91     if($options['displayCat']){
    92         $cats =bbr_get_category_arr();
    93         foreach($cats  as $cat) {
    94         $idCurr=bbr_get_default_id($cat->term_id, 'category');
    95              $xmlStr.='<ring type="cat" color="'.$options["cat_id_".$idCurr].'" url="'.get_category_link($idCurr).'" count="'.$cat->count.'">'.$cat->name.'</ring>';
    96         }   
    97     }
    98     if($options['displayKeyWord']){
    99         $tags = bbr_get_keywords_arr();
    100         foreach ( $tags as $key => $tag ) {
    101         $idCurr=bbr_get_default_id($tag["id"], 'post_tag');
    102             $xmlStr.='<ring type="keyword" color="'.$options["tag_id_".$idCurr].'" url="'.$tag["link"].'">'.$key.'</ring>';
    103         }
    104     }   
    105     // on fini
    106     $xmlStr.="</DATA>";
    107     return urlencode($xmlStr);
     46
     47function BillyBenRing_widget()
     48{
     49    bbr_check_version();
     50    register_widget("BillyBenRing");
    10851}
    109  
    110 function widget_BillyBenRing($args) {
    111     extract($args);
    112     $options = get_option('bbr_options');
    113     echo $before_widget;
    114     ?>
    115         <?php if( !empty($options['title']) ): ?>
    116             <?php echo $before_title . $options['title'] . $after_title; ?>
    117         <?php endif; ?>
    118         <?php
    119             if( !stristr( $_SERVER['PHP_SELF'], 'widgets.php' ) ){
    120                 echo bbr_get_FlashCode();
    121             }
    122         ?>
    123     <?php
    124     echo $after_widget;
    125 }
    126  
    127 function BillyBenRing_widget()
    128 {
    129   register_sidebar_widget(__('BillyBenRing'), 'widget_BillyBenRing');
    130 }
    131 add_action('admin_menu', 'bbr_init_menu');
    13252
    133 add_action("plugins_loaded", "BillyBenRing_widget");
     53
     54add_action("widgets_init", "BillyBenRing_widget");
     55add_action('wp_loaded' , 'bbr_create_option_page');
    13456register_activation_hook( __FILE__, 'bbr_install' );
    13557register_deactivation_hook( __FILE__, 'bbr_uninstall' );
    136 
     58add_shortcode( 'BBR', 'bbr_shortcodehandler' );
    13759
    13860?>
  • billyben-rings/trunk/BillyBenRing/elm/utilsClasse.php

    r377867 r380802  
    2323    return get_categories();
    2424}
    25 
     25function bbr_get_page_arr(){
     26    $catArr=array();
     27    $cats = get_pages();
     28    foreach ( (array) $cats as $cat ) {
     29        $catName=$cat->post_title;
     30        $link = get_page_link( intval($cat->ID));
     31        $catArr[]=Array("id"=>$cat->ID, "link"=>$link, "name"=>$catName);
     32    }
     33    return $catArr;
     34}
    2635function bbr_get_keywords_arr(){
    2736    $tags = get_terms('post_tag');
     
    3443}
    3544
    36 
    37 
    38 function bbr_init_options($options){
     45function bbr_init_single_widget_options($options){
    3946    $options['width'] = (isset($options['width']))?$options['width']:'300';
    4047    $options['height'] = (isset($options['height']))?$options['height']:'300';
    41     $options['ringSize'] = (isset($options['ringSize']))?$options['ringSize']:20;
     48    $options['ringSize'] = (isset($options['ringSize']))?$options['ringSize']:15;
    4249    $options['firstRingSize']= (isset($options['firstRingSize']))?$options['firstRingSize']:20;
    4350    $options['displayLink']=(isset($options['displayLink']))?$options['displayLink']:true;
     
    4552    $options['displayCat']=(isset($options['displayCat']))?$options['displayCat']:false;
    4653    $options['displayKeyWord']=(isset($options['displayKeyWord']))?$options['displayKeyWord']:false;
     54    $options['displayPage']=(isset($options['displayPage']))?$options['displayPage']:false;
    4755    $options['transparent']=(isset($options['transparent']))?$options['transparent']:true;
    4856    $options['bgColor']=(isset($options['bgColor']))?$options['bgColor']:"CCCCCC";
     
    5664    $options['decalAngle']=(isset($options['decalAngle']))?$options['decalAngle']:0;
    5765    $options['textAlign']=(isset($options['textAlign']))?$options['textAlign']:0;
     66    return $options;
     67
     68}
     69
     70function bbr_init_options($options){   
     71   
    5872    $options['bbr_currLang']=(isset($options['bbr_currLang']))?$options['bbr_currLang']:"En";
     73    $options['link_dest']=(isset($options['link_dest']))?$options['link_dest']:"_blank";
     74    $options['cat_dest']=(isset($options['cat_dest']))?$options['cat_dest']:"_self";
     75    $options['tag_dest']=(isset($options['tag_dest']))?$options['tag_dest']:"_self";
     76    $options['page_dest']=(isset($options['page_dest']))?$options['page_dest']:"_self";
     77    $options['display']=(isset($options['display']))?$options['display']:"bbr_link_table";
     78   
     79    $options['short_id']=(isset($options['short_id']))?$options['short_id']:0;
     80   
    5981    // init des couleur
    6082    //les liens
    61     $defaultColor="00CCFF";
     83    $defaultColor="CCCCCC";
    6284    $cats = bbr_get_bookmark_arr();
    6385    foreach (  $cats as $catName=>$bookmarks ) {
     
    82104        $options[$catId]=(isset($options[$catId]))?$options[$catId]:$defaultColor;
    83105    }
    84          
    85          
    86          
    87          
    88            
     106    $cats=bbr_get_page_arr();
     107    foreach ( $cats as  $tag ) {
     108        $catId="page_id_".$tag["id"];
     109        $options[$catId]=(isset($options[$catId]))?$options[$catId]:$defaultColor;     
     110    }
    89111    return $options;
    90112   
     
    95117    if(function_exists('icl_object_id')){
    96118        $options=get_option('bbr_options');
    97         $curValue=icl_object_id($curValue, $type, true, $options['bbr_currLang']);     
     119        $curValue=icl_object_id($curValue, $type, true, $options['bbr_currLang']); 
    98120    }
    99121    return $curValue;   
    100122}
    101123
     124// construction du xml de retour
     125function bbr_getXML_String($displays){
     126    $options=get_option('bbr_options');
     127    $options= bbr_init_options($options);
     128    $xmlStr="<DATA>";
     129    // si des liens
     130    if(isset($displays['displayLink'])&&$displays['displayLink']){ 
     131        $cats = bbr_get_bookmark_arr();
     132        $catsId=bbr_get_bookmark_tag_arr();
     133        foreach (  $cats as $catName=>$bookmarks ) {
     134            $catStr=(isset($displays['displayLinkTag'])&&$displays['displayLinkTag'])?'cat="'.$catName.'" catColor="'.$options["link_cat_id_".$catsId[$catName]].'" ':' ';
     135          foreach($bookmarks as $bm){
     136               $xmlStr.='<ring type="link" '.$catStr.' url="'.$bm->link_url.'" color="'.$options["link_id_".$bm->link_id].'">'.$bm->link_name.'</ring>';
     137            }         
     138         }         
     139    }   
     140    // si catégory 
     141    if(isset($displays['displayCat'])&&$displays['displayCat']){
     142        $cats =bbr_get_category_arr();
     143        foreach($cats  as $cat) {
     144        $idCurr=bbr_get_default_id($cat->term_id, 'category');
     145             $xmlStr.='<ring type="cat" color="'.$options["cat_id_".$idCurr].'" url="'.get_category_link($idCurr).'" count="'.$cat->count.'">'.$cat->name.'</ring>';
     146        }   
     147    }
     148    // si tag
     149    if(isset($displays['displayKeyWord'])&&$displays['displayKeyWord']){
     150        $tags = bbr_get_keywords_arr();
     151        foreach ( $tags as $key => $tag ) {
     152        $idCurr=bbr_get_default_id($tag["id"], 'post_tag');
     153            $xmlStr.='<ring type="keyword" color="'.$options["tag_id_".$idCurr].'" url="'.$tag["link"].'">'.$key.'</ring>';
     154        }
     155    }   
     156    // si page
     157    if(isset($displays['displayPage'])&&$displays['displayPage']){
     158        $tags = bbr_get_page_arr();
     159        foreach ( $tags as $tag ) {
     160            $idCurr=bbr_get_default_id($tag["id"], 'page');     
     161            $xmlStr.='<ring type="page" color="'.$options["page_id_".$idCurr].'" url="'.$tag["link"].'">'.$tag["name"].'</ring>';   
     162        }
     163    }   
     164    // on fini
     165    $xmlStr.="</DATA>";
     166    return urlencode($xmlStr);
     167}
     168
     169function bbr_transform_attribute_to_option($atts){
     170    if(count($atts)<1)return $atts;
     171    $options=bbr_init_single_widget_options(array());
     172    foreach($options as $key=>$value){
     173        $lowerKey=strtolower($key);
     174        if(isset($atts[$lowerKey])){
     175            $atts[$key]=$atts[$lowerKey];
     176            if($key!=$lowerKey)unset($atts[$lowerKey]);
     177        }
     178   
     179    }
     180    return $atts;
     181   
     182}
     183
    102184
    103185?>
  • billyben-rings/trunk/readme.txt

    r380749 r380802  
    66Stable tag: 2.1.1
    77
    8 Display your links, tags, pages, and/or categories by a circular sideBar widget, with full or arrowed circles. Fully customizable. Add Shortcode to your page/post. Mutli Instance
     8Display links, tag, pages, and categories by a circular sideBar widget, with full or arrowed circles. Fully customizable, ShortCoded, Mutli Instance.
    99
    1010== Description ==
     
    47474. The BBR's Color Option page
    48485. The BBR Help Page head
    49 6. The SIdeBar configuration of BBR Widget
     496. The SideBar configuration of BBR Widget
    5050
    5151== Changelog ==
     52= 2.1.1 =
     53* minor bug corrected
    5254= 2.1.0 =
    5355* Add ShortCode
    5456* Change Menu - add specific BBR Menu
     57
    5558Updating from version 2.0 should not erase your configuration
    5659= 2.0.0 =
Note: See TracChangeset for help on using the changeset viewer.