Changeset 16123 for extensions/ExtendedDescription/main.inc.php
- Timestamp:
- Jun 28, 2012, 3:31:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ExtendedDescription/main.inc.php
r16121 r16123 129 129 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_photo_sized("$1", "$2", "$3")'; 130 130 131 // [random album=xx ]132 $patterns[] = '#\[random\s+(?:album|cat)= \s*?(\d+)\s*?\]#ie';133 $replacements[] = 'extdesc_get_random_photo("$1" )';131 // [random album=xx size=SQ|TH|XXS|XS|S|M|L|XL|XXL] 132 $patterns[] = '#\[random\s+(?:album|cat)=(\d+)(\s+size=(SQ|TH|XXS|XS|S|M|L|XL|XXL))?\]#ie'; 133 $replacements[] = 'extdesc_get_random_photo("$1", "$3")'; 134 134 135 135 // Balises <!--complete-->, <!--more--> et <!--up-down--> … … 398 398 $result = pwg_query($query); 399 399 400 if ( $result)400 if (pwg_db_num_rows($result)) 401 401 { 402 402 $template->set_filename('extended_description_content', 'picture_content.tpl'); 403 403 404 $picture = mysql_fetch_assoc($result);404 $picture = pwg_db_fetch_assoc($result); 405 405 406 406 // url … … 452 452 453 453 454 function extdesc_get_random_photo($category_id )454 function extdesc_get_random_photo($category_id, $size="M") 455 455 { 456 456 include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); 457 457 458 458 $query = ' 459 SELECT 460 id, 461 path 459 SELECT id 462 460 FROM '.IMAGES_TABLE.' 463 461 JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id … … 467 465 ;'; 468 466 $result = pwg_query($query); 469 while ($row = pwg_db_fetch_assoc($result)) 470 { 471 return '<img src="'.get_element_url($row).'">'; 467 468 if (pwg_db_num_rows($result)) 469 { 470 list($img_id) = pwg_db_fetch_row($result); 471 return get_photo_sized($img_id, $size, 'false'); 472 472 } 473 473
Note: See TracChangeset
for help on using the changeset viewer.