function fwp_category_box($checked, $object, $tags = array()) { global $wp_db_version; if (fwp_test_wp_version(FWP_SCHEMA_25)) { // WordPress 2.5.x ?> <div id="category-adder" class="wp-hidden-children"> <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e('+ Add New Category'); ?> </a></h4> <p id="category-add" class="wp-hidden-child"> <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e('New category name'); ?> " tabindex="3" /> <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3)); ?> <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e('Add'); ?> " tabindex="3" /> <?php wp_nonce_field('add-category', '_ajax_nonce', false); ?> <span id="category-ajax-response"></span> </p> </div> <ul id="category-tabs"> <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e('All posts'); ?> </a> <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p> </li> </ul> <div id="categories-all" class="ui-tabs-panel"> <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> <?php fwp_category_checklist(NULL, false, $checked); ?> </ul> </div> <?php } elseif (fwp_test_wp_version(FWP_SCHEMA_20)) { // WordPress 2.x ?> <div id="moremeta"> <div id="grabit" class="dbx-group"> <fieldset id="categorydiv" class="dbx-box"> <h3 class="dbx-handle"><?php _e('Categories'); ?> </h3> <div class="dbx-content"> <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> <p id="jaxcat"></p> <div id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?> </div> </div> </fieldset> </div> </div> <?php } else { // WordPress 1.5 ?> <fieldset style="width: 60%;"> <legend><?php _e('Categories'); ?> </legend> <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> <div style="height: 10em; overflow: scroll;"><?php fwp_category_checklist(NULL, false, $checked); ?> </div> </fieldset> <?php } }
function fwp_category_box($checked, $object, $tags = array(), $params = array()) { global $wp_db_version; if (is_string($params)) { $prefix = $params; $taxonomy = 'category'; } elseif (is_array($params)) { $prefix = isset($params['prefix']) ? $params['prefix'] : ''; $taxonomy = isset($params['taxonomy']) ? $params['taxonomy'] : 'category'; } $tax = get_taxonomy($taxonomy); if (strlen($prefix) > 0) { $idPrefix = $prefix . '-'; $idSuffix = "-" . $prefix; $namePrefix = $prefix . '_'; } else { $idPrefix = 'feedwordpress-'; $idSuffix = "-feedwordpress"; $namePrefix = 'feedwordpress_'; } ?> <div id="<?php print $idPrefix; ?> taxonomy-<?php print $taxonomy; ?> " class="feedwordpress-category-div"> <ul id="<?php print $idPrefix; print $taxonomy; ?> -tabs" class="category-tabs"> <li class="ui-tabs-selected tabs"><a href="#<?php print $idPrefix; print $taxonomy; ?> -all" tabindex="3"><?php _e('All posts'); ?> </a> <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these <?php print $tax->labels->name; ?> </p> </li> </ul> <div id="<?php print $idPrefix; print $taxonomy; ?> -all" class="tabs-panel"> <input type="hidden" value="0" name="tax_input[<?php print $taxonomy; ?> ][]" /> <ul id="<?php print $idPrefix; print $taxonomy; ?> checklist" class="list:<?php print $taxonomy; ?> categorychecklist form-no-clear"> <?php fwp_category_checklist(NULL, false, $checked, $params); ?> </ul> </div> <div id="<?php print $idPrefix; print $taxonomy; ?> -adder" class="<?php print $taxonomy; ?> -adder wp-hidden-children"> <h4><a id="<?php print $idPrefix; print $taxonomy; ?> -add-toggle" class="category-add-toggle" href="#<?php print $idPrefix; print $taxonomy; ?> -add" class="hide-if-no-js" tabindex="3"><?php _e('+ Add New Category'); ?> </a></h4> <p id="<?php print $idPrefix; print $taxonomy; ?> -add" class="category-add wp-hidden-child"> <?php $newcat = 'new' . $taxonomy; ?> <label class="screen-reader-text" for="<?php print $idPrefix; ?> new<?php print $taxonomy; ?> "><?php _e('Add New Category'); ?> </label> <input id="<?php print $idPrefix; ?> new<?php print $taxonomy; ?> " class="new<?php print $taxonomy; ?> form-required form-input-tip" aria-required="true" tabindex="3" type="text" name="<?php print $newcat; ?> " value="<?php _e('New category name'); ?> " /> <label class="screen-reader-text" for="<?php print $idPrefix; ?> new<?php print $taxonomy; ?> -parent"><?php _e('Parent Category:'); ?> </label> <?php wp_dropdown_categories(array('taxonomy' => $taxonomy, 'hide_empty' => 0, 'id' => $idPrefix . 'new' . $taxonomy . '-parent', 'class' => 'new' . $taxonomy . '-parent', 'name' => $newcat . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3)); ?> <input type="button" id="<?php print $idPrefix; print $taxonomy; ?> -add-sumbit" class="add:<?php print $idPrefix; print $taxonomy; ?> checklist:<?php print $idPrefix . $taxonomy; ?> -add add-categorychecklist-category-add button category-add-submit" value="<?php _e('Add'); ?> " tabindex="3" /> <?php /* wp_nonce_field currently doesn't let us set an id different from name, but we need a non-unique name and a unique id */ ?> <input type="hidden" id="_ajax_nonce<?php print esc_html($idSuffix); ?> " name="_ajax_nonce" value="<?php print wp_create_nonce('add-' . $taxonomy); ?> " /> <input type="hidden" id="_ajax_nonce-add-<?php print $taxonomy; print esc_html($idSuffix); ?> " name="_ajax_nonce-add-<?php print $taxonomy; ?> " value="<?php print wp_create_nonce('add-' . $taxonomy); ?> " /> <span id="<?php print $idPrefix; print $taxonomy; ?> -ajax-response" class="<?php print $taxonomy; ?> -ajax-response"></span> </p> </div> </div> <?php }
function fwp_category_box($checked, $object, $tags = array(), $prefix = '') { global $wp_db_version; if (strlen($prefix) > 0) { $idPrefix = $prefix . '-'; $idSuffix = "-" . $prefix; $namePrefix = $prefix . '_'; } else { $idPrefix = 'feedwordpress-'; $idSuffix = "-feedwordpress"; $namePrefix = 'feedwordpress_'; } ?> <div id="<?php print $idPrefix; ?> taxonomy-category" class="feedwordpress-category-div"> <ul id="<?php print $idPrefix; ?> category-tabs" class="category-tabs"> <li class="ui-tabs-selected tabs"><a href="#<?php print $idPrefix; ?> categories-all" tabindex="3"><?php _e('All posts'); ?> </a> <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p> </li> </ul> <div id="<?php print $idPrefix; ?> categories-all" class="tabs-panel"> <ul id="<?php print $idPrefix; ?> categorychecklist" class="list:category categorychecklist form-no-clear"> <?php fwp_category_checklist(NULL, false, $checked, $prefix); ?> </ul> </div> <div id="<?php print $idPrefix; ?> category-adder" class="category-adder wp-hidden-children"> <h4><a id="<?php print $idPrefix; ?> category-add-toggle" class="category-add-toggle" href="#<?php print $idPrefix; ?> category-add" class="hide-if-no-js" tabindex="3"><?php _e('+ Add New Category'); ?> </a></h4> <p id="<?php print $idPrefix; ?> category-add" class="wp-hidden-child"> <?php if (FeedWordPressCompatibility::test_version(FWP_SCHEMA_30)) { $newcat = 'newcategory'; // Well, thank God they added "egory" before WP 3.0 came out. } else { $newcat = 'newcat'; } ?> <input type="text" name="<?php print $newcat; ?> " id="<?php print $idPrefix; ?> newcategory" class="newcategory form-required form-input-tip" value="<?php _e('New category name'); ?> " tabindex="3" /> <label class="screen-reader-text" for="<?php print $idPrefix; ?> newcategory-parent"><?php _e('Parent Category:'); ?> </label> <?php wp_dropdown_categories(array('hide_empty' => 0, 'id' => $idPrefix . 'newcategory-parent', 'class' => 'newcategory-parent', 'name' => $newcat . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3)); ?> <input type="button" id="<?php print $idPrefix; ?> category-add-sumbit" class="add:<?php print $idPrefix; ?> categorychecklist:category-add add-categorychecklist-category-add button" value="<?php _e('Add'); ?> " tabindex="3" /> <?php /* wp_nonce_field currently doesn't let us set an id different from name, but we need a non-unique name and a unique id */ ?> <input type="hidden" id="_ajax_nonce<?php print esc_html($idSuffix); ?> " name="_ajax_nonce" value="<?php print wp_create_nonce('add-category'); ?> " /> <input type="hidden" id="_ajax_nonce-add-category<?php print esc_html($idSuffix); ?> " name="_ajax_nonce-add-category" value="<?php print wp_create_nonce('add-category'); ?> " /> <span id="<?php print $idPrefix; ?> category-ajax-response" class="category-ajax-response"></span> </p> </div> </div> <?php }