function launch_navigation($atts) { $op_fonts = new OptimizePress_Fonts(); extract(shortcode_atts(array('style' => 1, 'font_size' => '', 'font_family' => '', 'font_style' => '', 'font_color' => '', 'font_spacing' => '', 'font_shadow' => ''), $atts)); $active = $inactive = ''; switch ($style) { case 1: case 2: $active = '<a href="{link}"><img width="163" height="102" src="{image}" alt="" /> {text}</a>'; $inactive = '<p><img width="163" height="102" src="{image}" alt="" /> {text}</p>'; break; case 3: $active = '<p><a href="{link}">{text}</a></p>'; $inactive = '<p><span>{text}</span></p>'; break; case 4: case 7: case 8: case 9: $active = '<a href="{link}">{text}</a>'; $inactive = '<span>{text}</span>'; break; case 10: $active = '<a href="{link}"><div class="thumb"><img src="{image}" class="scale-with-grid" /></div><span>{text}</span></a>'; $inactive = '<div class="thumb"><img src="{image}" class="scale-with-grid" /></div><span>{text}</span>'; break; } $str = ''; $menu_items = _op_launch_menu_list(); if (!empty($menu_items)) { foreach ($menu_items as $menu) { $tpl = $inactive; $class = ''; if ($menu['active'] === true) { /*$class = 'active';*/ $class = ''; $tpl = $active; } if ($menu['selected'] === true) { $class .= ($class == '' ? '' : ' ') . 'active current-page'; } if (!empty($menu['text'])) { $menu['text'] = stripslashes($menu['text']); } $str .= '<li' . ($class == '' ? '' : ' class="' . $class . '"') . '>' . op_convert_template($tpl, $menu) . '</li>'; } $font_family_css = ''; $font_style_css = ''; $font_shadow_css = ''; if (!empty($font_family) && $font_family != 'undefined') { $font_family_css = 'font-family: ' . $font_family . ';'; $op_fonts->add_font($font_family); } if (!empty($font_style) && $font_style != 'undefined') { if ($font_style == 'italic') { $font_style_css = 'font-style: italic;'; } elseif ($font_style == 'bold italic') { $font_style_css = 'font-style: italic; font-weight: bold;'; } else { $font_style_css = 'font-weight: ' . $font_style . ';'; } } if (!empty($font_shadow) && $font_shadow != 'undefined') { switch (strtolower(str_replace(' ', '', $font_shadow))) { case '': case 'none': $font_shadow_css = 'none'; break; case 'light': $font_shadow_css = '1px 1px 0px rgba(255,255,255,0.5)'; break; case 'dark': default: $font_shadow_css = '0 1px 1px #000000, 0 1px 1px rgba(0, 0, 0, 0.5)'; } $font_shadow_css = 'text-shadow: ' . $font_shadow_css . ';'; } $id = op_generate_id(); $className = $style >= 7 && $style <= 10 ? 'launch-nav-style-' . $style : 'video-navigation-' . $style; $str = ' <style> #video-navigation-' . $id . ' ul li a{ ' . (!empty($font_size) && $font_size != 'undefined' ? 'font-size: ' . $font_size . 'px;' : '') . ' ' . (!empty($font_family_css) ? $font_family_css : '') . ' ' . (!empty($font_style_css) ? $font_style_css : '') . ' ' . (!empty($font_color) && $font_color != 'undefined' ? 'color: ' . $font_color . ';' : '') . ' ' . (!empty($font_spacing) && $font_spacing != 'undefined' ? 'letter-spacing: ' . $font_spacing . 'px;' : '') . ' ' . (!empty($font_shadow_css) ? $font_shadow_css : '') . ' } </style> <div id="video-navigation-' . $id . '" class="video-navigation ' . $className . '"> <ul class="cf">' . $str . '</ul> </div>'; } else { if (is_admin()) { $str = '<p>' . __('This navigation bar will only display when added to a page which has been added to funnel as a funnel stage', OP_SN) . '</p>'; } } return $str; }
static function testimonials($atts, $content = '') { // Decode encoded chars $atts = op_urldecode($atts); //Extract the shortcodes into variables extract(shortcode_atts(array('style' => 1, 'margin_top' => '', 'margin_bottom' => ''), $atts)); //Initialize style arrays $cont_styles = array(1, 5, 9, 11, 14); $tblock_styles = array(5); //Initialize the return string $str = ''; //Make sure there is a testimonial in the shortcode $mc = preg_match_all('/' . op_shortcode_regex('testimonial') . '/s', $content, $matches); //Continue if there are matches if ($mc > 0) { //Loop through the testimonial elements for ($i = 0; $i < $mc; $i++) { //Extract the data from the child shortcode $data = shortcode_atts(array('name' => '', 'company' => '', 'href' => '', 'image' => ''), shortcode_parse_atts($matches[3][$i])); // Decode encoded chars if (is_array($data)) { foreach ($data as $key => $att) { $data[$key] = urldecode($att); } } //Get this testimonials content $data['content'] = urldecode($matches[5][$i]); //Generate a font style out of the font attribute $data['font_str'] = op_asset_font_style($atts); //Get the current font settings $original_font_str = $GLOBALS['OP_LIVEEDITOR_FONT_STR']; //If font settings are present then set the style string and set the font string if (!empty($data['font_string'])) { $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = array('elements' => array('p', 'a'), 'style_str' => $font); } //Return the font string back to normal $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = $original_font_str; //Add margin to the data array $data['margin_top'] = $margin_top; $data['margin_bottom'] = $margin_bottom; //Decode encoded characters (needed for correct parsing of shortcodes) // $data['name'] = urldecode($data['name']); // $data['company'] = urldecode($data['company']); // $data['href'] = urldecode($data['href']); // $data['image'] = urldecode($data['image']); //Generate the element ID $data['id'] = 'testimonial-' . op_generate_id(); //Clear out the template and reload it with the style of this testimonial, putting the //returned HTML into the display string _op_tpl('clear'); $str .= _op_tpl('_load_file', OP_ASSETS . 'tpls/testimonials/style_' . $style . '.php', $data, true); } //If there is a container div in this style, add it to the HTML if (in_array($style, $cont_styles)) { $str = '<div class="' . (in_array($style, $tblock_styles) ? 'testimonial-block-three cf' : 'testimonial-block cf') . '">' . $str . '</div>'; } } return $str; }