<?php //Generate the parent container styles $block_styles = (!empty_allow_zero($top_margin) ? ' margin-top: ' . $top_margin . 'px;' : '') . (!empty_allow_zero($bottom_margin) ? ' margin-bottom: ' . $bottom_margin . 'px;' : '') . (!empty_allow_zero($alignment) && $alignment != 'center' ? ' float: ' . $alignment . ';' : '') . (!empty_allow_zero($border_color) || !empty_allow_zero($border_weight) || !empty_allow_zero($border_radius) ? ' border: 1px #000 solid;' : '') . (!empty_allow_zero($border_color) ? ' border-color: ' . $border_color . ';' : '') . (!empty_allow_zero($border_weight) ? ' border-width: ' . $border_weight . 'px;' : '') . (!empty_allow_zero($border_radius) ? ' border-radius: ' . $border_radius . 'px; -moz-border-radius: ' . $border_radius . 'px; -webkit-border-radius: ' . $border_radius . 'px;' : '') . (!empty_allow_zero($width) ? ' width: ' . $width . 'px;' : '') . (!empty_allow_zero($bg_color) ? ' background-color: ' . $bg_color . ';' : '') . (!empty_allow_zero($bg_color_end) ? ' background: ' . $bg_color_end . ';background: -moz-linear-gradient(top, ' . $bg_color . ' 0%, ' . $bg_color_end . ' 100%);background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,' . $bg_color . '), color-stop(100%,' . $bg_color_end . '));background: -webkit-linear-gradient(top, ' . $bg_color . ' 0%,' . $bg_color_end . ' 100%);background: -o-linear-gradient(top, ' . $bg_color . ' 0%,' . $bg_color_end . ' 100%);background: -ms-linear-gradient(top, ' . $bg_color . ' 0%,' . $bg_color_end . ' 100%);background: linear-gradient(top, ' . $color_1 . ' 0%,' . $color_2 . ' 100%));filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'' . $bg_color . '\', endColorstr=\'' . $bg_color_end . '\',GradientType=0 );' : ''); //Add style attribute around styles if styles exist $block_styles = !empty_allow_zero($block_styles) ? ' style="' . $block_styles . '"' : ''; //Generate the content styles $content_styles = (!empty_allow_zero($top_padding) ? ' padding-top: ' . $top_padding . 'px;' : '') . (!empty_allow_zero($right_padding) ? ' padding-right: ' . $right_padding . 'px;' : '') . (!empty_allow_zero($bottom_padding) ? ' padding-bottom: ' . $bottom_padding . 'px;' : '') . (!empty_allow_zero($left_padding) ? ' padding-left: ' . $left_padding . 'px;' : '') . (!empty_allow_zero($font) ? $font : ''); //Add style attribute around content styles if styles exist $content_styles = !empty_allow_zero($content_styles) ? ' style="' . $content_styles . '"' : '';
function op_popup($atts, $content = '') { //Extract the attributes into variables extract(shortcode_atts(array('style' => '1', 'title' => '', 'letter_spacing' => '', 'width' => '', 'top_margin' => '', 'bottom_margin' => '', 'top_padding' => '', 'bottom_padding' => '', 'left_padding' => '', 'right_padding' => '', 'alignment' => '', 'popup_width' => '700', 'popup_open_effect' => 'fade', 'popup_close_effect' => 'fade', 'popup_open_speed' => 'normal', 'popup_close_speed' => 'normal', 'popup_border_size' => '0', 'popup_border_color' => '#ffffff', 'popup_padding_top' => '20', 'popup_padding_bottom' => '20', 'popup_padding_left' => '30', 'popup_padding_right' => '30'), $atts)); //Get current style $style = op_get_current_item($styles, $style); //Set up font $font = op_asset_font_style($atts, 'content_font_'); $original_font_str = $GLOBALS['OP_LIVEEDITOR_FONT_STR']; $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = !empty($font) ? array('elements' => array('p', 'a'), 'style_str' => $font) : $GLOBALS['OP_LIVEEDITOR_FONT_STR']; //Set the temporary asset tag to the feature box // self::$temp_tag = 'op_popup'; //Get content $args = func_get_args(); //Get the content for adding an element field $content = call_user_func_array(array('OptimizePress_Default_Assets', '_add_element_field'), $args); //Process content from above $content = op_process_asset_content($content); //Set the font back to the original string $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = $GLOBALS['OP_LIVEEDITOR_DEPTH'] == 1 ? $original_font_str : $GLOBALS['OP_LIVEEDITOR_FONT_STR']; //Init the block style variable $block_style = ''; //Set up attributes for the asset $chks = array('width' => 'width', 'top_margin' => 'margin-top', 'bottom_margin' => 'margin-bottom'); //Loop through each attribute foreach ($chks as $chk => $prob) { //Add attribute to the block style string $block_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : ''; } //Add the style HTML attribute if we have styles in the block style string $block_style = !empty($block_style) ? ' style=\'' . $block_style . '\'' : $block_style; //Init the content style string $content_style = ''; //Init the attributes for the content styling $chks = array('top_padding' => 'padding-top', 'bottom_padding' => 'padding-bottom', 'left_padding' => 'padding-left', 'right_padding' => ' padding-right'); //Loop through each attribute foreach ($chks as $chk => $prob) { //Add attribute to the content style string $content_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : ''; } //Add font to content style string $content_style .= $font; //Add the style HTML attribute if we have styles in the content style string $content_style = !empty($content_style) ? ' style=\'' . $content_style . '\'' : $content_style; if (!defined('OP_LIVEEDITOR')) { wp_enqueue_script(OP_SN . '-popup', OP_JS . 'popup' . OP_SCRIPT_DEBUG . '.js', array(OP_SN . '-noconflict-js'), OP_VERSION, true); } // fancybox options $popup_data = ' data-width="' . $popup_width . '" '; $popup_data .= ' data-open-effect="' . $popup_open_effect . '" '; $popup_data .= ' data-close-effect="' . $popup_close_effect . '" '; // $popup_data .= ' data-open-method="' . $popup_open_method . '" '; // $popup_data .= ' data-close-method="' . $popup_close_method . '" '; $popup_data .= ' data-open-speed="' . $popup_open_speed . '" '; $popup_data .= ' data-close-speed="' . $popup_close_speed . '" '; $popup_data .= ' data-border-color="' . $popup_border_color . '" '; $popup_data .= ' data-border-size="' . $popup_border_size . '" '; $popup_data .= ' data-padding-top="' . $popup_padding_top . '" '; $popup_data .= ' data-padding-bottom="' . $popup_padding_bottom . '" '; $popup_data .= ' data-padding-left="' . $popup_padding_left . '" '; $popup_data .= ' data-padding-right="' . $popup_padding_right . '" '; return '<div class="op-popup cf"' . $content_style . $popup_data . '>' . $content . '</div>'; }
<?php //Init the style string $style_str = ''; $font_style_str = ''; //Set margins $style_str .= !empty_allow_zero($margin_top) ? ' margin-top: ' . $margin_top . 'px;' : ''; $style_str .= !empty_allow_zero($margin_bottom) ? ' margin-bottom: ' . $margin_bottom . 'px;' : ''; //Add the font settings $font_style_str .= !empty($font_str) ? $font_str : ''; //Finish the style string echo !empty($style_str) || !empty($font_style_str) ? ' <style> #' . $id . '{ ' . $style_str . ' ' . $font_style_str . ' } #' . $id . ' cite{ ' . $font_style_str . ' } #' . $id . ' cite a{ ' . $font_style_str . ' } </style> ' : '';
static function feature_box($atts, $content = '') { // Decode encoded chars $atts = op_urldecode($atts); //Extract the attributes into variables extract(shortcode_atts(array('style' => '1', 'title' => '', 'letter_spacing' => '', 'width' => '', 'top_margin' => '', 'bottom_margin' => '', 'top_padding' => '', 'bottom_padding' => '', 'left_padding' => '', 'right_padding' => '', 'alignment' => ''), $atts)); //Init the styles array $styles = array(1 => 'feature-box feature-box-1', 2 => 'feature-box feature-box-2', 3 => 'feature-box feature-box-2 feature-box-2-blue', 4 => 'feature-box feature-box-3', 5 => 'feature-box feature-box-3 feature-box-3-blue', 6 => 'feature-box feature-box-4', 7 => 'feature-box feature-box-4 feature-box-4-brown', 8 => 'feature-box feature-box-5', 9 => 'feature-box feature-box-5 feature-box-5-round', 10 => 'feature-box feature-box-6', 11 => 'feature-box feature-box-6 feature-box-6-round', 12 => 'feature-box feature-box-7', 13 => 'feature-box feature-box-8', 14 => 'feature-box feature-box-9', 15 => 'feature-box feature-box-9 feature-box-9-brown', 16 => 'feature-box feature-box-10', 17 => 'feature-box feature-box-11', 18 => 'feature-box feature-box-12', 19 => 'feature-box feature-box-13', 20 => 'feature-box feature-box-14', 21 => 'feature-box feature-box-14 feature-box-14-round', 22 => 'feature-box feature-box-15', 23 => 'feature-box feature-box-16', 24 => 'feature-box feature-box-17', 25 => 'feature-box feature-box-18', 26 => 'feature-box feature-box-19', 27 => 'feature-box feature-box-20', 28 => 'feature-box feature-box-21', 29 => 'feature-box feature-box-22', 30 => 'feature-box feature-box-22 feature-box-22-round', 31 => 'feature-box feature-box-23', 32 => 'feature-box feature-box-24', 33 => 'feature-box feature-box-25'); //Init the styles that have a title $title_styles = array('13', '16', '17', '18', '19', '31', '32', '33'); //Init switch to determine whether or not this box has a title $has_title = false; //Get current style $style = op_get_current_item($styles, $style); //Init styling strings $style_str = ''; $title_str = ''; //Determine whether or not we need a title if (in_array($style, $title_styles)) { //Set the title switch to true $has_title = true; //Get the font styles $title_str = op_asset_font_style($atts, 'font_'); //Generate the style attribute string $title_str = $title_str == '' ? '' : " style='" . $title_str . "'"; } //Set up font $font = op_asset_font_style($atts, 'content_font_'); $original_font_str = $GLOBALS['OP_LIVEEDITOR_FONT_STR']; $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = !empty($font) ? array('elements' => array('p', 'a'), 'style_str' => $font) : $GLOBALS['OP_LIVEEDITOR_FONT_STR']; //Set the temporary asset tag to the feature box self::$temp_tag = 'feature_box'; //Get content $args = func_get_args(); //Get the content for adding an element field $content = call_user_func_array(array('OptimizePress_Default_Assets', '_add_element_field'), $args); //Process content from above $content = op_process_asset_content($content); //Set the font back to the original string $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = $GLOBALS['OP_LIVEEDITOR_DEPTH'] == 1 ? $original_font_str : $GLOBALS['OP_LIVEEDITOR_FONT_STR']; //Init the block style variable $block_style = ''; //Set up attributes for the asset $chks = array('width' => 'width', 'top_margin' => 'margin-top', 'bottom_margin' => 'margin-bottom'); //Loop through each attribute foreach ($chks as $chk => $prob) { //Add attribute to the block style string $block_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : ''; } //Add the style HTML attribute if we have styles in the block style string $block_style = !empty($block_style) ? ' style=\'' . $block_style . '\'' : $block_style; //Init the content style string $content_style = ''; //Init the attributes for the content styling $chks = array('top_padding' => 'padding-top', 'bottom_padding' => 'padding-bottom', 'left_padding' => 'padding-left', 'right_padding' => ' padding-right'); //Loop through each attribute foreach ($chks as $chk => $prob) { //Add attribute to the content style string $content_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : ''; } //Add font to content style string $content_style .= $font; //Add the style HTML attribute if we have styles in the content style string $content_style = !empty($content_style) ? ' style=\'' . $content_style . '\'' : $content_style; //Return the generated HTML return ' <div class="' . $styles[$style] . ' feature-box-align-' . $alignment . '"' . $block_style . '> ' . ($has_title ? '<h2 class="box-title"' . $title_str . '>' . $title . '</h2>' : '') . ' <div class="feature-box-content cf"' . $content_style . '>' . $content . '</div> </div> '; }
<?php //Generate the block styling string $block_style = (!empty_allow_zero($top_margin) ? 'margin-top: ' . $top_margin . 'px;' : '') . (!empty_allow_zero($bottom_margin) ? 'margin-bottom: ' . $bottom_margin . 'px;' : '') . (!empty_allow_zero($width) ? 'width: ' . $width . 'px;' : ''); //Add style attribute to block styling string if its not empty $block_style = !empty($block_style) ? ' style=\'' . $block_style . '\'' : ''; //Generate the content styling string $content_style = (!empty_allow_zero($top_padding) ? 'padding-top: ' . $top_padding . 'px;' : '') . (!empty_allow_zero($right_padding) ? 'padding-right: ' . $right_padding . 'px;' : '') . (!empty_allow_zero($bottom_padding) ? 'padding-bottom: ' . $bottom_padding . 'px;' : '') . (!empty_allow_zero($left_padding) ? 'padding-left: ' . $left_padding . 'px;' : ''); //Add style attribute to content styling string if its not empty $content_style = !empty($content_style) ? ' style=\'' . $content_style . '\'' : '';