diff --git a/comicpress_manager_admin.php b/comicpress_manager_admin.php
index 3c42669..c53c93b 100644
--- a/comicpress_manager_admin.php
+++ b/comicpress_manager_admin.php
@@ -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 '
';
- echo __("Remember, you need at least two categories defined in order to use ComicPress.", 'comicpress-manager');
- echo '
';
- }
+ if (count(get_all_category_ids()) < 2) {
+ echo '';
+ echo __("Remember, you need at least two categories defined in order to use ComicPress.", 'comicpress-manager');
+ echo '
';
+ }
}
/**
* 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) {
__(" (the transcript to use for all posts)", 'comicpress-manager')
);
- if (!is_plugin_active('what-did-they-say/what-did-they-say.php')) {
- $form_titles_and_fields[] = '' . __('Want even better control over your transcripts? Try What Did They Say?!?', 'comicpress-manager') . '';
- }
-
$form_titles_and_fields[] = array(
__("Upload Date Format:", 'comicpress-manager'),
'' .
@@ -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)
);
- }
+ }
?>