Dotclear


Ignore:
Timestamp:
11/17/13 20:25:53 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Children:
2567:6c11245cbf04, 2568:61c67a7d17fa
Message:

Add some people in CREDITS, remove trailing spaces and tabs.

Location:
plugins/widgets
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/_admin.php

    r2230 r2566  
    2727          preg_match('/plugin.php\?p=widgets(&.*)?$/',$_SERVER['REQUEST_URI']), 
    2828          $core->auth->check('admin',$core->blog->id)); 
    29 ?> 
  • plugins/widgets/_default_widgets.php

    r2412 r2566  
    123123# --BEHAVIOR-- initDefaultWidgets 
    124124$core->callBehavior('initDefaultWidgets',$__widgets,$__default_widgets); 
    125 ?> 
  • plugins/widgets/_define.php

    r2257 r2566  
    2323     ) 
    2424); 
    25 ?> 
  • plugins/widgets/_install.php

    r1179 r2566  
    3838$core->setVersion('widgets',$version); 
    3939return true; 
    40 ?> 
  • plugins/widgets/_public.php

    r1179 r2566  
    2626          # widgets to disable 
    2727          $disable = isset($attr['disable']) ? trim($attr['disable']) : ''; 
    28            
     28 
    2929          if ($type == '') { 
    3030               $res = "publicWidgets::widgetsHandler('nav','".addslashes($disable)."');"."\n". 
     
    3939          return '<?php '.$res.' ?>'; 
    4040     } 
    41       
     41 
    4242     public static function widgetsHandler($type,$disable='') 
    4343     { 
     
    4545          $GLOBALS['core']->blog->settings->addNameSpace('widgets'); 
    4646          $widgets = $GLOBALS['core']->blog->settings->widgets->{$wtype}; 
    47            
     47 
    4848          if (!$widgets) { // If widgets value is empty, get defaults 
    4949               $widgets = self::defaultWidgets($type); 
     
    5151               $widgets = dcWidgets::load($widgets); 
    5252          } 
    53            
     53 
    5454          if ($widgets->isEmpty()) { // Widgets are empty, don't show anything 
    5555               return; 
    5656          } 
    57            
     57 
    5858          $disable = preg_split('/\s*,\s*/',$disable,-1,PREG_SPLIT_NO_EMPTY); 
    5959          $disable = array_flip($disable); 
    60            
     60 
    6161          foreach ($widgets->elements() as $k => $w) 
    6262          { 
     
    6767          } 
    6868     } 
    69       
     69 
    7070     private static function defaultWidgets($type) 
    7171     { 
    7272          $widgets = new dcWidgets(); 
    7373          $w = new dcWidgets(); 
    74            
     74 
    7575          if (isset($GLOBALS['__default_widgets'][$type])) { 
    7676               $w = $GLOBALS['__default_widgets'][$type]; 
    7777          } 
    78            
     78 
    7979          return $w; 
    8080     } 
    81       
     81 
    8282     public static function tplWidget($attr,$content) 
    8383     { 
     
    8585               return; 
    8686          } 
    87            
     87 
    8888          # We change tpl:lang syntax, we need it 
    8989          $content = preg_replace('/\{\{tpl:lang\s+(.*?)\}\}/msu','{tpl:lang $1}',$content); 
    90            
     90 
    9191          # We remove every {{tpl: 
    9292          $content = preg_replace('/\{\{tpl:.*?\}\}/msu','',$content); 
    93            
     93 
    9494          return 
    9595          "<?php publicWidgets::widgetHandler('".addslashes($attr['id'])."','".str_replace("'","\\'",$content)."'); ?>"; 
    9696     } 
    97       
     97 
    9898     public static function widgetHandler($id,$xml) 
    9999     { 
    100100          $widgets =& $GLOBALS['__widgets']; 
    101            
     101 
    102102          if (!($widgets->{$id} instanceof dcWidget)) { 
    103103               return; 
    104104          } 
    105            
     105 
    106106          $xml = '<?xml version="1.0" encoding="utf-8" ?><widget>'.$xml.'</widget>'; 
    107107          $xml = @simplexml_load_string($xml); 
     
    110110               return; 
    111111          } 
    112            
     112 
    113113          $w = clone $widgets->{$id}; 
    114            
     114 
    115115          foreach ($xml->setting as $e) 
    116116          { 
     
    118118                    continue; 
    119119               } 
    120                 
     120 
    121121               $setting = (string) $e['name']; 
    122122               if (count($e->children())>0) { 
     
    127127               $w->{$setting} = preg_replace_callback('/\{tpl:lang (.*?)\}/msu',array('self','widgetL10nHandler'),$text); 
    128128          } 
    129            
     129 
    130130          echo $w->call(0); 
    131131     } 
    132       
     132 
    133133     private static function widgetL10nHandler($m) 
    134134     { 
     
    136136     } 
    137137} 
    138 ?> 
  • plugins/widgets/class.widgets.php

    r2442 r2566  
    1515{ 
    1616     private $__widgets = array(); 
    17       
     17 
    1818     public static function load($s) 
    1919     { 
    2020          $o = @unserialize(base64_decode($s)); 
    21            
     21 
    2222          if ($o instanceof self) { 
    2323               return $o; 
     
    2626          } 
    2727     } 
    28       
     28 
    2929     public function store() 
    3030     { 
     
    3535          return base64_encode(serialize($serialized)); 
    3636     } 
    37       
     37 
    3838     public function create($id,$name,$callback,$append_callback=null,$desc='') 
    3939     { 
     
    4141          $this->__widgets[$id]->append_callback = $append_callback; 
    4242     } 
    43       
     43 
    4444     public function append($widget) 
    4545     { 
     
    5151          } 
    5252     } 
    53       
     53 
    5454     public function isEmpty() 
    5555     { 
    5656          return count($this->__widgets) == 0; 
    5757     } 
    58       
     58 
    5959     public function elements($sorted=false) 
    6060     { 
     
    6464          return $this->__widgets; 
    6565     } 
    66       
     66 
    6767     public function __get($id) 
    6868     { 
     
    7272          return $this->__widgets[$id]; 
    7373     } 
    74       
     74 
    7575     public function __wakeup() 
    7676     { 
     
    8282          } 
    8383     } 
    84       
     84 
    8585     public static function loadArray($A,$widgets) 
    8686     { 
     
    8888               return false; 
    8989          } 
    90            
     90 
    9191          uasort($A,array('self','arraySort')); 
    92            
     92 
    9393          $result = new self; 
    9494          foreach ($A as $v) 
     
    9797               { 
    9898                    $w = clone $widgets->{$v['id']}; 
    99                      
     99 
    100100                    # Settings 
    101101                    unset($v['id']); 
     
    104104                         $w->{$sid} = $s; 
    105105                    } 
    106                      
     106 
    107107                    $result->append($w); 
    108108               } 
    109109          } 
    110            
     110 
    111111          return $result; 
    112112     } 
    113       
     113 
    114114     private static function arraySort($a, $b) 
    115115     { 
     
    119119          return $a['order'] > $b['order'] ? 1 : -1; 
    120120     } 
    121       
     121 
    122122     private static function sort($a,$b) 
    123123     { 
    124           $c = $a->name();  
    125           $d = $b->name();  
    126           if ($c == $d) {  
    127                return 0;  
    128           }  
    129           return ($c < $d) ? -1 : 1;  
     124          $c = $a->name(); 
     125          $d = $b->name(); 
     126          if ($c == $d) { 
     127               return 0; 
     128          } 
     129          return ($c < $d) ? -1 : 1; 
    130130     } 
    131131} 
     
    139139     public $append_callback = null; 
    140140     private $settings = array(); 
    141       
     141 
    142142     public function serialize($order) { 
    143143          $values = array(); 
     
    148148          return $values; 
    149149     } 
    150       
     150 
    151151     public function __construct($id,$name,$callback,$desc='') 
    152152     { 
     
    156156          $this->desc = $desc; 
    157157     } 
    158       
     158 
    159159     public function id() 
    160160     { 
    161161          return $this->id; 
    162162     } 
    163       
     163 
    164164     public function name() 
    165165     { 
     
    171171          return $this->desc; 
    172172     } 
    173       
     173 
    174174     public function getCallback() 
    175175     { 
    176176          return $this->public_callback; 
    177177     } 
    178       
     178 
    179179     public function call($i=0) 
    180180     { 
     
    184184          return '<p>Callback not found for widget '.$this->id.'</p>'; 
    185185     } 
    186       
     186 
    187187     /* Widget settings 
    188188     --------------------------------------------------- */ 
     
    194194          return null; 
    195195     } 
    196       
     196 
    197197     public function __set($n,$v) 
    198198     { 
     
    201201          } 
    202202     } 
    203       
     203 
    204204     public function setting($name,$title,$value,$type='text') 
    205205     { 
     
    210210               } 
    211211          } 
    212            
     212 
    213213          $this->settings[$name] = array( 
    214214               'title' => $title, 
     
    216216               'value' => $value 
    217217          ); 
    218            
     218 
    219219          if (isset($options)) { 
    220220               $this->settings[$name]['options'] = $options; 
    221221          } 
    222222     } 
    223       
     223 
    224224     public function settings() 
    225225     { 
    226226          return $this->settings; 
    227227     } 
    228       
     228 
    229229     public function formSettings($pr='',&$i=0) 
    230230     { 
     
    235235               $i++; 
    236236          } 
    237            
     237 
    238238          return $res; 
    239239     } 
    240       
     240 
    241241     public function formSetting($id,$s,$pr='',&$i=0) 
    242242     { 
     
    288288     } 
    289289} 
    290 ?> 
  • plugins/widgets/dragdrop.js

    r2401 r2566  
    1313 
    1414$(function() { 
    15       
     15 
    1616     // clean 
    1717     $('.remove-if-drag').remove(); 
    1818     $('.hidden-if-drag').hide(); 
    1919     $('.widgets, .sortable-delete').addClass('if-drag'); 
    20       
     20 
    2121     // move 
    2222     $( ".connected, .sortable-delete" ).sortable({ 
     
    3434          }, 
    3535          update: function(event, ui) { 
    36                 
     36 
    3737               ul = $(this); 
    3838               widget = ui.item; 
    3939               field = ul.parents('.widgets'); 
    40                 
     40 
    4141               // met a zéro le décalage 
    4242               ui.item.css('left', 'auto'); 
    43                 
     43 
    4444               // signale les zones vides 
    4545               if( ul.find('li:not(.empty-widgets)').length == 0 ) { 
     
    5050                    field.find('ul.sortable-delete').show(); 
    5151               } 
    52                 
     52 
    5353               // remove 
    5454               if( widget.parents('ul').is('.sortable-delete') ) { 
     
    5757                    }); 
    5858               } 
    59                 
     59 
    6060               // réordonne 
    6161               reorder(ul); 
    62                 
     62 
    6363               // expand 
    6464               if(widget.find('img.expand').length == 0) { 
     
    6666                    dotclear.viewPostContent(widget, 'close'); 
    6767               } 
    68                 
     68 
    6969          } 
    7070     }); 
    71       
     71 
    7272     // add 
    7373     $( "#widgets-ref > li" ).draggable({ 
     
    8181          } 
    8282     }); 
    83       
     83 
    8484     $("li.ui-draggable, ul.ui-sortable li") 
    8585          .not('ul.sortable-delete li, li.empty-widgets') 
  • plugins/widgets/style.css

    r2442 r2566  
    120120     width: 49%; 
    121121     background: #eee; 
    122      padding: 1.5em 1% 0;  
     122     padding: 1.5em 1% 0; 
    123123     margin: 0 1% 0 0; 
    124124} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map