Example #1
0
 public static function change($query)
 {
     Crumb::$href = $query;
     $amp = explode('?', $query, 2);
     $eq = explode('=', $amp[0], 2);
     $sl = explode('/', $eq[0], 2);
     if (sizeof($eq) !== 1 && sizeof($sl) === 1) {
         //В первой крошке нельзя использовать символ "=" для совместимости с левыми параметрами для главной страницы, которая всё равно покажется
         $params = $query;
         $query = '';
     } else {
         $params = (string) @$amp[1];
         $query = $amp[0];
     }
     self::$params = $params;
     parse_str($params, self::$get);
     $right = self::right($query);
     $counter = ++self::$globalcounter;
     $inst = self::getInstance();
     $old = $inst->path;
     //Crumb::$path=$right;
     //Crumb::$value=(string)@$right[0];
     //Crumb::$child=Crumb::getInstance((string)@$right[0]);
     $that = self::getInstance($right);
     $child = null;
     while ($that) {
         $that->counter = $counter;
         $that->is = true;
         $that->child = $child;
         $that->value = (string) @$right[sizeof($that->path)];
         //$that->query = Crumb::short(right.slice(that.path.length));
         $child = $that;
         if (!empty($that->parent)) {
             $that = $that->parent;
         } else {
             $that = false;
         }
     }
     $that = self::getInstance($old);
     if (!$that) {
         return;
     }
     while ($that) {
         if ($that->counter == $counter) {
             break;
         }
         $that->is = $that->child = $that->value = $that->query = null;
         $that = $that->parent;
     }
 }