WP 2.8 compatibility changes (Frumph)

This commit is contained in:
John Bintz 2009-08-10 10:48:09 -04:00
parent e2c51b0d22
commit d21865773b
7 changed files with 56 additions and 55 deletions

View File

@ -1,7 +1,7 @@
<?php
function cpm_action_do_first_run() {
global $cpm_config, $blog_id;
global $cpm_config, $blog_id, $wpmu_version;
$dir_list = array(
CPM_DOCUMENT_ROOT,
@ -9,8 +9,8 @@ function cpm_action_do_first_run() {
CPM_DOCUMENT_ROOT . '/comics-rss',
CPM_DOCUMENT_ROOT . '/comics-archive'
);
//if ($is_wpmu = function_exists('get_site_option')) { $dir_list = cpm_wpmu_first_run_dir_list(); }
$is_wpmu = $wpmu_version;
if ($is_wpmu) { $dir_list = cpm_wpmu_first_run_dir_list(); }
$any_made = false;
$all_made = true;

View File

@ -1,7 +1,7 @@
<?php
function cpm_action_update_config() {
global $cpm_config;
global $cpm_config, $wpmu_version;
$cpm_config->is_cpm_managing_posts = true;
@ -35,10 +35,10 @@ function cpm_action_update_config() {
}
}
//if (function_exists('get_site_option')) {
// cpm_wpmu_save_options();
// $cpm_config->is_wp_options = true;
//}
if ($wpmu_version) {
cpm_wpmu_save_options();
$cpm_config->is_wp_options = true;
}
if (!$cpm_config->is_wp_options) {
if (!$do_write) {

View File

@ -57,7 +57,7 @@ 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;
global $plugin_page, $access_level, $pagenow, $cpm_config, $wp_version, $wpmu_version;
load_plugin_textdomain('comicpress-manager', cpm_get_plugin_path());
@ -107,7 +107,7 @@ function cpm_add_pages() {
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_submenu_page($filename, $plugin_title, __("Upload", 'comicpress-manager'), $access_level, $filename, 'cpm_manager_index_caller');
//if (!function_exists('get_site_option')) {
//if (!$wpmu_version) {
add_submenu_page($filename, $plugin_title, __("Import", 'comicpress-manager'), $access_level, $filename . '-import', 'cpm_manager_import_caller');
//}
@ -730,7 +730,7 @@ function cpm_wrap_content($help_content, $activity_content, $show_sidebar = true
<?php }
function cpm_manager_page_caller($page) {
global $cpm_config;
global $cpm_config, $wpmu_version;
$do_first_run = false;
if (!cpm_option('cpm-did-first-run')) {
@ -741,18 +741,18 @@ function cpm_manager_page_caller($page) {
$do_first_run = !$all_comic_folders_found;
if (!$do_first_run) {
//if (!function_exists('get_site_option')) {
if ($wpmu_version) {
update_option("comicpress-manager-cpm-did-first-run", 1);
//}
}
}
}
if ($do_first_run) {
include("pages/comicpress_first_run.php");
cpm_manager_first_run(plugin_basename(__FILE__));
//if (!function_exists('get_site_option')) {
if ($wpmu_version) {
update_option("comicpress-manager-cpm-did-first-run", 1);
//}
}
} else {
if ($cpm_config->did_first_run) { $page = "config"; }
include("pages/comicpress_${page}.php");
@ -1288,7 +1288,7 @@ function cpm_obfuscate_filename($filename) {
}
function cpm_do_gd_file_check_on_upload($check_file_path, $target_filename) {
global $cpm_config;
global $cpm_config, $wpmu_version;
$file_ok = true;
$did_filecheck = false;
@ -1624,9 +1624,9 @@ function cpm_handle_file_uploads($files) {
}
}
}
//if (function_exists('get_site_option')) {
// if (cpm_wpmu_is_over_storage_limit()) { $ok_to_keep_uploading = false; break; }
//}
if ($wpmu_version) {
if (cpm_wpmu_is_over_storage_limit()) { $ok_to_keep_uploading = false; break; }
}
}
if ($ok_to_keep_uploading) {
@ -1646,9 +1646,9 @@ function cpm_handle_file_uploads($files) {
}
}
}
//if (function_exists('get_site_option')) {
// if (cpm_wpmu_is_over_storage_limit()) { $ok_to_keep_uploading = false; }
//}
if ($wpmu_version) {
if (cpm_wpmu_is_over_storage_limit()) { $ok_to_keep_uploading = false; }
}
}
if ($ok_to_keep_uploading) {
@ -1859,7 +1859,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;
global $cpm_config, $wpmu_version;
// display informative messages to the use
// TODO: remove separate arrays and tag messages based on an enum value
@ -1945,9 +1945,9 @@ function cpm_handle_warnings() {
arsort($available_backup_files);
//if (function_exists('get_site_option')) {
//$cpm_config->show_config_editor = true;
//} else {
// if ($wpmu_version) {
// $cpm_config->show_config_editor = true;
// } else {
if ($cpm_config->config_method == "comicpress-config.php") {
if (!$cpm_config->can_write_config) {
$update_automatically = false;
@ -1987,19 +1987,19 @@ function cpm_handle_warnings() {
<hr />
<?php }
}
//}
// }
if ($cpm_config->show_config_editor) {
echo cpm_manager_edit_config();
} ?>
<?php //if (!function_exists('get_site_option')) { ?>
<?php if ($wpmu_version) { ?>
<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>)
<?php echo cpm_show_debug_info(false);
//}
}
return false;
}
@ -2040,7 +2040,7 @@ function cpm_handle_actions() {
* Show the details of the current setup in the Sidebar.
*/
function cpm_show_comicpress_details() {
global $cpm_config;
global $cpm_config, $wpmu_version;
$all_comic_dates_ok = true;
$all_comic_dates = array();
@ -2135,7 +2135,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 (!function_exists('get_site_option')) { ?>
<?php if (!$wpmu_version) { ?>
<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>)
@ -2159,7 +2159,7 @@ function cpm_show_comicpress_details() {
<?php } ?>
</ul>
</li>
<?php //} ?>
<?php } ?>
<li>
<strong><a href="#" onclick="Element.show('debug-info'); $('cpm-right-column').style.minHeight = $('cpm-left-column').offsetHeight + 'px'; return false"><?php _e('Show debug info', 'comicpress-manager') ?></a></strong> (<em><?php _e("this data is sanitized to protect your server's configuration", 'comicpress-manager') ?></em>)
<?php echo cpm_show_debug_info() ?>
@ -2294,7 +2294,7 @@ function cpm_show_debug_info($display_none = true) {
* Show the config editor.
*/
function cpm_manager_edit_config() {
global $cpm_config;
global $cpm_config, $wpmu_version;
include('cp_configuration_options.php');
@ -2342,7 +2342,7 @@ function cpm_manager_edit_config() {
$no_wpmu = false;
extract($field_info);
//$ok = (function_exists('get_site_option')) ? ($no_wpmu !== true) : true;
// $ok = ($wpmu_version) ? ($no_wpmu !== true) : true;
$ok = true;
if ($ok) {
$description = " <em>(" . $description . ")</em>";
@ -2411,7 +2411,7 @@ function cpm_manager_edit_config() {
}
}
} ?>
<?php //if (!function_exists('get_site_option')) { ?>
<?php if (!$wpmu_version) { ?>
<?php
$all_comic_folders_found = true;
foreach (array(''. 'rss_', 'archive_') as $folder_name) {
@ -2435,7 +2435,7 @@ function cpm_manager_edit_config() {
</td>
</tr>
<?php } ?>
<?php //} ?>
<?php } ?>
<tr>
<td colspan="2" align="center">
<input class="button update-config" type="submit" value="<?php _e("Update Config", 'comicpress-manager') ?>" />

View File

@ -65,7 +65,7 @@ function cpm_option($name) { return get_option("comicpress-manager-${name}"); }
* Calculate the document root where comics are stored.
*/
function cpm_calculate_document_root() {
global $cpm_attempted_document_roots;
global $cpm_attempted_document_roots, $wpmu_version;
$cpm_attempted_document_roots = array();
$document_root = null;
@ -86,9 +86,9 @@ function cpm_calculate_document_root() {
if (is_null($document_root)) { $document_root = $_SERVER['DOCUMENT_ROOT'] . $parsed_url['path']; }
//if (function_exists('get_site_option')) {
// $document_root = cpm_wpmu_modify_path($document_root);
//}
if ($wpmu_version) {
$document_root = cpm_wpmu_modify_path($document_root);
}
return untrailingslashit($document_root);
}
@ -132,6 +132,7 @@ function cpm_generate_example_date($example_date) {
* Build the URI to a comic file.
*/
function cpm_build_comic_uri($filename, $base_dir = null) {
global $wpmu_version;
if (!is_null($base_dir)) {
if (strlen($filename) < strlen($base_dir)) { return false; }
}
@ -146,7 +147,7 @@ function cpm_build_comic_uri($filename, $base_dir = null) {
$parsed_url = parse_url(get_bloginfo('url'));
$path = $parsed_url['path'];
//if (function_exists('get_site_option')) { $path = cpm_wpmu_fix_admin_uri($path); }
if ($wpmu_version) { $path = cpm_wpmu_fix_folder_to_use($path); }
$count = (cpm_get_subcomic_directory() !== false) ? 3 : 2;
@ -336,7 +337,7 @@ function cpm_read_comics_folder() {
* Read information about the current installation.
*/
function cpm_read_information_and_check_config() {
global $cpm_config, $cpm_attempted_document_roots, $blog_id;
global $cpm_config, $cpm_attempted_document_roots, $blog_id, $wpmu_version;
$cpm_config->config_method = read_current_theme_comicpress_config();
$cpm_config->config_filepath = get_functions_php_filepath();
@ -388,7 +389,7 @@ function cpm_read_information_and_check_config() {
$any_cpm_document_root_failures = false;
//if (!function_exists('get_site_option')) {
if (!$wpmu_version) {
// is the site root configured properly?
if (!file_exists(CPM_DOCUMENT_ROOT)) {
$cpm_config->errors[] = sprintf(__('The comics site root <strong>%s</strong> does not exist. Check your <a href="options-general.php">WordPress address and address settings</a>.', 'comicpress-manager'), CPM_DOCUMENT_ROOT);
@ -399,7 +400,7 @@ function cpm_read_information_and_check_config() {
$cpm_config->errors[] = sprintf(__('The comics site root <strong>%s</strong> does not contain a WordPress index.php file. Check your <a href="options-general.php">WordPress address and address settings</a>.', 'comicpress-manager'), CPM_DOCUMENT_ROOT);
$any_cpm_document_root_failures = true;
}
//}
}
if ($any_cpm_document_root_failures) {
$cpm_config->errors[] = print_r($cpm_attempted_document_roots, true);
@ -533,12 +534,12 @@ function cpm_read_information_and_check_config() {
* Read the ComicPress config from a file.
*/
function read_current_theme_comicpress_config() {
global $cpm_config;
global $cpm_config, $wpmu_version;
//if (function_exists('get_site_option')) {
// cpm_wpmu_load_options();
// return __("WordPress Options", 'comicpress-manager');
//}
if ($wpmu_version) {
cpm_wpmu_load_options();
return __("WordPress Options", 'comicpress-manager');
}
$current_theme_info = get_theme(get_current_theme());

View File

@ -4,7 +4,7 @@
* The config editor dialog.
*/
function cpm_manager_cpm_config() {
global $cpm_config;
global $cpm_config, $wpmu_version;
include(realpath(dirname(__FILE__)) . '/../cpm_configuration_options.php');
@ -18,8 +18,8 @@ function cpm_manager_cpm_config() {
<input type="hidden" name="action" value="update-cpm-config" />
<?php foreach ($configuration_options as $option) {
$ok = true;
//if (function_exists('get_site_option')) { $ok = !isset($option['strip-wpmu']); }
if (is_string($option)) { $ok = true; }
if ($wpmu_version) { $ok = !isset($option['strip-wpmu']); }
// if (is_string($option)) { $ok = true; }
if ($option['type'] == "categories") {
$ok = (count($category_checkboxes = cpm_generate_additional_categories_checkboxes($option['id'], explode(",", $result))) > 0);

View File

@ -4,11 +4,11 @@
* The main manager screen.
*/
function cpm_manager_first_run($target_page) {
global $cpm_config;
global $cpm_config, $wpmu_version;
$target_page = "?page=${target_page}";
//$is_wpmu = function_exists("get_site_option");
$is_wpmu = $wpmu_version;
ob_start();

View File

@ -2,7 +2,7 @@
Contributors: johncoswell
Tags: comicpress, webcomics, management, admin, posts, plugin
Requires at least: 2.5.1
Tested up to: 2.7.1
Tested up to: 2.8
Stable tag: 1.4.5
Donate link: http://www.coswellproductions.com/wordpress/wordpress-plugins/