Compare commits
19 Commits
2.9-releas
...
master
Author | SHA1 | Date |
---|---|---|
John Bintz | a2e13853ab | |
John Bintz | c5b54a19f3 | |
Philip M. Hofer (Frumph) | d7797ef29a | |
Philip M. Hofer (Frumph) | f38e92d374 | |
Philip M. Hofer (Frumph) | 367d6f9b41 | |
John Bintz | 6181a4ee3c | |
John Bintz | 398bbc01c2 | |
Philip M. Hofer (Frumph) | fd52a600ba | |
Philip M. Hofer (Frumph) | 96b5db1227 | |
Philip M. Hofer (Frumph) | 36a8a1a2b6 | |
Philip M. Hofer (Frumph) | 8f254211e5 | |
Philip M. Hofer (Frumph) | 5ff967308e | |
Philip M. Hofer (Frumph) | 758ebe3ce8 | |
Philip M. Hofer (Frumph) | 548e077a94 | |
Philip M. Hofer (Frumph) | 2dcd8bf19b | |
Philip M. Hofer (Frumph) | 80d9d946a6 | |
Philip M. Hofer (Frumph) | bae1436fc1 | |
John Bintz | 3613121c05 | |
Philip M. Hofer (Frumph) | a68e5258d1 |
|
@ -24,16 +24,15 @@ class ComicPressMediaHandling {
|
|||
|
||||
function _get_filter($filter_to_use = null) {
|
||||
global $comic_filename_filters;
|
||||
|
||||
if (!is_null($filter_to_use)) {
|
||||
if (is_string($filter_to_use)) {
|
||||
if (isset($comic_filename_filters[$filter_to_use])) {
|
||||
return $this->_convert_to_percent_filter($comic_filename_filters[$filter_to_use]);
|
||||
}
|
||||
$options = get_option('comicpress_options');
|
||||
if (isset($options['comic_filename_filters'][$filter_to_use])) {
|
||||
return $this->_convert_to_percent_filter($options['comic_filename_filters'][$filter_to_use]);
|
||||
}
|
||||
// if (isset($options['comic_filename_filters'][$filter_to_use])) {
|
||||
// return $this->_convert_to_percent_filter($options['comic_filename_filters'][$filter_to_use]);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +42,6 @@ class ComicPressMediaHandling {
|
|||
} else {
|
||||
$filter = str_replace('{date}', $this->default_filename_filter, $filter);
|
||||
}
|
||||
|
||||
return $filter;
|
||||
}
|
||||
|
||||
|
@ -100,9 +98,6 @@ class ComicPressMediaHandling {
|
|||
case 'type-folder':
|
||||
$value = $this->type_folder;
|
||||
break;
|
||||
case 'upload-path':
|
||||
$value = get_option('upload_path');
|
||||
break;
|
||||
default:
|
||||
if (preg_match('#^date-(.*)$#', $matches[1], $date_matches) > 0) {
|
||||
if (isset($this->post_to_use)) {
|
||||
|
|
|
@ -19,23 +19,6 @@ function comicpress_admin_print_styles() {
|
|||
wp_enqueue_style('comicpress-options', get_template_directory_uri() . '/options/options.css');
|
||||
}
|
||||
|
||||
function comicpress_save_options_comic_filename_filters($incoming) {
|
||||
$filters = array();
|
||||
|
||||
foreach (array_values($incoming) as $filter) {
|
||||
$filters[wp_filter_nohtml_kses($filter['name'])] = wp_filter_nohtml_kses($filter['filter']);
|
||||
}
|
||||
|
||||
if (!empty($filters)) {
|
||||
if (!isset($filters['default'])) {
|
||||
$cpmh = new ComicPressMediaHandling();
|
||||
$filters['default'] = $cpmh->default_filter;
|
||||
}
|
||||
}
|
||||
|
||||
return $filters;
|
||||
}
|
||||
|
||||
function comicpress_admin_page_head() { ?>
|
||||
<!--[if lt ie 8]> <style> div.show { position: static; margin-top: 1px; } #cpadmin div.off { height: 22px; } </style> <![endif]-->
|
||||
<?php }
|
||||
|
@ -71,7 +54,7 @@ function comicpress_admin() {
|
|||
'comic_clicks_next',
|
||||
'disable_default_comic_nav',
|
||||
'enable_widgetarea_use_sidebar_css',
|
||||
'disable_lrsidebars_frontpage',
|
||||
'disable_lrsidebars',
|
||||
'disable_footer_text',
|
||||
'disable_blogheader',
|
||||
'enable_comicpress_debug',
|
||||
|
@ -207,13 +190,6 @@ function comicpress_admin() {
|
|||
) as $key) {
|
||||
$comicpress_options['comicpress_config'][$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['comic_filename_filters'])) {
|
||||
$comicpress_options['comic_filename_filters'] = comicpress_save_options_comic_filename_filters($_REQUEST['comic_filename_filters']);
|
||||
} else {
|
||||
$comicpress_options['comic_filename_filters'] = array();
|
||||
}
|
||||
|
||||
$tab = 'config';
|
||||
update_option('comicpress_options',$comicpress_options);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ function comicpress_load_options() {
|
|||
'disable_comic_blog_frontpage' => false,
|
||||
'disable_comic_blog_single' => false,
|
||||
'disable_blog_frontpage' => false,
|
||||
'disable_lrsidebars_frontpage' => false,
|
||||
'disable_lrsidebars' => false,
|
||||
'disable_footer_text' => false,
|
||||
'disable_blogheader' => false,
|
||||
'disable_page_titles' => false,
|
||||
|
@ -206,8 +206,7 @@ function comicpress_load_options() {
|
|||
|
||||
'enable_comment_count_in_rss' => false,
|
||||
'enable_scroll_to_top' => false,
|
||||
'enable_page_load_info' => false,
|
||||
'comic_filename_filters' => array()
|
||||
'enable_page_load_info' => false
|
||||
|
||||
) as $field => $value) {
|
||||
$comicpress_options[$field] = $value;
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
<?php include(get_template_directory() . '/layout-head.php'); ?>
|
||||
|
||||
<?php if (!$comicpress_options['disable_comic_frontpage'] && !$comicpress_options['disable_comic_blog_frontpage'] && !is_paged() ) {
|
||||
if (is_archive()) echo "Thinks its an archive";
|
||||
Protect();
|
||||
$comic_query = '&showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
||||
$posts = query_posts($comic_query);
|
||||
$comic_query = 'showposts=1&cat="'.get_all_comic_categories_as_cat_string().'"';
|
||||
query_posts($comic_query);
|
||||
$wp_query->is_archive = false;
|
||||
if (have_posts()) {
|
||||
while (have_posts()) : the_post();
|
||||
comicpress_display_post();
|
||||
endwhile;
|
||||
}
|
||||
Restore();
|
||||
UnProtect();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php if (comicpress_check_child_file('layout-foot') == false) { ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (is_cp_theme_layout('v3cr')) { ?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -16,29 +16,33 @@
|
|||
|
||||
<?php if (is_cp_theme_layout('v,v3c')) { ?>
|
||||
<div id="content" class="narrowcolumn">
|
||||
<div class="column">
|
||||
<?php get_sidebar('overblog'); ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if (!$comicpress_options['disable_comic_frontpage'] && is_home()) {
|
||||
if (is_home()) {
|
||||
if (!$comicpress_options['disable_comic_frontpage']) {
|
||||
Protect();
|
||||
$comic_query = 'showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
||||
$posts = query_posts($comic_query);
|
||||
query_posts($comic_query);
|
||||
if (have_posts()) {
|
||||
while (have_posts()) : the_post();
|
||||
global $frontpage_postnum;
|
||||
$frontpage_postnum = $post->ID;
|
||||
$temp_single = $wp_query->is_single;
|
||||
$wp_query->is_single = true;
|
||||
comicpress_display_comic_area();
|
||||
$wp_query->is_single = $temp_single;
|
||||
$temp_single = null;
|
||||
endwhile;
|
||||
}
|
||||
Restore();
|
||||
UnProtect();
|
||||
wp_reset_query();
|
||||
}
|
||||
if (is_single() & in_comic_category()) {
|
||||
} else {
|
||||
if (is_single() && in_comic_category()) {
|
||||
comicpress_display_comic_area();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (is_cp_theme_layout('3c,standard,3c2r')) { ?>
|
||||
|
@ -46,7 +50,6 @@
|
|||
<div id="subcontent-wrapper">
|
||||
<?php } ?>
|
||||
|
||||
<?php get_sidebar('overblog'); ?>
|
||||
<?php if (is_cp_theme_layout('3c,rgn')) get_sidebar('left'); ?>
|
||||
|
||||
<?php if (is_cp_theme_layout('v3cr')) { ?>
|
||||
|
@ -56,7 +59,7 @@
|
|||
|
||||
<?php if (!is_cp_theme_layout('v3c,v')) { ?>
|
||||
<div id="content" class="narrowcolumn">
|
||||
<div class="column">
|
||||
<?php get_sidebar('overblog'); ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
|
||||
</th>
|
||||
<td>
|
||||
<?php _e('Choose a directory to get the Archive/Search thumbnails from.','comicpress'); ?>
|
||||
<?php _e('Choose a directory to get the ARCHIVE/SEARCH thumbnails from.','comicpress'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -135,7 +135,7 @@
|
|||
|
||||
</th>
|
||||
<td>
|
||||
<?php _e('Choose a directory to get the Mini thumbnails from. (for archive-comic-list, etc.)','comicpress'); ?>
|
||||
<?php _e('Choose a directory to get the MINI thumbnails from. (for archive-comic-list, etc.)','comicpress'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -147,86 +147,18 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="archive_comic_width"><?php _e('Archive Thumbnail Width','comicpress'); ?></label></th>
|
||||
<th scope="row"><label for="archive_comic_width"><?php _e('ARCHIVE Thumbnail Width','comicpress'); ?></label></th>
|
||||
<td colspan="2">
|
||||
<input type="text" size="7" name="archive_comic_width" id="archive_comic_width" value="<?php echo $comicpress_options['comicpress_config']['archive_comic_width']; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="mini_comic_width"><?php _e('Mini Thumbnail Width','comicpress'); ?></label></th>
|
||||
<th scope="row"><label for="mini_comic_width"><?php _e('MINI Thumbnail Width','comicpress'); ?></label></th>
|
||||
<td colspan="2">
|
||||
<input type="text" size="7" name="mini_comic_width" id="mini_comic_width" value="<?php echo $comicpress_options['comicpress_config']['mini_comic_width']; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$cpmh = new ComicPressMediaHandling();
|
||||
|
||||
$filters = $comicpress_options['comic_filename_filters'];
|
||||
if (!isset($filters['default'])) {
|
||||
$filters['default'] = $cpmh->default_filter;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><label><?php _e('Comic Filename Filters', 'comicpress'); ?></label></th>
|
||||
<td colspan="2">
|
||||
<p>
|
||||
<em>For advanced users.</em> Specify the filters used to find the filename.
|
||||
</p>
|
||||
<div id="comicpress-comic-filename-filters-holder">
|
||||
</div>
|
||||
<a href="#" id="add-new-filter"><?php _e('Add new filter', 'comicpress') ?></a>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
var filter_data = [];
|
||||
<?php foreach ($filters as $name => $filter) { ?>
|
||||
filter_data.push({name:'<?php echo esc_js($name) ?>', filter:'<?php echo esc_js($filter) ?>'});
|
||||
<?php } ?>
|
||||
|
||||
var build_row = function(data) {
|
||||
var key = (new Date()).getTime();
|
||||
var row = $('<div>\
|
||||
<label>\
|
||||
<strong>Key:</strong>\
|
||||
<input type="text" size="15" name="comic_filename_filters[' + key + '][name]" value="' + data.name + '" />\
|
||||
</label>\
|
||||
<label>\
|
||||
<strong>Filter:</strong>\
|
||||
<input type="text" size="60" name="comic_filename_filters[' + key + '][filter]" value="' + data.filter + '" />\
|
||||
</label>\
|
||||
<a href="#">Remove</a>\
|
||||
</div>');
|
||||
$('a', row).click(function() {
|
||||
if (confirm('<?php _e('Are you sure?', 'comicpress') ?>')) {
|
||||
$(this).parent().remove();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
$('#add-new-filter').click(function() {
|
||||
$('#comicpress-comic-filename-filters-holder').append(build_row({name:'new_filter',filter:'%wordpress%'}));
|
||||
return false;
|
||||
});
|
||||
|
||||
$.each(filter_data, function(index, f) {
|
||||
$('#comicpress-comic-filename-filters-holder').append(build_row(f));
|
||||
});
|
||||
}(jQuery))
|
||||
</script>
|
||||
<p>
|
||||
Available parameters:
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>%wordpress%</strong>: The WordPress root folder</li>
|
||||
<li><strong>%type-folder%</strong>: The folder for the requested filetype (comic, rss, archive, or mini)</li>
|
||||
<li><strong>%date-(format)%</strong>: The formatting to use for the requested date as per the <a href="http://php.net/date">date()</a> function <em>(ex: %date-Ymd% is <?php echo date('Ymd') ?>)</em></li>
|
||||
<li><strong>%upload-path%</strong>: The value of the upload_path option, which is the destination upload directory for WPMU installs.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
|
|
@ -152,12 +152,12 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="disable_lrsidebars_frontpage"><?php _e('Disable home page sidebars','comicpress'); ?></label></th>
|
||||
<th scope="row"><label for="disable_lrsidebars"><?php _e('Disable left and right sidebars','comicpress'); ?></label></th>
|
||||
<td>
|
||||
<input id="disable_lrsidebars_frontpage" name="disable_lrsidebars_frontpage" type="checkbox" value="1" <?php checked(true, $comicpress_options['disable_lrsidebars_frontpage']); ?> />
|
||||
<input id="disable_lrsidebars" name="disable_lrsidebars" type="checkbox" value="1" <?php checked(true, $comicpress_options['disable_lrsidebars']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('Your home page will not display the default left/right sidebars. Minimalists dream. WARNING: Not recommended for use with Graphic Novel layouts.','comicpress'); ?>
|
||||
<?php _e('Your site will not display the default left/right sidebars. Minimalists dream. WARNING: Not recommended for use with Graphic Novel layouts.','comicpress'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -221,20 +221,3 @@ div.show .cpadmin-footer img{
|
|||
min-width: 80px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/** Comic Filters **/
|
||||
|
||||
#comicpress-comic-filename-filters-holder div {
|
||||
border: solid #ddd 1px;
|
||||
padding: 3px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#comicpress-comic-filename-filters-holder label {
|
||||
float: left;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#comicpress-comic-filename-filters-holder input {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php global $comicpress_options;
|
||||
if (!$comicpress_options['disable_lrsidebars_frontpage']) { ?>
|
||||
if (!$comicpress_options['disable_lrsidebars']) { ?>
|
||||
<div id="sidebar-left">
|
||||
<div class="sidebar-head"></div>
|
||||
<div class="sidebar">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php global $comicpress_options;
|
||||
if (!$comicpress_options['disable_lrsidebars_frontpage']) { ?>
|
||||
if (!$comicpress_options['disable_lrsidebars']) { ?>
|
||||
<div id="sidebar-right">
|
||||
<div class="sidebar-head"></div>
|
||||
<div class="sidebar">
|
||||
|
|
28
style.css
28
style.css
|
@ -86,15 +86,6 @@ acronym, abbr {
|
|||
border-bottom: 1px dashed #000;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 5px;
|
||||
margin: 10px 0;
|
||||
display: block;
|
||||
overflow: scroll;
|
||||
font-family: 'Courier', monospace;
|
||||
border: 1px dotted #000;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -443,8 +434,8 @@ h4, h4 a {
|
|||
}
|
||||
|
||||
.narrowcolumn {
|
||||
width: 540px;
|
||||
padding: 5px 10px;
|
||||
width: 550px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
/* add 10px to smaller width layouts */
|
||||
|
@ -458,10 +449,6 @@ h4, h4 a {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.column {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.column_one {
|
||||
width: 48%;
|
||||
float: left;
|
||||
|
@ -474,18 +461,15 @@ h4, h4 a {
|
|||
padding: 1%;
|
||||
}
|
||||
|
||||
.post, .post-page {
|
||||
clear: both;
|
||||
text-align: left;
|
||||
padding: 2px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.post {}
|
||||
|
||||
.post-content {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.post-foot {
|
||||
.home .post-blog .post-foot,
|
||||
.page-template-blog-php .post-foot {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.post-image {
|
||||
|
|
|
@ -41,8 +41,7 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
array(null, $default),
|
||||
array('fail', $default),
|
||||
array(array(), $default),
|
||||
array('test', 'test'),
|
||||
array('test-from-option', 'test-from-option'),
|
||||
array('test', 'test')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -54,12 +53,6 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
|
||||
$comic_filename_filters['test'] = 'test';
|
||||
|
||||
update_option('comicpress_options', array(
|
||||
'comic_filename_filters' => array(
|
||||
'test-from-option' => 'test-from-option'
|
||||
)
|
||||
));
|
||||
|
||||
$default = str_replace('{date}', $this->cpmh->default_filename_filter, $this->cpmh->default_filter);
|
||||
|
||||
$cpmh = $this->getMock('ComicPressMediaHandling', array('_convert_to_percent_filter'));
|
||||
|
@ -102,8 +95,7 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
array('%test test%', '%test test%'),
|
||||
array('%wordpress%/%type-folder%', vfsStream::url('root') . '/comic'),
|
||||
array('%date-Y%', '2009'),
|
||||
array('%wordpress%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/comic/2009-01-01.*\..*'),
|
||||
array('%wordpress%/%upload-path%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/1/files/comic/2009-01-01.*\..*')
|
||||
array('%wordpress%/%type-folder%/%date-Y-m-d%*.*', vfsStream::url('root') . '/comic/2009-01-01.*\..*')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -114,8 +106,6 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
$cpmh = $this->getMock('ComicPressMediaHandling', array('_abspath'));
|
||||
$cpmh->expects($this->any())->method('_abspath')->will($this->returnValue(vfsStream::url('root')));
|
||||
|
||||
update_option('upload_path', '1/files');
|
||||
|
||||
$this->assertEquals($expected_result, $cpmh->_expand_filter($filter, 'comic', (object)array('ID' => 1, 'post_date' => '2009-01-01 15:00:00')));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once('PHPUnit/Framework.php');
|
||||
require_once('MockPress/mockpress.php');
|
||||
require_once(dirname(__FILE__) . '/../comicpress-options.php');
|
||||
require_once(dirname(__FILE__) . '/../classes/ComicPressMediaHandling.inc');
|
||||
|
||||
class ComicPressOptionsAdminTest extends PHPUnit_Framework_TestCase {
|
||||
function providerTestSaveComicFilenameFilters() {
|
||||
$cpmh = new ComicPressMediaHandling();
|
||||
|
||||
return array(
|
||||
array(
|
||||
array(),
|
||||
array()
|
||||
),
|
||||
array(
|
||||
array(1 => array(
|
||||
'name' => 'test', 'filter' => 'myfilter'
|
||||
)),
|
||||
array(
|
||||
'default' => $cpmh->default_filter,
|
||||
'test' => 'myfilter'
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(1 => array(
|
||||
'name' => 'default', 'filter' => 'test'
|
||||
)),
|
||||
array(
|
||||
'default' => 'test'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestSaveComicFilenameFilters
|
||||
*/
|
||||
function testSaveComicFilenameFilters($incoming, $expected) {
|
||||
$this->assertEquals($expected, comicpress_save_options_comic_filename_filters($incoming));
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ class ComicPressRelatedPostsTest extends PHPUnit_Framework_TestCase {
|
|||
}
|
||||
|
||||
function testBuildPostTable() {
|
||||
$this->markTestIncomplete();
|
||||
$posts = array(
|
||||
(object)array('ID' => 1, 'post_date' => '2009-01-01', 'post_title' => 'Post 1', 'guid' => 'post-1'),
|
||||
(object)array('ID' => 2, 'post_date' => '2009-01-02', 'post_title' => 'Post 2', 'guid' => 'post-2'),
|
||||
|
@ -31,7 +32,7 @@ class ComicPressRelatedPostsTest extends PHPUnit_Framework_TestCase {
|
|||
wp_set_post_categories($id, $cats);
|
||||
}
|
||||
|
||||
$output = '<div class="related_posts"><h4>Title</h4><ul><li><a title="Post 3" href="post-3">Post 3</a></li></ul></div>';
|
||||
$output = '<div class="related_posts"><span>Title</span><table class="month-table"><tr><td class="archive-date" align="right">Jan 3, 2009</td><td class="archive-title"><a title="Post 3" href="post-3">Post 3</a></td></tr></table></div>';
|
||||
|
||||
$this->rp->related_categories = array(2);
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
|
||||
$builder->option('sidebars_widgets', array());
|
|
@ -1,154 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="http://comicpress.local/" />
|
||||
<title>TestComicFilenameFilters</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr><td rowspan="1" colspan="3">TestComicFilenameFilters</td></tr>
|
||||
</thead><tbody>
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>link=ComicPress Options</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>//div[@id='comicpress-tab-config']/span</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--Remove existing filters-->
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>while</td>
|
||||
<td>${filter_count} > 0</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>//div[@id='comicpress-comic-filename-filters-holder']/div[1]/a</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertConfirmation</td>
|
||||
<td>Are you sure?</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>endWhile</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>comicpress_save_config</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--Add and remove works-->
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>echo</td>
|
||||
<td>${filter_count}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>add-new-filter</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>new_filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertEval</td>
|
||||
<td>(${new_filter_count}) == (${filter_count} + 1)</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>comicpress_save_config</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertTextPresent</td>
|
||||
<td>ComicPress Settings SAVED!</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>new_filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertEval</td>
|
||||
<td>(${new_filter_count}) == (${filter_count} + 1)</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>//div[@id='comicpress-comic-filename-filters-holder']/div[2]/a</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertConfirmation</td>
|
||||
<td>Are you sure?</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>new_filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertEval</td>
|
||||
<td>(${new_filter_count}) == (${filter_count})</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>comicpress_save_config</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertTextPresent</td>
|
||||
<td>ComicPress Settings SAVED!</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>storeXpathCount</td>
|
||||
<td>//div[@id="comicpress-comic-filename-filters-holder"]/div</td>
|
||||
<td>new_filter_count</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertEval</td>
|
||||
<td>(${new_filter_count}) == (${filter_count})</td>
|
||||
<td>true</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertTextPresent</td>
|
||||
<td>ComicPress Settings SAVED!</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="selenium.base" href="" />
|
||||
<title>TestWidgetInitIsCorrect</title>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding="1" cellspacing="1" border="1">
|
||||
<thead>
|
||||
<tr><td rowspan="1" colspan="3">TestWidgetInitIsCorrect</td></tr>
|
||||
</thead><tbody>
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/wp-admin/</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--Blow away all widgets-->
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>link=Post Fixtures</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>link=themes/comicpress-2.8/test/fixtures/destroy-widgets.inc</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>pf[is_ok]</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>//input[@value='Load Provided Data']</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertTextPresent</td>
|
||||
<td>New data set loaded into WordPress.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--Check to make sure no widgets have lingering init code-->
|
||||
<tr>
|
||||
<td>clickAndWait</td>
|
||||
<td>site-visit-button</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>assertElementNotPresent</td>
|
||||
<td>//script[contains(text(), 'var image_root')]</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<!--Done, go home-->
|
||||
<tr>
|
||||
<td>open</td>
|
||||
<td>/wp-admin/</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
</body>
|
||||
</html>
|
|
@ -45,10 +45,11 @@ class ComicPressBookmarkWidget extends WP_Widget {
|
|||
);
|
||||
}
|
||||
|
||||
function init() {}
|
||||
function init() {
|
||||
add_action('wp_head', array(&$this, 'wp_head'));
|
||||
}
|
||||
|
||||
function is_active() {
|
||||
add_action('wp_head', array(&$this, 'wp_head'));
|
||||
add_action('template_redirect', array(&$this, 'template_redirect'));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,11 @@ class ComicPressComicBlogPostWidget extends WP_Widget {
|
|||
$temp_query = $wp_query->is_single;
|
||||
$wp_query->is_single = true;
|
||||
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
||||
if ( !empty( $title ) ) { echo "<div class=\"comic-post-header\">".$title."</div>\r\n"; }
|
||||
if (!empty($title)) { echo "<div class=\"comic-post-widget-header\">".$title."</div>\r\n"; }
|
||||
if ($instance['showtitle']) { echo "<div class=\"comic-post-widget-title\">".get_the_title()."</div>\r\n"; }
|
||||
if ($instance['showdate']) { echo "<div class=\"comic-post-widget-date\">".get_the_time('F jS, Y')."</div>\r\n"; }
|
||||
the_content();
|
||||
if ($instance['showcommentlink']) comicpress_display_comment_link();
|
||||
$wp_query->is_single = $temp_query;
|
||||
echo $after_widget;
|
||||
}
|
||||
|
@ -44,11 +47,14 @@ class ComicPressComicBlogPostWidget extends WP_Widget {
|
|||
UnProtect();
|
||||
wp_reset_query();
|
||||
} else {
|
||||
if (!empty($post->post_content)) {
|
||||
if (!empty($post->post_content) && in_comic_category()) {
|
||||
echo $before_widget;
|
||||
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
||||
if ( !empty( $title ) ) { echo "<div class=\"comic-post-header\">".$title."</div>\r\n"; }
|
||||
if (!empty($title)) { echo "<div class=\"comic-post-widget-header\">".$title."</div>\r\n"; }
|
||||
if ($instance['showtitle']) { echo "<div class=\"comic-post-widget-title\">".get_the_title()."</div>\r\n"; }
|
||||
if ($instance['showdate']) { echo "<div class=\"comic-post-widget-date\">".get_the_time('F jS, Y')."</div>\r\n"; }
|
||||
the_content();
|
||||
if ($instance['showcommentlink']) comicpress_display_comment_link();
|
||||
echo $after_widget;
|
||||
}
|
||||
}
|
||||
|
@ -58,16 +64,26 @@ class ComicPressComicBlogPostWidget extends WP_Widget {
|
|||
$instance = $old_instance;
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['onlyhome'] = (bool)( $new_instance['onlyhome'] == 1 ? true : false );
|
||||
$instance['showtitle'] = (bool)( $new_instance['showtitle'] == 1 ? true : false );
|
||||
$instance['showdate'] = (bool)( $new_instance['showdate'] == 1 ? true : false );
|
||||
$instance['showcommentlink'] = (bool)( $new_instance['showcommentlink'] == 1 ? true : false );
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form($instance) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'onlyhome' => false ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'onlyhome' => false, 'showtitle' => false, 'showdate' => false, 'showcommentlink' => false ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$onlyhome = $instance['onlyhome'];
|
||||
$showtitle = $instance['showtitle'];
|
||||
$showdate = $instance['showdate'];
|
||||
$showcommentlink = $instance['showcommentlink'];
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>">Heading:<br /><input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('onlyhome'); ?>"><input id="<?php echo $this->get_field_id('onlyhome'); ?>" name="<?php echo $this->get_field_name('onlyhome'); ?>" type="checkbox" value="1" <?php checked(true, $onlyhome); ?> /> Display only on the home page?</label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('showtitle'); ?>"><input id="<?php echo $this->get_field_id('showtitle'); ?>" name="<?php echo $this->get_field_name('showtitle'); ?>" type="checkbox" value="1" <?php checked(true, $showtitle); ?> /> Show the title of the post?</label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('showdate'); ?>"><input id="<?php echo $this->get_field_id('showdate'); ?>" name="<?php echo $this->get_field_name('showdate'); ?>" type="checkbox" value="1" <?php checked(true, $showdate); ?> /> Show the date of the post?</label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('showcommentlink'); ?>"><input id="<?php echo $this->get_field_id('showcommentlink'); ?>" name="<?php echo $this->get_field_name('showcommentlink'); ?>" type="checkbox" value="1" <?php checked(true, $showcommentlink); ?> /> Show the comment link to the post?</label></p>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class ComicPressCommentsWidget extends WP_Widget {
|
|||
|
||||
echo $before_widget;
|
||||
$title = empty($instance['title']) ? __('Permalink','comicpress') : apply_filters('widget_title', $instance['title']); ?>
|
||||
<?php if ('open' == $post->comment_status) { ?><div class="comment-link"><?php comments_popup_link('<span class="comment-balloon comment-balloon-empty">”</span>Comment ', '<span class="comment-balloon">1</span>Comment ', '<span class="comment-balloon">%</span>Comment '); ?></div><?php } ?>
|
||||
<?php if ('open' == $post->comment_status) { ?><div class="comment-link"><?php comments_popup_link('<span class="comment-balloon comment-balloon-empty"> </span> Comment ', '<span class="comment-balloon">1</span> Comment ', '<span class="comment-balloon">%</span> Comment '); ?></div><?php } ?>
|
||||
<?php
|
||||
echo $after_widget;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue