PluginProbe ʕ •ᴥ•ʔ
Ocean Extra / 2.5.7
Ocean Extra v2.5.7
2.5.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.4.1 1.1.4.2 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.0.1 1.2.1 1.2.1.1 1.2.1.2 1.2.10 1.2.2 1.2.2.1 1.2.2.2 1.2.2.3 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.16 1.4.17 1.4.18 1.4.19 1.4.2 1.4.20 1.4.21 1.4.22 1.4.23 1.4.24 1.4.25 1.4.26 1.4.27 1.4.28 1.4.29 1.4.3 1.4.30 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.12 1.5.13 1.5.14 1.5.15 1.5.16 1.5.17 1.5.18 1.5.19 1.5.2 1.5.20 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6
ocean-extra / includes / widgets / video.php
ocean-extra / includes / widgets Last commit date
js 1 year ago about-me.php 2 years ago contact-info.php 5 years ago custom-header-logo.php 6 years ago custom-header-nav.php 6 years ago custom-links.php 4 years ago custom-menu.php 6 years ago facebook.php 2 years ago flickr.php 1 day ago instagram.php 3 years ago mailchimp.php 2 years ago recent-posts.php 4 years ago social-share.php 9 months ago social.php 2 years ago tags.php 6 years ago twitter.php 2 years ago video.php 6 years ago
video.php
136 lines
1 <?php
2 /**
3 * Video widget.
4 *
5 * @package OceanWP WordPress theme
6 */
7
8 // Exit if accessed directly
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 if ( ! class_exists( 'Ocean_Extra_Video_Widget' ) ) {
14 class Ocean_Extra_Video_Widget extends WP_Widget {
15
16 /**
17 * Register widget with WordPress.
18 *
19 * @since 1.0.0
20 */
21 public function __construct() {
22 parent::__construct(
23 'ocean_video',
24 esc_html__( '&raquo; Video', 'ocean-extra' ),
25 array(
26 'classname' => 'widget-oceanwp-video video-widget',
27 'description' => esc_html__( 'Easily to display any type of video.', 'ocean-extra' ),
28 'customize_selective_refresh' => true,
29 )
30 );
31 }
32
33 /**
34 * Front-end display of widget.
35 *
36 * @see WP_Widget::widget()
37 * @since 1.0.0
38 *
39 * @param array $args Widget arguments.
40 * @param array $instance Saved values from database.
41 */
42 public function widget( $args, $instance ) {
43
44 $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : '';
45 $video_url = isset( $instance['video_url'] ) ? $instance['video_url'] : '';
46 $description = isset( $instance['video_description'] ) ? $instance['video_description'] : '';
47
48 // Before widget WP hook
49 echo $args['before_widget'];
50
51 // Show widget title
52 if ( $title ) {
53 echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
54 }
55
56 // Show video
57 if ( $video_url ) {
58 echo '<p class="responsive-video-wrap clr">';
59 echo wp_oembed_get( $video_url, array(
60 'width' => 270
61 ) );
62 echo '</p>';
63 } else {
64 esc_html_e( 'You forgot to enter a video URL.', 'ocean-extra' );
65 }
66
67 // Show video description if field isn't empty
68 if ( $description ) {
69 echo '<div class="oceanwp-video-widget-description">'. do_shortcode( $description ) .'</div>';
70 }
71
72 // After widget WP hook
73 echo $args['after_widget'];
74
75 }
76
77 /**
78 * Sanitize widget form values as they are saved.
79 *
80 * @see WP_Widget::update()
81 * @since 1.0.0
82 *
83 * @param array $new_instance Values just sent to be saved.
84 * @param array $old_instance Previously saved values from database.
85 *
86 * @return array Updated safe values to be saved.
87 */
88 public function update( $new_instance, $old_instance ) {
89 $instance = $old_instance;
90 $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
91 $instance['video_url'] = ! empty( $new_instance['video_url'] ) ? esc_url( $new_instance['video_url'] ) : '';
92 $instance['video_description'] = ! empty( $new_instance['video_description'] ) ? strip_tags( $new_instance['video_description'] ) : '';
93 return $instance;
94 }
95
96 /**
97 * Back-end widget form.
98 *
99 * @see WP_Widget::form()
100 * @since 1.0.0
101 *
102 * @param array $instance Previously saved values from database.
103 */
104 public function form( $instance ) {
105
106 // Parse arguments
107 $instance = wp_parse_args((array) $instance, array(
108 'title' => esc_attr__( 'Video', 'ocean-extra' ),
109 'video_url' => '',
110 'video_description' => '',
111 ) ); ?>
112
113 <p>
114 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'ocean-extra' ); ?>:</label>
115 <input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
116 </p>
117
118 <p>
119 <label for="<?php echo esc_attr( $this->get_field_id( 'video_url' ) ); ?>">
120 <?php esc_html_e( 'Video URL ', 'ocean-extra' ); ?></label>
121 <input class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'video_url' ) ); ?>" type="text" value="<?php echo esc_attr( esc_url( $instance['video_url'] ) ); ?>" />
122 <span style="display:block;padding:5px 0" class="description"><?php esc_html_e( 'Enter in a video URL that is compatible with WordPress\'s built-in oEmbed feature.', 'ocean-extra' ); ?> <a href="http://codex.wordpress.org/Embeds" target="_blank"><?php esc_html_e( 'Learn More', 'ocean-extra' ); ?></a></span>
123 </p>
124
125 <p>
126 <label for="<?php echo esc_attr( $this->get_field_id( 'video_description' ) ); ?>"><?php esc_html_e( 'Description', 'ocean-extra' ); ?></label>
127 <textarea rows="15" id="<?php echo esc_attr( $this->get_field_id( 'video_description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'video_description' ) ); ?>" class="widefat" style="height: 100px;"><?php if( !empty( $instance['video_description'] ) ) { echo esc_textarea( $instance['video_description'] ); } ?></textarea>
128 </p>
129
130 <?php
131
132 }
133
134 }
135 }
136 register_widget( 'Ocean_Extra_Video_Widget' );