PageRenderTime 52ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/youtube-embed/includes/options-widgets.php

https://bitbucket.org/crypticrod/sr_wp_code
PHP | 263 lines | 203 code | 35 blank | 25 comment | 104 complexity | 7d991a931f5b73c6bf895610451ae971 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.1, GPL-3.0, LGPL-2.0, AGPL-3.0
  1. <?php
  2. // Set default options
  3. $default = array( 'titles' => 'YouTube', 'id' => '', 'type' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'link' => '', 'react' => '', 'stop' => '', 'sweetspot' => '', 'disablekb' => '', 'autohide' => '', 'controls' => '', 'profile' => '0', 'list' => '', 'template' => '', 'hd' => '', 'style' => '' );
  4. $instance = wp_parse_args( ( array ) $instance, $default );
  5. $general = ye_set_general_defaults();
  6. // Title field
  7. $field_id = $this -> get_field_id( 'titles' );
  8. $field_name = $this -> get_field_name( 'titles' );
  9. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Title' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'titles' ] ).'" /></p>';
  10. // Video ID field
  11. $field_id = $this -> get_field_id( 'id' );
  12. $field_name = $this -> get_field_name( 'id' );
  13. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Video URL, ID or List name' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'id' ] ) . '" /></p>';
  14. // Profile field
  15. $field_id = $this -> get_field_id( 'profile' );
  16. $field_name = $this -> get_field_name( 'profile' );
  17. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
  18. ye_generate_profile_list( attribute_escape( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
  19. echo '</select></p>';
  20. // Embed type field
  21. $field_id = $this -> get_field_id( 'type' );
  22. $field_name = $this -> get_field_name( 'type' );
  23. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Embed Type' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
  24. if ( attribute_escape( $instance[ 'type' ] ) == '' ) { echo " selected='selected'"; }
  25. echo '>' . __( 'Profile default' ) . '</option><option value="v"';
  26. if ( attribute_escape( $instance[ 'type' ] ) == 'v' ) { echo " selected='selected'"; }
  27. echo '>' . __( 'IFRAME' ) . '</option><option value="p"';
  28. if ( attribute_escape( $instance[ 'type' ] ) == 'p' ) { echo " selected='selected'"; }
  29. echo '>' . __( 'OBJECT' ) . '</option><option value="m"';
  30. if ( attribute_escape( $instance[ 'type' ] ) == 'c' ) { echo " selected='selected'"; }
  31. echo '>' . __( 'Chromeless' ) . '</option><option value="c"';
  32. if ( attribute_escape( $instance[ 'type' ] ) == 'm' ) { echo " selected='selected'"; }
  33. echo '>' . __( 'EmbedPlus' ) . '</option></select></p>';
  34. // Template
  35. $field_id = $this -> get_field_id( 'template' );
  36. $field_name = $this -> get_field_name( 'template' );
  37. echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Template' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'template' ] ) . '" /></p>';
  38. // Style
  39. $field_id = $this -> get_field_id( 'style' );
  40. $field_name = $this -> get_field_name( 'style' );
  41. echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Style' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'style' ] ) . '" /></p>';
  42. // Size fields
  43. $field_id = $this -> get_field_id( 'width' );
  44. $field_name = $this -> get_field_name( 'width' );
  45. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Size' ) . ': </label><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'width' ] ) . '" />&nbsp;x&nbsp;';
  46. $field_id = $this -> get_field_id( 'height' );
  47. $field_name = $this -> get_field_name( 'height' );
  48. echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'height' ] ) . '" />&nbsp;pixels</p>';
  49. echo "<table>\n";
  50. // Start field
  51. $field_id = $this -> get_field_id( 'start' );
  52. $field_name = $this -> get_field_name( 'start' );
  53. echo "\r\n" . '<tr><td width="100%">' . __( 'Start (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /></td></tr>';
  54. // Autoplay field
  55. $field_id = $this -> get_field_id( 'autoplay' );
  56. $field_name = $this -> get_field_name( 'autoplay' );
  57. echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  58. if ( attribute_escape( $instance[ 'autoplay' ] ) == '' ) { echo " selected='selected'"; }
  59. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  60. if ( attribute_escape( $instance[ 'autoplay' ] ) == '0' ) { echo " selected='selected'"; }
  61. echo '>' . __( 'No' ) . '</option><option value="1"';
  62. if ( attribute_escape( $instance[ 'autoplay' ] ) == '1' ) { echo " selected='selected'"; }
  63. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  64. echo "</table>\n";
  65. ?>
  66. <h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
  67. <?php
  68. // Autohide field
  69. $field_id = $this -> get_field_id( 'autohide' );
  70. $field_name = $this -> get_field_name( 'autohide' );
  71. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Auto hide' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
  72. if ( attribute_escape( $instance[ 'autohide' ] ) == '' ) { echo " selected='selected'"; }
  73. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  74. if ( attribute_escape( $instance[ 'autohide' ] ) == '0' ) { echo " selected='selected'"; }
  75. echo '>' . __( 'Controls &amp; progress bar visible' ) . '</option><option value="1"';
  76. if ( attribute_escape( $instance[ 'autohide' ] ) == '1' ) { echo " selected='selected'"; }
  77. echo '>' . __( 'Controls &amp; progress bar fade out' ) . '</option><option value="2"';
  78. if ( attribute_escape( $instance[ 'autohide' ] ) == '2' ) { echo " selected='selected'"; }
  79. echo '>' . __( 'Progress bar fades' ) . '</option></select></p>';
  80. // List field
  81. $field_id = $this -> get_field_id( 'list' );
  82. $field_name = $this -> get_field_name( 'list' );
  83. echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'List Playback' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
  84. if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
  85. echo '>' . __( 'Profile default' ) . '</option><option value="order"';
  86. if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
  87. echo '>' . __( 'Play each video in order' ) . '</option><option value="random"';
  88. if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
  89. echo '>' . __( 'Play videos randomly' ) . '</option><option value="single"';
  90. if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
  91. echo '>' . __( 'Play one random video' ) . '</option></select></p>';
  92. echo "<table>\n";
  93. // Controls field
  94. $field_id = $this -> get_field_id( 'controls' );
  95. $field_name = $this -> get_field_name( 'controls' );
  96. echo "\r\n" . '<tr><td width="100%">' . __( 'Controls' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  97. if ( attribute_escape( $instance[ 'controls' ] ) == '' ) { echo " selected='selected'"; }
  98. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  99. if ( attribute_escape( $instance[ 'controls' ] ) == '0' ) { echo " selected='selected'"; }
  100. echo '>' . __( 'No' ) . '</option><option value="1"';
  101. if ( attribute_escape( $instance[ 'controls' ] ) == '1' ) { echo " selected='selected'"; }
  102. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  103. // Loop video field
  104. $field_id = $this -> get_field_id( 'loop' );
  105. $field_name = $this -> get_field_name( 'loop' );
  106. echo "\r\n" . '<tr><td width="100%">' . __( 'Loop Video' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  107. if ( attribute_escape( $instance[ 'loop' ] ) == '' ) { echo " selected='selected'"; }
  108. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  109. if ( attribute_escape( $instance[ 'loop' ] ) == '0' ) { echo " selected='selected'"; }
  110. echo '>' . __( 'No' ) . '</option><option value="1"';
  111. if ( attribute_escape( $instance[ 'loop' ] ) == '1' ) { echo " selected='selected'"; }
  112. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  113. echo "</table>\n";
  114. ?>
  115. <h4><?php _e( 'Non-EmbedPlus &amp; HTML5 Options' ); ?></h4>
  116. <?php
  117. echo "<table>\n";
  118. // Annotation field
  119. $field_id = $this -> get_field_id( 'annotation' );
  120. $field_name = $this -> get_field_name( 'annotation' );
  121. echo "\r\n" . '<tr><td width="100%">' . __( 'Annotations' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  122. if ( attribute_escape( $instance[ 'annotation' ] ) == '' ) { echo " selected='selected'"; }
  123. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  124. if ( attribute_escape( $instance[ 'annotation' ] ) == '0' ) { echo " selected='selected'"; }
  125. echo '>' . __( 'No' ) . '</option><option value="1"';
  126. if ( attribute_escape( $instance[ 'annotation' ] ) == '1' ) { echo " selected='selected'"; }
  127. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  128. // Closed Caption field
  129. $field_id = $this -> get_field_id( 'cc' );
  130. $field_name = $this -> get_field_name( 'cc' );
  131. echo "\r\n" . '<tr><td width="100%">' . __( 'Closed Captions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  132. if ( attribute_escape( $instance[ 'cc' ] ) == '' ) { echo " selected='selected'"; }
  133. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  134. if ( attribute_escape( $instance[ 'cc' ] ) == '0' ) { echo " selected='selected'"; }
  135. echo '>' . __( 'No' ) . '</option><option value="1"';
  136. if ( attribute_escape( $instance[ 'cc' ] ) == '1' ) { echo " selected='selected'"; }
  137. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  138. // Disable keyboard field
  139. $field_id = $this -> get_field_id( 'disablekb' );
  140. $field_name = $this -> get_field_name( 'disablekb' );
  141. echo "\r\n" . '<tr><td width="100%">' . __( 'Disable Keyboard' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  142. if ( attribute_escape( $instance[ 'disablekb' ] ) == '' ) { echo " selected='selected'"; }
  143. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  144. if ( attribute_escape( $instance[ 'disablekb' ] ) == '0' ) { echo " selected='selected'"; }
  145. echo '>' . __( 'No' ) . '</option><option value="1"';
  146. if ( attribute_escape( $instance[ 'disablekb' ] ) == '1' ) { echo " selected='selected'"; }
  147. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  148. // Fullscreen field
  149. $field_id = $this -> get_field_id( 'fullscreen' );
  150. $field_name = $this -> get_field_name( 'fullscreen' );
  151. echo "\r\n" . '<tr><td width="100%">' . __( 'Fullscreen' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  152. if ( attribute_escape( $instance[ 'fullscreen' ] ) == '' ) { echo " selected='selected'"; }
  153. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  154. if ( attribute_escape( $instance[ 'fullscreen' ] ) == '0' ) { echo " selected='selected'"; }
  155. echo '>' . __( 'No' ) . '</option><option value="1"';
  156. if ( attribute_escape( $instance[ 'fullscreen' ] ) == '1' ) { echo " selected='selected'"; }
  157. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  158. // Information field
  159. $field_id = $this -> get_field_id( 'info' );
  160. $field_name = $this -> get_field_name( 'info' );
  161. echo "\r\n" . '<tr><td width="100%">' . __( 'Information' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  162. if ( attribute_escape( $instance[ 'info' ] ) == '' ) { echo " selected='selected'"; }
  163. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  164. if ( attribute_escape( $instance[ 'info' ] ) == '0' ) { echo " selected='selected'"; }
  165. echo '>' . __( 'No' ) . '</option><option value="1"';
  166. if ( attribute_escape( $instance[ 'info' ] ) == '1' ) { echo " selected='selected'"; }
  167. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  168. // YouTube Link field
  169. $field_id = $this -> get_field_id( 'link' );
  170. $field_name = $this -> get_field_name( 'link' );
  171. echo "\r\n" . '<tr><td width="100%">' . __( 'Link to YouTube' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  172. if ( attribute_escape( $instance[ 'link' ] ) == '' ) { echo " selected='selected'"; }
  173. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  174. if ( attribute_escape( $instance[ 'link' ] ) == '0' ) { echo " selected='selected'"; }
  175. echo '>' . __( 'No' ) . '</option><option value="1"';
  176. if ( attribute_escape( $instance[ 'link' ] ) == '1' ) { echo " selected='selected'"; }
  177. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  178. // Related videos field
  179. $field_id = $this -> get_field_id( 'related' );
  180. $field_name = $this -> get_field_name( 'related' );
  181. echo "\r\n" . '<tr><td width="100%">' . __( 'Related Videos' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  182. if ( attribute_escape( $instance[ 'related' ] ) == '' ) { echo " selected='selected'"; }
  183. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  184. if ( attribute_escape( $instance[ 'related' ] ) == '0' ) { echo " selected='selected'"; }
  185. echo '>' . __( 'No' ) . '</option><option value="1"';
  186. if ( attribute_escape( $instance[ 'related' ] ) == '1' ) { echo " selected='selected'"; }
  187. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  188. echo "</table>\n";
  189. ?>
  190. <h4><?php _e('EmbedPlus Options'); ?></h4>
  191. <?php
  192. echo "<table>\n";
  193. // Stop field
  194. $field_id = $this -> get_field_id( 'stop' );
  195. $field_name = $this -> get_field_name( 'stop' );
  196. echo "\r\n" . '<tr><td width="100%">' . __( 'Stop (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'stop' ] ) . '" /></td></tr>';
  197. // HD field
  198. $field_id = $this -> get_field_id( 'hd' );
  199. $field_name = $this -> get_field_name( 'hd' );
  200. echo "\r\n" . '<tr><td width="100%">' . __( 'Play HD' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  201. if ( attribute_escape( $instance[ 'hd' ] ) == '' ) { echo " selected='selected'"; }
  202. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  203. if ( attribute_escape( $instance[ 'hd' ] ) == '0' ) { echo " selected='selected'"; }
  204. echo '>' . __( 'No' ) . '</option><option value="1"';
  205. if ( attribute_escape( $instance[ 'hd' ] ) == '1' ) { echo " selected='selected'"; }
  206. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  207. // Reactions field
  208. $field_id = $this -> get_field_id( 'react' );
  209. $field_name = $this -> get_field_name( 'react' );
  210. echo "\r\n" . '<tr><td width="100%">' . __( 'Real-time Reactions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  211. if ( attribute_escape( $instance[ 'react' ] ) == '' ) { echo " selected='selected'"; }
  212. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  213. if ( attribute_escape( $instance[ 'react' ] ) == '0' ) { echo " selected='selected'"; }
  214. echo '>' . __( 'No' ) . '</option><option value="1"';
  215. if ( attribute_escape( $instance[ 'react' ] ) == '1' ) { echo " selected='selected'"; }
  216. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  217. // Sweetspot field
  218. $field_id = $this -> get_field_id( 'sweetspot' );
  219. $field_name = $this -> get_field_name( 'sweetspot' );
  220. echo "\r\n" . '<tr><td width="100%">' . __( 'Sweet Spots' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
  221. if ( attribute_escape( $instance[ 'sweetspot' ] ) == '' ) { echo " selected='selected'"; }
  222. echo '>' . __( 'Profile default' ) . '</option><option value="0"';
  223. if ( attribute_escape( $instance[ 'sweetspot' ] ) == '0' ) { echo " selected='selected'"; }
  224. echo '>' . __( 'No' ) . '</option><option value="1"';
  225. if ( attribute_escape( $instance[ 'sweetspot' ] ) == '1' ) { echo " selected='selected'"; }
  226. echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
  227. echo "</table>\n";
  228. ?>