Ignore:
Timestamp:
07/26/12 19:27:33 (7 years ago)
Author:
rvelices
Message:

rv_sitemap: ability to select which derivatives to include in the sitemap

Location:
extensions/rv_sitemap
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_sitemap/changelog.txt

    r16301 r17144  
     12.4.c 
     2        - ability to select which derivatives to include in the sitemap 
     3 
    142.4.b 
    25        - urls for picture pages 
  • extensions/rv_sitemap/main.inc.php

    r16940 r17144  
    11<?php /* 
    22Plugin Name: RV sitemap 
    3 Version: 2.4.b 
     3Version: 2.4.c 
    44Description: Creates a sitemap for your gallery. Sitemaps are used to inform search engines about pages that are available for crawling. 
    55Plugin URI: http://piwigo.org/ext/extension_view.php?eid=78 
  • extensions/rv_sitemap/sitemap.php

    r16940 r17144  
    226226  } 
    227227 
     228        $selected_derivatives = array(); 
    228229  if ($photo_count > 0) 
    229230  { 
     231                if (isset($_POST['selected_derivatives'])) 
     232                        $selected_derivatives = $_POST['selected_derivatives']; 
     233 
     234                foreach($selected_derivatives as $type) 
     235                        $selected_derivatives_params[] = ImageStdParams::get_by_type($type); 
     236 
    230237    $query = 'SELECT DISTINCT i.* FROM '.IMAGES_TABLE.' i 
    231238  INNER JOIN '.IMAGE_CATEGORY_TABLE.' on i.id=image_id 
     
    242249      $src_image = new SrcImage($row); 
    243250      $images_xml = ''; 
    244       foreach( array(IMG_THUMB, $conf['derivative_default_size']) as $derivative_type) 
     251                        $done_iurls=array(); 
     252                        foreach( $selected_derivatives_params as $params ) 
    245253      { 
    246         $deriv_url = DerivativeImage::url($derivative_type, $src_image); 
    247         $images_xml .= '<image:image><image:loc>'.$deriv_url.'</image:loc></image:image>'; 
     254        $deriv_url = DerivativeImage::url($params, $src_image); 
     255                                if (!isset($done_iurls[$deriv_url])) 
     256                                { 
     257                                        $done_iurls[$deriv_url] = 1; 
     258                                        $images_xml .= '<image:image><image:loc>'.$deriv_url.'</image:loc></image:image>'; 
     259                                } 
    248260      } 
    249261      add_url($url, $row['date_available'], null, null, $images_xml); 
     
    279291  $freq_tags = 'monthly'; 
    280292  $photo_count = 0; 
     293        $selected_derivatives = array(); 
    281294 
    282295  $conf_file_name = sitemaps_get_config_file_name(); 
     
    353366$template->assign('frequenciesT', $frequenciesT); 
    354367 
     368$available_derivatives = array(); 
     369foreach(array_keys(ImageStdParams::get_defined_type_map()) as $type) 
     370{ 
     371        $available_derivatives[$type] = l10n($type); 
     372} 
     373$template->assign( array('available_derivatives'=>$available_derivatives, 'selected_derivatives' => $selected_derivatives)); 
     374 
    355375$template->set_filename('sitemap', dirname(__FILE__).'/sitemap.tpl'); 
    356376$template->assign_var_from_handle('ADMIN_CONTENT', 'sitemap'); 
  • extensions/rv_sitemap/sitemap.tpl

    r16301 r17144  
    5050<fieldset> 
    5151<legend>{'Recent photos'|@translate}</legend> 
    52 <input type="input" size="4" name="photo_count" value="{$PHOTO_COUNT}"/> 
     52<input type="input" size="4" name="photo_count" value="{$PHOTO_COUNT}"/> {'Photos'|@translate} 
     53&nbsp;&nbsp;&nbsp; 
     54{'Multiple Size'|@translate}: 
     55<select style="width:200px" name="selected_derivatives[]" multiple="multiple" size="5"> 
     56  {html_options options=$available_derivatives selected=$selected_derivatives} 
     57</select> 
    5358</fieldset> 
    5459 
Note: See TracChangeset for help on using the changeset viewer.