function shortcode_cffp_translations()
{
    $strings = array('button_title' => __('Insert new featured post', 'cfp'), 'add_new_window_title' => __('Insert new featured post', 'cfp'), 'window_title' => __('Edit featured post properties', 'cfp'), 'label_category' => __('Category/Term (optional)', 'cfp'), 'label_taxonomy' => __('Taxonomy name (optional)', 'cfp'), 'label_post_type' => __('Post type', 'cfp'), 'label_post_id' => __('Post ID (if set, will override all other options)', 'cfp'), 'label_post_num' => __('Number of posts', 'cfp'), 'label_post_offset' => __('Post offset', 'cfp'), 'label_template' => __('Template', 'cfp'), 'close_win' => __('Close', 'cfp'));
    $locale = _WP_Editors::$mce_locale;
    $translated = 'tinyMCE.addI18n("' . $locale . '.cffp", ' . json_encode($strings) . ");\n";
    // templates option
    $templates = cfp_get_templates();
    $options = array();
    foreach ($templates as $key => $template) {
        $options[] = array('value' => $key, 'text' => isset($template['name']) ? $template['name'] : $key);
    }
    $translated .= 'var cffp_templates = ' . json_encode($options) . ";\n";
    // taxonomies list
    $taxonomies = get_taxonomies(array('public' => true), 'objects');
    $options = array(array('value' => '', 'text' => __('No taxonomy', 'cfp')));
    foreach ($taxonomies as $tax => $data) {
        $options[] = array('value' => $tax, 'text' => $data->labels->singular_name);
    }
    $translated .= 'var cffp_taxonomies = ' . json_encode($options) . ";\n";
    // post types list
    $post_types = get_post_types(array('public' => true), 'objects');
    $options = array();
    foreach ($post_types as $type => $data) {
        $options[] = array('value' => $type, 'text' => $data->labels->singular_name);
    }
    $translated .= 'var cffp_post_types = ' . json_encode($options) . ";\n";
    return $translated;
}
/**
 * Displays a drop-down select box populated with all registered templates
 * @param array $args - @see cfp_dropdown() for more details 
 */
function cfp_templates_dropdown($args = array())
{
    $templates = cfp_get_templates();
    $options = array();
    foreach ($templates as $key => $template) {
        $options[$key] = isset($template['name']) ? $template['name'] : $key;
    }
    $args['options'] = $options;
    return cfp_dropdown($args);
}
function cfp_initialize_visual_composer()
{
    if (!function_exists('vc_map')) {
        return;
    }
    $templates = cfp_get_templates();
    $template_options = array();
    foreach ($templates as $key => $template) {
        $template_options[$key] = isset($template['name']) ? $template['name'] : $key;
    }
    vc_map(array('name' => __('CodeFlavors Featured Post', 'cfp'), 'description' => __('Feature any post type.', 'cfp'), 'base' => "codeflavors_featured_post", 'class' => '', 'icon' => cfp_get_uri('assets/admin/images/featured.png'), 'category' => __('Content', 'cfp'), 'params' => array(array('type' => 'dropdown', 'admin_label' => true, 'class' => '', 'heading' => __('Post type', "cfp"), 'param_name' => 'post_type', 'value' => array_flip(cfp_get_post_types()), 'description' => ''), array('type' => 'dropdown', 'class' => '', 'heading' => __('Taxonomy name', 'cfp'), 'param_name' => 'taxonomy', 'value' => array_flip(cfp_get_taxonomies()), 'description' => ''), array('type' => 'textfield', 'class' => '', 'heading' => __('Category/Term', 'cfp'), 'param_name' => 'category', 'description' => __('Enter category/term name or ID', 'cfp')), array('type' => 'textfield', 'class' => '', 'heading' => __('Number of posts', 'cfp'), 'param_name' => 'post_num', 'value' => '1', 'description' => __('Number of posts to retrieve', 'cfp')), array('type' => 'textfield', 'class' => '', 'heading' => __('Post offset', 'cfp'), 'param_name' => 'offset', 'description' => __('Skip posts (ie. to retrieve starting with the second post, set the offset to 1)', 'cfp'), 'value' => '0'), array('type' => 'textfield', 'class' => '', 'heading' => __('Post ID', 'cfp'), 'param_name' => 'post_id', 'description' => __('When set, will override all other parameters and return the post having this ID.', 'cfp')), array('type' => 'dropdown', 'class' => '', 'heading' => __('Template', 'cfp'), 'param_name' => 'template', 'value' => array_flip($template_options), 'description' => __('Select one of the available templates to display the featured post.', 'cfp')))));
}