Changeset 16125
- Timestamp:
- Jun 28, 2012, 4:35:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ExtendedDescription/main.inc.php
r16123 r16125 125 125 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_img_thumb("$1", "$2", "$3")'; 126 126 127 // Balises [photo =xx.yy;SQ|TH|XXS|XS|S|M|L|XL|XXL;true|false]128 $patterns[] = '#\[photo =([\d\.]*);?(SQ|TH|XXS|XS|S|M|L|XL|XXL|);?(true|false|)\]#ie';129 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_photo_sized("$1", "$2", "$3" )';130 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")';127 // Balises [photo id=xx album=yy size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no] 128 $patterns[] = '#\[photo\s+id=(\d+)(?:\s+album=(\d+))?(?:\s+size=(SQ|TH|XXS|XS|S|M|L|XL|XXL))?(?:\s+html=(yes|no))?(?:\s+link=(yes|no))?\]#ie'; 129 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_photo_sized("$1", "$2", "$3", "$4", "$5")'; 130 131 // Balises [random album=xx size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no] 132 $patterns[] = '#\[random\s+(?:album|cat)=(\d+)(?:\s+size=(SQ|TH|XXS|XS|S|M|L|XL|XXL))?(?:\s+html=(yes|no))?(?:\s+link=(yes|no))?\]#ie'; 133 $replacements[] = 'extdesc_get_random_photo("$1", "$2", "$3", "$4")'; 134 134 135 135 // Balises <!--complete-->, <!--more--> et <!--up-down--> … … 372 372 373 373 // Return html code for a photo 374 function get_photo_sized($ elem_id, $size, $show_url)374 function get_photo_sized($image_id, $cat_id, $size, $html, $link) 375 375 { 376 376 global $template; 377 378 if (empty($size)) $size = 'M';379 if (empty($show_url)) $show_url = 'true';380 381 list($image_id, $cat_id) = array_pad(explode(".",$elem_id), 2, "");382 377 383 378 $size_map = array( … … 393 388 ); 394 389 390 if (!array_key_exists($size, $size_map)) $size = 'M'; 391 $link = $link=='no' ? false: true; 392 $html = $html=='no' ? false: true; 393 395 394 $deriv_type = $size_map[ strtoupper($size) ]; 396 395 … … 436 435 } 437 436 438 $content = $template->parse('extended_description_content', true); 439 if (get_boolean($show_url)) 440 { 441 return '<a href="'.$url.'">'.$content.'</a>'; 442 } 443 else 444 { 445 return $content; 437 438 if ($html) 439 { 440 $content = $template->parse('extended_description_content', true); 441 if ($link) return '<a href="'.$url.'">'.$content.'</a>'; 442 else return $content; 443 } 444 else 445 { 446 return $selected_derivative->get_url(); 446 447 } 447 448 } … … 452 453 453 454 454 function extdesc_get_random_photo($category_id, $size ="M")455 function extdesc_get_random_photo($category_id, $size, $html, $link) 455 456 { 456 457 include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); … … 469 470 { 470 471 list($img_id) = pwg_db_fetch_row($result); 471 return get_photo_sized($img_id, $ size, 'false');472 return get_photo_sized($img_id, $category_id, $size, $html, $link); 472 473 } 473 474
Note: See TracChangeset
for help on using the changeset viewer.