Ejemplo n.º 1
0
 function wvrx_ts_enqueue_scripts()
 {
     // action definition
     if (function_exists('wvrx_ts_slider_header')) {
         wvrx_ts_slider_header();
     }
     // add plugin CSS here, too.
     wp_register_style('wvrx-ts-style-sheet', wvrx_ts_plugins_url('weaverx-ts-style', WVRX_TS_MINIFY . '.css'), null, WVRX_TS_VERSION, 'all');
     wp_enqueue_style('wvrx-ts-style-sheet');
 }
 function wvrx_ts_enqueue_scripts()
 {
     // action definition
     if (function_exists('wvrx_ts_slider_header')) {
         wvrx_ts_slider_header();
     }
     //-- Weaver X PLus js lib - requires jQuery...
     // put the enqueue script in the tabs shortcode where it belongs
     //wp_enqueue_script('wvrxtsJSLib', wvrx_ts_plugins_url('/js/wvrx-ts-jslib', WVRX_TS_MINIFY . '.js'),array('jquery'),WVRX_TS_VERSION);
     // add plugin CSS here, too.
     wp_register_style('wvrx-ts-style-sheet', wvrx_ts_plugins_url('weaverx-ts-style', WVRX_TS_MINIFY . '.css'), null, WVRX_TS_VERSION, 'all');
     wp_enqueue_style('wvrx-ts-style-sheet');
 }
function wvrx_ts_help_link($ref, $label)
{
    $t_dir = wvrx_ts_plugins_url('/help/' . $ref, '');
    $pp_help = '<a style="text-decoration:none;" href="' . $t_dir . '" target="_blank" title="' . $label . '">' . '<span style="color:red; vertical-align: middle; margin-left:.25em;" class="dashicons dashicons-editor-help"></span></a>';
    echo $pp_help;
}
function wvrx_ts_sc_tab_group($args, $content)
{
    extract(shortcode_atts(array('border_color' => '', 'tab_bg' => '', 'tab_selected_color' => '', 'pane_min_height' => '', 'pane_bg' => ''), $args));
    if (isset($GLOBALS['wvrx_ts_in_tab_container']) && $GLOBALS['wvrx_ts_in_tab_container']) {
        return __('<strong>Sorry, you cannot nest tab_containers.</strong>', 'weaverx-theme-support');
    }
    // enqueue the theme support jslib only now when it will actually be needed!
    wp_enqueue_script('wvrxtsJSLib', wvrx_ts_plugins_url('/js/wvrx-ts-jslib', WVRX_TS_MINIFY . '.js'), array('jquery'), WVRX_TS_VERSION, true);
    if (!isset($GLOBALS['wvrx_ts_tab_id'])) {
        $GLOBALS['wvrx_ts_tab_id'] = 1;
    } else {
        ++$GLOBALS['wvrx_ts_tab_id'];
    }
    $group_id = 'wvr-tab-group-' . $GLOBALS['wvrx_ts_tab_id'];
    $css = '';
    // default styles
    $add_style = '';
    if ($border_color != '') {
        $css .= '#' . $group_id . '.wvr-tabs-style .wvr-tabs-pane,#' . $group_id . '.wvr-tabs-style .wvr-tabs-nav span {border-color:' . $border_color . ";}\n";
    }
    if ($pane_min_height != '') {
        $css .= '#' . $group_id . '.wvr-tabs-style .wvr-tabs-pane {min-height:' . $pane_min_height . ";}\n";
    }
    if ($pane_bg != '') {
        $css .= '#' . $group_id . '.wvr-tabs-style .wvr-tabs-pane {background-color:' . $pane_bg . ";}\n";
    }
    if ($tab_bg != '') {
        $css .= '#' . $group_id . '.wvr-tabs-style .wvr-tabs-nav span {background-color:' . $tab_bg . ";}\n";
    }
    if ($tab_selected_color != '') {
        $css .= '#' . $group_id . '.wvr-tabs-style .wvr-tabs-nav span.wvr-tabs-current,#' . $group_id . '.wvr-tabs-style .wvr-tabs-nav span:hover {background-color:' . $tab_selected_color . ";}\n";
    }
    if ($css != '') {
        // specified some style...
        $add_style = "<style type=\"text/css\">\n" . $css . "</style>\n";
    }
    $GLOBALS['wvrx_ts_in_tab_container'] = true;
    $GLOBALS['wvrx_ts_num_tabs'] = 0;
    do_shortcode($content);
    // process the tabs on this
    $out = '*** Unclosed or mismatched [tab_group] shortcodes ***';
    if (isset($GLOBALS['wvrx_ts_tabs']) && is_array($GLOBALS['wvrx_ts_tabs'])) {
        foreach ($GLOBALS['wvrx_ts_tabs'] as $tab) {
            $tabs[] = '<span>' . $tab['title'] . '</span>' . "\n";
            $panes[] = "\n" . '<div class="wvr-tabs-pane">' . $tab['content'] . '</div>';
        }
        $out = '<div id="' . $group_id . '" class="wvr-tabs wvr-tabs-style"> <!-- tab_group -->' . "\n" . '<div class="wvr-tabs-nav">' . "\n" . implode('', $tabs) . '</div>' . "\n" . '<div class="wvr-tabs-panes">' . implode('', $panes) . "\n" . '</div><div class="wvr-tabs-clear"></div>' . "\n" . '</div> <!-- end tab_group -->' . "\n";
    }
    // Forget globals we generated
    unset($GLOBALS['wvrx_ts_in_tab_container'], $GLOBALS['wvrx_ts_tabs'], $GLOBALS['wvrx_ts_num_tabs']);
    return $add_style . $out;
}