filter previews and internal filters
This commit is contained in:
parent
c5b70935fc
commit
b25c05e600
@ -103,10 +103,12 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($filter_to_use) {
|
if ($filter_to_use) {
|
||||||
$target = $this->get_filters_dir() . '/' . preg_replace('#[^a-z0-9_-]#', '', strtolower($filter_to_use));
|
$all_filters = $this->_get_available_override_filters();
|
||||||
if (is_dir($target)) {
|
|
||||||
$this->override_filter_info = array();
|
$filter_to_use = preg_replace('#[^a-z0-9_-]#', '', strtolower($filter_to_use));
|
||||||
foreach (glob($target . '/*') as $file) {
|
|
||||||
|
if (isset($all_filters[$filter_to_use])) {
|
||||||
|
foreach (glob($all_filters[$filter_to_use] . '/*') as $file) {
|
||||||
if (preg_match('#\.(php|inc)$#', $file) > 0) { $this->override_filter_info['php'] = $file; }
|
if (preg_match('#\.(php|inc)$#', $file) > 0) { $this->override_filter_info['php'] = $file; }
|
||||||
if (preg_match('#\.(css)$#', $file) > 0) { $this->override_filter_info['css'] = $file; }
|
if (preg_match('#\.(css)$#', $file) > 0) { $this->override_filter_info['css'] = $file; }
|
||||||
}
|
}
|
||||||
@ -864,19 +866,27 @@ class WhatDidTheySayAdmin {
|
|||||||
|
|
||||||
function _get_available_override_filters() {
|
function _get_available_override_filters() {
|
||||||
$available_filters = array();
|
$available_filters = array();
|
||||||
if (is_dir($this->get_filters_dir())) {
|
$search_path = array(
|
||||||
foreach (glob($this->get_filters_dir() . '/*') as $dir) {
|
realpath(dirname(__FILE__) . '/../transcript-filters'),
|
||||||
if (is_dir($dir)) {
|
$this->get_filters_dir()
|
||||||
if (basename($dir) == preg_replace('#[^a-z0-9_-]#', '', strtolower(basename($dir)))) {
|
);
|
||||||
foreach (glob($dir . '/*') as $file) {
|
|
||||||
if (preg_match('#^(.*)\.(inc|php)$#', basename($file), $matches) > 0) {
|
foreach ($search_path as $target) {
|
||||||
$available_filters[] = basename($dir);
|
if (is_dir($target)) {
|
||||||
|
foreach (glob($target . '/*') as $dir) {
|
||||||
|
if (is_dir($dir)) {
|
||||||
|
if (basename($dir) == preg_replace('#[^a-z0-9_-]#', '', strtolower(basename($dir)))) {
|
||||||
|
foreach (glob($dir . '/*') as $file) {
|
||||||
|
if (preg_match('#^(.*)\.(inc|php)$#', basename($file), $matches) > 0) {
|
||||||
|
$available_filters[basename($dir)] = $dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $available_filters;
|
return $available_filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,14 +69,17 @@
|
|||||||
<?php _e('Use the selected transcript filter set:', 'what-did-they-say') ?>
|
<?php _e('Use the selected transcript filter set:', 'what-did-they-say') ?>
|
||||||
<select id="wdts-filters-to-use" name="wdts[filters_to_use]">
|
<select id="wdts-filters-to-use" name="wdts[filters_to_use]">
|
||||||
<option value="__default__"><?php _e('(default)', 'what-did-they-say') ?></option>
|
<option value="__default__"><?php _e('(default)', 'what-did-they-say') ?></option>
|
||||||
<?php foreach ($available_filters as $filter_name) { ?>
|
<?php foreach (array_keys($available_filters) as $filter_name) { ?>
|
||||||
<option value="<?php echo $filter_name ?>"<?php echo ($options['filters_to_use'] == $filter_name) ? ' selected="selected"' : '' ?>><?php echo $filter_name ?></option>
|
<option value="<?php echo $filter_name ?>"<?php echo ($options['filters_to_use'] == $filter_name) ? ' selected="selected"' : '' ?>><?php echo $filter_name ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
|
<a href="#" id="refresh-filter-preview"><img src="<?php echo plugin_dir_url(dirname(__FILE__) . '/../../../') . 'graphics/view-refresh.png' ?>" /></a>
|
||||||
</label>
|
</label>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div id="wdts-sample-transcript-holder"></div>
|
<div id="wdts-sample-transcript-holder"></div>
|
||||||
|
|
||||||
|
<p><em><?php _e('(Hint: Use the above to preview your filters and style while you work on them! The previewer always includes the default stylesheet.)', 'what-did-they-say') ?></em></p>
|
||||||
|
|
||||||
<input class="button" type="submit" value="<?php _e('Change default styles', 'what-did-they-say') ?>" />
|
<input class="button" type="submit" value="<?php _e('Change default styles', 'what-did-they-say') ?>" />
|
||||||
</form>
|
</form>
|
||||||
|
@ -107,6 +107,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$('wdts-filters-to-use').observe('change', load_sample_transcript);
|
$('wdts-filters-to-use').observe('change', load_sample_transcript);
|
||||||
|
$('refresh-filter-preview').observe('click', function(e) {
|
||||||
|
Event.stop(e);
|
||||||
|
load_sample_transcript();
|
||||||
|
});
|
||||||
|
|
||||||
Event.observe(window, 'load', load_sample_transcript);
|
Event.observe(window, 'load', load_sample_transcript);
|
||||||
|
|
||||||
|
BIN
graphics/view-refresh.png
Normal file
BIN
graphics/view-refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 912 B |
@ -0,0 +1,40 @@
|
|||||||
|
div.wdts-transcript {
|
||||||
|
border: solid #333 1px;
|
||||||
|
padding: 0.5em;
|
||||||
|
margin: 0.5em;
|
||||||
|
background-color: #C6D9E9
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div, div.wdts-transcript span {
|
||||||
|
font-family: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-scene-heading {
|
||||||
|
text-transform: uppercase;
|
||||||
|
text-align: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog {
|
||||||
|
text-align: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span {
|
||||||
|
display: inline
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span.wdts-name {
|
||||||
|
text-transform: inherit;
|
||||||
|
font-weight: bold
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span.wdts-speech {
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span.wdts-direction {
|
||||||
|
font-style: italic
|
||||||
|
}
|
||||||
|
|
||||||
|
.wdts-transcript-opener {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class LeftJustifiedBasic extends WDTSDisplayFilters {
|
||||||
|
/**
|
||||||
|
* Filter for dialog short code.
|
||||||
|
*/
|
||||||
|
function filter_shortcode_dialog($name, $direction, $speech, $content) {
|
||||||
|
$content = '<div class="wdts-dialog"><span class="wdts-name">' . $name . '</span>';
|
||||||
|
if (!empty($direction)) {
|
||||||
|
$content .= ' <span class="wdts-direction">' . $direction . '</span>';
|
||||||
|
}
|
||||||
|
$content .= ': <span class="wdts-speech">' . $speech . '</span></div>';
|
||||||
|
|
||||||
|
return array($name, $direction, $speech, $content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user