Changeset 19282 for extensions/ExtendedDescription
- Timestamp:
- Dec 4, 2012, 4:16:01 PM (12 years ago)
- Location:
- extensions/ExtendedDescription
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ExtendedDescription/main.inc.php
r19159 r19282 137 137 138 138 // Balises [img=xx.yy,xx.yy,xx.yy;left|right|;name|titleName|] 139 //$patterns[] = '#\[img=(\d*)\.?(\d*|);?(left|right|);?(name|titleName|)\]#ie';140 139 $patterns[] = '#\[img=([\d\s\.,]*);?(left|right|);?(name|titleName|)\]#ie'; 141 140 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_img_thumb("$1", "$2", "$3")'; 142 141 143 142 // Balises [photo id=xx album=yy size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no] 144 // $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))){1,5}\s*\]#ie'; //10145 143 $patterns[] = '#\[photo ([^\]]+)\]#ie'; 146 144 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_photo_sized("$1")'; 147 145 148 146 // Balises [random album=xx size=SQ|TH|XXS|XS|S|M|L|XL|XXL html=yes|no link=yes|no] 149 // $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))){1,4}\s*\]#ie'; //8 150 $patterns[] = '#\[random ([^\]]+)\]#ie'; 147 $patterns[] = '#\[random([^\]]*)\]#ie'; 151 148 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'extdesc_get_random_photo("$1")'; 152 149 153 150 // Balises [slider album=xx nb_images=yy random=yes|no list=aa,bb,cc size=SQ|TH|XXS|XS|S|M|L|XL|XXL speed=z title=yes|no effect=... arrows=yes|no control=yes|no elastic=yes|no] 154 // $patterns[] = '#\[slider(?:(?:\s+(album)=(\d+))|(?:\s+(nb_images)=(\d+))|(?:\s+(random)=(yes|no))|(?:\s+(list)=([\d,]+))|(?:\s+(size)=(SQ|TH|XXS|XS|S|M|L|XL|XXL))|(?:\s+(speed)=(\d+))|(?:\s+(title)=(yes|no))|(?:\s+(effect)=([a-zA-Z]+))|(?:\s+(arrows)=(yes|no))|(?:\s+(control)=(yes|no))|(?:\s+(elastic)=(yes|no))){1,11}\s*\]#ie'; //22155 151 $patterns[] = '#\[slider ([^\]]+)\]#ie'; 156 152 $replacements[] = ($param == 'subcatify_category_description') ? '' : 'get_slider("$1")'; … … 490 486 * Return html code for a random photo 491 487 * 492 * @int album: select picture from this album 488 * @int album: select picture from this album (default: all) 493 489 * @string size: picture size (default: M) 494 490 * @string html: return complete html structure (default: yes) … … 508 504 509 505 // check album id 510 if (empty($params['album'])) 511 { 512 if (empty($params['cat'])) return 'missing album id'; 506 if ( empty($params['album']) and !empty($params['cat']) ) 507 { 513 508 $params['album'] = $params['cat']; 514 509 } … … 516 511 // get picture id 517 512 $query = ' 518 SELECT id 513 SELECT id, category_id 519 514 FROM '.IMAGES_TABLE.' 520 515 JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id 521 WHERE category_id = '.$params['album'].' 516 WHERE 517 '.(empty($params['album']) ? '1=1': 'category_id = '.$params['album']); 518 519 $query.= ' '.get_sql_condition_FandF(array( 520 'forbidden_categories' => 'category_id', 521 'visible_categories' => 'category_id', 522 'visible_images' => 'id' 523 ), 524 'AND' 525 ); 526 527 $query.= ' 522 528 ORDER BY '.DB_RANDOM_FUNCTION.'() 523 529 LIMIT 1 … … 527 533 if (pwg_db_num_rows($result)) 528 534 { 529 list($ img_id) = pwg_db_fetch_row($result);530 return get_photo_sized( 'id='.$img_id.' album='.$params['album'].' size='.$params['size'].' html='.$params['html'].' link='.$params['link']);535 list($params['id'], $params['album']) = pwg_db_fetch_row($result); 536 return get_photo_sized($params); 531 537 } 532 538 … … 549 555 * @string arrows: display navigation arrows (default: yes) 550 556 * @string control: display navigation bar (default: yes) 551 * @string elastic: adapt slider size to each picture (default: no)557 * @string elastic: adapt slider size to each picture (default: yes) 552 558 */ 553 559 function get_slider($param) … … 566 572 'arrows' => array('yes|no', 'yes'), 567 573 'control' => array('yes|no', 'yes'), 568 'elastic' => array('yes|no', ' no'),574 'elastic' => array('yes|no', 'yes'), 569 575 ); 570 576 … … 577 583 578 584 // parameters 579 $params['arrows'] = $params['arrows']===' no' ? 'false' : 'true';580 $params['control'] = $params['control']===' no' ? 'false' : 'true';585 $params['arrows'] = $params['arrows']==='yes' ? 'true' : 'false'; 586 $params['control'] = $params['control']==='yes' ? 'true' : 'false'; 581 587 $params['elastic'] = $params['elastic']==='yes' ? true : false; 582 588 $params['title'] = $params['title']==='yes' ? true : false; 589 $params['random'] = $params['random']==='yes' ? true : false; 583 590 584 591 // pictures from album... 585 592 if (!empty($params['album'])) 586 593 { 587 // parameters588 $params['random'] = $params['random']==='yes' ? true : false;589 590 594 // get image order inside category 591 595 if ($params['random']) … … 689 693 function parse_parameters($param, $default_params) 690 694 { 695 if (is_array($param)) 696 { 697 return $param; 698 } 699 691 700 $params = array(); 692 701 -
extensions/ExtendedDescription/template/slider.tpl
r17349 r19282 24 24 {/footer_script} 25 25 26 {if not $elastic_size} 27 {assign var=slider_min_h value=$img_size.h} 26 {if $elastic_size} 27 {assign var=slider_full_height value=0} 28 {else} 29 {assign var=slider_full_height value=$img_size.h} 28 30 {/if} 31 {assign var=slider_full_width value=0} 29 32 30 <div class="slider-wrapper theme-default" style="width:{$img_size.w}px;{if $elastic_size}height:{math equation='x+y' x=$img_size.h y=40}px;{/if}">31 <div id="slider{$slider_id}" class="nivoSlider" style="width:{$img_size.w}px;{if $elastic_size}height:{$img_size.h}px;{/if}">32 {foreach from=$slider_content item=thumbnail }{strip}33 <div class="slider-wrapper theme-default"> 34 <div id="slider{$slider_id}" class="nivoSlider"> 35 {foreach from=$slider_content item=thumbnail name=slider}{strip} 33 36 {assign var=derivative value=$pwg->derivative($derivative_params, $thumbnail.src_image)} 34 37 {if !$derivative->is_cached()} … … 39 42 <img {if $derivative->is_cached()}src="{$derivative->get_url()}"{else}src="" data-src="{$derivative->get_url()}"{/if} alt="{$thumbnail.TN_ALT}" {$derivative->get_size_htm()} {if $show_title}title="<a href='{$thumbnail.URL}'>{$thumbnail.NAME|replace:'"':"'"}</a>"{/if}> 40 43 41 {if not $elastic_size}42 44 {assign var=derivative_size value=$derivative->get_size()} 43 {math assign=slider_min_h equation="min(x,y)" x=$slider_min_h y=$derivative_size[1]} 44 {/if} 45 {/strip}{/foreach} 45 {math assign=slider_full_width equation="max(x,y)" x=$slider_full_width y=$derivative_size[0]} 46 {if $elastic_size} 47 {math assign=slider_full_height equation="max(x,y)" x=$slider_full_height y=$derivative_size[1]} 48 {else} 49 {math assign=slider_full_height equation="min(x,y)" x=$slider_full_height y=$derivative_size[1]} 50 {/if} 51 {if $smarty.foreach.slider.first} 52 {assign var=slider_init_width value=$derivative_size[0]} 53 {assign var=slider_init_height value=$derivative_size[1]} 54 {/if} 55 56 {/strip} 57 {/foreach} 46 58 </div> 47 59 </div> 48 60 49 {if not $elastic_size}50 61 {footer_script} 62 $("#slider{$slider_id}").parent(".slider-wrapper").css({ldelim} 63 height: {$slider_full_height}{if $controlNav=='true'}+40{/if}, 64 width: {$slider_full_width} 65 }); 51 66 $("#slider{$slider_id}").css({ldelim} 52 height: {$slider_min_h} 67 height: {if $elastic_size}{$slider_init_height}{else}{$slider_full_height}{/if}, 68 width: {$slider_init_width} 53 69 }); 54 70 {/footer_script} 55 {/if}
Note: See TracChangeset
for help on using the changeset viewer.