Subversion Repositories all2e1pixeloutmp3flashplayer

[/] [autoloads/] [all2e1PixelOutMp3FlashPlayerOperators.php] - Blame information for rev 1

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 m.bader
<?php
2
 
3
class all2e1PixelOutMp3FlashPlayerOperators
4
{
5
    /*!
6
     Constructor
7
    */
8
    function all2e1PixelOutMp3FlashPlayerOperators()
9
    {
10
        $this->Operators = array('mp3player');
11
    }
12
 
13
    /*!
14
     Returns the operators in this class.
15
    */
16
    function &operatorList()
17
    {
18
        return $this->Operators;
19
    }
20
 
21
    /*!
22
     \return true to tell the template engine that the parameter list
23
    exists per operator type, this is needed for operator classes
24
    that have multiple operators.
25
    */
26
    function namedParameterPerOperator()
27
    {
28
        return true;
29
    }
30
 
31
    /*!
32
     The first operator has two parameters, the other has none.
33
     See eZTemplateOperator::namedParameterList()
34
    */
35
    function namedParameterList()
36
    {
37
        return array( 'mp3player' => array('url' => array( 'type' => 'string',
38
                                                           'required' => true,
39
                                                           'default' => '' ),
40
                                           'id' => array( 'type' => 'string',
41
                                                          'required' => false,
42
                                                          'default' => '' )
43
                                            )
44
                  );
45
    }
46
 
47
    /*!
48
     Executes the needed operator(s).
49
     Checks operator names, and calls the appropriate functions.
50
    */
51
    function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
52
                     &$currentNamespace, &$operatorValue, &$namedParameters )
53
    {
54
        switch ( $operatorName )
55
        {
56
            case 'mp3player':
57
            {
58
                $operatorValue = $this->mp3player( $namedParameters['url'], $namedParameters['id'] );
59
            } break;
60
        }
61
    }
62
 
63
    function mp3player( $url, $id )
64
    {
65
        $ini = eZINI::instance( 'all2e1pixeloutmp3flashplayer.ini' );
66
 
67
        $playerLocation = '/extension/all2e1pixeloutmp3flashplayer/design/standard/flash/player.swf';
68
        $url = trim($url, '"');
69
 
70
        $returnArray = array('<object type="application/x-shockwave-flash" data="'.$playerLocation.'" id="audioplayer'.$id.'" height="'.$ini->variable( 'FunctionalOptions','height' ).'" width="'.$ini->variable( 'FunctionalOptions','width' ).'">');
71
        array_push($returnArray, '<param name="movie" value="'.$playerLocation.'" />');
72
        array_push($returnArray, '<param name="FlashVars" value="playerID='.$id.'&amp;soundFile='.$url.'&autostart='.$ini->variable( 'FunctionalOptions','autostart' ).'&loop='.$ini->variable( 'FunctionalOptions','loop' ).'&bg=0x'.$ini->variable( 'DesignSettings','bg' ).'&leftbg=0x'.$ini->variable( 'DesignSettings','leftbg' ).'&rightbg=0x'.$ini->variable( 'DesignSettings','rightbg' ).'&rightbghover=0x'.$ini->variable( 'DesignSettings','rightbghover' ).'&lefticon=0x'.$ini->variable( 'DesignSettings','lefticon' ).'&righticon=0x'.$ini->variable( 'DesignSettings','righticon' ).'&righticonhover=0x'.$ini->variable( 'DesignSettings','righticonhover' ).'&text=0x'.$ini->variable( 'DesignSettings','text' ).'&slider=0x'.$ini->variable( 'DesignSettings','slider' ).'&loader=0x'.$ini->variable( 'DesignSettings','loader' ).'&track=0x'.$ini->variable( 'DesignSettings','track' ).'&border=0x'.$ini->variable( 'DesignSettings','border' ).'" />');
73
        array_push($returnArray, '<param name="quality" value="high" />');
74
        array_push($returnArray, '<param name="menu" value="false" />');
75
        array_push($returnArray, '<param name="wmode" value="transparent" />');
76
        array_push($returnArray, '</object>');
77
 
78
        return implode('', $returnArray);
79
    }
80
 
81
    /// \privatesection
82
    var $Operators;
83
}
84
 
85
?>