@@ -30,6 +30,7 @@ class WP_DocumentCloud {
30
30
const CACHING_ENABLED = false ,
31
31
DEFAULT_EMBED_HEIGHT = 620 ,
32
32
DEFAULT_EMBED_WIDTH = 600 ,
33
+ DEFAULT_EMBED_FULL_WIDTH = 940 ,
33
34
OEMBED_PROVIDER = 'https://www.documentcloud.org/api/oembed.{format} ' ,
34
35
OEMBED_RESOURCE_DOMAIN = 'www.documentcloud.org ' ;
35
36
@@ -91,6 +92,7 @@ function get_default_atts() {
91
92
// 4. `WP_DocumentCloud::DEFAULT_EMBED_WIDTH`
92
93
'maxheight ' => intval (get_option ('documentcloud_default_height ' , WP_DocumentCloud::DEFAULT_EMBED_HEIGHT )),
93
94
'maxwidth ' => intval (get_option ('documentcloud_default_width ' , WP_DocumentCloud::DEFAULT_EMBED_WIDTH )),
95
+ 'format ' => 'normal ' ,
94
96
'sidebar ' => 'false ' ,
95
97
'text ' => 'true ' ,
96
98
'pdf ' => 'true ' ,
@@ -100,6 +102,7 @@ function get_default_atts() {
100
102
function add_dc_arguments ($ provider , $ url , $ args ) {
101
103
foreach ($ args as $ key => $ value ) {
102
104
switch ($ key ) {
105
+ case 'format ' :
103
106
case 'height ' :
104
107
case 'width ' :
105
108
case 'discover ' :
@@ -142,6 +145,16 @@ function handle_dc_shortcode($atts) {
142
145
$ filtered_atts ['maxwidth ' ] = $ atts ['width ' ];
143
146
}
144
147
148
+ // If the format is set to wide, it blows away all other width
149
+ // settings.
150
+ if ($ filtered_atts ['format ' ] == 'wide ' ) {
151
+ $ filtered_atts ['maxwidth ' ] = get_option ('documentcloud_full_width ' , DEFAULT_EMBED_FULL_WIDTH );
152
+ }
153
+
154
+ // For the benefit of some templates
155
+ global $ post ;
156
+ $ is_wide = intval ($ filtered_atts ['maxwidth ' ]) > $ default_atts ['maxwidth ' ];
157
+
145
158
if (WP_DocumentCloud::CACHING_ENABLED ) {
146
159
// This lets WordPress cache the result of the oEmbed call.
147
160
// Thanks to http://bit.ly/1HykA0U for this pattern.
@@ -153,7 +166,7 @@ function handle_dc_shortcode($atts) {
153
166
154
167
}
155
168
156
- // TinyMCE and settings page
169
+ // Setup TinyMCE shortcode button
157
170
158
171
function register_tinymce_filters () {
159
172
add_filter ('mce_external_plugins ' ,
0 commit comments