source: extensions/modus/functions.inc.php @ 30213

Last change on this file since 30213 was 30053, checked in by rvelices, 10 years ago

modus improve display of image number on picture page + add fotorama template

File size: 3.5 KB
Line 
1<?php
2function modus_css_gradient($gradient) {
3        if (!empty($gradient))
4        {
5                $std = implode(',',$gradient);
6                $gs=trim($gradient[0],'#'); $ge=trim($gradient[1],'#');
7                return "filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#FF$gs,endColorStr=#FF$ge); /* IE to 9*/
8        background-image: -moz-linear-gradient(top,$std); /* FF 3.16 to 15 */
9        background-image: -webkit-linear-gradient(top,$std); /* Chrome, Safari */
10        background-image: -ms-linear-gradient(top,$std); /* IE ? to 9 */
11        background-image: -o-linear-gradient(top,$std); /* Opera 11 to 12 */
12        background-image: linear-gradient(to bottom,$std); /* Standard must be last */";
13        }
14}
15
16function modus_get_default_config()
17{
18  return array(
19        'skin' => 'dark',
20        'album_thumb_size' => 250,
21  'index_photo_deriv'=>'2small',
22  'index_photo_deriv_hdpi'=>'xsmall',
23);
24}
25
26function modus_smarty_prefilter($source)
27{
28        global $lang, $conf;
29
30        $source = str_replace('<div id="imageHeaderBar">', '<div class=titrePage id=imageHeaderBar>', $source );
31        $source = str_replace('<div id=imageHeaderBar>',   '<div class=titrePage id=imageHeaderBar>', $source );
32
33        if (!isset($lang['modus_theme']))
34                load_language('theme.lang', dirname(__FILE__).'/');
35
36        // picture page actionButtons wrap for mobile
37        if (strpos($source, '<div id="imageToolBar">')!==false || strpos($source, '<div id=imageToolBar>')!==false){
38                if ( !($pos=strpos($source,'<div class="actionButtons">') ) )
39                        $pos = strpos($source,'<div class=actionButtons>');
40                if ($pos !== false)
41                {
42                        $source = substr_replace($source, '<div class=actionButtonsWrapper><a id=imageActionsSwitch class=pwg-button><span class="pwg-icon pwg-icon-ellipsis"></span></a>{combine_script version=1 id=\'modus.async\' path="themes/`$themeconf.id`/js/modus.async.js" load=\'async\'}', $pos, 0);
43                        $pos = strpos($source,'caddie', $pos+1);
44                        $pos = strpos($source,'</div>', $pos+1);
45                        $source = substr_replace($source, '</div>', $pos, 0);
46                }
47        }
48
49        /* move imageNumber from imageToolBar to imageHeaderBar*/
50        if (preg_match('#<div[ a-zA-Z"=]+id="?imageHeaderBar"?>#', $source, $matches, PREG_OFFSET_CAPTURE)
51                && preg_match('#<div class="?imageNumber"?>{\\$PHOTO}</div>#', $source, $matches2, PREG_OFFSET_CAPTURE, $matches[0][1]+20))
52        {
53                $source = substr_replace($source, '', $matches2[0][1], strlen($matches2[0][0]));
54                $source = substr_replace($source, $matches2[0][0], $matches[0][1]+strlen($matches[0][0]),0);
55        }
56
57        if ( ($pos=strpos($source, '<ul class="categoryActions">'))!==false || ($pos=strpos($source, '<ul class=categoryActions>'))!==false){
58                if ( ($pos2=strpos($source, '</ul>', $pos))!==false
59                        && (substr_count($source, '<li>', $pos, $pos2-$pos) > 2) )
60                        $source = substr_replace($source, '<a id=albumActionsSwitcher class=pwg-button><span class="pwg-icon pwg-icon-ellipsis"></span></a>{combine_script version=1 id=\'modus.async\' path="themes/`$themeconf.id`/js/modus.async.js" load=\'async\'}', $pos, 0);
61        }
62
63        $re = preg_quote('<img title="{$cat.icon_ts.TITLE}" src="', '/')
64                        .'[^>]+'
65                        .preg_quote('/recent{if $cat.icon_ts.IS_CHILD_DATE}_by_child{/if}.png"', '/')
66                        .'[^>]+'
67                        .preg_quote('alt="(!)">', '/');
68        $source = preg_replace('/'.$re.'/',
69                '<span class=albSymbol title="{$cat.icon_ts.TITLE}">{if $cat.icon_ts.IS_CHILD_DATE}'.MODUS_STR_RECENT_CHILD.'{else}'.MODUS_STR_RECENT.'{/if}</span>',
70                $source);
71
72        $re = preg_quote('<img title="{$thumbnail.icon_ts.TITLE}" src="', '/')
73                .'[^>]+'
74                .preg_quote('/recent.png" alt="(!)">', '/');
75        $source = preg_replace('/'.$re.'/',
76                '<span class=albSymbol title="{$thumbnail.icon_ts.TITLE}">'.MODUS_STR_RECENT.'</span>',
77                $source);
78
79        return $source;
80}
81
82?>
Note: See TracBrowser for help on using the repository browser.