* * Copyright 2008-2011 Crowd Favorite, Ltd. All rights reserved. * Released under the GPL license * http://www.opensource.org/licenses/gpl-license.php */ /** * Meta box for Article Appendices */ function anno_appendices_meta_box($post) { if (function_exists('wp_editor')) { $html = ''; $html .= '
'; $appendices = get_post_meta($post->ID, '_anno_appendices', true); if (!empty($appendices) && is_array($appendices)) { foreach ($appendices as $index => $content) { $html .= anno_appendix_box_content($index + 1, $content); } } else { $html .= anno_appendix_box_content(1); } $html .= ' '; $html .= '
'; $html .= '

'._x('Add Another Appendix', 'Meta box repeater link', 'anno').'

'. '
'; echo $html; } else { echo '

'.sprintf(_x('The Annotum editor requires at least WordPress 3.3. It appears you are using WordPress %s. ', 'WordPress version error message', 'anno'), get_bloginfo('version')).'

'; } } /** * Output for Appendix edit input. */ function anno_appendix_box_content($index = null, $content = null) { $html = ''; if (empty($index) && $index !== 0) { $index = '###INDEX###'; } if (empty($content)) { $content = '

 

'; } ob_start(); anno_load_editor(anno_process_editor_content($content), esc_attr('appendix-'.$index), array('textarea_name' => esc_attr('anno_appendix['.$index.']'))); $editor_markup = ob_get_contents(); ob_end_clean(); $html .='

'._x('appendix', 'meta box title', 'anno').' '.esc_html($index).' - '._x('delete', 'meta box delete repeater link', 'anno').'

'.$editor_markup.'
'; return $html; }