Beispiel #1
0
 echo $css_id . ' .maxbutton .mb-text2 { color: ' . $button['text_color'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { font-family: ' . $button['text2_font_family'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { font-size: ' . $button['text2_font_size'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { font-style: ' . $button['text2_font_style'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { font-weight: ' . $button['text2_font_weight'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { text-align: ' . $button['text2_align'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { padding-top: ' . $button['text2_padding_top'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { padding-bottom: ' . $button['text2_padding_bottom'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { padding-left: ' . $button['text2_padding_left'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { padding-right: ' . $button['text2_padding_right'] . '; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { line-height: 1.0em; }' . "\n";
 echo $css_id . ' .maxbutton .mb-text2 { width: 100%; }' . "\n";
 echo $css_id_hover . ' { color: ' . $button['text_color_hover'] . '; }' . "\n";
 // Hover gradients
 $gradient_start_color_hover = mbpro_hex2rgba($button['gradient_start_color_hover'], $button['gradient_start_opacity_hover']);
 $gradient_end_color_hover = mbpro_hex2rgba($button['gradient_end_color_hover'], $button['gradient_end_opacity_hover']);
 echo $css_id_hover . ' .maxbutton { background-color: ' . $button['gradient_start_color_hover'] . '; }' . "\n";
 echo $css_id_hover . ' .maxbutton { background: linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); }' . "\n";
 echo $css_id_hover . ' .maxbutton { background: -moz-linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); }' . "\n";
 echo $css_id_hover . ' .maxbutton { background: -o-linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); }' . "\n";
 echo $css_id_hover . ' .maxbutton { background: -webkit-gradient(linear, left top, left bottom, color-stop(.' . $gradient_stop . ', ' . $gradient_start_color_hover . '), color-stop(1, ' . $gradient_end_color_hover . ')); }' . "\n";
 //echo $css_id_hover . ' .maxbutton { filter: progid:DXImageTransform.Microsoft.gradient(startColorStr="' . $button['gradient_start_color_hover'] . '", endColorStr="' . $button['gradient_end_color_hover'] . '"); }' . "\n";
 //echo $css_id_hover . ' .maxbutton { -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorStr="' . $button['gradient_start_color_hover'] . '", endColorStr="' . $button['gradient_end_color_hover'] . '"); }' . "\n";
 echo $css_id_hover . ' .maxbutton { border-color: ' . $button['border_color_hover'] . '; }' . "\n";
 echo $css_id_hover . ' .maxbutton { text-shadow: ' . $button['text_shadow_offset_left'] . ' ' . $button['text_shadow_offset_top'] . ' ' . $button['text_shadow_width'] . ' ' . $button['text_shadow_color_hover'] . '; }' . "\n";
 echo $css_id_hover . ' .maxbutton { box-shadow: ' . $button['box_shadow_offset_left'] . ' ' . $button['box_shadow_offset_top'] . ' ' . $button['box_shadow_width'] . ' ' . $button['box_shadow_color_hover'] . '; }' . "\n";
 echo $css_id_hover . ' .maxbutton .mb-text { color: ' . $button['text_color_hover'] . '; }' . "\n";
 echo $css_id_hover . ' .maxbutton .mb-text2 { color: ' . $button['text_color_hover'] . '; }' . "\n";
 echo '</style>' . "\n";
 echo '<a class="' . $element_id . '" href="' . $button['url'] . '">';
 echo '<div class="maxbutton">';
Beispiel #2
0
$maxbutton_gradient_end_opacity_hover_display = strlen($maxbutton_gradient_end_opacity_hover_display) == 1 ? '0' . $maxbutton_gradient_end_opacity_hover_display : $maxbutton_gradient_end_opacity_hover_display;
$maxbutton_container_enabled_value = isset($button) ? $button->container_enabled : 'on';
$maxbutton_container_width_value = isset($button) ? $button->container_width : '';
$maxbutton_container_margin_top_value = isset($button) ? $button->container_margin_top : '';
$maxbutton_container_margin_right_value = isset($button) ? $button->container_margin_right : '';
$maxbutton_container_margin_bottom_value = isset($button) ? $button->container_margin_bottom : '';
$maxbutton_container_margin_left_value = isset($button) ? $button->container_margin_left : '';
$maxbutton_container_alignment_value = isset($button) ? $button->container_alignment : '';
$maxbutton_container_center_div_wrap_enabled_value = isset($button) ? $button->container_center_div_wrap_enabled : 'on';
$maxbutton_external_css_value = isset($button) ? $button->external_css : '';
$maxbutton_important_css_value = isset($button) ? $button->important_css : '';
// Convert hex to rgba
$gradient_start_rgba = mbpro_hex2rgba($maxbutton_gradient_start_color_value, $maxbutton_gradient_start_opacity_value);
$gradient_end_rgba = mbpro_hex2rgba($maxbutton_gradient_end_color_value, $maxbutton_gradient_end_opacity_value);
$gradient_start_rgba_hover = mbpro_hex2rgba($maxbutton_gradient_start_color_hover_value, $maxbutton_gradient_start_opacity_hover_value);
$gradient_end_rgba_hover = mbpro_hex2rgba($maxbutton_gradient_end_color_hover_value, $maxbutton_gradient_end_opacity_hover_value);
$redirect = false;
$button_id = 0;
if ($_POST) {
    global $wpdb;
    // The icon width is determined from the icon url, so we
    // need to get it first before setting the data array.
    $icon_url = stripslashes($_POST[$maxbutton_icon_url_key]);
    $icon_width = '';
    if (isset($icon_url) && $icon_url != '') {
        $icon_width = mbpro_get_image_width_from_url($icon_url);
    }
    $data = array('name' => $_POST[$maxbutton_name_key] != '' ? stripslashes($_POST[$maxbutton_name_key]) : __('Unnamed Button', 'maxbuttons-pro'), 'description' => stripslashes($_POST[$maxbutton_description_key]), 'url' => stripslashes($_POST[$maxbutton_url_key]), 'new_window' => isset($_POST[$maxbutton_new_window_key]) ? $wpdb->escape($_POST[$maxbutton_new_window_key]) : '', 'nofollow' => isset($_POST[$maxbutton_nofollow_key]) ? $wpdb->escape($_POST[$maxbutton_nofollow_key]) : '', 'width' => $_POST[$maxbutton_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_width_key]) . 'px' : $maxbutton_width_default, 'height' => $_POST[$maxbutton_height_key] != '' ? $wpdb->escape($_POST[$maxbutton_height_key]) . 'px' : $maxbutton_height_default, 'icon_url' => stripslashes($_POST[$maxbutton_icon_url_key]), 'icon_position' => $_POST[$maxbutton_icon_position_key] != '' ? $wpdb->escape($_POST[$maxbutton_icon_position_key]) : $maxbutton_icon_position_default, 'icon_padding_top' => $_POST[$maxbutton_icon_padding_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_icon_padding_top_key]) . 'px' : $maxbutton_icon_padding_top_default, 'icon_padding_bottom' => $_POST[$maxbutton_icon_padding_bottom_key] != '' ? $wpdb->escape($_POST[$maxbutton_icon_padding_bottom_key]) . 'px' : $maxbutton_icon_padding_bottom_default, 'icon_padding_left' => $_POST[$maxbutton_icon_padding_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_icon_padding_left_key]) . 'px' : $maxbutton_icon_padding_left_default, 'icon_padding_right' => $_POST[$maxbutton_icon_padding_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_icon_padding_right_key]) . 'px' : $maxbutton_icon_padding_right_default, 'icon_width' => $icon_width, 'icon_alt' => stripslashes($_POST[$maxbutton_icon_alt_key]), 'text' => stripslashes($_POST[$maxbutton_text_key]), 'text_font_family' => $_POST[$maxbutton_text_font_family_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_family_key]) : $maxbutton_text_font_family_default, 'text_font_size' => $_POST[$maxbutton_text_font_size_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_size_key]) : $maxbutton_text_font_size_default, 'text_font_style' => $_POST[$maxbutton_text_font_style_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_style_key]) : $maxbutton_text_font_style_default, 'text_font_weight' => $_POST[$maxbutton_text_font_weight_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_weight_key]) : $maxbutton_text_font_weight_default, 'text_align' => $_POST[$maxbutton_text_align_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_align_key]) : $maxbutton_text_align_default, 'text_padding_top' => $_POST[$maxbutton_text_padding_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_top_key]) . 'px' : $maxbutton_text_padding_top_default, 'text_padding_bottom' => $_POST[$maxbutton_text_padding_bottom_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_bottom_key]) . 'px' : $maxbutton_text_padding_bottom_default, 'text_padding_left' => $_POST[$maxbutton_text_padding_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_left_key]) . 'px' : $maxbutton_text_padding_left_default, 'text_padding_right' => $_POST[$maxbutton_text_padding_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_right_key]) . 'px' : $maxbutton_text_padding_right_default, 'text2' => stripslashes($_POST[$maxbutton_text2_key]), 'text2_font_family' => $_POST[$maxbutton_text2_font_family_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_font_family_key]) : $maxbutton_text2_font_family_default, 'text2_font_size' => $_POST[$maxbutton_text2_font_size_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_font_size_key]) : $maxbutton_text2_font_size_default, 'text2_font_style' => $_POST[$maxbutton_text2_font_style_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_font_style_key]) : $maxbutton_text2_font_style_default, 'text2_font_weight' => $_POST[$maxbutton_text2_font_weight_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_font_weight_key]) : $maxbutton_text2_font_weight_default, 'text2_align' => $_POST[$maxbutton_text2_align_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_align_key]) : $maxbutton_text2_align_default, 'text2_padding_top' => $_POST[$maxbutton_text2_padding_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_padding_top_key]) . 'px' : $maxbutton_text2_padding_top_default, 'text2_padding_bottom' => $_POST[$maxbutton_text2_padding_bottom_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_padding_bottom_key]) . 'px' : $maxbutton_text2_padding_bottom_default, 'text2_padding_left' => $_POST[$maxbutton_text2_padding_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_padding_left_key]) . 'px' : $maxbutton_text2_padding_left_default, 'text2_padding_right' => $_POST[$maxbutton_text2_padding_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_text2_padding_right_key]) . 'px' : $maxbutton_text2_padding_right_default, 'text_color' => $_POST[$maxbutton_text_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_color_key]) : $maxbutton_text_color_default, 'text_color_hover' => $_POST[$maxbutton_text_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_color_hover_key]) : $maxbutton_text_color_hover_default, 'text_shadow_offset_left' => $_POST[$maxbutton_text_shadow_offset_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_offset_left_key]) . 'px' : $maxbutton_text_shadow_offset_left_default, 'text_shadow_offset_top' => $_POST[$maxbutton_text_shadow_offset_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_offset_top_key]) . 'px' : $maxbutton_text_shadow_offset_top_default, 'text_shadow_width' => $_POST[$maxbutton_text_shadow_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_width_key]) . 'px' : $maxbutton_text_shadow_width_default, 'text_shadow_color' => $_POST[$maxbutton_text_shadow_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_color_key]) : $maxbutton_text_shadow_color_default, 'text_shadow_color_hover' => $_POST[$maxbutton_text_shadow_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_color_hover_key]) : $maxbutton_text_shadow_color_hover_default, 'border_radius_top_left' => $_POST[$maxbutton_border_radius_top_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_top_left_key]) . 'px' : $maxbutton_border_radius_top_left_default, 'border_radius_top_right' => $_POST[$maxbutton_border_radius_top_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_top_right_key]) . 'px' : $maxbutton_border_radius_top_right_default, 'border_radius_bottom_left' => $_POST[$maxbutton_border_radius_bottom_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_bottom_left_key]) . 'px' : $maxbutton_border_radius_bottom_left_default, 'border_radius_bottom_right' => $_POST[$maxbutton_border_radius_bottom_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_bottom_right_key]) . 'px' : $maxbutton_border_radius_bottom_right_default, 'border_style' => $_POST[$maxbutton_border_style_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_style_key]) : $maxbutton_border_style_default, 'border_width' => $_POST[$maxbutton_border_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_width_key]) . 'px' : $maxbutton_border_width_default, 'border_color' => $_POST[$maxbutton_border_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_color_key]) : $maxbutton_border_color_default, 'border_color_hover' => $_POST[$maxbutton_border_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_color_hover_key]) : $maxbutton_border_color_hover_default, 'box_shadow_offset_left' => $_POST[$maxbutton_box_shadow_offset_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_offset_left_key]) . 'px' : $maxbutton_box_shadow_offset_left_default, 'box_shadow_offset_top' => $_POST[$maxbutton_box_shadow_offset_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_offset_top_key]) . 'px' : $maxbutton_box_shadow_offset_top_default, 'box_shadow_width' => $_POST[$maxbutton_box_shadow_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_width_key]) . 'px' : $maxbutton_box_shadow_width_default, 'box_shadow_color' => $_POST[$maxbutton_box_shadow_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_color_key]) : $maxbutton_box_shadow_color_default, 'box_shadow_color_hover' => $_POST[$maxbutton_box_shadow_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_color_hover_key]) : $maxbutton_box_shadow_color_hover_default, 'gradient_start_color' => $_POST[$maxbutton_gradient_start_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_color_key]) : $maxbutton_gradient_start_color_default, 'gradient_start_color_hover' => $_POST[$maxbutton_gradient_start_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_color_hover_key]) : $maxbutton_gradient_start_color_hover_default, 'gradient_end_color' => $_POST[$maxbutton_gradient_end_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_color_key]) : $maxbutton_gradient_end_color_default, 'gradient_end_color_hover' => $_POST[$maxbutton_gradient_end_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_color_hover_key]) : $maxbutton_gradient_end_color_hover_default, 'gradient_stop' => $_POST[$maxbutton_gradient_stop_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_stop_key]) : $maxbutton_gradient_stop_default, 'gradient_start_opacity' => $_POST[$maxbutton_gradient_start_opacity_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_opacity_key]) : $maxbutton_gradient_start_opacity_default, 'gradient_end_opacity' => $_POST[$maxbutton_gradient_end_opacity_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_opacity_key]) : $maxbutton_gradient_end_opacity_default, 'gradient_start_opacity_hover' => $_POST[$maxbutton_gradient_start_opacity_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_opacity_hover_key]) : $maxbutton_gradient_start_opacity_hover_default, 'gradient_end_opacity_hover' => $_POST[$maxbutton_gradient_end_opacity_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_opacity_hover_key]) : $maxbutton_gradient_end_opacity_hover_default, 'container_enabled' => $_POST[$maxbutton_container_enabled_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_enabled_key]) : $maxbutton_container_enabled_default, 'container_width' => $_POST[$maxbutton_container_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_width_key]) . 'px' : '', 'container_margin_top' => $_POST[$maxbutton_container_margin_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_top_key]) . 'px' : '', 'container_margin_right' => $_POST[$maxbutton_container_margin_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_right_key]) . 'px' : '', 'container_margin_bottom' => $_POST[$maxbutton_container_margin_bottom_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_bottom_key]) . 'px' : '', 'container_margin_left' => $_POST[$maxbutton_container_margin_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_left_key]) . 'px' : '', 'container_alignment' => $_POST[$maxbutton_container_alignment_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_alignment_key]) : '', 'container_center_div_wrap_enabled' => isset($_POST[$maxbutton_container_center_div_wrap_enabled_key]) ? $wpdb->escape($_POST[$maxbutton_container_center_div_wrap_enabled_key]) : '', 'external_css' => isset($_POST[$maxbutton_external_css_key]) ? $wpdb->escape($_POST[$maxbutton_external_css_key]) : '', 'important_css' => isset($_POST[$maxbutton_important_css_key]) ? $wpdb->escape($_POST[$maxbutton_important_css_key]) : '');
    if ($_GET['id'] == '') {
        // This is a new button
        $wpdb->insert(mbpro_get_buttons_table_name(), $data);
Beispiel #3
0
function mbpro_button_shortcode($atts)
{
    extract(shortcode_atts(array('id' => '', 'text' => '', 'text2' => '', 'url' => '', 'window' => '', 'nofollow' => '', 'externalcss' => '', 'externalcsspreview' => '', 'ignorecontainer' => '', 'exclude' => ''), $atts));
    // Get button ID
    $button_id = "{$id}";
    if ($button_id != '') {
        $button = mbpro_get_button($button_id);
        if (isset($button)) {
            // Get the vars
            $button_text = "{$text}" != '' ? "{$text}" : $button->text;
            $button_text2 = "{$text2}" != '' ? "{$text2}" : $button->text2;
            $button_url = "{$url}" != '' ? "{$url}" : $button->url;
            $button_window = '';
            $button_nofollow = '';
            // If we're not in the admin and the button is in the trash, just return nothing
            if (!is_admin() && $button->status == 'trash') {
                return '';
            }
            // Check to handle excludes
            if ("{$exclude}" != '') {
                global $post;
                // Don't render the button if excluded from the current post/page
                $exclude = explode(',', "{$exclude}");
                if (in_array($post->ID, $exclude)) {
                    return '';
                }
            }
            if ($button->gradient_stop != '') {
                $gradient_stop = strlen($button->gradient_stop) == 1 ? '0' . $button->gradient_stop : $button->gradient_stop;
            } else {
                $gradient_stop = '45';
                // Default
            }
            $external_css = false;
            if ("{$externalcss}" != '') {
                if ("{$externalcss}" == 'true') {
                    $external_css = true;
                }
            } else {
                if ($button->external_css == 'on') {
                    $external_css = true;
                }
            }
            // Check to exit early with external css preview
            $external_css_preview = false;
            if ("{$externalcsspreview}" != '') {
                if ("{$externalcsspreview}" == 'true') {
                    $external_css_preview = true;
                }
            }
            // Check to ignore container
            $ignore_container = false;
            if ("{$ignorecontainer}" != '') {
                if ("{$ignorecontainer}" == 'true') {
                    $ignore_container = true;
                }
            }
            $show_icon = false;
            if ($button->icon_url != '') {
                $show_icon = true;
            }
            // Check to set !important
            $important = '';
            if ($button->important_css == 'on') {
                $important = ' !important';
            }
            // Initialize the css
            $css = '';
            if (!$external_css && !$external_css_preview) {
                // Add the opening <style> tag
                $css .= '<style type="text/css">';
            }
            // The container style
            if ($button->container_enabled == 'on') {
                $css .= 'div.maxbutton-' . $button->id . '-container { ';
                if ($button->container_alignment != '') {
                    $css .= $button->container_alignment . $important . '; ';
                }
                if ($button->container_width != '') {
                    $css .= 'width: ' . $button->container_width . $important . '; ';
                }
                if ($button->container_margin_top != '') {
                    $css .= 'margin-top: ' . $button->container_margin_top . $important . '; ';
                }
                if ($button->container_margin_right != '') {
                    $css .= 'margin-right: ' . $button->container_margin_right . $important . '; ';
                }
                if ($button->container_margin_bottom != '') {
                    $css .= 'margin-bottom: ' . $button->container_margin_bottom . $important . '; ';
                }
                if ($button->container_margin_left != '') {
                    $css .= 'margin-left: ' . $button->container_margin_left . $important . '; ';
                }
                $css .= '} ';
            }
            // Gradients
            $gradient_start_color = mbpro_hex2rgba($button->gradient_start_color, $button->gradient_start_opacity);
            $gradient_end_color = mbpro_hex2rgba($button->gradient_end_color, $button->gradient_end_opacity);
            // The button style
            $css .= 'a.maxbutton-' . $button->id . ' { ';
            $css .= 'text-decoration: none' . $important . '; ';
            $css .= 'color: ' . $button->text_color . $important . '; ';
            $css .= '} ';
            $css .= 'a.maxbutton-' . $button->id . ' .maxbutton { ';
            $css .= $button->width != '' ? 'width: ' . $button->width . $important . '; ' : '';
            $css .= $button->height != '' ? 'height: ' . $button->height . $important . '; ' : '';
            $css .= 'background-color: ' . $button->gradient_start_color . $important . '; ';
            $css .= 'background: linear-gradient(' . $gradient_start_color . ' ' . $gradient_stop . '%, ' . $gradient_end_color . '); ';
            $css .= 'background: -moz-linear-gradient(' . $gradient_start_color . ' ' . $gradient_stop . '%, ' . $gradient_end_color . '); ';
            $css .= 'background: -o-linear-gradient(' . $gradient_start_color . ' ' . $gradient_stop . '%, ' . $gradient_end_color . '); ';
            $css .= 'background: -webkit-gradient(linear, left top, left bottom, color-stop(.' . $gradient_stop . ', ' . $gradient_start_color . '), color-stop(1, ' . $gradient_end_color . ')); ';
            $css .= 'border-style: ' . $button->border_style . $important . '; ';
            $css .= 'border-width: ' . $button->border_width . $important . '; ';
            $css .= 'border-color: ' . $button->border_color . $important . '; ';
            if (mbpro_border_radius_values_are_equal($button->border_radius_top_left, $button->border_radius_top_right, $button->border_radius_bottom_left, $button->border_radius_bottom_right)) {
                $css .= 'border-radius: ' . $button->border_radius_top_left . $important . '; ';
                $css .= '-moz-border-radius: ' . $button->border_radius_top_left . $important . '; ';
                $css .= '-webkit-border-radius: ' . $button->border_radius_top_left . $important . '; ';
            } else {
                $css .= 'border-top-left-radius: ' . $button->border_radius_top_left . $important . '; ';
                $css .= 'border-top-right-radius: ' . $button->border_radius_top_right . $important . '; ';
                $css .= 'border-bottom-left-radius: ' . $button->border_radius_bottom_left . $important . '; ';
                $css .= 'border-bottom-right-radius: ' . $button->border_radius_bottom_right . $important . '; ';
                $css .= '-moz-border-radius-topleft: ' . $button->border_radius_top_left . $important . '; ';
                $css .= '-moz-border-radius-topright: ' . $button->border_radius_top_right . $important . '; ';
                $css .= '-moz-border-radius-bottomleft: ' . $button->border_radius_bottom_left . $important . '; ';
                $css .= '-moz-border-radius-bottomright: ' . $button->border_radius_bottom_right . $important . '; ';
                $css .= '-webkit-border-top-left-radius: ' . $button->border_radius_top_left . $important . '; ';
                $css .= '-webkit-border-top-right-radius: ' . $button->border_radius_top_right . $important . '; ';
                $css .= '-webkit-border-bottom-left-radius: ' . $button->border_radius_bottom_left . $important . '; ';
                $css .= '-webkit-border-bottom-right-radius: ' . $button->border_radius_bottom_right . $important . '; ';
            }
            $css .= 'text-shadow: ' . $button->text_shadow_offset_left . ' ' . $button->text_shadow_offset_top . ' ' . $button->text_shadow_width . ' ' . $button->text_shadow_color . $important . '; ';
            $css .= 'box-shadow: ' . $button->box_shadow_offset_left . ' ' . $button->box_shadow_offset_top . ' ' . $button->box_shadow_width . ' ' . $button->box_shadow_color . $important . '; ';
            // PIE
            $css .= '-pie-background: linear-gradient(' . $gradient_start_color . ' ' . $gradient_stop . '%, ' . $gradient_end_color . '); ';
            $css .= 'position: relative' . $important . '; ';
            $css .= 'behavior: url("' . MAXBUTTONS_PRO_PLUGIN_URL . '/pie/PIE.htc"); ';
            $css .= '} ';
            $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-text { ';
            $css .= 'color: ' . $button->text_color . $important . '; ';
            $css .= 'font-family: ' . $button->text_font_family . $important . '; ';
            $css .= 'font-size: ' . $button->text_font_size . $important . '; ';
            $css .= 'font-style: ' . $button->text_font_style . $important . '; ';
            $css .= 'font-weight: ' . $button->text_font_weight . $important . '; ';
            $css .= 'text-align: ' . $button->text_align . $important . '; ';
            $css .= 'padding-top: ' . $button->text_padding_top . $important . '; ';
            $css .= 'padding-right: ' . $button->text_padding_right . $important . '; ';
            $css .= 'padding-bottom: ' . $button->text_padding_bottom . $important . '; ';
            $css .= 'padding-left: ' . $button->text_padding_left . $important . '; ';
            $css .= 'line-height: 1.0em' . $important . '; ';
            $css .= 'width: 100%' . $important . '; ';
            $css .= '} ';
            $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-text2 { ';
            $css .= 'color: ' . $button->text_color . $important . '; ';
            $css .= 'font-family: ' . $button->text2_font_family . $important . '; ';
            $css .= 'font-size: ' . $button->text2_font_size . $important . '; ';
            $css .= 'font-style: ' . $button->text2_font_style . $important . '; ';
            $css .= 'font-weight: ' . $button->text2_font_weight . $important . '; ';
            $css .= 'text-align: ' . $button->text2_align . $important . '; ';
            $css .= 'padding-top: ' . $button->text2_padding_top . $important . '; ';
            $css .= 'padding-right: ' . $button->text2_padding_right . $important . '; ';
            $css .= 'padding-bottom: ' . $button->text2_padding_bottom . $important . '; ';
            $css .= 'padding-left: ' . $button->text2_padding_left . $important . '; ';
            $css .= 'line-height: 1.0em' . $important . '; ';
            $css .= 'width: 100%' . $important . '; ';
            $css .= '} ';
            if ($show_icon) {
                // Check how to handle the icon width
                $icon_width = $button->icon_width;
                if (!isset($icon_width) || $icon_width == '') {
                    // Get the icon width from the icon url and then save it to the
                    // database so that getimagesize runs at most once per button
                    $icon_width = mbpro_get_image_width_from_url($button->icon_url);
                    mbpro_update_button_icon_width($button->id, $icon_width);
                }
                $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-icon { ';
                $css .= 'padding-top: ' . $button->icon_padding_top . $important . '; ';
                $css .= 'padding-right: ' . $button->icon_padding_right . $important . '; ';
                $css .= 'padding-bottom: ' . $button->icon_padding_bottom . $important . '; ';
                $css .= 'padding-left: ' . $button->icon_padding_left . $important . '; ';
                $css .= 'width: ' . $icon_width . $important . '; ';
                $css .= '} ';
                // These help avoid theme image styles from creeping into the button
                $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-icon img { ';
                $css .= 'background: none' . $important . '; ';
                $css .= 'padding: 0px' . $important . '; ';
                $css .= 'margin: 0px' . $important . '; ';
                $css .= 'border: none' . $important . '; ';
                $css .= 'border-radius: 0px' . $important . '; ';
                $css .= '-moz-border-radius: 0px' . $important . '; ';
                $css .= '-webkit-border-radius: 0px' . $important . '; ';
                $css .= 'box-shadow: none' . $important . '; ';
                $css .= '} ';
                if ($button->icon_position == 'left') {
                    $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-icon.mb-left { ';
                    $css .= 'float: left' . $important . '; ';
                    $css .= 'text-align: left' . $important . '; ';
                    $css .= '} ';
                }
                if ($button->icon_position == 'right') {
                    $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-icon.mb-right { ';
                    $css .= 'float: right' . $important . '; ';
                    $css .= 'text-align: right' . $important . '; ';
                    $css .= '} ';
                }
                if ($button->icon_position == 'top') {
                    $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-icon.mb-top { ';
                    $css .= 'text-align: center' . $important . '; ';
                    $css .= '} ';
                }
                if ($button->icon_position == 'bottom') {
                    $css .= 'a.maxbutton-' . $button->id . ' .maxbutton .mb-icon.mb-bottom { ';
                    $css .= 'text-align: center' . $important . '; ';
                    $css .= '} ';
                }
            }
            // The button style - visited
            $css .= 'a.maxbutton-' . $button->id . ':visited { ';
            $css .= 'text-decoration: none' . $important . '; ';
            $css .= 'color: ' . $button->text_color . $important . '; ';
            $css .= '} ';
            // Only render the hover styles if button has a url
            if ($button_url != '') {
                // Hover gradients
                $gradient_start_color_hover = mbpro_hex2rgba($button->gradient_start_color_hover, $button->gradient_start_opacity_hover);
                $gradient_end_color_hover = mbpro_hex2rgba($button->gradient_end_color_hover, $button->gradient_end_opacity_hover);
                // The button style - hover
                $css .= 'a.maxbutton-' . $button->id . ':hover { ';
                $css .= 'text-decoration: none' . $important . '; ';
                $css .= 'color: ' . $button->text_color_hover . $important . '; ';
                $css .= '} ';
                $css .= 'a.maxbutton-' . $button->id . ':hover .maxbutton { ';
                $css .= 'background-color: ' . $button->gradient_start_color_hover . $important . '; ';
                $css .= 'background: linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); ';
                $css .= 'background: -moz-linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); ';
                $css .= 'background: -o-linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); ';
                $css .= 'background: -webkit-gradient(linear, left top, left bottom, color-stop(.' . $gradient_stop . ', ' . $gradient_start_color_hover . '), color-stop(1, ' . $gradient_end_color_hover . ')); ';
                $css .= 'border-color: ' . $button->border_color_hover . $important . '; ';
                $css .= 'text-shadow: ' . $button->text_shadow_offset_left . ' ' . $button->text_shadow_offset_top . ' ' . $button->text_shadow_width . ' ' . $button->text_shadow_color_hover . $important . '; ';
                $css .= 'box-shadow: ' . $button->box_shadow_offset_left . ' ' . $button->box_shadow_offset_top . ' ' . $button->box_shadow_width . ' ' . $button->box_shadow_color_hover . $important . '; ';
                // PIE
                $css .= '-pie-background: linear-gradient(' . $gradient_start_color_hover . ' ' . $gradient_stop . '%, ' . $gradient_end_color_hover . '); ';
                $css .= 'position: relative' . $important . '; ';
                $css .= 'behavior: url("' . MAXBUTTONS_PRO_PLUGIN_URL . '/pie/PIE.htc"); ';
                $css .= '} ';
                $css .= 'a.maxbutton-' . $button->id . ':hover .maxbutton .mb-text { ';
                $css .= 'color: ' . $button->text_color_hover . $important . '; ';
                $css .= '} ';
                $css .= 'a.maxbutton-' . $button->id . ':hover .maxbutton .mb-text2 { ';
                $css .= 'color: ' . $button->text_color_hover . $important . '; ';
                $css .= '} ';
            }
            if (!$external_css && !$external_css_preview) {
                // Close the style element
                $css .= '</style>';
            }
            if ($external_css_preview) {
                return $css;
            }
            // Check to open the link in a new window
            if ("{$window}" != '') {
                if ("{$window}" == 'new') {
                    $button_window = 'target="_blank"';
                }
            } else {
                if ($button->new_window == 'on') {
                    $button_window = 'target="_blank"';
                }
            }
            // Check to add rel="nofollow" to the link
            if ("{$nofollow}" != '') {
                if ("{$nofollow}" == 'true') {
                    $button_nofollow = 'rel="nofollow"';
                }
            } else {
                if ($button->nofollow == 'on') {
                    $button_nofollow = 'rel="nofollow"';
                }
            }
            // Initialize the output
            $output = '';
            // Check to add the css
            if (!$external_css) {
                $output .= $css;
            }
            // Check to load the font family script
            if ($button_text != '' || $button_text2 != '') {
                $output .= '<script type="text/javascript">';
                $output .= $button_text != '' ? 'mbpro_loadFontFamilyStylesheet("' . $button->text_font_family . '");' : '';
                $output .= $button_text2 != '' ? 'mbpro_loadFontFamilyStylesheet("' . $button->text2_font_family . '");' : '';
                $output .= '</script>';
            }
            if (!$ignore_container) {
                // Check to add the center div wrapper
                if ($button->container_center_div_wrap_enabled == 'on') {
                    $output .= '<div align="center">';
                }
                // Check to add the container
                if ($button->container_enabled == 'on') {
                    $output .= '<div class="maxbutton-' . $button->id . '-container">';
                }
            }
            // If no button url then don't output the href
            if ($button_url == '') {
                $output .= '<a class="maxbutton-' . $button->id . '">';
            } else {
                $output .= '<a class="maxbutton-' . $button->id . '" href="' . $button_url . '" ' . $button_window . ' ' . $button_nofollow . '>';
            }
            $output .= '<div class="maxbutton">';
            if ($show_icon && $button->icon_position == 'left') {
                $output .= '<div class="mb-icon mb-left"><img src="' . $button->icon_url . '" alt="' . $button->icon_alt . '" border="0" /></div>';
            }
            if ($show_icon && $button->icon_position == 'right') {
                $output .= '<div class="mb-icon mb-right"><img src="' . $button->icon_url . '" alt="' . $button->icon_alt . '" border="0" /></div>';
            }
            if ($show_icon && $button->icon_position == 'top') {
                $output .= '<div class="mb-icon mb-top"><img src="' . $button->icon_url . '" alt="' . $button->icon_alt . '" border="0" /></div>';
            }
            if ($button_text != '') {
                $output .= '<div class="mb-text">' . $button_text . '</div>';
            }
            if ($button_text2 != '') {
                $output .= '<div class="mb-text2">' . $button_text2 . '</div>';
            }
            if ($show_icon && $button->icon_position == 'bottom') {
                $output .= '<div class="mb-icon mb-bottom"><img src="' . $button->icon_url . '" alt="' . $button->icon_alt . '" border="0" /></div>';
            }
            if ($show_icon) {
                // This clear div is only needed if an icon is present
                $output .= '<div style="clear: both;"></div>';
            }
            $output .= '</div>';
            $output .= '</a>';
            if (!$ignore_container) {
                // Check to close the container
                if ($button->container_enabled == 'on') {
                    $output .= '</div>';
                    // Might need to clear the float
                    if ($button->container_alignment == 'float: right' || $button->container_alignment == 'float: left') {
                        $output .= '<div style="clear: both;"></div>';
                    }
                }
                // Check to close the center div wrapper
                if ($button->container_center_div_wrap_enabled == 'on') {
                    $output .= '</div>';
                }
            }
            return $output;
        }
    }
}