allow for high-level embedding to work around bad advice from smashing magazine

This commit is contained in:
John Bintz 2009-10-01 22:43:31 -04:00
parent 22d05629ef
commit e5bbd400b9
6 changed files with 55 additions and 15 deletions

View File

@ -21,7 +21,8 @@ class WhatDidTheySayAdmin {
'automatic_embedding' => true, 'automatic_embedding' => true,
'search_integration' => true, 'search_integration' => true,
'excerpt_distance' => 30, 'excerpt_distance' => 30,
'use_nl2br' => false 'use_nl2br' => false,
'high_insertion_level' => false
); );
var $capabilities = array(); var $capabilities = array();
@ -79,7 +80,7 @@ class WhatDidTheySayAdmin {
} }
if ($options['automatic_embedding']) { if ($options['automatic_embedding']) {
add_filter('the_content', array(&$this, 'the_content_automatic_embedding'), 15); add_filter('the_content', array(&$this, 'the_content_automatic_embedding'), $options['high_insertion_level'] ? 100 : 15);
} }
foreach (get_class_methods($this) as $method) { foreach (get_class_methods($this) as $method) {
@ -526,6 +527,22 @@ class WhatDidTheySayAdmin {
return $updated; return $updated;
} }
/**
* Handle updating the insertion level.
*/
function handle_update_high_insertion_level($info) {
$updated = false;
if (current_user_can('manage_options')) {
$options = get_option('what-did-they-say-options');
$options['high_insertion_level'] = isset($info['high_insertion_level']);
update_option('what-did-they-say-options', $options);
$updated = __('Insertion level updated.', 'what-did-they-say');
}
return $updated;
}
/** /**
* Handle updates to languages. * Handle updates to languages.
* @param array $info The part of the $_POST array for What Did They Say?!? * @param array $info The part of the $_POST array for What Did They Say?!?

View File

@ -8,7 +8,7 @@
<?php } ?> <?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?> <?php if (current_user_can('submit_transcriptions')) { ?>
<div id="wdts-<?php echo $new_transcript_id ?>" style="zoom:1<?php echo (!$transcript_options->are_new_transcripts_allowed() ? ';display:none' : '') ?>"> <div id="wdts-<?php echo $new_transcript_id ?>" style="zoom:1<?php echo (!$transcript_options->are_new_transcripts_allowed() ? ';display:none' : '') ?>">
<?php wdts_hedaer_wrapper(__('Submit a New Transcript:', 'what-did-they-say')) ?> <?php wdts_header_wrapper(__('Submit a New Transcript:', 'what-did-they-say')) ?>
<form method="post"> <form method="post">
<input type="hidden" name="wdts[_nonce]" value="<?php echo wp_create_nonce('what-did-they-say') ?>" /> <input type="hidden" name="wdts[_nonce]" value="<?php echo wp_create_nonce('what-did-they-say') ?>" />
<input type="hidden" name="wdts[module]" value="queue-transcript" /> <input type="hidden" name="wdts[module]" value="queue-transcript" />
@ -30,6 +30,6 @@
<input type="submit" value="<?php _e('Submit For Approval', 'what-did-they-say') ?>" /> <input type="submit" value="<?php _e('Submit For Approval', 'what-did-they-say') ?>" />
</div> </div>
</form> </form>
<script type="text/javascript">WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $new_transcript_id ?>')</script>
</div> </div>
<script type="text/javascript">WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $new_transcript_id ?>')</script>
<?php } ?> <?php } ?>

View File

@ -1,4 +1,22 @@
<?php if (current_user_can('manage_options')) { ?> <?php if (current_user_can('manage_options')) { ?>
<h3><?php _e('Force a High Insertion Level for Automatic Transcript Embedding', 'what-did-they-say') ?></h3>
<p><?php _e('If you are using automatic transcript embedding and got a message stating that controls could not be loaded, enable this option.', 'what-did-they-say') ?></p>
<p><?php _e('This is potentially impolite to other plugins and themes, so if you don\'t need it, disable it.', 'what-did-they-say') ?></p>
<form method="post">
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<input type="hidden" name="wdts[module]" value="high-insertion-level" />
<label>
<input type="checkbox"
name="wdts[high_insertion_level]"
value="yes"
<?php echo ($options['high_insertion_level'] ? 'checked="checked"' : '') ?> />
<?php _e('Inject transcripts at level 100 instead of level 15', 'what-did-they-say') ?>
</label>
<input type="submit" class="button" value="<?php _e('Change Insertion Level', 'what-did-they-say') ?>" />
</form>
<h3><?php _e('Reset Settings to Default', 'what-did-they-say') ?></h3> <h3><?php _e('Reset Settings to Default', 'what-did-they-say') ?></h3>
<p><?php _e('Click the button below to reset capabilities and languages to their defaults. This will not affect any transcriptions you have already created, but some transcriptions may become inaccessible if you don\'t redefine the original language.', 'what-did-they-say') ?></p> <p><?php _e('Click the button below to reset capabilities and languages to their defaults. This will not affect any transcriptions you have already created, but some transcriptions may become inaccessible if you don\'t redefine the original language.', 'what-did-they-say') ?></p>
<form method="post" id="reset-wdts"> <form method="post" id="reset-wdts">

View File

@ -1,13 +1,3 @@
<?php
function wdts_header_wrapper($text) {
if (is_admin()) {
echo '<p><strong>' . $text . '</strong></p>';
} else {
echo '<h3 class="wdts">' . $text . '</h3>';
}
}
?>
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" /> <input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
<?php if (is_admin()) { ?> <?php if (is_admin()) { ?>
<input type="hidden" name="wdts[module]" value="manage-post-transcripts" /> <input type="hidden" name="wdts[module]" value="manage-post-transcripts" />
@ -62,6 +52,7 @@
<span class="wdts-update-message"></span> <span class="wdts-update-message"></span>
<?php } ?> <?php } ?>
</div> </div>
<div class="wdts-embed-warning"><?php _e('Uh oh...there\'s a problem with automatic embedding. Enable &quot;Inject transcripts at level 100 instead of level 15&quot; on the What Did They Say?!? Misc. Options page.', 'what-did-they-say') ?></div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -85,3 +85,9 @@
h3.wdts { h3.wdts {
margin: 0.75em 0 0.25em; margin: 0.75em 0 0.25em;
} }
.wdts-embed-warning {
font-size: 115%;
color: #770000;
font-weight: bold;
}

View File

@ -218,4 +218,12 @@ function the_media_transcript_queue_editor() {
<?php } <?php }
} }
function wdts_header_wrapper($text) {
if (is_admin()) {
echo '<p><strong>' . $text . '</strong></p>';
} else {
echo '<h3 class="wdts">' . $text . '</h3>';
}
}
?> ?>