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

Last change on this file since 31940 was 30377, checked in by plg, 9 years ago

option to display/hide page banner (compatible with plugin Header Manager)

File size: 3.6 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  'display_page_banner' => false,
24);
25}
26
27function modus_smarty_prefilter($source)
28{
29        global $lang, $conf;
30
31        $source = str_replace('<div id="imageHeaderBar">', '<div class=titrePage id=imageHeaderBar>', $source );
32        $source = str_replace('<div id=imageHeaderBar>',   '<div class=titrePage id=imageHeaderBar>', $source );
33
34        if (!isset($lang['modus_theme']))
35                load_language('theme.lang', dirname(__FILE__).'/');
36
37        // picture page actionButtons wrap for mobile
38        if (strpos($source, '<div id="imageToolBar">')!==false || strpos($source, '<div id=imageToolBar>')!==false){
39                if ( !($pos=strpos($source,'<div class="actionButtons">') ) )
40                        $pos = strpos($source,'<div class=actionButtons>');
41                if ($pos !== false)
42                {
43                        $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);
44                        $pos = strpos($source,'caddie', $pos+1);
45                        $pos = strpos($source,'</div>', $pos+1);
46                        $source = substr_replace($source, '</div>', $pos, 0);
47                }
48        }
49
50        /* move imageNumber from imageToolBar to imageHeaderBar*/
51        if (preg_match('#<div[ a-zA-Z"=]+id="?imageHeaderBar"?>#', $source, $matches, PREG_OFFSET_CAPTURE)
52                && preg_match('#<div class="?imageNumber"?>{\\$PHOTO}</div>#', $source, $matches2, PREG_OFFSET_CAPTURE, $matches[0][1]+20))
53        {
54                $source = substr_replace($source, '', $matches2[0][1], strlen($matches2[0][0]));
55                $source = substr_replace($source, $matches2[0][0], $matches[0][1]+strlen($matches[0][0]),0);
56        }
57
58        if ( ($pos=strpos($source, '<ul class="categoryActions">'))!==false || ($pos=strpos($source, '<ul class=categoryActions>'))!==false){
59                if ( ($pos2=strpos($source, '</ul>', $pos))!==false
60                        && (substr_count($source, '<li>', $pos, $pos2-$pos) > 2) )
61                        $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);
62        }
63
64        $re = preg_quote('<img title="{$cat.icon_ts.TITLE}" src="', '/')
65                        .'[^>]+'
66                        .preg_quote('/recent{if $cat.icon_ts.IS_CHILD_DATE}_by_child{/if}.png"', '/')
67                        .'[^>]+'
68                        .preg_quote('alt="(!)">', '/');
69        $source = preg_replace('/'.$re.'/',
70                '<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>',
71                $source);
72
73        $re = preg_quote('<img title="{$thumbnail.icon_ts.TITLE}" src="', '/')
74                .'[^>]+'
75                .preg_quote('/recent.png" alt="(!)">', '/');
76        $source = preg_replace('/'.$re.'/',
77                '<span class=albSymbol title="{$thumbnail.icon_ts.TITLE}">'.MODUS_STR_RECENT.'</span>',
78                $source);
79
80        return $source;
81}
82
83?>
Note: See TracBrowser for help on using the repository browser.