Ignore:
Timestamp:
10/25/10 10:31:09 (9 years ago)
Author:
plg
Message:

bug 1932: use core functions to create URLs.

Make the use of query_string more explicit (show_xml_list)

Warning: PhotoWidget currently doesn't work with $confquestion_mark_in_urls = false

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/photoWidget/include/photoWidgetContent.class.php

    r7315 r7385  
    2222class photoWidgetContent 
    2323{ 
    24   private $query_string = null, $applicable = false; 
     24  private $show_xml_list = false, $applicable = false; 
    2525   
    2626  public function __construct($config) { 
    2727    $this->plugin_config = $config; 
    28  
    29     $this->fmt_xml = make_index_url() . '/category/%s/pw.xml'; 
    30     $xml_pattern = '`category/([^/]*)/pw\.xml$`'; 
    31      
    32     if (preg_match($xml_pattern, $_SERVER['QUERY_STRING'], $matches)) { 
    33       $this->query_string = $matches[1]; 
    34     } 
    3528  } 
    3629 
     
    4841      } 
    4942    } 
     43 
     44    $match_content = $_SERVER['QUERY_STRING']; 
     45    if (PHPWG_ROOT_PATH != $page['root_path']) { 
     46      $match_content = $_SERVER['PATH_INFO']; 
     47    } 
     48 
     49    $xml_pattern = '#/pw\.xml$#'; 
     50    if (preg_match($xml_pattern, $match_content)) { 
     51      $this->show_xml_list = true; 
     52    } 
    5053  } 
    5154 
     
    5760    } 
    5861 
    59     if ($this->query_string!=null) 
     62    if ($this->show_xml_list) 
    6063    { 
    6164      foreach ($images as &$image) { 
     
    8588    } 
    8689 
    87     if ($this->query_string!=null) 
     90    if ($this->show_xml_list) 
    8891    { 
    8992      $image_ids = array(); 
     
    119122 
    120123  private function getXmlPath($category) { 
    121     if (!empty($category['permalink'])) { 
    122       return sprintf($this->fmt_xml, $category['permalink']); 
    123     } elseif ( $GLOBALS['conf']['category_url_style']=='id-name' ) { 
    124       $id_name = $category['id'] . '-' . str2url($category['name']); 
    125       return sprintf($this->fmt_xml, $id_name); 
    126     } else { 
    127       return sprintf($this->fmt_xml, $category['id']); 
    128     }     
     124    global $page; 
     125 
     126    return sprintf( 
     127      '%s/pw.xml', 
     128      make_index_url( 
     129        array( 
     130          'section' => 'categories', 
     131          'category' => $page['category'] 
     132          ) 
     133        ) 
     134      ); 
    129135  } 
    130136 
Note: See TracChangeset for help on using the changeset viewer.