From ff200fd084503fcd4617a750c8b77a1d491ae210 Mon Sep 17 00:00:00 2001 From: Margaret Trauth Date: Thu, 16 Aug 2012 15:51:45 -0700 Subject: [PATCH] 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. --- comicpress_manager_admin.php | 347 +++++++++++++++-------------------- 1 file changed, 143 insertions(+), 204 deletions(-) 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('"; @@ -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) ); - } + } ?>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': "" }; -var ajax_request_uri = "/comicpress_manager_count_missing_entries.php?blog_id="; +var ajax_request_uri = "/comicpress_manager_count_missing_entries.php?blog_id="; @@ -1898,7 +1848,7 @@ var ajax_request_uri = "/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(); } ?> - +
() @@ -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; - } - ?>
@@ -2114,7 +2059,7 @@ function cpm_show_comicpress_details() {
  • properties['comic_folder'] . $subdir_path; + echo $cpm_config->properties['comic_folder']; ?>
    __('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"]); ?> -
  • properties["${type}_comic_folder"] . $subdir_path; ?> +
  • properties["${type}_comic_folder"]; ?> get_scale_method() != CPM_SCALE_NONE) && (cpm_option("cpm-${type}-generate-thumbnails") == 1) && @@ -2184,7 +2129,7 @@ function cpm_show_comicpress_details() {
  • blog_category_info['name'] ?> properties['blogcat']) ?>
  • - +
  • () @@ -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() {
  • - (" . $description . ")"; $config_id = (isset($field_info['variable_name'])) ? $field_info['variable_name'] : $field_info['id']; @@ -2416,7 +2353,7 @@ function cpm_manager_edit_config() { - +
    - +
    + />
    @@ -2462,16 +2400,17 @@ function cpm_manager_edit_config() { case "integer": ?> - + - + ?> + properties["${folder_name}comic_folder"])) { $all_comic_folders_found = false; break; } } @@ -2504,6 +2443,7 @@ function cpm_manager_edit_config() { -
    :
    +