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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map