From 7810b9655d7d53685ebc1d33799efb2d6d94e615 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 3 Nov 2009 22:46:43 -0500 Subject: [PATCH] remove inline partial editing support --- addons/Core/Core.inc | 126 +---------------------------------------- classes/ComicPress.inc | 1 - functions.php | 17 ++---- 3 files changed, 8 insertions(+), 136 deletions(-) diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index f1a613f..85d9863 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -28,20 +28,7 @@ class ComicPressAddonCore extends ComicPressAddon { add_filter('comicpress_display_attached_images', array(&$this, 'comicpress_display_attached_images'), 10, 2); } - if (isset($this->comicpress->comicpress_options['helpers']['show_partials_info'])) { - wp_enqueue_script('prototype'); - add_filter('comicpress_partial', array(&$this, 'show_inline_comicpress_partial_editor'), 20, 2); - add_action('wp_head', array(&$this, 'add_inline_comicpress_partial_edit_hooks')); - add_action('wp_footer', array(&$this, 'add_inline_comicpress_partial_holders')); - } - - if (is_admin()) { - add_action('admin_head', array(&$this, 'add_edit_area')); - } else { - add_action('wp_head', array(&$this, 'add_edit_area')); - } - - $this->comic_image_types = array( + $this->comic_image_types = array( 'none' => __('Not a comic', 'comicpress'), 'comic' => __('Comic', 'comicpress'), 'rss' => __('RSS', 'comicpress'), @@ -49,81 +36,6 @@ class ComicPressAddonCore extends ComicPressAddon { ); } - function add_edit_area() { ?> - - )([^\<]+)()#', '\1\2 | Edit\3', $content); - return $content; - } - - function add_inline_comicpress_partial_edit_hooks() { ?> - - - 0) { - $valid_partials[] = $matches[1]; - } - } - - foreach ($valid_partials as $key) { - if (isset($this->comicpress->comicpress_options['override_partials'][$key])) { - $partial_code = htmlentities($this->comicpress->comicpress_options['override_partials'][$key]); - } else { - $partial_code = htmlentities(file_get_contents(get_template_directory() . DIRECTORY_SEPARATOR . $key . '.inc')); - } - - $hash = md5($key); ?> - - ' . __('Image index:', 'comicpress') @@ -194,8 +106,7 @@ class ComicPressAddonCore extends ComicPressAddon { function admin_menu() { global $plugin_page, $pagenow, $post; - add_theme_page(__("ComicPress Core", 'comicpress'), __('ComicPress Core', 'comicpress'), 'edit_themes', 'comicpress/render_admin', array(&$this, 'render_admin')); - add_theme_page(__("Edit Partials", 'comicpress'), __('Edit Partials', 'comicpress'), 'edit_themes', 'comicpress/edit_partials', array(&$this, 'render_edit_partials')); + add_theme_page(__("ComicPress", 'comicpress'), __('ComicPress Core', 'comicpress'), 'edit_themes', 'comicpress/render_admin', array(&$this, 'render_admin')); if (strpos($pagenow, "post") === 0) { add_meta_box("comic-image-ordering", __("Comic Image Ordering", 'comicpress'), array(&$this, 'render_comic_image_ordering'), "post", "normal", "low"); @@ -338,12 +249,6 @@ class ComicPressAddonCore extends ComicPressAddon { } } - function render_edit_partials() { - $nonce = wp_create_nonce('comicpress'); - - include(dirname(__FILE__) . '/partials/edit-partials.inc'); - } - /** * Render the comic image ordering interface. */ @@ -595,33 +500,6 @@ class ComicPressAddonCore extends ComicPressAddon { if (method_exists($this, $method)) { $this->{$method}($info); } - } else if (is_array($info['ordering'])) { - // comic ordering - - /* - if (isset($_POST['meta'])) { - $meta_key_to_ignore = false; - foreach ($_POST['meta'] as $meta_key => $params) { - foreach ($params as $type => $value) { - if ($type == "key" && $value == "comic_ordering") { - $meta_key_to_ignore = $meta_key; break; - } - } - } - - if ($meta_key_to_ignore !== false) { - unset($_POST['meta'][$meta_key_to_ignore]); - } - } - - $this->handle_update_comic_ordering($info); - */ - } else if (isset($info['partial'])) { - $this->handle_update_override_partial($info); - $this->info(sprintf(__("Partial %s updated.", 'comicpress'), $info['partial'])); - - $this->comicpress->save(); - $this->comicpress->init(); } else { //coming from us $this->handle_update_comicpress_options($info); diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 5720a25..3e03079 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -16,7 +16,6 @@ class ComicPress { 'category_usage' => 'storyline', 'layout' => 'classic.inc', 'helpers' => array(), - 'override_partials' => array(), 'addons' => array(), 'storyline_order' => '' ); diff --git a/functions.php b/functions.php index ca9cdae..86baa9b 100644 --- a/functions.php +++ b/functions.php @@ -106,19 +106,14 @@ function include_partial($partials = '') { $content = $target = null; - if (($result = $comicpress->get_options_partial($partials)) !== false) { - list($target, $code) = $result; - ob_start(); eval(' ?>' . $code . 'get_partial_path($partials); - - if ($target !== false) { - ob_start(); include($target); $content = ob_get_clean(); - } + $target = $comicpress->get_partial_path($partials); - $target = str_replace(".inc", "", $target); + if ($target !== false) { + ob_start(); include($target); $content = ob_get_clean(); } - + + $target = str_replace(".inc", "", $target); + if (!empty($target) && !empty($content)) { echo apply_filters("comicpress_partial", $content, $target); }