diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index 3ecc229..61501ca 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -575,7 +575,7 @@ class ComicPressAddonCore extends ComicPressAddon { function handle_update_override_partial($info) { switch ($info['action']) { case __('Update partial', 'comicpress'): - $this->comicpress->comicpress_options['override_partials'][$info['partial']] = $info['code']; + $this->comicpress->comicpress_options['override_partials'][$info['partial']] = stripslashes($info['code']); break; case __('Delete override partial', 'comicpress'): unset($this->comicpress->comicpress_options['override_partials'][$info['partial']]); @@ -643,4 +643,4 @@ class ComicPressAddonCore extends ComicPressAddon { } } -?> \ No newline at end of file +?> diff --git a/functions.php b/functions.php index fd3c1e4..7612938 100644 --- a/functions.php +++ b/functions.php @@ -1,236 +1,230 @@ -init(); - $addons = array(); - - if (get_magic_quotes_gpc()) { - $_POST = array_map('stripslashes_deep', $_POST); - $_GET = array_map('stripslashes_deep', $_GET); - $_REQUEST = array_map('stripslashes_deep', $_REQUEST); - } - - if (is_dir($addons_dir = (dirname(__FILE__) . '/addons'))) { - $entries = glob($addons_dir . '/*'); - if (is_array($entries)) { - foreach ($entries as $entry) { - if (is_dir($entry)) { - $classname = basename($entry); - if (file_exists($entry . "/${classname}.inc")) { - require_once($entry . "/${classname}.inc"); - $classname = "ComicPressAddon${classname}"; - if (class_exists($classname)) { - $addon =& new $classname(); - - $addon->init(&$comicpress); - if (current_user_can('edit_posts')) { - if (is_array($_REQUEST['cp'])) { - if (isset($_REQUEST['cp']['_nonce'])) { - if (wp_verify_nonce($_REQUEST['cp']['_nonce'], 'comicpress')) { - if (method_exists($addon, 'handle_update')) { - $addon->handle_update(); - $comicpress->load(); - } - } - } - } - if (is_admin()) { - add_action('admin_notices', array(&$addon, 'display_messages')); - } else { - add_action('wp_head', array(&$addon, 'display_messages')); - } - } - $addons[] = $addon; - } - } - } - } - } - } - - $layouts = $comicpress->get_layout_choices(); - if (isset($layouts[$comicpress->comicpress_options['layout']])) { - if (isset($layouts[$comicpress->comicpress_options['layout']]['Sidebars'])) { - foreach (explode(",", $layouts[$comicpress->comicpress_options['layout']]['Sidebars']) as $sidebar) { - $sidebar = trim($sidebar); - register_sidebar($sidebar); - } - } - } -} - -function comicpress_init() { - global $post, $comicpress; - - if (!empty($post)) { - if (in_comic_category() && $comicpress->is_multicomic() && !is_index()) { - $comicpress->setup_multicomic_partial_paths($post->ID); - } - } - - $comicpress->partial_paths[] = get_template_directory() . '/partials'; -} - -function comicpress_get_header() { - get_header(); -} - -function include_partial($partials = '') { - global $comicpress, $post, $nav_comics; - - if (!is_array($partials)) { $partials = func_get_args(); } - - $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 = str_replace(".inc", "", $target); - } - - if (!empty($target) && !empty($content)) { - echo apply_filters("comicpress_partial", $content, $target); - } -} - -function in_comic_category() { - global $post, $comicpress; - - return $comicpress->in_comic_category($post->ID); -} - -/** - * Display the list of Storyline categories. - */ -function comicpress_list_storyline_categories($args = "") { - global $category_tree; - - $defaults = array( - 'style' => 'list', 'title_li' => __('Storyline') - ); - - $r = wp_parse_args($args, $defaults); - - extract($r); - - $categories_by_id = get_all_category_objects_by_id(); - - $output = ''; - if ($style == "list") { $output .= '
  • '; } - if ($title_li && ($style == "list")) { $output .= $title_li; } - if ($style == "list") { $output .= "
  • ", $current_depth); - } - if ($style == "list") { $output .= ""; } - echo $output; -} - -/** -* Display the comic transcript -* Transcript must be entered into a custom field named "transcript" -* @param string $displaymode, "raw" (straight from the field), "br" (includes html line breaks), "styled" (fully css styled with JavaScript expander) -*/ -function the_transcript($displaymode = 'raw') { - $transcript = get_post_meta( get_the_ID(), "transcript", true ); - switch ($displaymode) { - case "raw": - echo $transcript; - break; - case "br": - echo nl2br($transcript); - break; - case "styled": - if (!empty($transcript)) { ?> - -
    ↓ Transcript


    - -
  • -

    Latest Comics

    - -
  • - -
  • -

    ? Random Comic

    -
  • - -
  • - -
  • - +init(); + $addons = array(); + + if (is_dir($addons_dir = (dirname(__FILE__) . '/addons'))) { + $entries = glob($addons_dir . '/*'); + if (is_array($entries)) { + foreach ($entries as $entry) { + if (is_dir($entry)) { + $classname = basename($entry); + if (file_exists($entry . "/${classname}.inc")) { + require_once($entry . "/${classname}.inc"); + $classname = "ComicPressAddon${classname}"; + if (class_exists($classname)) { + $addon =& new $classname(); + + $addon->init(&$comicpress); + if (current_user_can('edit_posts')) { + if (is_array($_REQUEST['cp'])) { + if (isset($_REQUEST['cp']['_nonce'])) { + if (wp_verify_nonce($_REQUEST['cp']['_nonce'], 'comicpress')) { + if (method_exists($addon, 'handle_update')) { + $addon->handle_update(); + $comicpress->load(); + } + } + } + } + if (is_admin()) { + add_action('admin_notices', array(&$addon, 'display_messages')); + } else { + add_action('wp_head', array(&$addon, 'display_messages')); + } + } + $addons[] = $addon; + } + } + } + } + } + } + + $layouts = $comicpress->get_layout_choices(); + if (isset($layouts[$comicpress->comicpress_options['layout']])) { + if (isset($layouts[$comicpress->comicpress_options['layout']]['Sidebars'])) { + foreach (explode(",", $layouts[$comicpress->comicpress_options['layout']]['Sidebars']) as $sidebar) { + $sidebar = trim($sidebar); + register_sidebar($sidebar); + } + } + } +} + +function comicpress_init() { + global $post, $comicpress; + + if (!empty($post)) { + if (in_comic_category() && $comicpress->is_multicomic() && !is_index()) { + $comicpress->setup_multicomic_partial_paths($post->ID); + } + } + + $comicpress->partial_paths[] = get_template_directory() . '/partials'; +} + +function comicpress_get_header() { + get_header(); +} + +function include_partial($partials = '') { + global $comicpress, $post, $nav_comics; + + if (!is_array($partials)) { $partials = func_get_args(); } + + $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 = str_replace(".inc", "", $target); + } + + if (!empty($target) && !empty($content)) { + echo apply_filters("comicpress_partial", $content, $target); + } +} + +function in_comic_category() { + global $post, $comicpress; + + return $comicpress->in_comic_category($post->ID); +} + +/** + * Display the list of Storyline categories. + */ +function comicpress_list_storyline_categories($args = "") { + global $category_tree; + + $defaults = array( + 'style' => 'list', 'title_li' => __('Storyline') + ); + + $r = wp_parse_args($args, $defaults); + + extract($r); + + $categories_by_id = get_all_category_objects_by_id(); + + $output = ''; + if ($style == "list") { $output .= '
  • '; } + if ($title_li && ($style == "list")) { $output .= $title_li; } + if ($style == "list") { $output .= "
  • ", $current_depth); + } + if ($style == "list") { $output .= ""; } + echo $output; +} + +/** +* Display the comic transcript +* Transcript must be entered into a custom field named "transcript" +* @param string $displaymode, "raw" (straight from the field), "br" (includes html line breaks), "styled" (fully css styled with JavaScript expander) +*/ +function the_transcript($displaymode = 'raw') { + $transcript = get_post_meta( get_the_ID(), "transcript", true ); + switch ($displaymode) { + case "raw": + echo $transcript; + break; + case "br": + echo nl2br($transcript); + break; + case "styled": + if (!empty($transcript)) { ?> + +
    ↓ Transcript


    + +
  • +

    Latest Comics

    + +
  • + +
  • +

    ? Random Comic

    +
  • + +
  • + +
  • +