-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-gktvi-media-buttons.php
109 lines (97 loc) · 4.17 KB
/
class-gktvi-media-buttons.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
if ( !defined ( 'ABSPATH' ) ) {
exit;
}
class GKTVI_Media_Buttons {
public function __construct() {
add_action( 'media_buttons', array( $this,'create_media_buttons' ), 15, 2 );
add_action( 'media_buttons', array( $this, 'create_video_modal' ), 15, 2 );
}
public function create_media_buttons() {
add_thickbox();
?>
<a href='#' id='gktDeferImage' class='button'>
<span style='margin: 3px 5px 0 0;' class='dashicons dashicons-images-alt'></span>Defer Image Load</a>
<a href='#TB_inline?width=900&height=500&inlineId=gktDeferVideo' id='gktviShowModal' class='thickbox button' title='Enter the YouTube video information to generate a shortcode.'>
<span style='margin: 3px 5px 0 0;' class='dashicons dashicons-video-alt3'></span>Defer YouTube Video</a>
<?php
}
public function create_video_modal() {
?>
<div style="display: none;" id="gktDeferVideo" width="500">
<table class="gkt-form-table">
<tbody>
<tr>
<td>
<p>YouTube Video URL:</p>
</td>
<td>
<label>
<input type="text" id="gkt-video-url" class="widefat gktvi-element" value='' />
</label>
<i>"https://www.youtube.com/watch?v=sGUNPMPrxvA", for example</i>
</td>
</tr>
<tr>
<td>
<p>Video Width (px):</p>
</td>
<td>
<label>
<input size="20" type="text" id="gkt-video-width" class="gktvi-element" />
</label>
</td>
</tr>
<tr>
<td>
<p>Video Height (px):</p>
</td>
<td>
<label>
<input size="20" type="text" id="gkt-video-height" class="gktvi-element" />
</label>
</td>
</tr>
<tr>
<td>
<p>Video Thumbnail Resolution:</p>
</td>
<td>
<select id="gkt-video-res" class="gktvi-element">
<option value="hqdefault">High Quality</option>
<option value="mqdefault">Medium Quality</option>
<option value="sddefault">Standard Quality</option>
<option value="maxresdefault">Maximum Resolution</option>
</select>
</td>
</tr>
<tr>
<td>
<p>Mobile Friendly?</p>
</td>
<td>
<select id="gkt-video-mobile" class="gktvi-element">
<option value="yes">yes</option>
<option value="no">no</option>
</select>
</td>
</tr>
<tr>
<td>
<p>Video CSS Class:</p>
<i style="display: block; margin-top: -18px;">(optional)</i>
</td>
<td>
<label>
<input type="text" id="gkt-video-class" class="widefat" class="gktvi-element" />
</label>
</td>
</tr>
</tbody>
</table>
<input id='gkt-yt-submit-btn' type='button' class='button button-primary gkt-ytvideo-insert' value='Insert Shortcode' />
</div>
<?php
}
}
new GKTVI_Media_Buttons();