Admin now uses WP_PLUGIN_DIR and WP_PLUGIN_URL to figure out where it lives, instead of manually munging stuff based on PLUGINDIR.
cpm_get_plugin_url() has been largely cloned from cpm_get_plugin_path(), use these to get the URL and the file path, respectively, as they may be different in secured setups.
This commit is contained in:
parent
a25b3dec96
commit
ff200fd084
@ -4,16 +4,16 @@
|
||||
|
||||
require_once('comicpress_manager_library.php');
|
||||
|
||||
add_action("admin_menu", "cpm_add_pages");
|
||||
add_action("add_category_form_pre", "cpm_comicpress_categories_warning");
|
||||
add_action("pre_post_update", "cpm_handle_pre_post_update");
|
||||
add_action("save_post", "cpm_handle_edit_post");
|
||||
add_action("delete_post", "cpm_handle_delete_post");
|
||||
add_filter("manage_posts_columns", "cpm_manage_posts_columns");
|
||||
add_action("manage_posts_custom_column", "cpm_manage_posts_custom_column");
|
||||
add_action("create_category", "cpm_rebuild_storyline_structure");
|
||||
add_action("delete_category", "cpm_rebuild_storyline_structure");
|
||||
add_action("edit_category", "cpm_rebuild_storyline_structure");
|
||||
add_action('admin_menu', 'cpm_add_pages');
|
||||
add_action('add_category_form_pre', 'cpm_comicpress_categories_warning');
|
||||
add_action('pre_post_update', 'cpm_handle_pre_post_update');
|
||||
add_action('save_post', 'cpm_handle_edit_post');
|
||||
add_action('delete_post', 'cpm_handle_delete_post');
|
||||
add_filter('manage_posts_columns', 'cpm_manage_posts_columns');
|
||||
add_action('manage_posts_custom_column', 'cpm_manage_posts_custom_column');
|
||||
add_action('create_category', 'cpm_rebuild_storyline_structure');
|
||||
add_action('delete_category', 'cpm_rebuild_storyline_structure');
|
||||
add_action('edit_category', 'cpm_rebuild_storyline_structure');
|
||||
|
||||
$cpm_config = new ComicPressConfig();
|
||||
|
||||
@ -21,9 +21,9 @@ include('cp_configuration_options.php');
|
||||
|
||||
$default_comicpress_config_file_lines = array('<?' . 'php');
|
||||
foreach ($comicpress_configuration_options as $option_info) {
|
||||
$default_comicpress_config_file_lines[] = "//{$option_info['name']} - {$option_info['description']} (default \"{$option_info['default']}\")";
|
||||
$default_comicpress_config_file_lines[] = "\${$option_info['id']} = \"{$option_info['default']}\";";
|
||||
$default_comicpress_config_file_lines[] = "";
|
||||
$default_comicpress_config_file_lines[] = "//{$option_info['name']} - {$option_info['description']} (default \"{$option_info['default']}\")";
|
||||
$default_comicpress_config_file_lines[] = "\${$option_info['id']} = \"{$option_info['default']}\";";
|
||||
$default_comicpress_config_file_lines[] = "";
|
||||
}
|
||||
$default_comicpress_config_file_lines[] = "?>";
|
||||
|
||||
@ -37,18 +37,24 @@ cpm_initialize_options();
|
||||
* are defined.
|
||||
*/
|
||||
function cpm_comicpress_categories_warning() {
|
||||
if (count(get_all_category_ids()) < 2) {
|
||||
echo '<div style="margin: 10px; padding: 5px; background-color: #440008; color: white; border: solid #a00 1px">';
|
||||
echo __("Remember, you need at least two categories defined in order to use ComicPress.", 'comicpress-manager');
|
||||
echo '</div>';
|
||||
}
|
||||
if (count(get_all_category_ids()) < 2) {
|
||||
echo '<div style="margin: 10px; padding: 5px; background-color: #440008; color: white; border: solid #a00 1px">';
|
||||
echo __("Remember, you need at least two categories defined in order to use ComicPress.", 'comicpress-manager');
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the plugin folder.
|
||||
*/
|
||||
function cpm_get_plugin_path() {
|
||||
return PLUGINDIR . '/' . preg_replace('#^.*/([^\/]*)#', '\\1', dirname(plugin_basename(__FILE__)));
|
||||
return WP_PLUGIN_DIR . '/' . preg_replace('#^.*/([^\/]*)#', '\\1', dirname(plugin_basename(__FILE__)));
|
||||
}
|
||||
/**
|
||||
* Get the URL to the plugin folder.
|
||||
*/
|
||||
function cpm_get_plugin_url() {
|
||||
return WP_PLUGIN_URL . '/' . preg_replace('#^.*/([^\/]*)#', '\\1', dirname(plugin_basename(__FILE__)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,9 +62,9 @@ function cpm_get_plugin_path() {
|
||||
* Also read in the configuration and handle any POST actions.
|
||||
*/
|
||||
function cpm_add_pages() {
|
||||
global $plugin_page, $access_level, $pagenow, $cpm_config, $wp_version, $wpmu_version;
|
||||
global $plugin_page, $access_level, $pagenow, $cpm_config, $wp_version;
|
||||
|
||||
load_plugin_textdomain('comicpress-manager', cpm_get_plugin_path());
|
||||
load_plugin_textdomain('comicpress-manager', false, cpm_get_plugin_path());
|
||||
|
||||
$widget_options = get_option('dashboard_widget_options');
|
||||
if ( !$widget_options || !is_array($widget_options) )
|
||||
@ -112,29 +118,33 @@ function cpm_add_pages() {
|
||||
wp_enqueue_script('scriptaculous-builder');
|
||||
}
|
||||
|
||||
if (!isset($access_level)) { $access_level = 10; }
|
||||
if (!isset($access_level)) { $access_level = 'edit_post'; }
|
||||
|
||||
$plugin_title = __("ComicPress Manager", 'comicpress-manager');
|
||||
|
||||
add_menu_page($plugin_title, __("ComicPress", 'comicpress-manager'), $access_level, $filename, "cpm_manager_index_caller", get_option('siteurl') . '/' . cpm_get_plugin_path() . '/comicpress-icon.png');
|
||||
add_menu_page($plugin_title, __("ComicPress", 'comicpress-manager'), $access_level, $filename, "cpm_manager_index_caller", cpm_get_plugin_url() . '/comicpress-icon.png', 9);
|
||||
add_submenu_page($filename, $plugin_title, __("Upload", 'comicpress-manager'), $access_level, $filename, 'cpm_manager_index_caller');
|
||||
|
||||
//if (!$wpmu_version) {
|
||||
|
||||
if (function_exists('is_super_admin'))
|
||||
if (is_super_admin()) $is_super = true;
|
||||
|
||||
if (!cpm_this_is_multisite() || $is_super) {
|
||||
add_submenu_page($filename, $plugin_title, __("Import", 'comicpress-manager'), $access_level, $filename . '-import', 'cpm_manager_import_caller');
|
||||
//}
|
||||
}
|
||||
|
||||
add_submenu_page($filename, $plugin_title, __("Bulk Edit", 'comicpress-manager'), $access_level, $filename . '-status', 'cpm_manager_status_caller');
|
||||
|
||||
add_submenu_page($filename, $plugin_title, __("Storyline Structure", 'comicpress-manager'), $access_level, $filename . '-storyline', 'cpm_manager_storyline_caller');
|
||||
|
||||
add_submenu_page($filename, $plugin_title, __("Change Dates", 'comicpress-manager'), $access_level, $filename . '-dates', 'cpm_manager_dates_caller');
|
||||
add_submenu_page($filename, $plugin_title, __("ComicPress Config", 'comicpress-manager'), $access_level, $filename . '-config', 'cpm_manager_config_caller');
|
||||
add_submenu_page($filename, $plugin_title, __("Manager Config", 'comicpress-manager'), $access_level, $filename . '-cpm-config', 'cpm_manager_cpm_config_caller');
|
||||
// add_submenu_page($filename, $plugin_title, __("Change Dates", 'comicpress-manager'), $access_level, $filename . '-dates', 'cpm_manager_dates_caller');
|
||||
add_submenu_page($filename, $plugin_title, __("Config", 'comicpress-manager'), $access_level, $filename . '-config', 'cpm_manager_config_caller');
|
||||
add_submenu_page($filename, $plugin_title, __("Options", 'comicpress-manager'), $access_level, $filename . '-options', 'cpm_manager_cpm_config_caller');
|
||||
|
||||
if ($pagenow == "index.php") {
|
||||
if (cpm_option('cpm-enable-dashboard-rss-feed') == 1) {
|
||||
wp_register_sidebar_widget( 'dashboard_cpm', __("ComicPress News", "comicpress-manager"), 'cpm_dashboard_widget',
|
||||
array( 'all_link' => "http://mindfaucet.com/comicpress/", 'feed_link' => "http://feeds.feedburner.com/comicpress?format=xml", 'width' => 'half', 'class' => 'widget_rss' )
|
||||
wp_register_sidebar_widget( 'dashboard_cpm', __('ComicPress News', 'comicpress-manager'), 'cpm_dashboard_widget',
|
||||
array( 'all_link' => "http://frumph.net/", 'feed_link' => "http://frumph.net/feed/", 'width' => 'half', 'class' => 'widget_rss' )
|
||||
);
|
||||
|
||||
add_filter('wp_dashboard_widgets', 'cpm_add_dashboard_widget');
|
||||
@ -168,16 +178,7 @@ function cpm_handle_pre_post_update($post_id) {
|
||||
if ($post_id > 0) {
|
||||
$post = get_post($post_id);
|
||||
if (!in_array($post->post_type, array("attachment", "revision", "page"))) {
|
||||
$ok = false;
|
||||
extract(cpm_get_all_comic_categories());
|
||||
$post_categories = wp_get_post_categories($post_id);
|
||||
foreach ($category_tree as $node) {
|
||||
$parts = explode("/", $node);
|
||||
if (in_array(end($parts), $post_categories)) {
|
||||
$ok = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
$ok = true;
|
||||
if ($ok) {
|
||||
$original_timestamp = false;
|
||||
foreach (array("post_date", "post_date_gmt") as $param) {
|
||||
@ -237,42 +238,20 @@ function cpm_handle_pre_post_update($post_id) {
|
||||
* Handle editing a post.
|
||||
*/
|
||||
function cpm_handle_edit_post($post_id) {
|
||||
global $cpm_config;
|
||||
global $cpm_config;
|
||||
|
||||
if (!$cpm_config->is_cpm_managing_posts) {
|
||||
$ok = false;
|
||||
extract(cpm_get_all_comic_categories());
|
||||
$post_categories = wp_get_post_categories($post_id);
|
||||
foreach ($category_tree as $node) {
|
||||
$parts = explode("/", $node);
|
||||
if (in_array(end($parts), $post_categories)) {
|
||||
$ok = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_uploaded_file($_FILES['comicpress-replace-image']['tmp_name']) && !$ok) {
|
||||
$post_categories = wp_get_post_categories($post_id);
|
||||
$post_categories[] = end(explode("/", reset($category_tree)));
|
||||
wp_set_post_categories($post_id, $post_categories);
|
||||
$ok = true;
|
||||
}
|
||||
|
||||
if ($ok) {
|
||||
$new_date = date(CPM_DATE_FORMAT, strtotime(implode("-", array($_POST['aa'], $_POST['mm'], $_POST['jj']))));
|
||||
|
||||
foreach (array('hovertext' => 'comicpress-img-title',
|
||||
'transcript' => 'comicpress-transcript') as $meta_name => $post_name) {
|
||||
if (isset($_POST[$post_name])) {
|
||||
update_post_meta($post_id, $meta_name, $_POST[$post_name]);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_uploaded_file($_FILES['comicpress-replace-image']['tmp_name'])) {
|
||||
$_POST['override-date'] = $new_date;
|
||||
cpm_handle_file_uploads(array('comicpress-replace-image'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$cpm_config->is_cpm_managing_posts) {
|
||||
$new_date = date(CPM_DATE_FORMAT, strtotime(implode("-", array($_POST['aa'], $_POST['mm'], $_POST['jj']))));
|
||||
foreach (array('hovertext' => 'comicpress-img-title', 'transcript' => 'comicpress-transcript') as $meta_name => $post_name) {
|
||||
if (isset($_POST[$post_name])) {
|
||||
update_post_meta($post_id, $meta_name, $_POST[$post_name]);
|
||||
}
|
||||
}
|
||||
if (is_uploaded_file($_FILES['comicpress-replace-image']['tmp_name'])) {
|
||||
$_POST['override-date'] = $new_date;
|
||||
cpm_handle_file_uploads(array('comicpress-replace-image'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,7 +322,7 @@ function cpm_dashboard_widget($sidebar_args) {
|
||||
extract($sidebar_args, EXTR_SKIP);
|
||||
}
|
||||
echo $before_widget . $before_title . $widget_name . $after_title;
|
||||
wp_widget_rss_output('http://feeds.feedburner.com/comicpress?format=xml', array('items' => 2, 'show_summary' => true));
|
||||
wp_widget_rss_output('http://frumph.net/feed/', array('items' => 2, 'show_summary' => true));
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
@ -425,12 +404,7 @@ function cpm_manage_posts_custom_column($column_name) {
|
||||
}
|
||||
|
||||
$ok = false;
|
||||
|
||||
if (cpm_get_subcomic_directory() !== false) {
|
||||
if (in_category(get_option('comicpress-manager-manage-subcomic'))) {
|
||||
$ok = true;
|
||||
}
|
||||
} else {
|
||||
|
||||
extract(cpm_get_all_comic_categories());
|
||||
foreach ($category_tree as $node) {
|
||||
$parts = explode("/", $node);
|
||||
@ -438,7 +412,6 @@ function cpm_manage_posts_custom_column($column_name) {
|
||||
$ok = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ok) {
|
||||
if (isset($broken_down_comic_files[$post_date])) {
|
||||
@ -487,12 +460,12 @@ function cpm_manage_posts_custom_column($column_name) {
|
||||
* so that it includes/removes the affected categories.
|
||||
*/
|
||||
function cpm_rebuild_storyline_structure($term_id) {
|
||||
global $cpm_config;
|
||||
global $cpm_config;
|
||||
|
||||
if (empty($cpm_config->is_cpm_modifying_categories)) {
|
||||
cpm_read_information_and_check_config();
|
||||
cpm_normalize_storyline_structure();
|
||||
}
|
||||
if (empty($cpm_config->is_cpm_modifying_categories)) {
|
||||
cpm_read_information_and_check_config();
|
||||
cpm_normalize_storyline_structure();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -573,15 +546,11 @@ function cpm_post_editor($width = 435, $is_import = false) {
|
||||
|
||||
extract(cpm_normalize_storyline_structure());
|
||||
|
||||
if (cpm_get_subcomic_directory() !== false) {
|
||||
$post_categories = array(get_option('comicpress-manager-manage-subcomic'));
|
||||
} else {
|
||||
if (cpm_option('cpm-default-comic-category-is-last-storyline') == 1) {
|
||||
$post_categories = array(end(explode("/", end($category_tree))));
|
||||
} else {
|
||||
$post_categories = array($cpm_config->properties['comiccat']);
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
cpm_display_storyline_checkboxes($category_tree, $post_categories);
|
||||
@ -594,12 +563,12 @@ function cpm_post_editor($width = 435, $is_import = false) {
|
||||
|
||||
// see if there are additional categories that can be set besides the comic and blog categories
|
||||
|
||||
if (count($category_checkboxes = cpm_generate_additional_categories_checkboxes()) > 0) {
|
||||
/* if (count($category_checkboxes = cpm_generate_additional_categories_checkboxes()) > 0) {
|
||||
$form_titles_and_fields[] = array(
|
||||
__("Additional Categories:", 'comicpress-manager'),
|
||||
implode("\n", $category_checkboxes)
|
||||
);
|
||||
}
|
||||
} */
|
||||
|
||||
$form_titles_and_fields[] = array(
|
||||
__("Time to post:", 'comicpress-manager'),
|
||||
@ -660,10 +629,6 @@ function cpm_post_editor($width = 435, $is_import = false) {
|
||||
__(" <em>(the transcript to use for all posts)</em>", 'comicpress-manager')
|
||||
);
|
||||
|
||||
if (!is_plugin_active('what-did-they-say/what-did-they-say.php')) {
|
||||
$form_titles_and_fields[] = '<em>' . __('Want even better control over your transcripts? Try <a href="http://wordpress.org/extend/plugins/what-did-they-say/" target="wdts">What Did They Say?!?</a>', 'comicpress-manager') . '</em>';
|
||||
}
|
||||
|
||||
$form_titles_and_fields[] = array(
|
||||
__("Upload Date Format:", 'comicpress-manager'),
|
||||
'<input type="text" id="upload-date-format" name="upload-date-format" />' .
|
||||
@ -688,7 +653,7 @@ function cpm_post_editor($width = 435, $is_import = false) {
|
||||
__("Quick Tags (click to add):", 'comicpress-manager'),
|
||||
implode("\n", $all_tags_links)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?><table class="form-table"><?php
|
||||
|
||||
@ -762,12 +727,12 @@ function cpm_wrap_content($help_content, $activity_content, $show_sidebar = true
|
||||
<?php }
|
||||
|
||||
function cpm_manager_page_caller($page) {
|
||||
global $cpm_config, $wpmu_version;
|
||||
global $cpm_config;
|
||||
|
||||
$do_first_run = false;
|
||||
if (!cpm_option('cpm-did-first-run')) {
|
||||
$all_comic_folders_found = true;
|
||||
foreach (array(''. 'rss_', 'archive_') as $folder_name) {
|
||||
foreach (array(''. 'rss_', 'archive_', 'mini_') as $folder_name) {
|
||||
if (!file_exists(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${folder_name}comic_folder"])) { $all_comic_folders_found = false; break; }
|
||||
}
|
||||
|
||||
@ -833,9 +798,6 @@ function cpm_find_thumbnails($date_root) {
|
||||
foreach (array('rss', 'archive', 'mini') as $type) {
|
||||
if ($cpm_config->separate_thumbs_folder_defined[$type]) {
|
||||
$path = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||
$path .= '/' . $subdir;
|
||||
}
|
||||
$files = glob($path . '/' . $date_root . "*");
|
||||
if ($files === false) { $files = array(); }
|
||||
|
||||
@ -913,15 +875,11 @@ function generate_comic_categories_options($form_name, $label = true) {
|
||||
$first_category = null;
|
||||
|
||||
extract(cpm_normalize_storyline_structure());
|
||||
if (cpm_get_subcomic_directory() !== false) {
|
||||
$default_category = get_option('comicpress-manager-manage-subcomic');
|
||||
} else {
|
||||
if (cpm_option('cpm-default-comic-category-is-last-storyline') == 1) {
|
||||
$default_category = end(explode("/", end($category_tree)));
|
||||
} else {
|
||||
$default_category = $cpm_config->properties['comiccat'];
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
foreach (get_all_category_ids() as $cat_id) {
|
||||
@ -1079,9 +1037,6 @@ function cpm_write_thumbnail($input, $target_filename, $do_rebuild = false) {
|
||||
$converted_target_filename = preg_replace('#\.[^\.]+$#', '', $target_filename) . '.' . $target_format;
|
||||
|
||||
$target = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||
$target .= '/' . $subdir;
|
||||
}
|
||||
$target .= '/' . $converted_target_filename;
|
||||
|
||||
if (!in_array($target, $write_targets)) {
|
||||
@ -1325,7 +1280,7 @@ function cpm_obfuscate_filename($filename) {
|
||||
}
|
||||
|
||||
function cpm_do_gd_file_check_on_upload($check_file_path, $target_filename) {
|
||||
global $cpm_config, $wpmu_version;
|
||||
global $cpm_config;
|
||||
|
||||
$file_ok = true;
|
||||
$did_filecheck = false;
|
||||
@ -1423,9 +1378,6 @@ function cpm_handle_file_uploads($files) {
|
||||
$did_convert_cmyk_jpeg = array();
|
||||
|
||||
$target_root = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$_POST['upload-destination'] . "_folder"];
|
||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||
$target_root .= '/' . $subdir;
|
||||
}
|
||||
|
||||
$write_thumbnails = isset($_POST['thumbnails']) && ($_POST['upload-destination'] == "comic");
|
||||
$new_post = isset($_POST['new_post']) && ($_POST['upload-destination'] == "comic");
|
||||
@ -1549,9 +1501,6 @@ function cpm_handle_file_uploads($files) {
|
||||
if (@unlink($target_root . '/' . $target_filename)) {
|
||||
foreach (cpm_get_thumbnails_to_generate() as $type) {
|
||||
$path = CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties[$type . "_comic_folder"];
|
||||
if (($subdir = cpm_get_thumbnails_to_generate()) !== false) {
|
||||
$path .= '/' . $subdir;
|
||||
}
|
||||
@unlink($path . '/' . $target_filename);
|
||||
}
|
||||
}
|
||||
@ -1661,7 +1610,7 @@ function cpm_handle_file_uploads($files) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($wpmu_version) {
|
||||
if (cpm_this_is_multisite()) {
|
||||
if (cpm_wpmu_is_over_storage_limit()) { $ok_to_keep_uploading = false; break; }
|
||||
}
|
||||
}
|
||||
@ -1683,7 +1632,7 @@ function cpm_handle_file_uploads($files) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($wpmu_version) {
|
||||
if (cpm_this_is_multisite()) {
|
||||
if (cpm_wpmu_is_over_storage_limit()) { $ok_to_keep_uploading = false; }
|
||||
}
|
||||
}
|
||||
@ -1838,7 +1787,7 @@ function cpm_show_post_body_template($width = 435) {
|
||||
function cpm_include_javascript($name) {
|
||||
|
||||
$js_path = realpath(ABSPATH . cpm_get_plugin_path() . '/js');
|
||||
$plugin_url_root = get_option('siteurl') . '/' . cpm_get_plugin_path();
|
||||
$plugin_url_root = cpm_get_plugin_url();
|
||||
|
||||
$regular_file = $name;
|
||||
$minified_file = 'minified-' . $name;
|
||||
@ -1861,7 +1810,8 @@ function cpm_include_javascript($name) {
|
||||
function cpm_write_global_styles_scripts() {
|
||||
global $cpm_config, $blog_id;
|
||||
|
||||
$plugin_url_root = get_option('siteurl') . '/' . cpm_get_plugin_path();
|
||||
// $plugin_url_root = get_option('siteurl') . '/' . cpm_get_plugin_path();
|
||||
$plugin_url_root = cpm_get_plugin_url();
|
||||
|
||||
$ajax_request_url = isset($_SERVER['URL']) ? $_SERVER['URL'] : $_SERVER['SCRIPT_URL'];
|
||||
?>
|
||||
@ -1875,7 +1825,7 @@ var messages = {
|
||||
'count_missing_posts_counting': "<?php _e("counting", 'comicpress-manager') ?>"
|
||||
};
|
||||
|
||||
var ajax_request_uri = "<?php echo $plugin_url_root ?>/comicpress_manager_count_missing_entries.php?blog_id=<?php echo $blog_id ?>";
|
||||
var ajax_request_uri = "<?php echo $plugin_url_root; ?>/comicpress_manager_count_missing_entries.php?blog_id=<?php echo $blog_id ?>";
|
||||
</script>
|
||||
<?php cpm_include_javascript("comicpress_script.js") ?>
|
||||
<link rel="stylesheet" href="<?php echo $plugin_url_root . '/comicpress_styles.css' ?>" type="text/css" />
|
||||
@ -1898,7 +1848,7 @@ var ajax_request_uri = "<?php echo $plugin_url_root ?>/comicpress_manager_count_
|
||||
* Handle any warnings that have been invoked.
|
||||
*/
|
||||
function cpm_handle_warnings() {
|
||||
global $cpm_config, $wpmu_version;
|
||||
global $cpm_config;
|
||||
|
||||
// display informative messages to the use
|
||||
// TODO: remove separate arrays and tag messages based on an enum value
|
||||
@ -1984,7 +1934,7 @@ function cpm_handle_warnings() {
|
||||
|
||||
arsort($available_backup_files);
|
||||
|
||||
// if ($wpmu_version) {
|
||||
// if ($wpmu_version || defined('VHOST')) {
|
||||
// $cpm_config->show_config_editor = true;
|
||||
// } else {
|
||||
if ($cpm_config->config_method == "comicpress-config.php") {
|
||||
@ -2032,7 +1982,7 @@ function cpm_handle_warnings() {
|
||||
echo cpm_manager_edit_config();
|
||||
} ?>
|
||||
|
||||
<?php if ($wpmu_version) { ?>
|
||||
<?php if (!cpm_this_is_multisite()) { ?>
|
||||
<hr />
|
||||
|
||||
<strong><?php _e('Debug info', 'comicpress-manager') ?></strong> (<em><?php _e("this data is sanitized to protect your server's configuration", 'comicpress-manager') ?></em>)
|
||||
@ -2062,7 +2012,7 @@ function cpm_handle_actions() {
|
||||
$valid_actions = array('multiple-upload-file', 'create-missing-posts',
|
||||
'update-config', 'restore-backup', 'change-dates',
|
||||
'write-comic-post', 'update-cpm-config', 'do-first-run', 'skip-first-run',
|
||||
'build-storyline-schema', 'batch-processing', 'manage-subcomic');
|
||||
'build-storyline-schema', 'batch-processing');
|
||||
|
||||
//
|
||||
// take actions based upon $_POST['action']
|
||||
@ -2079,7 +2029,7 @@ function cpm_handle_actions() {
|
||||
* Show the details of the current setup in the Sidebar.
|
||||
*/
|
||||
function cpm_show_comicpress_details() {
|
||||
global $cpm_config, $wpmu_version;
|
||||
global $cpm_config;
|
||||
|
||||
$all_comic_dates_ok = true;
|
||||
$all_comic_dates = array();
|
||||
@ -2090,11 +2040,6 @@ function cpm_show_comicpress_details() {
|
||||
}
|
||||
}
|
||||
|
||||
$subdir_path = '';
|
||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||
$subdir_path .= '/' . $subdir;
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- ComicPress details -->
|
||||
<div id="comicpress-details">
|
||||
@ -2114,7 +2059,7 @@ function cpm_show_comicpress_details() {
|
||||
</li>
|
||||
<li><strong><?php _e('Comics folder:', 'comicpress-manager') ?></strong>
|
||||
<?php
|
||||
echo $cpm_config->properties['comic_folder'] . $subdir_path;
|
||||
echo $cpm_config->properties['comic_folder'];
|
||||
?><br />
|
||||
<?php
|
||||
$too_many_comics_message = "";
|
||||
@ -2131,9 +2076,9 @@ function cpm_show_comicpress_details() {
|
||||
'rss' => __('RSS feed folder:', 'comicpress-manager'),
|
||||
'mini' => __('Minithumb folder:', 'comicpress-manager'))
|
||||
as $type => $title) {
|
||||
$realpath = realpath(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${type}_comic_folder"] . $subdir_path);
|
||||
$realpath = realpath(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${type}_comic_folder"]);
|
||||
?>
|
||||
<li><strong><?php echo $title ?></strong> <?php echo $cpm_config->properties["${type}_comic_folder"] . $subdir_path; ?>
|
||||
<li><strong><?php echo $title ?></strong> <?php echo $cpm_config->properties["${type}_comic_folder"]; ?>
|
||||
<?php if (
|
||||
($cpm_config->get_scale_method() != CPM_SCALE_NONE) &&
|
||||
(cpm_option("cpm-${type}-generate-thumbnails") == 1) &&
|
||||
@ -2184,7 +2129,7 @@ function cpm_show_comicpress_details() {
|
||||
<li><strong><?php _e('Blog category:', 'comicpress-manager') ?></strong> <a href="<?php echo get_category_link($cpm_config->properties['blogcat']) ?>">
|
||||
<?php echo $cpm_config->blog_category_info['name'] ?></a> <?php printf(__('(ID %s)', 'comicpress-manager'), $cpm_config->properties['blogcat']) ?></li>
|
||||
|
||||
<?php if (!$wpmu_version) { ?>
|
||||
<?php if (!cpm_this_is_multisite()) { ?>
|
||||
<li><strong><?php _e("PHP Version:", 'comicpress-manager') ?></strong> <?php echo phpversion() ?>
|
||||
<?php if (substr(phpversion(), 0, 3) < 5.2) { ?>
|
||||
(<a href="http://gophp5.org/hosts"><?php _e("upgrade strongly recommended", 'comicpress-manager') ?></a>)
|
||||
@ -2306,18 +2251,13 @@ function cpm_show_debug_info($display_none = true) {
|
||||
clearstatcache();
|
||||
$output_config['folder_perms'] = array();
|
||||
|
||||
$subdir = "";
|
||||
if (($subdir = cpm_get_subcomic_directory()) !== false) {
|
||||
$subdir = '/' . $subdir;
|
||||
}
|
||||
|
||||
$output_config['directory_realpaths'] = array();
|
||||
|
||||
foreach (array(
|
||||
'comic' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['comic_folder'] . $subdir,
|
||||
'rss' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['rss_comic_folder'] . $subdir,
|
||||
'mini' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['mini_comic_folder'] . $subdir,
|
||||
'archive' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['archive_comic_folder'] . $subdir,
|
||||
'comic' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['comic_folder'],
|
||||
'rss' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['rss_comic_folder'],
|
||||
'mini' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['mini_comic_folder'],
|
||||
'archive' => CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties['archive_comic_folder'],
|
||||
'config' => $cpm_config->config_filepath
|
||||
) as $key => $path) {
|
||||
if (($s = @stat($path)) !== false) {
|
||||
@ -2347,45 +2287,44 @@ function cpm_show_debug_info($display_none = true) {
|
||||
* Show the config editor.
|
||||
*/
|
||||
function cpm_manager_edit_config() {
|
||||
global $cpm_config, $wpmu_version;
|
||||
global $cpm_config;
|
||||
|
||||
include('cp_configuration_options.php');
|
||||
include('cp_configuration_options.php');
|
||||
|
||||
$max_depth = 3;
|
||||
$max_depth_message = false;
|
||||
$max_directories = 256;
|
||||
$max_depth = 3;
|
||||
$max_depth_message = false;
|
||||
$max_directories = 256;
|
||||
|
||||
$folders_to_ignore = implode("|", array('wp-content', 'wp-includes', 'wp-admin'));
|
||||
$folders_to_ignore = implode("|", array('wp-content', 'wp-includes', 'wp-admin'));
|
||||
|
||||
$folder_stack = glob(CPM_DOCUMENT_ROOT . '/*');
|
||||
if ($folder_stack === false) { $folder_stack = array(); }
|
||||
$found_folders = array();
|
||||
$folder_stack = glob(CPM_DOCUMENT_ROOT . '/*');
|
||||
if ($folder_stack === false) { $folder_stack = array(); }
|
||||
$found_folders = array();
|
||||
|
||||
while (count($folder_stack) > 0) {
|
||||
$file = array_shift($folder_stack);
|
||||
if (is_dir($file)) {
|
||||
$root_file = substr($file, strlen(CPM_DOCUMENT_ROOT) + 1);
|
||||
if (preg_match("#(${folders_to_ignore})$#", $root_file) == 0) {
|
||||
if (count(explode("/", $root_file)) <= $max_depth) {
|
||||
$found_folders[] = $root_file;
|
||||
|
||||
$files = glob($file . "/*");
|
||||
if (is_array($files)) {
|
||||
$folder_stack = array_merge($folder_stack, $files);
|
||||
}
|
||||
} else {
|
||||
if (!$max_depth_message) {
|
||||
$cpm_config->messages[] = sprintf(__("I went %s levels deep in my search for comic directories. Are you sure you have your site set up correctly?", 'comicpress-manager'), $max_depth);
|
||||
$max_depth_message = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($found_folders) == $max_directories) {
|
||||
$cpm_config->messages[] = sprintf(__("I found over %s directories from your site root. Are you sure you have your site set up correctly?", 'comicpress-manager'), $max_directories);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (count($folder_stack) > 0) {
|
||||
$file = array_shift($folder_stack);
|
||||
if (is_dir($file)) {
|
||||
$root_file = substr($file, strlen(CPM_DOCUMENT_ROOT) + 1);
|
||||
if (preg_match("#(${folders_to_ignore})$#", $root_file) == 0) {
|
||||
if (count(explode("/", $root_file)) <= $max_depth) {
|
||||
$found_folders[] = $root_file;
|
||||
$files = glob($file . "/*");
|
||||
if (is_array($files)) {
|
||||
$folder_stack = array_merge($folder_stack, $files);
|
||||
}
|
||||
} /* else {
|
||||
if (!$max_depth_message) {
|
||||
$cpm_config->messages[] = sprintf(__("I went %s levels deep in my search for comic directories. Are you sure you have your site set up correctly?", 'comicpress-manager'), $max_depth);
|
||||
$max_depth_message = true;
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
if (count($found_folders) == $max_directories) {
|
||||
$cpm_config->messages[] = sprintf(__("I found over %s directories from your site root. Are you sure you have your site set up correctly?", 'comicpress-manager'), $max_directories);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sort($found_folders);
|
||||
|
||||
@ -2395,13 +2334,11 @@ function cpm_manager_edit_config() {
|
||||
<input type="hidden" name="action" value="update-config" />
|
||||
|
||||
<table class="form-table">
|
||||
<?php foreach ($comicpress_configuration_options as $field_info) {
|
||||
<?php
|
||||
foreach ($comicpress_configuration_options as $field_info) {
|
||||
$no_wpmu = false;
|
||||
extract($field_info);
|
||||
|
||||
// $ok = ($wpmu_version) ? ($no_wpmu !== true) : true;
|
||||
$ok = true;
|
||||
if ($ok) {
|
||||
$description = " <em>(" . $description . ")</em>";
|
||||
|
||||
$config_id = (isset($field_info['variable_name'])) ? $field_info['variable_name'] : $field_info['id'];
|
||||
@ -2416,7 +2353,7 @@ function cpm_manager_edit_config() {
|
||||
<option value="<?php echo $category->cat_ID ?>"
|
||||
<?php echo ($cpm_config->properties[$config_id] == $cat_id) ? " selected" : "" ?>><?php echo $category->cat_name; ?></option>
|
||||
<?php } ?>
|
||||
</select><?php echo $description ?></td>
|
||||
</select><br /><?php echo $description ?></td>
|
||||
</tr>
|
||||
<?php break;
|
||||
case "folder":
|
||||
@ -2432,7 +2369,8 @@ function cpm_manager_edit_config() {
|
||||
foreach ($found_folders as $file) { ?>
|
||||
<option <?php echo ($file == $cpm_config->properties[$config_id]) ? " selected" : "" ?> value="<?php echo $file ?>"><?php echo $file ?></option>
|
||||
<?php } ?>
|
||||
</select><?php echo $description ?>
|
||||
</select><br />
|
||||
<?php echo $description ?>
|
||||
</div>
|
||||
|
||||
<input type="radio" name="folder-<?php echo $config_id ?>" id="folder-e-<?php echo $config_id ?>" value="enter" <?php echo !$directory_found_in_list ? "checked" : "" ?>/> <label for="folder-e-<?php echo $config_id ?>">Enter in my directory name</label><br />
|
||||
@ -2462,16 +2400,17 @@ function cpm_manager_edit_config() {
|
||||
case "integer": ?>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $name ?>:</th>
|
||||
<td><input type="text" name="<?php echo $config_id ?>" size="20" value="<?php echo $cpm_config->properties[$config_id] ?>" /><?php echo $description ?></td>
|
||||
<td><input type="text" name="<?php echo $config_id ?>" size="20" value="<?php echo $cpm_config->properties[$config_id] ?>" /><br />
|
||||
<?php echo $description ?></td>
|
||||
</tr>
|
||||
<?php break;
|
||||
}
|
||||
}
|
||||
} ?>
|
||||
<?php if (!$wpmu_version) { ?>
|
||||
?>
|
||||
<?php if (!is_multisite()) { ?>
|
||||
<?php
|
||||
$all_comic_folders_found = true;
|
||||
foreach (array(''. 'rss_', 'archive_') as $folder_name) {
|
||||
foreach (array(''. 'rss_', 'archive_', 'mini_') as $folder_name) {
|
||||
if (!file_exists(CPM_DOCUMENT_ROOT . '/' . $cpm_config->properties["${folder_name}comic_folder"])) { $all_comic_folders_found = false; break; }
|
||||
}
|
||||
|
||||
@ -2504,6 +2443,7 @@ function cpm_manager_edit_config() {
|
||||
<?php return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the footer.
|
||||
*/
|
||||
@ -2520,22 +2460,21 @@ function cpm_show_footer() {
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="cpm-footer">
|
||||
<div id="cpm-footer-paypal">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
|
||||
">
|
||||
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="">
|
||||
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
||||
</form>
|
||||
<div id="cpm-footer" style="float: left; width="100%">
|
||||
<div id="cpm-footer-paypal" style="float: left; width:140px;">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||
<input type="hidden" name="cmd" value="_s-xclick" />
|
||||
<input type="hidden" name="hosted_button_id" value="46RNWXBE7467Q" />
|
||||
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
|
||||
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
|
||||
</form>
|
||||
</div>
|
||||
<div id="cpm-footer-text">
|
||||
<?php _e('<a href="http://wordpress.org/extend/plugins/comicpress-manager/" target="_new">ComicPress Manager</a> is built for the <a href="http://www.mindfaucet.com/comicpress/" target="_new">ComicPress</a> theme', 'comicpress-manager') ?> |
|
||||
<?php _e('Copyright 2008-2009 <a href="mailto:john@coswellproductions.com?Subject=ComicPress Manager Comments">John Bintz</a>', 'comicpress-manager') ?> |
|
||||
<?php _e('Released under the GNU GPL', 'comicpress-manager') ?> |
|
||||
<div id="cpm-footer-text" style="width: 700px;">
|
||||
<?php _e('<a href="http://wordpress.org/extend/plugins/comicpress-manager/" target="_new">ComicPress Manager</a> is built for the <a href="http://comicpress.org/" target="_new">ComicPress</a> Theme', 'comicpress-manager') ?><br />
|
||||
<?php _e('Copyright 2008-2009 John Bintz, Copyright 2010 <a href="mailto:philip@frumph.net">Philip M. Hofer (Frumph)</a>', 'comicpress-manager') ?><br />
|
||||
<?php _e('Released under the GNU GPL v3', 'comicpress-manager') ?> |
|
||||
<?php echo $version_string ?>
|
||||
<?php _e('<a href="http://bugs.comicpress.org/index.php?project=2">Report a Bug</a>', 'comicpress-manager') ?> |
|
||||
<?php _e('<a href="http://bugs.comicpress.org/index.php?project=2">Report a Bug</a>', 'comicpress-manager') ?><br />
|
||||
<?php _e('Uses the <a target="_new" href="http://www.dynarch.com/projects/calendar/">Dynarch DHTML Calendar Widget</a>', 'comicpress-manager') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user