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
  • inc/public/lib.tpl.context.php

    r1537 r2566  
    1515{ 
    1616     public $stack = array(); 
    17       
     17 
    1818     public function __set($name,$var) 
    1919     { 
     
    2727          } 
    2828     } 
    29       
     29 
    3030     public function __get($name) 
    3131     { 
     
    3333               return null; 
    3434          } 
    35            
     35 
    3636          $n = count($this->stack[$name]); 
    3737          if ($n > 0) { 
    3838               return $this->stack[$name][($n-1)]; 
    3939          } 
    40            
     40 
    4141          return null; 
    4242     } 
    43       
     43 
    4444     public function exists($name) 
    4545     { 
    4646          return isset($this->stack[$name][0]); 
    4747     } 
    48       
     48 
    4949     public function pop($name) 
    5050     { 
     
    5757          } 
    5858     } 
    59       
     59 
    6060     # Loop position tests 
    6161     public function loopPosition($start,$length=null,$even=null) 
     
    6464               return false; 
    6565          } 
    66            
     66 
    6767          $index = $this->cur_loop->index(); 
    6868          $size = $this->cur_loop->count(); 
    69            
     69 
    7070          $test = false; 
    7171          if ($start >= 0) 
     
    9191               } 
    9292          } 
    93            
     93 
    9494          if ($even !== null) { 
    9595               $test = $test && $index%2 == $even; 
    9696          } 
    97            
     97 
    9898          return $test; 
    9999     } 
    100       
    101       
     100 
     101 
    102102     # Static methods 
    103103     public static function global_filter($str, 
     
    107107          array_pop($args); 
    108108          $args[0] =& $str; 
    109            
     109 
    110110          # --BEHAVIOR-- publicBeforeContentFilter 
    111111          $res = $GLOBALS['core']->callBehavior('publicBeforeContentFilter',$GLOBALS['core'],$tag,$args); 
    112            
     112 
    113113          if ($remove_html) { 
    114114               $str = self::remove_html($str); 
    115115               $str = preg_replace('/\s+/',' ',$str); 
    116116          } 
    117            
     117 
    118118          if ($encode_xml) { 
    119119               $str = self::encode_xml($str); 
    120120          } 
    121            
     121 
    122122          if ($cut_string) { 
    123123               $str = self::cut_string($str,(integer) $cut_string); 
    124124          } 
    125            
     125 
    126126          if ($lower_case) { 
    127127               $str = self::lower_case($str); 
     
    133133               } 
    134134          } 
    135            
     135 
    136136          # --BEHAVIOR-- publicAfterContentFilter 
    137137          $res = $GLOBALS['core']->callBehavior('publicAfterContentFilter',$GLOBALS['core'],$tag,$args); 
    138            
     138 
    139139          return $str; 
    140140     } 
    141       
    142       
     141 
     142 
    143143     public static function cut_string($str,$l) 
    144144     { 
    145145          return text::cutString($str,$l); 
    146146     } 
    147       
     147 
    148148     public static function encode_xml($str) 
    149149     { 
    150150          return html::escapeHTML($str); 
    151151     } 
    152       
     152 
    153153     public static function remove_html($str) 
    154154     { 
    155155          return html::decodeEntities(html::clean($str)); 
    156156     } 
    157       
     157 
    158158     public static function lower_case($str) 
    159159     { 
    160160          return mb_strtolower($str); 
    161161     } 
    162       
     162 
    163163     public static function upper_case($str) 
    164164     { 
     
    173173          return $str; 
    174174     } 
    175       
     175 
    176176     public static function categoryPostParam(&$p) 
    177177     { 
     
    180180               $p['cat_url'] = substr($p['cat_url'],1); 
    181181          } 
    182            
     182 
    183183          $p['cat_url'] = preg_split('/\s*,\s*/',$p['cat_url'],-1,PREG_SPLIT_NO_EMPTY); 
    184            
     184 
    185185          foreach ($p['cat_url'] as &$v) 
    186186          { 
     
    195195          } 
    196196     } 
    197       
     197 
    198198     # Static methods for pagination 
    199199     public static function PaginationNbPages() 
    200200     { 
    201201          global $_ctx; 
    202            
     202 
    203203          if ($_ctx->pagination === null) { 
    204204               return false; 
    205205          } 
    206            
     206 
    207207          $nb_posts = $_ctx->pagination->f(0); 
    208208          $nb_per_page = $_ctx->post_params['limit'][1]; 
    209            
     209 
    210210          $nb_pages = ceil($nb_posts/$nb_per_page); 
    211            
     211 
    212212          return $nb_pages; 
    213213     } 
    214       
     214 
    215215     public static function PaginationPosition($offset=0) 
    216216     { 
     
    220220               $p = 1; 
    221221          } 
    222            
     222 
    223223          $p = $p+$offset; 
    224            
     224 
    225225          $n = self::PaginationNbPages(); 
    226226          if (!$n) { 
    227227               return $p; 
    228228          } 
    229            
     229 
    230230          if ($p > $n || $p <= 0) { 
    231231               return 1; 
     
    234234          } 
    235235     } 
    236       
     236 
    237237     public static function PaginationStart() 
    238238     { 
     
    240240               return self::PaginationPosition() == 1; 
    241241          } 
    242            
     242 
    243243          return true; 
    244244     } 
    245       
     245 
    246246     public static function PaginationEnd() 
    247247     { 
     
    249249               return self::PaginationPosition() == self::PaginationNbPages(); 
    250250          } 
    251            
     251 
    252252          return false; 
    253253     } 
    254       
     254 
    255255     public static function PaginationURL($offset=0) 
    256256     { 
    257257          $args = $_SERVER['URL_REQUEST_PART']; 
    258            
     258 
    259259          $n = self::PaginationPosition($offset); 
    260            
     260 
    261261          $args = preg_replace('#(^|/)page/([0-9]+)$#','',$args); 
    262            
     262 
    263263          $url = $GLOBALS['core']->blog->url.$args; 
    264            
     264 
    265265          if ($n > 1) { 
    266266               $url = preg_replace('#/$#','',$url); 
    267267               $url .= '/page/'.$n; 
    268268          } 
    269            
     269 
    270270          # If search param 
    271271          if (!empty($_GET['q'])) { 
     
    275275          return $url; 
    276276     } 
    277       
     277 
    278278     # Robots policy 
    279279     public static function robotsPolicy($base,$over) 
     
    282282          $base = array_flip(preg_split('/\s*,\s*/',$base)); 
    283283          $over = array_flip(preg_split('/\s*,\s*/',$over)); 
    284            
     284 
    285285          foreach ($pol as $k => &$v) 
    286286          { 
     
    292292               } 
    293293          } 
    294            
     294 
    295295          if ($pol['ARCHIVE'] == 'ARCHIVE') { 
    296296               unset($pol['ARCHIVE']); 
    297297          } 
    298            
     298 
    299299          return implode(', ',$pol); 
    300300     } 
    301       
     301 
    302302     # Smilies static methods 
    303303     public static function getSmilies($blog) 
     
    310310          $definition = $blog->themes_path.'/%s/smilies/smilies.txt'; 
    311311          $base_url = $blog->settings->system->themes_url.'/%s/smilies/'; 
    312            
     312 
    313313          $res = array(); 
    314            
     314 
    315315          foreach ($path as $t) 
    316316          { 
     
    322322          return false; 
    323323     } 
    324       
     324 
    325325     public static function smiliesDefinition($f,$url) 
    326326     { 
    327327          $def = file($f); 
    328                 
     328 
    329329          $res = array(); 
    330330          foreach($def as $v) 
     
    339339               } 
    340340          } 
    341            
     341 
    342342          return $res; 
    343343     } 
    344       
     344 
    345345     public static function addSmilies($str) 
    346346     { 
     
    387387          # 
    388388          # 
    389           #   Regular expression derived from the _tokenize() subroutine in  
     389          #   Regular expression derived from the _tokenize() subroutine in 
    390390          #   Brad Choate's MTRegex plugin. 
    391391          #   <http://www.bradchoate.com/past/mtregex.php> 
     
    397397                     '(?s:<\?.*?\?>)|'.                # processing instruction 
    398398                                                            # regular tags 
    399                      '(?:<[/!$]?[-a-zA-Z0-9:]+\b(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*>)';  
     399                     '(?:<[/!$]?[-a-zA-Z0-9:]+\b(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*>)'; 
    400400 
    401401          $parts = preg_split("{($match)}", $str, -1, PREG_SPLIT_DELIM_CAPTURE); 
    402402 
    403403          foreach ($parts as $part) { 
    404                if (++$index % 2 && $part != '')  
     404               if (++$index % 2 && $part != '') 
    405405                    $tokens[] = array('text', $part); 
    406406               else 
     
    415415     { 
    416416          global $core, $_ctx; 
    417            
     417 
    418418          try { 
    419419               $media = new dcMedia($core); 
     
    425425               $p_site = preg_replace('#^(.+?//.+?)/(.*)$#','$1',$core->blog->url); 
    426426               $p_root = $core->blog->public_path; 
    427                 
     427 
    428428               $pattern = '(?:'.preg_quote($p_site,'/').')?'.preg_quote($p_url,'/'); 
    429429               $pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|jpeg|gif|png))"[^>]+/msui',$pattern); 
    430                 
     430 
    431431               $src = ''; 
    432432               $alt = ''; 
    433                 
     433 
    434434               # We first look in post content 
    435435               if (!$cat_only && $_ctx->posts) 
     
    440440                         foreach ($m[1] as $i => $img) { 
    441441                              if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) { 
    442                                    $dirname = str_replace('\\', '/', dirname($img));  
     442                                   $dirname = str_replace('\\', '/', dirname($img)); 
    443443                                   $src = $p_url.($dirname != '/' ? $dirname : '').'/'.$src; 
    444444                                   if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) { 
     
    450450                    } 
    451451               } 
    452                 
     452 
    453453               # No src, look in category description if available 
    454454             if (!$src && $with_category && $_ctx->posts->cat_desc) 
     
    458458                         foreach ($m[1] as $i => $img) { 
    459459                              if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) { 
    460                                    $dirname = str_replace('\\', '/', dirname($img));  
     460                                   $dirname = str_replace('\\', '/', dirname($img)); 
    461461                                   $src = $p_url.($dirname != '/' ? $dirname : '').'/'.$src; 
    462462                                   if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) { 
     
    468468                    }; 
    469469               } 
    470                 
     470 
    471471               if ($src) { 
    472472                    if ($no_tag) { 
     
    476476                    } 
    477477               } 
    478                 
     478 
    479479          } catch (Exception $e) { 
    480480               $core->error->add($e->getMessage()); 
    481481          } 
    482482     } 
    483       
     483 
    484484     private static function ContentFirstImageLookup($root,$img,$size) 
    485485     { 
    486486          global $core; 
    487            
     487 
    488488          # Get base name and extension 
    489489          $info = path::info($img); 
    490490          $base = $info['base']; 
    491            
     491 
    492492          try { 
    493493               $media = new dcMedia($core); 
     
    496496                    $base = $m[1]; 
    497497               } 
    498                 
     498 
    499499               $res = false; 
    500500               if ($size != 'o' && file_exists($root.'/'.$info['dirname'].'/.'.$base.'_'.$size.'.jpg')) 
     
    528528               $core->error->add($e->getMessage()); 
    529529          } 
    530            
     530 
    531531          if ($res) { 
    532532               return $res; 
     
    535535     } 
    536536} 
    537 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map