Exemple #1
0
function shortcode_fa_slider_translations()
{
    $strings = array('button_title' => __('Insert new slider', 'fapro'), 'add_new_window_title' => __('Add new slider', 'fapro'), 'window_title' => __('Edit slider properties', 'fapro'), 'label_slider' => __('Select slider', 'fapro'), 'label_title' => __('Slider title (PRO)', 'fapro'), 'label_show_title' => __('Show title (PRO)', 'fapro'), 'label_in_archive' => __("Don't show in archive pages (PRO)", 'fapro'), 'label_width' => __('Width (PRO)', 'fapro'), 'label_height' => __('Height  (PRO)', 'fapro'), 'label_font_size' => __('Font size  (PRO)', 'fapro'), 'label_full_width' => __('Allow full width (PRO)', 'fapro'), 'label_top' => __('Distance top  (PRO)', 'fapro'), 'label_bottom' => __('Distance bottom  (PRO)', 'fapro'), 'label_show_slide_title' => __('Show slides titles (PRO)', 'fapro'), 'label_show_content' => __('Show slides content (PRO)', 'fapro'), 'label_show_date' => __('Show slides date (PRO)', 'fapro'), 'label_show_read_more' => __('Show slides read more (PRO)', 'fapro'), 'label_show_play_video' => __('Show slides play video (PRO)', 'fapro'), 'label_img_click' => __('Image clickable (PRO)', 'fapro'), 'label_auto_slide' => __('Autoslide (PRO)', 'fapro'), 'select_win_title' => __('Select slider', 'fapro'), 'close_win' => __('Close', 'fapro'));
    $locale = _WP_Editors::$mce_locale;
    $translated = 'tinyMCE.addI18n("' . $locale . '.fa_slider", ' . json_encode($strings) . ");\n";
    // output the sliders in variable
    $sliders = fa_get_sliders('publish');
    $output = array();
    foreach ($sliders as $slider) {
        $output[] = array('value' => $slider->ID, 'text' => empty($slider->post_title) ? '(' . __('no title', 'fapro') . ')' : esc_attr($slider->post_title));
    }
    $translated .= 'var fa_sliders=' . json_encode($output) . ";\n";
    return $translated;
}
Exemple #2
0
/**
 * Displays a dropdown of sliders
 * @param string $name
 * @param string $id
 * @param int $selected
 */
function fa_sliders_dropdown($name, $id = false, $selected = false, $class = '', $status = 'publish', $echo = true)
{
    $sliders = fa_get_sliders($status);
    if (!$sliders) {
        return false;
    }
    $options = array();
    foreach ($sliders as $slider) {
        $options[$slider->ID] = !empty($slider->post_title) ? esc_attr($slider->post_title) : '(' . esc_attr(__('no title', 'fapro')) . ')';
    }
    $args = array('options' => $options, 'name' => $name, 'id' => $id, 'class' => $class, 'selected' => $selected, 'select_opt' => __('Choose slider', 'fapro'), 'echo' => false);
    $result = fa_dropdown($args);
    if ($echo) {
        echo $result;
    }
    return $result;
}
Exemple #3
0
    /**
     * Meta box callback for slider shortcode
     * @param object $post
     */
    public function meta_box_slider_shortcode($post)
    {
        // output the sliders in variable
        $sliders = fa_get_sliders('publish');
        $options = array();
        foreach ($sliders as $slider) {
            $text = empty($slider->post_title) ? '(' . __('no title', 'fapro') . ')' : esc_attr($slider->post_title);
            $options[] = '<option value="' . $slider->ID . '">' . $text . ' (#' . $slider->ID . ')</option>';
        }
        ?>
<label for="fa-slider-shortcode"><?php 
        _e('Select slider', 'fapro');
        ?>
 :
<?php 
        if ($options) {
            ?>
<select id="fa-slider-shortcode" name="fa-slider-shortcode">
	<option value=""><?php 
            _e('Select', 'fapro');
            ?>
</option>
	<?php 
            echo implode("\n", $options);
            ?>
</select>
</label>
<p style="text-align:right;"><input type="button" id="fa-insert-shortcode" value="<?php 
            _e('Insert shortcode', 'fapro');
            ?>
" class="button" /></p>
<?php 
        } else {
            ?>
	<em><?php 
            _e('No published sliders found', 'fapro');
            ?>
</em>
</label>
<?php 
        }
    }