function easy_nivo_slider_load_plugin($plugin_array) { // Using session variables to pass these for now. // Switch to using wp inside the mce plugin when time permits if (!isset($_SESSION)) { session_start(); } // Prepare the website taxonomies $nivo_tax = easy_nivo_slider_post_types(); $_SESSION['nivo_tax'] = serialize($nivo_tax); // Prepare the plugin options $nivo_options = get_option('easy_nivo_slider_options'); $_SESSION['nivo_options'] = serialize($nivo_options); // If NextGen active, prepare the list of galleries if (function_exists('sns_get_nextgen_galleries')) { $nivo_nextgen = sns_get_nextgen_galleries(); $_SESSION['nivo_nextgen'] = serialize($nivo_nextgen); } // Annnnnnnnnd....activate $plug = plugins_url('/mce/editor_plugin.js', __FILE__); $plugin_array['easy_nivo_slider_plugin'] = $plug; return $plugin_array; }
function sns_form_image_selection($id_base, $name_base, $defaults, $taxonomies = NULL) { ?> <?php if (!$taxonomies) { $taxonomies = easy_nivo_slider_post_types(); } $default_post_type = $defaults['post_type']; $default_taxonomy = $defaults['taxonomy']; $default_term = $defaults['term']; ?> <fieldset class="nivo-slider-fieldset"> <legend><?php _e('Image Selection'); ?> :</legend> <table> <tr valign="top"> <th scope="row"><label for="<?php echo $id_base; ?> post_type"><?php _e('Post Type'); ?> :</label></th> <td><select id="<?php echo $id_base; ?> post_type" name="<?php echo $name_base; ?> [post_type]" class="nivo_listbox"> <?php foreach ($taxonomies['arr_post_types'] as $post_type => $label) { echo nivo_form_option($default_post_type, $label, $post_type); } ?> </select> </td> </tr> <tr valign="top"> <th scope="row"><label for="<?php echo $id_base; ?> taxonomy"><?php _e('Taxonomy'); ?> :</label></th> <td><select id="<?php echo $id_base; ?> taxonomy" name="<?php echo $name_base; ?> [taxonomy]" class="nivo_listbox"> <?php foreach ($taxonomies['arr_post_types'] as $post_type => $label) { if ($taxonomies['arr_post_types_taxonomies'][$post_type]) { foreach ($taxonomies['arr_post_types_taxonomies'][$post_type] as $taxonomy) { echo nivo_form_option($default_taxonomy, $taxonomies['arr_taxonomies'][$taxonomy], $taxonomy, 'taxonomy post_type_' . $post_type, $default_post_type == $post_type); } } } ?> </select> </td> </tr> <tr valign="top"> <th scope="row"><label for="<?php echo $id_base; ?> term"><?php _e('Term'); ?> :</label></th> <td><select id="<?php echo $id_base; ?> term" name="<?php echo $name_base; ?> [term]" class="nivo_listbox"> <?php foreach ($taxonomies['arr_taxonomies'] as $taxonomy => $taxonomy_label) { if ($taxonomies['arr_terms'][$taxonomy]) { echo nivo_form_option($default_term, 'Include all ' . $taxonomy_label, 'all', 'all_terms term taxonomy_' . $taxonomy); foreach ($taxonomies['arr_terms'][$taxonomy] as $term => $term_label) { echo nivo_form_option($default_term, $term_label, $term, 'term taxonomy_' . $taxonomy); } } } echo nivo_form_option($default_term, 'Include all terms', 'all', 'term taxonomy_' . $taxonomy); ?> </select> </td> </tr> <tr valign="top"> <th scope="row"><label for="<?php echo $id_base; ?> number"><?php _e('Number of images'); ?> :</label></th> <td><input id="<?php echo $id_base; ?> number" name="<?php echo $name_base; ?> [number]" value="<?php echo $defaults['number']; ?> " type="text" class="nivo_numeric_field" size="4" /> </td> </tr> </table> </fieldset> <?php }