@@ -29,8 +29,7 @@ class Field_video_url {
2929 * @param $params array
3030 * @return string
3131 */
32- public function form_output ($ params )
33- {
32+ public function form_output ($ params ) {
3433 $ video_info = !empty ($ params ['value ' ]) ? json_decode ($ params ['value ' ]) : null ;
3534
3635 $ input_options = array (
@@ -50,9 +49,9 @@ public function form_output($params)
5049 );
5150
5251 return $ this ->CI ->type ->load_view ('video_url ' , 'input ' , array (
53- 'input_options ' => $ input_options ,
54- 'input_hidden_options ' => $ input_hidden_options
55- ));
52+ 'input_options ' => $ input_options ,
53+ 'input_hidden_options ' => $ input_hidden_options
54+ ));
5655 }
5756
5857 // ----------------------------------------------------------------------
@@ -61,24 +60,21 @@ public function form_output($params)
6160 * Custom parameters
6261 * @author Jose Fonseca <jose@ditecnologia.com>
6362 */
64- public function param_video_heigth ($ value = null )
65- {
63+ public function param_video_heigth ($ value = null ) {
6664 return array (
6765 'input ' => form_input ('video_heigth ' , $ value ),
6866 'instructions ' => $ this ->CI ->lang ->line ('streams.video_heigth.instructions ' )
6967 );
7068 }
7169
72- public function param_video_width ($ value = null )
73- {
70+ public function param_video_width ($ value = null ) {
7471 return array (
7572 'input ' => form_input ('video_width ' , $ value ),
7673 'instructions ' => $ this ->CI ->lang ->line ('streams.video_width.instructions ' )
7774 );
7875 }
7976
80- public function param_video_autoplay ($ value = null )
81- {
77+ public function param_video_autoplay ($ value = null ) {
8278 $ options = array (
8379 '0 ' => $ this ->CI ->lang ->line ('streams.video_width.no ' ),
8480 '1 ' => $ this ->CI ->lang ->line ('streams.video_width.yes ' )
@@ -100,8 +96,7 @@ public function param_video_autoplay($value = null)
10096 * @param array
10197 * @return array
10298 */
103- public function pre_output ($ input , $ params )
104- {
99+ public function pre_output ($ input , $ params ) {
105100 if (!$ input )
106101 return null ;
107102 $ data = json_decode ($ input );
@@ -111,16 +106,13 @@ public function pre_output($input, $params)
111106 $ width = 560 ;
112107 $ source = $ data ->provider_name == 'Vimeo ' ? "//player.vimeo.com/video/ " . $ data ->video_id : "//youtube.com/embed/ " . $ data ->video_id ;
113108 /** set options * */
114- if (!empty ($ params ['video_heigth ' ]))
115- {
109+ if (!empty ($ params ['video_heigth ' ])) {
116110 $ height = $ params ['video_heigth ' ];
117111 }
118- if (!empty ($ params ['video_width ' ]))
119- {
112+ if (!empty ($ params ['video_width ' ])) {
120113 $ width = $ params ['video_width ' ];
121114 }
122- if (!empty ($ params ['video_autoplay ' ]))
123- {
115+ if (!empty ($ params ['video_autoplay ' ])) {
124116 $ source = $ source . '?autoplay=1 ' ;
125117 }
126118 $ iframe = '<iframe width=" ' . $ width . '" src=" ' . $ source . '" height=" ' . $ height . '" frameborder="0" allowfullscreen></iframe> ' ;
@@ -132,8 +124,7 @@ public function pre_output($input, $params)
132124
133125 // ----------------------------------------------------------------------
134126
135- public function pre_output_plugin ($ input , $ params )
136- {
127+ public function pre_output_plugin ($ input , $ params ) {
137128 if (!$ input )
138129 return null ;
139130 $ data = json_decode ($ input );
@@ -143,22 +134,19 @@ public function pre_output_plugin($input, $params)
143134 $ width = 560 ;
144135 $ source = $ data ->provider_name == 'Vimeo ' ? "//player.vimeo.com/video/ " . $ data ->video_id : "//youtube.com/embed/ " . $ data ->video_id ;
145136 /** set options * */
146- if (!empty ($ params ['video_heigth ' ]))
147- {
137+ if (!empty ($ params ['video_heigth ' ])) {
148138 $ height = $ params ['video_heigth ' ];
149139 }
150- if (!empty ($ params ['video_width ' ]))
151- {
140+ if (!empty ($ params ['video_width ' ])) {
152141 $ width = $ params ['video_width ' ];
153142 }
154- if (!empty ($ params ['video_autoplay ' ]))
155- {
143+ if (!empty ($ params ['video_autoplay ' ])) {
156144 $ source = $ source . '?autoplay=1 ' ;
157145 }
158146 $ iframe = '<iframe width=" ' . $ width . '" src=" ' . $ source . '" height=" ' . $ height . '" frameborder="0" allowfullscreen></iframe> ' ;
159147 $ data ->html = $ iframe ;
160148 $ data ->src = $ this ->_get_src ($ iframe );
161-
149+
162150 return (array ) $ data ;
163151 }
164152
@@ -173,13 +161,11 @@ public function pre_output_plugin($input, $params)
173161 * @param $field object
174162 * @return void
175163 */
176- public function event ()
177- {
164+ public function event () {
178165 $ this ->CI ->type ->add_js ('video_url ' , 'video_url.js ' );
179166 }
180167
181- private function _get_src ($ iframe_string )
182- {
168+ private function _get_src ($ iframe_string ) {
183169 $ match = array ();
184170 preg_match ('/src="([^"]+)"/ ' , $ iframe_string , $ match );
185171 return $ match [1 ];
0 commit comments