Dotclear


Ignore:
Timestamp:
11/28/11 10:26:03 (14 years ago)
Author:
Dsls <dsls@…>
Branch:
default
Message:

Added new method getURLFor in urlhandler
2 new behaviors :

  • publicGetURLFor
  • publicRegisterURL

All changes are backward compatibles, news plugins will be encouraged
to use new urlhandler method for public URLs generation

Location:
inc/public
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inc/public/class.dc.template.php

    r570 r772  
    742742     { 
    743743          $f = $this->getFilters($attr); 
    744           return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("archive")').'; ?>'; 
     744          return '<?php echo '.sprintf($f,'$core->url->getURLFor("archive")').'; ?>'; 
    745745     } 
    746746      
     
    796796           
    797797          $f = $this->getFilters($attr); 
    798           return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("feed")."/'.$type.'"').'; ?>'; 
     798          return '<?php echo '.sprintf($f,'$core->url->getURLFor("feed","'.$type.'")').'; ?>'; 
    799799     } 
    800800      
     
    881881     { 
    882882          $f = $this->getFilters($attr); 
    883           return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase(\'rsd\')').'; ?>'; 
     883          return '<?php echo '.sprintf($f,'$core->url->getURLFor(\'rsd\')').'; ?>'; 
    884884     } 
    885885      
     
    10451045           
    10461046          $f = $this->getFilters($attr); 
    1047           return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("feed")."/category/".'. 
    1048           '$_ctx->categories->cat_url."/'.$type.'"').'; ?>'; 
     1047          return '<?php echo '.sprintf($f,'$core->url->getURLFor("feed","category/".'. 
     1048          '$_ctx->categories->cat_url."/'.$type.'")').'; ?>'; 
    10491049     } 
    10501050      
     
    10551055     { 
    10561056          $f = $this->getFilters($attr); 
    1057           return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("category")."/".$_ctx->categories->cat_url').'; ?>'; 
     1057          return '<?php echo '.sprintf($f,'$core->url->getURLFor("category",$_ctx->categories->cat_url)').'; ?>'; 
    10581058     } 
    10591059      
     
    19341934     { 
    19351935          $f = $this->getFilters($attr); 
    1936           return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("lang").$_ctx->langs->post_lang').'; ?>'; 
     1936          return '<?php echo '.sprintf($f,'$core->url->getURLFor("lang",$_ctx->langs->post_lang)').'; ?>'; 
    19371937     } 
    19381938      
  • inc/public/lib.tpl.context.php

    r687 r772  
    9999     } 
    100100      
     101      
    101102     # Static methods 
    102103     public static function global_filter($str, 
  • inc/public/lib.urlhandlers.php

    r306 r772  
    1515{ 
    1616     public $args; 
     17      
     18     public function getURLFor($type,$value='') { 
     19          $core =& $GLOBALS['core']; 
     20          $url = $core->callBehavior("publicGetURLFor",$type,$value); 
     21          if ($url !== '') { 
     22               $url = $core->blog->url.$this->getBase($type); 
     23               if ($value !== '') { 
     24                    $url .= '/'.$value; 
     25               } 
     26          } 
     27          return $url; 
     28     } 
     29      
     30     public function register($type,$url,$representation,$handler) 
     31     { 
     32          $core =& $GLOBALS['core']; 
     33          $t = new ArrayObject(array($type,$url,$representation,$handler)); 
     34          $core->callBehavior("publicRegisterURL",$t); 
     35          parent::register($t[0],$t[1],$t[2],$t[3]); 
     36     } 
    1737      
    1838     public static function p404() 
Note: See TracChangeset for help on using the changeset viewer.

Sites map