Dotclear

Changeset 2814:9817c7cce256 for inc


Ignore:
Timestamp:
11/25/14 12:46:28 (11 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add decode() method = urldecode of get() method, useful for echoing URLs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.dc.adminurl.php

    r2783 r2814  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212if (!defined('DC_RC_PATH')) { return; } 
    13  
    1413 
    1514/** 
     
    4241      * @param  array  $params query string params (optional) 
    4342      */ 
    44      public function register ($name,$url,$params = array()) 
     43     public function register($name,$url,$params=array()) 
    4544     { 
    4645          $this->urls[$name] = array('url' => $url, 'qs' => $params); 
     
    5453      * @param  string $newurl new url if different from the original 
    5554      */ 
    56      public function registercopy ($name,$orig,$params = array(),$newurl='') 
     55     public function registercopy($name,$orig,$params=array(),$newurl='') 
    5756     { 
    5857          if (!isset($this->urls[$orig])) { 
     
    6564          } 
    6665          $this->urls[$name] = $url; 
    67  
    6866     } 
    6967 
     
    7674      * @return string            the forged url 
    7775      */ 
    78      public function get ($name,$params=array(),$separator='&amp;') 
     76     public function get($name,$params=array(),$separator='&amp;') 
    7977     { 
    8078          if (!isset($this->urls[$name])) { 
     
    9189 
    9290     /** 
     91      * retrieves a URL (decoded — useful for echoing) given its name, and optional parameters 
     92      * 
     93      * @param  string $name      URL Name 
     94      * @param  array  $params    query string parameters, given as an associative array 
     95      * @param  string $separator separator to use between QS parameters 
     96      * @return string            the forged decoded url 
     97      */ 
     98     public function decode($name,$params=array(),$separator='&amp;') 
     99     { 
     100          return urldecode($this->get($name,$params,$separator)); 
     101     } 
     102 
     103     /** 
    93104      * Returns $urls property content. 
    94105      * 
    95106      * @return  ArrayObject 
    96107      */ 
    97      public function dumpUrls() { 
     108     public function dumpUrls() 
     109     { 
    98110          return $this->urls; 
    99111     } 
    100112} 
    101  
Note: See TracChangeset for help on using the changeset viewer.

Sites map