Jarves\Tools::urlDecode PHP Метод

urlDecode() публичный статический Метод

public static urlDecode ( $string )
    public static function urlDecode($string)
    {
        $string = str_replace('%252F', '%2F', $string);
        return rawurldecode($string);
    }

Usage Example

Пример #1
0
 /**
  * Converts given primary values from type string into proper normalized array definition.
  * This builds the array for the $pk for all of these methods inside this class.
  *
  * The primaryKey comes primarily from the REST API.
  *
  *    admin/object/news/1
  *    admin/objects?uri=news/1/2
  * where
  *    admin/object/news/<id>
  *    admin/objects?uri=news/<id>
  *
  * is this ID.
  *
  * 1/2/3 => array( array(id =>1),array(id =>2),array(id =>3) )
  * 1 => array(array(id => 1))
  * idFooBar => array( id => "idFooBar")
  * idFoo/Bar => array(array(id => idFoo), array(id2 => "Bar"))
  * 1,45/2,45 => array(array(id => 1, pid = 45), array(id => 2, pid=>45))
  *
  * @param  string $pk
  *
  * @return array  Always a array with primary keys as arrays too. So $return[0] is the first primary key array. Example array(array('id' => 4))
  */
 public function primaryStringToArray($pk)
 {
     if ($pk === '') {
         return false;
     }
     $groups = explode('/', $pk);
     $result = array();
     foreach ($groups as $group) {
         $item = array();
         if ('' === $group) {
             continue;
         }
         $primaryGroups = explode(',', $group);
         foreach ($primaryGroups as $pos => $value) {
             if ($ePos = strpos($value, '=')) {
                 $key = substr($value, 0, $ePos);
                 $value = substr($value, $ePos + 1);
                 if (!in_array($key, $this->primaryKeys)) {
                     continue;
                 }
             } elseif (!$this->primaryKeys[$pos]) {
                 continue;
             }
             $key = $this->primaryKeys[$pos];
             $item[$key] = Tools::urlDecode($value);
         }
         if (count($this->primaryKeys) > count($item)) {
             foreach ($this->primaryKeys as $pk2) {
                 if (!@$item[$pk2]) {
                     $item[$pk2] = null;
                 }
             }
         }
         if (count($item) > 0) {
             $result[] = $item;
         }
     }
     return $result;
 }
All Usage Examples Of Jarves\Tools::urlDecode