public static function clean_uri()
 {
     $_GET = NULL;
     $orig_query_string = $_SERVER['QUERY_STRING'];
     if (strpos($_SERVER['QUERY_STRING'], '?') !== FALSE) {
         if (strpos($_SERVER['QUERY_STRING'], '?') < strpos($_SERVER['QUERY_STRING'], '&')) {
             $orig_query_string = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], '?') + 1);
             $_SERVER['QUERY_STRING'] = str_replace('?' . $orig_query_string, '', $_SERVER['QUERY_STRING']);
         }
     } else {
         $_SERVER['QUERY_STRING'] = '';
     }
     self::$_qs = $orig_query_string;
     foreach (array('REQUEST_URI', 'PATH_INFO', 'ORIG_PATH_INFO') as $uri_protocol) {
         if (!isset($_SERVER[$uri_protocol])) {
             continue;
         }
         if (strpos($_SERVER[$uri_protocol], '?') !== FALSE) {
             $_SERVER[$uri_protocol] = str_replace('?' . $orig_query_string, '', $_SERVER[$uri_protocol]);
         }
     }
 }
 /**
  * Retorna a URL formatada para paginação.
  *
  * @access public
  * @param integer $pageNumber - Número da página.
  * @param string $url - Url para concatenação.
  * @return string - Url completa com o link de paginação.
  */
 public function get_formated_url($pageNumber, $url = "")
 {
     $query_string = new Query_String();
     $currentUrl = $this->get_url();
     if ($url[0] === '?') {
         $page_param_name = substr(substr($url, 1), 0, -1);
         $query_string->{$page_param_name} = $pageNumber;
         return 'http://' . parse_url($currentUrl, PHP_URL_HOST) . parse_url($currentUrl, PHP_URL_PATH) . $query_string->to_url();
     } else {
         $params = "";
         if (strpos($currentUrl, '?') != false) {
             $params = substr($currentUrl, strpos($currentUrl, '?'), strlen($currentUrl));
         }
         return APP_DOMAIN . $url . "/" . $pageNumber . '/' . $params;
     }
 }
 protected function updateTemplate_CollectionPhotos(HTML_Indexer $index = null, Kiwi_Product $product_data = null)
 {
     if ($index === null) {
         $index = $this->_index;
     }
     if ($product_data === null) {
         $product_data = $this->_product_data;
     }
     $vars = array('obrazek_kolekce', 'ma_fotografie_kolekce', 'nema_fotografie_kolekce', 'fotografie_kolekce');
     foreach ($vars as $varname) {
         ${$varname} = $index->{$varname};
     }
     $collection = $product_data->collection;
     foreach ($ma_fotografie_kolekce as $elem) {
         $elem->active = !empty($collection);
     }
     foreach ($nema_fotografie_kolekce as $elem) {
         $elem->active = empty($collection);
     }
     if (!empty($fotografie_kolekce)) {
         if (empty($obrazek_kolekce)) {
             throw new Template_Element_Missing_Exception('obrazek_kolekce');
         }
         if (count($obrazek_kolekce) !== 1) {
             throw new Template_Invalid_Structure_Exception('The "obrazek_kolekce" element duplicity');
         }
         $obrazek_kolekce = $obrazek_kolekce[0];
         if (!empty($collection)) {
             $nav = new Project_Navigator();
             $collection_photos_dir = $nav->get($this->name . '_photos_collection');
             $max_cp = 60;
             foreach ($collection as $citem) {
                 if ($max_cp-- == 0) {
                     break;
                 }
                 $photo_small = $collection_photos_dir . $citem['FileName'];
                 $img = clone $obrazek_kolekce;
                 $img->src = $photo_small;
                 $a = new HTML_A();
                 $qso = new Query_String();
                 if ($citem['URL'] == '') {
                     $qso->set($this->ns . 'p', $citem['ID']);
                     $a->href = $this->_catalog_href . $qso->__toString();
                 } else {
                     $a->href = $this->_catalog_urlbase . $citem['URL'] . $qso->__toString();
                 }
                 $a->title = $citem['Title'];
                 $a->add($img);
                 foreach ($fotografie_kolekce as $elem) {
                     $elem->add($a);
                 }
             }
         }
     }
 }