Changeset 2852:86651202b279 for inc
- Timestamp:
- 12/16/14 21:59:13 (11 years ago)
- Branch:
- 2.7
- Location:
- inc/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.dc.adminurl.php
r2849 r2852 75 75 * @return string the forged url 76 76 */ 77 public function get($name,$params=array(),$ urlencode=true,$separator='&')77 public function get($name,$params=array(),$separator='&') 78 78 { 79 79 if (!isset($this->urls[$name])) { 80 80 throw new exception ('Unknown URL handler for '.$name); 81 }82 // compatibility check for old behavior83 if (!is_bool($urlencode)) {84 $separator=$urlencode;85 $urlencode = true;86 81 } 87 82 $url = $this->urls[$name]; … … 91 86 $u .= '?'.http_build_query($p,'',$separator); 92 87 } 93 return $u rlencode?$u:urldecode($u);88 return $u; 94 89 } 90 91 92 /** 93 * retrieves a URL given its name, and optional parameters 94 * 95 * @param string $name URL Name 96 * @param array $params query string parameters, given as an associative array 97 * @param boolean $urlencode set to true if url may not be encoded 98 * @param string $separator separator to use between QS parameters 99 * @return string the forged url 100 */ 101 public function redirect($name,$params=array(),$suffix="") 102 { 103 if (!isset($this->urls[$name])) { 104 throw new exception ('Unknown URL handler for '.$name); 105 } 106 http::redirect($this->get($name,$params,'&').$suffix); 107 } 108 109 110 /** 111 * retrieves a php page given its name, and optional parameters 112 * acts like get, but without the query string, should be used within forms actions 113 * 114 * @param string $name URL Name 115 * @return string the forged url 116 */ 117 public function getBase($name) 118 { 119 if (!isset($this->urls[$name])) { 120 throw new exception ('Unknown URL handler for '.$name); 121 } 122 return $this->urls[$name]['url']; 123 } 124 125 /** 126 * forges form hidden fields to pass to a generated <form>. Should be used in combination with 127 * form action retrieved from getBase() 128 * 129 * @param string $name URL Name 130 * @param array $params query string parameters, given as an associative array 131 * @return string the forged form data 132 */ 133 public function getHiddenFormFields($name,$params=array()) 134 { 135 if (!isset($this->urls[$name])) { 136 throw new exception ('Unknown URL handler for '.$name); 137 } 138 $url = $this->urls[$name]; 139 $p = array_merge($url['qs'],$params); 140 $str = ''; 141 foreach ((array)$p as $k => $v) { 142 $str .= form::hidden(array($k),$v); 143 } 144 return $str; 145 } 146 147 95 148 96 149 /** 97 150 * retrieves a URL (decoded — useful for echoing) given its name, and optional parameters 98 151 * 99 * @deprecated should use get(...,true,...) instead152 * should be used carefully, parameters are no more escaped 100 153 * 101 154 * @param string $name URL Name -
inc/admin/lib.dc.page.php
r2849 r2852 927 927 928 928 public static function getPF($file) { 929 return $GLOBALS['core']->adminurl->get('load.plugin.file',array('pf' => $file) ,false);929 return $GLOBALS['core']->adminurl->get('load.plugin.file',array('pf' => $file)); 930 930 } 931 931 } -
inc/admin/lib.pager.php
r2849 r2852 214 214 { 215 215 if ($this->core->auth->check('categories',$this->core->blog->id)) { 216 $cat_link = '<a href="'.$this->core->adminurl->get('admin.category',array('id' => '%s'),false).'">%s</a>'; 216 $cat_link = '<a href="'.$this->core->adminurl->get('admin.category',array('id' => '%s')).'">%s</a>'; 217 $cat_link = str_replace('%25s','%s',$cat_link); 217 218 } else { 218 219 $cat_link = '%2$s';
Note: See TracChangeset
for help on using the changeset viewer.