1: <?php
2: /**
3: * LICENSE (BSD)
4: *
5: * Copyright (c) 2013, Gerd Christian Kunze
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions are
10: * met:
11: *
12: * * Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: *
15: * * Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: *
19: * * Neither the name of Gerd Christian Kunze nor the names of the
20: * contributors may be used to endorse or promote products derived from
21: * this software without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24: * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34: *
35: * Shared
36: * 10.06.2013 13:16
37: */
38: namespace MOC\Plugin;
39: use MOC\Api;
40: use MOC\Module\Drive\File;
41:
42: /**
43: *
44: */
45: abstract class Shared {
46:
47: /**
48: * Register javascript files to load
49: *
50: * THIS SHOULD BE USED IN PluginLoader()
51: *
52: * @param File $File
53: */
54: final public function PluginJavaScript( File $File ) {
55: /** @var Gateway\mocJavaScriptHelper $Plugin */
56: $Plugin = Api::Plugin()->Load( Api::Plugin()->Get()->mocJavaScriptHelper() );
57: $Plugin->Register( $File );
58: }
59: /**
60: * Register stylesheet files to load
61: *
62: * THIS SHOULD BE USED IN PluginLoader()
63: *
64: * @param File $File
65: */
66: final public function PluginStyleSheet( File $File ) {
67: /** @var Gateway\mocStyleSheetHelper $Plugin */
68: $Plugin = Api::Plugin()->Load( Api::Plugin()->Get()->mocStyleSheetHelper() );
69: $Plugin->Register( $File );
70: }
71:
72: /**
73: * Determine the name of the plugin
74: *
75: * @return string
76: */
77: final public function PluginName() {
78: $Reflection = new \ReflectionObject( $this );
79: return $Reflection->getShortName();
80: }
81:
82: /**
83: * Determine the gateway used by the plugin
84: *
85: * @return string
86: */
87: final public function PluginGateway() {
88: $Reflection = new \ReflectionObject( $this );
89: return $Reflection->getParentClass()->getName();
90: }
91:
92: /**
93: * This method is used to determine if the plugin can handle the required task
94: *
95: * Return TRUE if your plugin is able to handle the task specified by the configuration
96: *
97: * Example:
98: *
99: * VideoPlayer-Plugin can handle only flv ?
100: *
101: * - Return only true if the source IS flv
102: *
103: * This way the manager is able to search for another plugin to handle other formats
104: *
105: * @return bool
106: */
107: public function PluginCapable() {
108: return false;
109: }
110:
111: /**
112: * This method is used to execute pre-usage code
113: *
114: * @return bool
115: */
116: public function PluginLoader() {
117:
118: }
119: }
120: