Changeset 16301
- Timestamp:
- Jul 2, 2012, 10:52:52 PM (12 years ago)
- Location:
- extensions/rv_sitemap
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_sitemap/changelog.txt
r16005 r16301 1 2.4.b 2 - urls for picture pages 3 - extended as images sitemap 4 1 5 2.4.a 2 6 - compatible piwigo 2.4 -
extensions/rv_sitemap/sitemap.php
r13075 r16301 20 20 out_xml('<?xml version="1.0" encoding="UTF-8"?'.'> 21 21 <?xml-stylesheet type="text/xsl" href="'.get_root_url().'plugins/'.basename(dirname(__FILE__)).'/sitemap.xsl"?'.'> 22 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" >', $gzip );22 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">', $gzip ); 23 23 } 24 24 … … 39 39 } 40 40 41 function add_url($url, $lastmod=null, $changefreq=null, $priority=null )41 function add_url($url, $lastmod=null, $changefreq=null, $priority=null, $images_xml=null) 42 42 { 43 43 $xml= … … 63 63 <priority>'.$priority.'</priority>'; 64 64 65 if ( isset($images_xml) ) 66 $xml .= "\n".$images_xml; 67 65 68 $xml .= ' 66 69 </url>'; … … 123 126 while ($row = mysql_fetch_assoc($result)) 124 127 { 125 array_push($categories, $row);128 $categories[] = $row; 126 129 } 127 130 usort($categories, 'global_rank_compare'); … … 129 132 $tags = get_available_tags(); 130 133 usort($tags, 'name_compare'); 131 132 // END AS GUEST133 $user = $save_user;134 134 135 135 if ( isset($_POST['submit']) ) … … 163 163 $freq_tags = $_POST['freq_tags']; 164 164 165 $photo_count = intval($_POST['photo_count']); 166 165 167 set_make_full_url(); 166 168 … … 223 225 } 224 226 } 227 228 if ($photo_count > 0) 229 { 230 $query = 'SELECT DISTINCT i.* FROM '.IMAGES_TABLE.' i 231 INNER JOIN '.IMAGE_CATEGORY_TABLE.' on i.id=image_id 232 '.get_sql_condition_FandF( array('forbidden_categories' => 'category_id', 'forbidden_images'=>'i.id'), 'WHERE ' ).' 233 ORDER BY date_available DESC 234 LIMIT '.$photo_count; 235 $result = pwg_query($query); 236 while ($row = mysql_fetch_assoc($result)) 237 { 238 $url = make_picture_url( array( 239 'image_id' => $row['id'], 240 'image_file' => $row['file'], 241 ) ); 242 $src_image = new SrcImage($row); 243 $images_xml = ''; 244 foreach( array(IMG_THUMB, $conf['derivative_default_size']) as $derivative_type) 245 { 246 $deriv_url = DerivativeImage::url($derivative_type, $src_image); 247 $images_xml .= '<image:image><image:loc>'.$deriv_url.'</image:loc></image:image>'; 248 } 249 add_url($url, $row['date_available'], null, null, $images_xml); 250 } 251 } 225 252 unset_make_full_url(); 226 253 end_xml($gzip); … … 237 264 $x = compact( 'filename', 'selected_tag_urls', 'prio_tags', 'freq_tags', 238 265 'selected_categories', 'prio_categories', 'freq_categories', 239 'selected_specials' );266 'selected_specials', 'photo_count' ); 240 267 $file = fopen( sitemaps_get_config_file_name(), 'w' ); 241 268 fwrite($file, serialize($x) ); … … 251 278 $freq_categories = 'monthly'; 252 279 $freq_tags = 'monthly'; 280 $photo_count = 0; 253 281 254 282 $conf_file_name = sitemaps_get_config_file_name(); … … 281 309 } 282 310 311 // END AS GUEST 312 $user = $save_user; 313 283 314 284 315 $template->assign( array( … … 288 319 'PRIO_CATEGORIES' => $prio_categories, 289 320 'PRIO_TAGS' => $prio_tags, 321 'PHOTO_COUNT' => $photo_count, 290 322 ) 291 323 ); -
extensions/rv_sitemap/sitemap.tpl
r12431 r16301 48 48 </fieldset> 49 49 50 <fieldset> 51 <legend>{'Recent photos'|@translate}</legend> 52 <input type="input" size="4" name="photo_count" value="{$PHOTO_COUNT}"/> 53 </fieldset> 54 50 55 51 56 <p> -
extensions/rv_sitemap/sitemap.xsl
r3417 r16301 2 2 <xsl:stylesheet version="2.0" 3 3 xmlns:html="http://www.w3.org/TR/REC-html40" 4 xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" 4 5 xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" 5 6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> … … 10 11 <title>XML Sitemap</title> 11 12 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 13 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 14 <!-- <script type="text/javascript" src="jquery.tablesorter.min.js"></script> 15 <script type="text/javascript"><![CDATA[ 16 $(document).ready(function() { 17 $("#sitemap").tablesorter( { widgets: ['zebra'] } ); 18 }); 19 ]]></script> --> 12 20 <style type="text/css"> 13 21 body { 14 font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana; 15 font-size:13px; 22 font-family: Helvetica, Arial, sans-serif; 23 font-size: 13px; 24 color: #545353; 16 25 } 17 18 #intro { 19 border:1px black solid; 20 padding:5px 13px 5px 13px; 21 margin:10px; 26 table { 27 border: none; 28 border-collapse: collapse; 22 29 } 23 24 #intro p { 25 line-height: 16.8667px; 30 #sitemap tr.odd { 31 background-color: #eee; 26 32 } 27 33 #sitemap tbody tr:hover { 34 background-color: #ccc; 35 } 36 #sitemap tbody tr:hover td, #sitemap tbody tr:hover td a { 37 color: #000; 38 } 39 #content { 40 margin: 0 auto; 41 width: 1000px; 42 } 43 .expl { 44 margin: 10px 3px; 45 line-height: 1.3em; 46 } 47 .expl a { 48 color: #da3114; 49 font-weight: bold; 50 } 51 a { 52 color: #000; 53 text-decoration: none; 54 } 55 a:visited { 56 color: #777; 57 } 58 a:hover { 59 text-decoration: underline; 60 } 28 61 td { 29 62 font-size:11px; 30 63 } 31 32 64 th { 33 65 text-align:left; … … 35 67 font-size:11px; 36 68 } 37 38 tr.high { 39 background-color:whitesmoke; 40 } 41 42 #footer { 43 padding:2px; 44 margin:10px; 45 font-size:8pt; 46 color:gray; 47 } 48 49 #footer a { 50 color:gray; 51 } 52 53 a { 54 color:black; 69 thead th { 70 border-bottom: 1px solid #000; 71 cursor: pointer; 55 72 } 56 73 </style> 57 74 </head> 58 75 <body> 59 <h1>XML Sitemap</h1> 60 <div id="intro"> 61 <p> 62 This is a XML Sitemap which is supposed to be processed by search engines like <a href="http://www.google.com">Google</a>, <a href="http://search.msn.com">MSN Search</a> and <a href="http://www.yahoo.com">YAHOO</a>.<br /> 63 You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a> and Google's <a href="http://code.google.com/sm_thirdparty.html">list of sitemap programs</a>. 76 <div id="content"> 77 <h1>XML Sitemap</h1> 78 <p class="expl"> 79 Generated by <a href="http://yoast.com/">Yoast</a>'s WordPress SEO plugin, this is an XML Sitemap, meant for consumption by search engines. 64 80 </p> 65 </div> 66 <div id="content"> 67 <table cellpadding="5"> 68 <tr style="border-bottom:1px black solid;"> 69 <th>URL</th> 70 <th>Priority</th> 71 <th>Change Frequency</th> 72 <th>LastChange</th> 73 </tr> 74 <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/> 75 <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> 76 <xsl:for-each select="sitemap:urlset/sitemap:url"> 81 <p class="expl"> 82 You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>. 83 </p> 84 <p class="expl"> 85 This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs. 86 </p> 87 <table id="sitemap" cellpadding="3"> 88 <thead> 77 89 <tr> 78 <xsl:if test="position() mod 2 != 1"> 79 <xsl:attribute name="class">high</xsl:attribute> 80 </xsl:if> 81 <td> 82 <xsl:variable name="itemURL"> 83 <xsl:value-of select="sitemap:loc"/> 84 </xsl:variable> 85 <a href="{$itemURL}"> 86 <xsl:value-of select="sitemap:loc"/> 87 </a> 88 </td> 89 <td> 90 <xsl:value-of select="concat(sitemap:priority*100,'%')"/> 91 </td> 92 <td> 93 <xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/> 94 </td> 95 <td> 96 <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/> 97 </td> 90 <th width="75%">URL</th> 91 <th width="5%">Priority</th> 92 <th width="5%">Images</th> 93 <th width="5%">Change Freq.</th> 94 <th width="10%">Last Change</th> 98 95 </tr> 99 </xsl:for-each> 96 </thead> 97 <tbody> 98 <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/> 99 <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> 100 <xsl:for-each select="sitemap:urlset/sitemap:url"> 101 <tr> 102 <td> 103 <xsl:variable name="itemURL"> 104 <xsl:value-of select="sitemap:loc"/> 105 </xsl:variable> 106 <a href="{$itemURL}"> 107 <xsl:value-of select="sitemap:loc"/> 108 </a> 109 </td> 110 <td> 111 <xsl:value-of select="concat(sitemap:priority*100,'%')"/> 112 </td> 113 <td> 114 <xsl:value-of select="count(image:image)"/> 115 </td> 116 <td> 117 <xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/> 118 </td> 119 <td> 120 <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/> 121 </td> 122 </tr> 123 </xsl:for-each> 124 </tbody> 100 125 </table> 101 126 </div>
Note: See TracChangeset
for help on using the changeset viewer.