/** * */ function twitter($atts = null) { if ($atts == 'generator') { $numbers = range(1, 20); foreach ($numbers as $val) { $number[$val] = $val; } $option = array('name' => __('Twitter', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'twitter', 'options' => array(array('name' => __('Username', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Paste your twitter username here. You can find your username by going to your settings page within twitter.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'id', 'default' => '', 'type' => 'text'), array('name' => __('Count', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select how many tweets you want to be displayed.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'number', 'default' => '', 'options' => $number, 'type' => 'select'), 'shortcode_has_atts' => true)); return $option; } $defaults = array('id' => '', 'number' => '1', 'title' => ' '); if (isset($atts['count'])) { $atts['number'] = $atts['count']; } if (isset($atts['username'])) { $atts['id'] = $atts['username']; } if (empty($atts['id'])) { $atts['id'] = mysite_get_setting('twitter_id'); } $atts = wp_parse_args($atts, $defaults); $instance = http_build_query($atts); $args = array('widget_name' => 'MySite_Twitter_Widget', 'instance' => $instance); $widget = new mysiteWidgets(); return $widget->_widget_generator($args); }
/** * */ function image_frame($atts = null, $content = null) { if ($atts == 'generator') { $option = array('name' => __('Image Frames', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'image_frame', 'options' => array(array('name' => __('Type', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Choose which type of frame you wish to use.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'style', 'default' => '', 'options' => array('border' => __('Transparent Border', MYSITE_ADMIN_TEXTDOMAIN), 'reflect' => __('Reflection', MYSITE_ADMIN_TEXTDOMAIN), 'framed' => __('Framed', MYSITE_ADMIN_TEXTDOMAIN), 'shadow' => __('Shadow', MYSITE_ADMIN_TEXTDOMAIN), 'reflect_shadow' => __('Reflection + Shadow', MYSITE_ADMIN_TEXTDOMAIN), 'framed_shadow' => __('Framed + Shadow', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Image URL', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can upload your image that you wish to use here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'content', 'default' => '', 'type' => 'upload'), array('name' => __('Align <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Set the alignment for your image here.<br /><br />Your image will float along the center, left or right hand sides depending on your choice.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'align', 'default' => '', 'options' => array('left' => __('left', MYSITE_ADMIN_TEXTDOMAIN), 'right' => __('right', MYSITE_ADMIN_TEXTDOMAIN), 'center' => __('center', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Alt Attribute <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type the alt text that you would like to display with your image here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'alt', 'default' => '', 'type' => 'text'), array('name' => __('Title Attribute <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type the title text that you would like to display with your image here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'title', 'default' => '', 'type' => 'text'), array('name' => __('Image Height <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can set the image height here. Leave this blank if you do not want to resize your image.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'height', 'default' => '', 'type' => 'text'), array('name' => __('Image Width <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can set the image width here. Leave this blank if you do not want to resize your image.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'width', 'default' => '', 'type' => 'text'), 'shortcode_has_atts' => true)); return $option; } extract(shortcode_atts(array('style' => '', 'align' => '', 'alt' => '', 'title' => '', 'height' => '', 'width' => '', 'link_to' => 'true', 'prettyphoto' => 'true'), $atts)); global $wp_query, $mysite; $out = ''; $effect = trim($style); $effect = !empty($effect) ? $effect : 'framed'; $align = $align == 'left' ? ' alignleft' : ($align == 'right' ? ' alignright' : ($align == 'center' ? ' aligncenter' : ' alignleft')); $class = $effect == 'reflect' ? "reflect{$align}" : ($effect == 'reflect_shadow' ? 'reflect' : ($effect == 'framed' ? "framed{$align}" : ($effect == 'framed_shadow' ? 'framed' : ''))); $width = !empty($width) ? trim(str_replace(' ', '', str_replace('px', '', $width))) : ''; $height = !empty($height) ? trim(str_replace(' ', '', str_replace('px', '', $height))) : ''; if (preg_match('!https?://.+\\.(?:jpe?g|png|gif)!Ui', $content, $matches)) { $out .= mysite_display_image(array('src' => $matches[0], 'alt' => $alt, 'title' => $title, 'class' => $class, 'height' => $height, 'width' => $width, 'link_to' => $link_to == 'true' ? $matches[0] : false, 'prettyphoto' => $prettyphoto == 'true' ? true : false, 'align' => $align, 'effect' => $effect, 'wp_resize' => mysite_get_setting('image_resize_type') == 'wordpress' ? true : false)); } return $out; }
/** * */ function jcarousel_portfolio($atts = null) { if ($atts == 'generator') { $option = array('name' => __('jCarousel Portfolio', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'jcarousel_portfolio', 'options' => array(array('name' => __('Number of Columns', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of columns you would like your posts to display in.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'column', 'default' => '', 'options' => array('1' => __('One Column', MYSITE_ADMIN_TEXTDOMAIN), '2' => __('Two Column', MYSITE_ADMIN_TEXTDOMAIN), '3' => __('Three Column', MYSITE_ADMIN_TEXTDOMAIN), '4' => __('Four Column', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Number of Portfolio Posts', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of posts you would like to display on each page.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'showposts', 'default' => '', 'options' => array_combine(range(1, 40), array_values(range(1, 40))), 'type' => 'select'), array('name' => __('Portfolio Categories <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select which portfolio categories you would like to display.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'cat', 'default' => array(), 'target' => 'portfolio_category', 'type' => 'multidropdown'), array('name' => __('Offset Portfolio Posts <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('This will skip a number of posts at the beginning.<br /><br />Useful if you are using multiple portfolio shortcodes on the same page.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'offset', 'default' => '', 'options' => array_combine(range(1, 10), array_values(range(1, 10))), 'type' => 'select'), array('name' => __('Scrolling Range', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select how many posts you wish to cycle when scrolling.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'scroll', 'default' => '', 'options' => array_combine(range(1, 4), array_values(range(1, 4))), 'type' => 'select'), array('name' => __('Animation speed', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Type out how fast you want the animation to display. The value is defined in milliseconds so 1000 equals 1 second.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'animation', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Automatic sliding', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select how many seconds you want to pass before the carousel cycles automatically.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'auto', 'options' => array_combine(range(1, 20), array_values(range(1, 20))), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Ending Wrap', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select the behaviour for when the end of the carousel is reached.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'wrap', 'options' => array('first' => __('First', MYSITE_ADMIN_TEXTDOMAIN), 'last' => __('Last', MYSITE_ADMIN_TEXTDOMAIN), 'both' => __('Both', MYSITE_ADMIN_TEXTDOMAIN), 'circular' => __('Circular', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Description Content', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('The content you enter here will be displayed to the left of your carousel.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'teaser', 'type' => 'textarea', 'shortcode_dont_multiply' => true), array('name' => __('Disable Portfolio Elements <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can hide certain elements from displaying here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'disable', 'options' => array('image' => __('Disable Post Image', MYSITE_ADMIN_TEXTDOMAIN), 'title' => __('Disable Post Title', MYSITE_ADMIN_TEXTDOMAIN), 'excerpt' => __('Disable Post Excerpt', MYSITE_ADMIN_TEXTDOMAIN), 'date' => __('Disable Date', MYSITE_ADMIN_TEXTDOMAIN), 'more' => __('Disable Read More', MYSITE_ADMIN_TEXTDOMAIN), 'visit' => __('Disable Visit Site', MYSITE_ADMIN_TEXTDOMAIN)), 'default' => '', 'type' => 'checkbox'), 'shortcode_has_atts' => true)); return $option; } extract(shortcode_atts(array('teaser' => '', 'column' => '4', 'showposts' => '8', 'cat' => '', 'offset' => '', 'disable' => '', 'scroll' => '1', 'animation' => 500, 'auto' => 0, 'wrap' => null), $atts)); global $post, $wp_rewrite, $wp_query, $mysite; $mobile_disable_shortcodes = mysite_get_setting('mobile_disable_shortcodes'); if (isset($mysite->mobile) && is_array($mobile_disable_shortcodes) && in_array('tooltips', $mobile_disable_shortcodes)) { return; } $out = ''; $portfolio_query = new WP_Query(); $wrap = trim($wrap); $teaser = trim($teaser); $column = trim($column); $showposts = trim($showposts); $cat = trim($cat); $offset = trim($offset); $gallery_post = $post->post_name; if (is_front_page()) { $_layout = mysite_get_setting('homepage_layout'); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images'); } else { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images'); } if (is_numeric($offset) && strpos($disable, 'pagination') === false) { $mysite->offset = $offset; $mysite->posts_per_page = $showposts; add_filter('post_limits', 'my_post_limit'); } if (!empty($cat)) { $portfolio_query->query(array('post_type' => 'portfolio', 'posts_per_page' => $showposts, 'tax_query' => array('relation' => 'IN', array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => explode(',', $cat))), 'offset' => $offset, 'nopaging' => 0)); } else { $portfolio_query->query(array('post_type' => 'portfolio', 'posts_per_page' => $showposts, 'offset' => $offset, 'nopaging' => 0)); } if ($portfolio_query->have_posts()) { $img_sizes = $mysite->layout[$images]; $carousel_id = 'mysite_jcarousel_' . self::_carousel_id(); $img_group = 'portfolio_img_group_' . rand(1, 1000); $width = ''; $height = ''; switch ($column) { case 1: $main_class = 'mysite_jcarousel_portfolio one_column_portfolio'; $width = $img_sizes['one_column_portfolio'][0]; $height = $img_sizes['one_column_portfolio'][1]; break; case 2: $main_class = 'mysite_jcarousel_portfolio two_column_portfolio'; $width = $img_sizes['two_column_portfolio'][0]; $height = $img_sizes['two_column_portfolio'][1]; break; case 3: $main_class = 'mysite_jcarousel_portfolio three_column_portfolio'; $width = $img_sizes['three_column_portfolio'][0]; $height = $img_sizes['three_column_portfolio'][1]; break; case 4: $main_class = 'mysite_jcarousel_portfolio four_column_portfolio'; $width = $img_sizes['four_column_portfolio'][0]; $height = $img_sizes['four_column_portfolio'][1]; break; } # Variable calculations $column_margin_percent = isset($mysite->layout['images']['column_margin']) ? $mysite->layout['images']['column_margin'] : 4; $image_padding = $mysite->layout['images']['image_padding']; $content_area_width = $img_sizes['one_column_portfolio'][0] + $image_padding; $space = $content_area_width * $column_margin_percent / 100; $wrapper_width = round(($width + $space + $image_padding) * $column); $text_width = $img_sizes['four_column_portfolio'][0] + $image_padding + $space; $nav_position = $height / 2 - 15; $fallback_width = $width + $image_padding; $out = '<div class="' . $main_class . (!empty($teaser) ? ' has_jcarousel_text' : ' no_jcarousel_text') . ' noscript">'; # Build the jCarousel $out .= '<script type="text/javascript">'; $out .= 'jQuery(document).ready(function() {'; $out .= 'jQuery("#' . $carousel_id . '").jcarousel({'; # Setup options $out .= 'visible: ' . $column . ','; $out .= 'scroll: ' . $scroll . ','; $out .= 'animation: ' . $animation . ','; $out .= 'auto: ' . $auto . ','; $out .= 'wrap: "' . $wrap . '",'; $out .= 'itemFallbackDimension: "' . $fallback_width . '",'; $out .= 'buttonNextHTML: null, buttonPrevHTML: null,'; $out .= 'initCallback: ' . $carousel_id . '_callback,'; $out .= 'setupCallback: mysite_jcarousel_setup,'; $out .= 'buttonNextCallback: ' . $carousel_id . '_next_event,'; if ($wrap != 'first' && $wrap != 'circular' && $wrap != 'both') { $out .= 'buttonPrevCallback: ' . $carousel_id . '_prev_event,'; } $out .= '});'; $out .= '});'; # Add disabled class to next button $out .= 'function ' . $carousel_id . '_next_event(c) {'; $out .= 'if( c.buttonNextState === true ) { jQuery("#' . $carousel_id . '_next").addClass("jcarousel_next_disabled"); }'; $out .= 'if( c.buttonNextState === false ){ jQuery("#' . $carousel_id . '_next").removeClass("jcarousel_next_disabled"); }'; $out .= '}'; # Add disabled class to prev button $out .= 'function ' . $carousel_id . '_prev_event(c) {'; $out .= 'if( c.buttonPrevState === true || c.buttonPrevState === null ) { jQuery("#' . $carousel_id . '_prev").addClass("jcarousel_prev_disabled"); }'; $out .= 'if( c.buttonPrevState === false ){ jQuery("#' . $carousel_id . '_prev").removeClass("jcarousel_prev_disabled"); }'; $out .= '}'; # Setup our custom next prev buttons $out .= 'function ' . $carousel_id . '_callback(c) {'; $out .= 'jQuery("#' . $carousel_id . '_next").live("click", function(){ c.next(); Cufon.refresh(); return false; });'; $out .= 'jQuery("#' . $carousel_id . '_prev").live("click", function(){ c.prev(); Cufon.refresh(); return false; });'; $out .= '}'; $out .= '</script>'; # Check if description is set if (!empty($teaser)) { # Setup description dimensions $wrapper_width = $wrapper_width - $text_width; # Decrease width of images to fit inside $old_width = $width; $old_height = $height; $width = round(($wrapper_width - $space * $column) / $column - $image_padding); $height = round($old_height * ($width / $old_width)); $out .= '<div class="mysite_jcarousel_text">' . $teaser; $out .= '<div class = "clearboth"></div>'; $out .= '<div class="mysite_jcarousel_nav"><span id = "' . $carousel_id . '_prev" class="mysite_jcarousel_prev"></span><span id="' . $carousel_id . '_next" class="mysite_jcarousel_next"></span></div>'; $out .= '</div>'; } else { # If description is empty just display jcarousel navagation $out .= '<div class="mysite_jcarousel_nav" style="top:' . $nav_position . 'px;">'; $out .= '<span id="' . $carousel_id . '_prev" class="mysite_jcarousel_prev"></span><span id="' . $carousel_id . '_next" class="mysite_jcarousel_next"></span>'; $out .= '</div>'; } # Start displaying the jCarousel HTML and slides $out .= '<div class="portfolio_clip">'; $out .= '<div id="' . $carousel_id . '_wrapper" class="jcarousel_wrapper jcarousel_grid" style="width: ' . $wrapper_width . 'px; height: auto;">'; $out .= '<ul id="' . $carousel_id . '" class="jcarousel-skin-mysite">'; while ($portfolio_query->have_posts()) { $portfolio_query->the_post(); # Start building slide $out .= '<li style="width: ' . $width . ';margin-right:' . $space . 'px;">'; $out .= '<div class="' . join(' ', get_post_class('post_grid_module', get_the_ID())) . '">'; $id = get_the_ID(); $image_id = get_post_thumbnail_id(); $custom_fields = get_post_custom($id); foreach ($custom_fields as $key => $value) { ${$key}[$id] = $value[0]; if (is_serialized(${$key}[$id])) { ${$key}[$id] = unserialize(${$key}[$id]); } } if (has_post_thumbnail() || !empty($_image[$id]) || !empty($_featured_video[$id])) { if (has_post_thumbnail()) { $img = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'full', true); } else { $img[0] = !empty($_image[$id]) ? $_image[$id] : ''; } if ($wp_rewrite->using_permalinks()) { $url = empty($_custom_link[$id]) ? home_url('/') . 'portfolio/' . $post->post_name . '/gallery/' . $gallery_post . '/' : $_custom_link[$id]; } else { $url = htmlspecialchars(add_query_arg(array('gallery' => $gallery_post), get_permalink($id))); } $link_to = empty($_post[$id][0]) ? empty($_featured_video[$id]) ? empty($_image[$id]) ? $img[0] : $_image[$id] : $_featured_video[$id] : $url; if (strpos($disable, 'image') === false) { $offset = $mysite->layout['images']['image_padding']; $load_width = $width + $offset; $load_height = $height + $offset; $out .= '<div class="post_grid_image" style="width:' . $load_width . 'px;">'; ob_start(); mysite_portfolio_image_begin(); $out .= ob_get_clean(); if (empty($img[0]) && !empty($_featured_video[$id])) { $video_check = mysite_video($args = array('url' => $_featured_video[$id], 'parse' => true, 'width' => $width, 'height' => $height)); } else { $video_check = false; } if (!empty($video_check)) { $out .= $video_check; } else { $image_tags = mysite_post_image_tags($image_id, $id); $out .= mysite_display_image(array('src' => $img[0], 'alt' => $image_tags['alt'], 'title' => $image_tags['title'], 'height' => $height, 'width' => $width, 'class' => 'hover_fade_js', 'link_to' => $link_to, 'link_class' => 'portfolio_img_load', 'prettyphoto' => empty($_post[$id][0]) ? true : false, 'group' => $img_group, 'preload' => false)); } ob_start(); mysite_portfolio_image_end(array('column' => $column, 'disable' => $disable, 'more' => !empty($_more[$id][0]) ? $_more[$id][0] : '', 'link' => !empty($_link[$id]) ? $_link[$id] : '', 'url' => $url, 'date' => !empty($_date[$id]) ? $_date[$id] : '')); $out .= ob_get_clean(); $out .= '</div>'; } } $out .= '<div class="post_grid_content">'; $out .= apply_filters('mysite_portfolio_date_top', '', array('column' => $column, 'date' => !empty($_date[$id]) ? $_date[$id] : '', 'disable' => $disable)); if (strpos($disable, 'title') === false) { $title = empty($_more[$id][0]) ? '<a href="' . esc_url($url) . '">' . get_the_title($id) . '</a>' : get_the_title($id); if ($column == 1 || $column == 2) { $out .= '<h2 class="post_title">' . $title . '</h2>'; } else { $out .= '<h3 class="post_title">' . $title . '</h3>'; } } if (!empty($_date[$id]) && strpos($disable, 'date') === false) { $out .= apply_filters('mysite_portfolio_date', '<p class="date">' . $_date[$id] . '</p>', array('column' => $column)); } if (empty($_more[$id][0]) || !empty($_link[$id]) || !empty($_teaser[$id])) { $out .= '<div class="post_excerpt">'; $out .= !empty($_teaser[$id]) && strpos($disable, 'excerpt') === false ? '<p class="portfolio_excerpt">' . do_shortcode($_teaser[$id]) . '</p>' : ''; if (empty($_more[$id][0]) || !empty($_link[$id])) { $out .= '<p>'; if (empty($_more[$id][0]) && strpos($disable, 'more') === false) { $read_more = '<a href="' . esc_url($url) . '" class="post_more_link portfolio_more">' . __('Read More', MYSITE_TEXTDOMAIN) . '</a> '; $out .= apply_filters('mysite_portfolio_read_more', $read_more, esc_url($url)); } if (!empty($_link[$id]) && strpos($disable, 'visit') === false) { $visit_site = '<a href="' . esc_url($_link[$id]) . '" class="post_more_link portfolio_link">' . __('Visit Site', MYSITE_TEXTDOMAIN) . '</a>'; $out .= apply_filters('mysite_portfolio_visit_site', $visit_site, esc_url($_link[$id])); } $out .= '</p>'; } $out .= '</div>'; } $out .= '</div>'; $out .= '</div>'; # Ending slide $out .= '</li>'; } # Ending jCarousel HTML $out .= '</ul>'; $out .= '</div><div class = "clearboth"></div></div>'; $out .= '</div>'; } else { $out .= __('No portfolio posts were found for the category selected.', MYSITE_TEXTDOMAIN); } if (is_numeric($offset)) { remove_filter('post_limits', 'my_post_limit'); } wp_reset_query(); return $out; }
function tooltip($atts = null, $content = null) { if ($atts == 'generator') { $option = array('name' => __('Tooltip', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'tooltip', 'options' => array(array('name' => __('Tooltip Trigger Text', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the trigger text that will display with your toggle.<br /><br />The tooltip will be displayed when hovering over the trigger text.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'trigger', 'type' => 'text'), array('name' => __('Tooltip Content', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the content that you wish to have displayed inside the tooltip.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'content', 'type' => 'textarea'), array('name' => __('Width <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can manually specify the width of your tooltip here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'width', 'type' => 'text'), array('name' => __('Tooltip Position <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select where you would like your tooltip to appear relative to your trigger text.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'position', 'options' => array('top' => __('Top', MYSITE_ADMIN_TEXTDOMAIN), 'right' => __('Right', MYSITE_ADMIN_TEXTDOMAIN), 'bottom' => __('Bottom', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Color Variation <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Choose one of our predefined color skins to use with your tooltip.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'variation', 'default' => '', 'target' => 'color_variations', 'type' => 'select'), array('name' => __('Custom BG Color <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Or you can also choose your own color to use as the background for your tooltip.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'bgColor', 'type' => 'color'), array('name' => __('Custom Text Color <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can change the color of the text that appears in your tooltip.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'textColor', 'type' => 'color'), array('name' => __('Sticky <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('By default the tooltip will close when you move the cursor from it. Making it sticky will have it stay open until you hover over it again.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'sticky', 'options' => array('true' => __('Tootip stays open until you hovered over', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'checkbox'), array('name' => __('Close Icon <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Checking this will create an icon inside the tooltip when clicked on will close the tooltip.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'close', 'options' => array('true' => __('Tooltip stays open until close icon is clicked', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'checkbox'), array('name' => __('Disable Arrow <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('By default there will be a small arrow on the tooltip for style purposes. Check this if you wish to hide it.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'arrow', 'options' => array('false' => __('Disable the tooltip arrow', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'checkbox'), array('name' => __('ID <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('If using HTML for your trigger make sure to specify an ID here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'custom_id', 'type' => 'text'), 'shortcode_has_atts' => true)); return $option; } global $mysite; extract(shortcode_atts(array('trigger' => '', 'width' => '', 'position' => '', 'variation' => '', 'bgcolor' => '', 'textcolor' => '', 'sticky' => '', 'close' => '', 'arrow' => '', 'custom_id' => ''), $atts)); $mobile_disable_shortcodes = mysite_get_setting('mobile_disable_shortcodes'); if (isset($mysite->mobile) && is_array($mobile_disable_shortcodes) && in_array('tooltips', $mobile_disable_shortcodes)) { return; } $out = ''; $options = ''; $style = ''; $bgcolor[0] = !empty($bgcolor[0]) ? $bgcolor[0] : ''; $tip_id = self::_tip_id(); $tip_load = 'tooltip_load_' . $tip_id; $tip_trigger = 'tooltip_trigger_' . $tip_id; $width = trim(str_replace(' ', '', str_replace('px', '', $width))); if (!empty($width)) { $options .= "width: {$width},"; } else { $options .= "width: 200,"; } if (trim($position) == 'top') { $options .= " positionBy: 'customTop',"; } elseif (trim($position) == 'right') { $options .= " positionBy: 'auto',"; } elseif (trim($position) == 'bottom') { $options .= " positionBy: 'customBottom',"; } if (trim($arrow) == 'false') { $options .= " arrows: false,"; } else { $options .= " arrows: true,"; } if (trim($sticky) == 'true' || trim($close) == 'true') { $options .= " sticky: true,"; } if (trim($sticky) == 'true' && trim($close) != 'true') { $options .= " mouseOutClose: true,"; $close = "jQuery('#cluetip-close').css('display','none');"; } if (!empty($variation)) { $style .= "jQuery('#cluetip').addClass('{$variation}');\rjQuery('#cluetip-arrows').addClass('{$variation}');"; } else { $style .= "jQuery('#cluetip-arrows').removeClass().addClass('cluetip-arrows');"; } if ($bgcolor[0] == '#' && (strlen($bgcolor) == 7 || strlen($bgcolor) == 4)) { $style .= "jQuery('#cluetip').css('background-color','{$bgcolor}').css('border-color','{$bgcolor}');jQuery('#cluetip-arrows').css('border-color','{$bgcolor}');"; } else { $style .= "jQuery('#cluetip').css('background-color','').css('border-color','');\rjQuery('#cluetip-arrows').css('border-color','');"; } // Check if user has set an ID if ($custom_id == '') { // If not then we set trigger to a link $script = "<script type=\"text/javascript\">\n\t\t/* <![CDATA[ */\n\t\tjQuery(document).ready(function() {\n\t\t\tjQuery('a#{$tip_trigger}').cluetip({ local:true, {$options} hideLocal: false, cursor: 'pointer', showTitle: false, waitImage: false, clickThrough: false, dropShadow: false, waitImage :false, onShow: function(e) { {$style}{$close} Cufon.refresh(); }, fx: { open: 'fadeIn', openSpeed: 'fast' } });\n\t\t});\n\t\t\n\t\t/* ]]> */\n\t\t</script>"; echo $script; echo '<div id="' . $tip_load . '" class="tooltip_load"' . (!empty($textcolor) ? ' style="color:' . $textcolor . ';"' : '') . '>' . $content . '</div>'; $out .= '<a id="' . $tip_trigger . '" class="tooltip_trigger" href="#' . $tip_load . '" rel="#' . $tip_load . '">' . $trigger . '</a>'; } else { // If ID is set then we echo out the custom trigger // echo trigger $out .= '<span id = "span' . $custom_id . '">' . $trigger . '</span>'; // echo content echo '<div id = "custom_tooltip_content' . $custom_id . '" class="tooltip_load" style="display:none;">' . $content . '</div>'; // script $script = "<script type=\"text/javascript\">\n\t\t\t/* <![CDATA[ */\n\t\t\tjQuery(document).ready(function() {\n\t\t\t\tjQuery('#span{$custom_id} > *').attr('id', '{$custom_id}');\n\t\t\t\tjQuery('#span{$custom_id} > *').attr('rel', '#custom_tooltip_content{$custom_id}');\n\t\t\t\tjQuery('#{$custom_id}').cluetip({ attribute: 'rel', local:true, {$options} hideLocal: false, cursor: 'pointer', showTitle: false, waitImage: false, clickThrough: false, dropShadow: false, waitImage :false, onShow: function(e) { {$style}{$close} Cufon.refresh(); }, fx: { open: 'fadeIn', openSpeed: 'fast' } });\n\t\t\t});\n\t\t\t\n\t\t\t/* ]]> */\n\t\t\t</script>"; echo $script; } return $out; }
/** * */ function jcarousel($atts = null, $content = null) { if ($atts == 'generator') { $option = array('name' => __('jCarousel', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'jcarousel', 'options' => array(array('name' => __('Visible Slides', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select how many slides you want to be visible at one time.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'visible', 'options' => array_combine(range(1, 20), array_values(range(1, 20))), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Scrolling range', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select how many slides you wish to cycle when clicking on the arrows.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'scroll', 'options' => array_combine(range(1, 20), array_values(range(1, 20))), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Animation speed', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Type out how fast you want the animation to display. The value is defined in milliseconds so 1000 equals 1 second.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'animation', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Automatic sliding', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select how many seconds you want to pass before the carousel cycles automatically.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'auto', 'options' => array_combine(range(1, 20), array_values(range(1, 20))), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Ending Wrap', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select the behaviour for when the end of the carousel is reached.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'wrap', 'options' => array('first' => __('First', MYSITE_ADMIN_TEXTDOMAIN), 'last' => __('Last', MYSITE_ADMIN_TEXTDOMAIN), 'both' => __('Both', MYSITE_ADMIN_TEXTDOMAIN), 'circular' => __('Circular', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Number of slides', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select how many slides you wish to display.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'multiply', 'options' => range(1, 20), 'type' => 'select', 'shortcode_multiplier' => true), array('name' => __('Space between items in pixels', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Choose how much space you wish to display between the slides', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'space', 'options' => array_combine(range(1, 40), array_values(range(1, 40))), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Slide Content', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('This is the content that will appear inside your slide.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'content', 'default' => '', 'type' => 'textarea', 'shortcode_multiply' => true), array('value' => 'slide', 'nested' => true), 'shortcode_has_atts' => true)); return $option; } extract(shortcode_atts(array('vertical' => 'false', 'visible' => '1', 'scroll' => '1', 'animation' => 500, 'auto' => 0, 'wrap' => 'both', 'space' => '20'), $atts)); global $mysite; $mobile_disable_shortcodes = mysite_get_setting('mobile_disable_shortcodes'); if (isset($mysite->mobile) && is_array($mobile_disable_shortcodes) && in_array('tooltips', $mobile_disable_shortcodes)) { return; } $carousel_id = 'mysite_custom_jcarousel_' . self::_carousel_id(); $space = trim($space); $out = '<div class="mysite_jcarousel noscript">'; # Build the jCarousel $out .= '<script type="text/javascript">'; $out .= 'jQuery(document).ready(function() {'; $out .= 'jQuery("#' . $carousel_id . '").jcarousel({'; # Setup options $out .= 'vertical: ' . $vertical . ','; $out .= 'visible: ' . $visible . ','; $out .= 'scroll: ' . $scroll . ','; $out .= 'animation: ' . $animation . ','; $out .= 'auto: ' . $auto . ','; $out .= 'wrap: "' . $wrap . '",'; if ($wrap == 'both') { $out .= 'itemFallbackDimension: 400,'; } $out .= 'buttonNextHTML: null, buttonPrevHTML: null,'; $out .= 'initCallback: ' . $carousel_id . '_callback,'; $out .= 'setupCallback: ' . $carousel_id . '_setup,'; $out .= 'buttonNextCallback: ' . $carousel_id . '_next_event,'; if ($wrap != 'first' && $wrap != 'circular' && $wrap != 'both') { $out .= 'buttonPrevCallback: ' . $carousel_id . '_prev_event,'; } $out .= '});'; $out .= '});'; # Add disabled class to next button $out .= 'function ' . $carousel_id . '_next_event(c) {'; $out .= 'if( c.buttonNextState === true ) { jQuery("#' . $carousel_id . '_next").addClass("jcarousel_next_disabled"); }'; $out .= 'if( c.buttonNextState === false ){ jQuery("#' . $carousel_id . '_next").removeClass("jcarousel_next_disabled"); }'; $out .= '}'; # Add disabled class to prev button $out .= 'function ' . $carousel_id . '_prev_event(c) {'; $out .= 'if( c.buttonPrevState === true || c.buttonPrevState === null ) { jQuery("#' . $carousel_id . '_prev").addClass("jcarousel_prev_disabled"); }'; $out .= 'if( c.buttonPrevState === false ){ jQuery("#' . $carousel_id . '_prev").removeClass("jcarousel_prev_disabled"); }'; $out .= '}'; # Setup our custom next prev buttons $out .= 'function ' . $carousel_id . '_callback(c) {'; $out .= 'jQuery("#' . $carousel_id . '_next").live("click touchstart", function(){ c.next(); Cufon.refresh(); return false; });'; $out .= 'jQuery("#' . $carousel_id . '_prev").live("click touchstart", function(){ c.prev(); Cufon.refresh(); return false; });'; $out .= '}'; # Show after jcarousel is completely setup $out .= 'function ' . $carousel_id . '_setup(c) {'; $out .= "c.clip.parent().parent().parent().parent().removeClass('noscript');"; $out .= '}'; $out .= '</script>'; $out .= '<div class="mysite_jcarousel_nav">'; $out .= '<span id="' . $carousel_id . '_prev" class="mysite_jcarousel_prev"></span><span id="' . $carousel_id . '_next" class="mysite_jcarousel_next"></span>'; $out .= '</div>'; # Start displaying the jCarousel HTML $out .= '<div id = "' . $carousel_id . '_wrapper" class = "jcarousel_wrapper jcarousel_grid">'; $out .= '<ul id = "' . $carousel_id . '" class = "jcarousel-skin-mysite">'; # Setup margins for horizontal items $margin = 'margin-left: ' . round($space / 2) . 'px; margin-right: ' . round($space / 2) . 'px;'; if (preg_match_all('/(.?)\\[(slide)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/slide\\])?(.?)/s', $content, $matches)) { foreach ($matches[0] as $slide) { # Fix the string so shortcode_parse_atts picks it up correctly $needle = strpos($slide, ']'); $start = substr($slide, 0, $needle); $end = substr($slide, $needle); $scfix = $start . ' ' . $end; # Grab the content of the slide $length = strlen(substr($slide, $needle + 1)) - 9; $content = substr($slide, $needle + 1, $length); $values = shortcode_parse_atts($scfix); # Output the slide $out .= '<li style = "' . $margin . '">' . do_shortcode($content) . '</li>'; } } # Ending jCarousel HTML $out .= '</ul>'; $out .= '</div><div class = "clearboth"></div></div>'; return $out; }
/** * */ function galleria($atts = null, $content = null) { if ($atts == 'generator') { $option = array('name' => __('Galleria', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'galleria', 'options' => array(array('name' => __('Transition Effect', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('The transition effect is the animation that displays when changing from one image to the next.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'transition', 'default' => '', 'options' => array('fade' => __('Fade', MYSITE_ADMIN_TEXTDOMAIN), 'slide' => __('Slide', MYSITE_ADMIN_TEXTDOMAIN), 'fadeslide' => __('Fade Slide', MYSITE_ADMIN_TEXTDOMAIN), 'pulse' => __('Pulse', MYSITE_ADMIN_TEXTDOMAIN), 'flash' => __('Flash', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Transition Speed', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('The transition speed is how fast the transition animation will take to complete.<br /><br />This number is in milliseconds, 1 second = 1000 milliseconds.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'speed', 'default' => '', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Height', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the height that you want the galleria to use.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'height', 'default' => '', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Width', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the width that you want the galleria to use.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'width', 'default' => '', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Enable Galleria Options', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can select various galleria options to use here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'enable', 'options' => array('image_crop' => __('Image Crop', MYSITE_ADMIN_TEXTDOMAIN), 'show_counter' => __('Show Counter', MYSITE_ADMIN_TEXTDOMAIN), 'show_imagenav' => __('Show Image Nav', MYSITE_ADMIN_TEXTDOMAIN), 'pause_on_interaction' => __('Pause on Hover', MYSITE_ADMIN_TEXTDOMAIN), 'lightbox' => __('Lightbox', MYSITE_ADMIN_TEXTDOMAIN)), 'default' => '', 'type' => 'checkbox', 'shortcode_dont_multiply' => true), array('name' => __('Number of images', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select how many images you wish to display in the galleria.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'multiply', 'default' => '', 'options' => range(1, 10), 'type' => 'select', 'shortcode_multiplier' => true), array('name' => __('Image 1 URL', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can upload an image to use here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'content', 'default' => '', 'type' => 'upload', 'shortcode_multiply' => true), array('name' => __('Image 1 Title Attribute <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the title text that you would like to use for this image.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'title', 'default' => '', 'type' => 'text', 'shortcode_multiply' => true), array('name' => __('Image 1 Alt Attribute <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the alt text that you would like to use for this image.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'alt', 'default' => '', 'type' => 'text', 'shortcode_multiply' => true), array('value' => 'image', 'nested' => true), 'shortcode_has_atts' => true)); return $option; } extract(shortcode_atts(array('transition' => 'fade', 'speed' => 'true', 'height' => '', 'width' => '', 'enable' => ''), $atts)); global $wp_query, $mysite; $mobile_disable_shortcodes = mysite_get_setting('mobile_disable_shortcodes'); if (isset($mysite->mobile) && is_array($mobile_disable_shortcodes) && in_array('galleria', $mobile_disable_shortcodes)) { return; } $out = ''; $galleria_id = 'galleria_' . rand(1, 1000); $width = !empty($width) ? trim(str_replace(' ', '', str_replace('px', '', $width))) : ''; $height = !empty($height) ? trim(str_replace(' ', '', str_replace('px', '', $height))) : ''; if (empty($width) || empty($height)) { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $img_size = $_layout == 'right_sidebar' ? 'big_sidebar_images' : ($_layout == 'full_width' ? 'images' : 'small_sidebar_images'); if (empty($width)) { $width = $mysite->layout[$img_size]['one_column_blog'][0]; } if (empty($height)) { $height = $mysite->layout[$img_size]['one_column_blog'][1]; } } $image_crop = 'false'; $show_counter = 'false'; $show_imagenav = 'false'; $pause_on_interaction = 'false'; $lightbox = ''; if (strpos($enable, 'image_crop') !== false) { $image_crop = 'true'; } if (strpos($enable, 'show_counter') !== false) { $show_counter = 'true'; } if (strpos($enable, 'show_imagenav') !== false) { $show_imagenav = 'true'; } if (strpos($enable, 'pause_on_interaction') !== false) { $pause_on_interaction = 'true'; } if (strpos($enable, 'lightbox') !== false) { $lightbox = ' extend: function(options) { this.bind(Galleria.IMAGE, function(e) { jQuery(e.imageTarget).click(this.proxy(function() { this.openLightbox(); })); }); },'; } $script = '<script type="text/javascript"> /* <![CDATA[ */ jQuery(document).ready(function() { jQuery("#' . $galleria_id . '").galleria({ autoplay: ' . $speed . ',' . $lightbox . ' thumbCrop: true, image_crop: ' . $image_crop . ', show_counter: ' . $show_counter . ', show_imagenav: ' . $show_imagenav . ', pause_on_interaction: ' . $pause_on_interaction . ', transition: "' . $transition . '" }); }); /* ]]> */ </script>'; if (!preg_match_all("/(.?)\\[(image)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/image\\])?(.?)/s", $content, $sc_matches)) { if (preg_match_all('!https?://.+\\.(?:jpe?g|png|gif)!Ui', $content, $matches)) { echo $script; $out .= '<div id="' . $galleria_id . '" style="width:' . $width . 'px;height:' . $height . 'px;">'; foreach ($matches[0] as $img) { $out .= mysite_display_image(array('src' => $img, 'title' => '', 'alt' => '')); } $out .= '</div>'; } } else { echo $script; $out .= '<div id="' . $galleria_id . '" style="width:' . $width . 'px;height:' . $height . 'px;">'; for ($i = 0; $i < count($sc_matches[0]); $i++) { $sc_matches[3][$i] = shortcode_parse_atts($sc_matches[3][$i]); } for ($i = 0; $i < count($sc_matches[0]); $i++) { $title = !empty($sc_matches[3][$i]['title']) ? $sc_matches[3][$i]['title'] : ''; $alt = !empty($sc_matches[3][$i]['alt']) ? $sc_matches[3][$i]['alt'] : ''; $out .= mysite_display_image(array('src' => $sc_matches[5][$i], 'title' => $title, 'alt' => $alt)); } $out .= '</div>'; } return $out; }
/** * */ function jcarousel_blog($atts = null) { if ($atts == 'generator') { $option = array('name' => __('jCarousel Blog', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'jcarousel_blog', 'options' => array(array('name' => __('Number of Columns', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of columns you wish to have your posts displayed in.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'column', 'options' => array('1' => __('One Column', MYSITE_ADMIN_TEXTDOMAIN), '2' => __('Two Column', MYSITE_ADMIN_TEXTDOMAIN), '3' => __('Three Column', MYSITE_ADMIN_TEXTDOMAIN), '4' => __('Four Column', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Number of Posts', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of posts you wish to have displayed on each page.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'showposts', 'options' => array_combine(range(1, 40), array_values(range(1, 40))), 'type' => 'select'), array('name' => __('Offset Posts <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('This will skip a number of posts at the beginning.<br /><br />Useful if you are using multiple blog shortcodes on the same page.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'offset', 'options' => array_combine(range(1, 10), array_values(range(1, 10))), 'type' => 'select'), array('name' => __('Post Content <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can choose to have the post excerpt displayed or the full content of your post including shortcodes.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'post_content', 'options' => array('excerpt' => __('Excerpt', MYSITE_ADMIN_TEXTDOMAIN), 'full' => __('Full Post', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Blog Categories <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('If you want posts from specific categories to display then you may choose them here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'category_in', 'default' => array(), 'target' => 'cat', 'type' => 'multidropdown'), array('name' => __('Scrolling Range', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Select how many posts you wish to cycle when scrolling.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'scroll', 'default' => '', 'options' => array_combine(range(1, 4), array_values(range(1, 4))), 'type' => 'select'), array('name' => __('Animation speed', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Type out how fast you want the animation to display. The value is defined in milliseconds so 1000 equals 1 second.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'animation', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Automatic sliding', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select how many seconds you want to pass before the carousel cycles automatically.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'auto', 'options' => array_combine(range(1, 20), array_values(range(1, 20))), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Ending Wrap', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('Select the behaviour for when the end of the carousel is reached.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'wrap', 'options' => array('first' => __('First', MYSITE_ADMIN_TEXTDOMAIN), 'last' => __('Last', MYSITE_ADMIN_TEXTDOMAIN), 'both' => __('Both', MYSITE_ADMIN_TEXTDOMAIN), 'circular' => __('Circular', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Description Content', MYSITE_ADMIN_TEXTDOMAIN), "desc" => __('The content you enter here will be displayed to the left of your carousel.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'teaser', 'type' => 'textarea', 'shortcode_dont_multiply' => true), array('name' => __('Disable Post Elements <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can hide certain elements from displaying here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'disable', 'options' => array('image' => __('Disable Post Image', MYSITE_ADMIN_TEXTDOMAIN), 'title' => __('Disable Post Title', MYSITE_ADMIN_TEXTDOMAIN), 'content' => __('Disable Post Content', MYSITE_ADMIN_TEXTDOMAIN), 'meta' => __('Disable Post Meta', MYSITE_ADMIN_TEXTDOMAIN), 'more' => __('Disable Read More', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'checkbox'), 'shortcode_has_atts' => true)); return $option; } extract(shortcode_atts(array('teaser' => '', 'column' => '', 'showposts' => '', 'offset' => '', 'post_content' => '', 'categories' => '', 'disable' => '', 'post_in' => '', 'category_in' => '', 'tag_in' => '', 'scroll' => '1', 'animation' => 500, 'auto' => 0, 'wrap' => null), $atts)); global $post, $wp_rewrite, $wp_query, $mysite; $mobile_disable_shortcodes = mysite_get_setting('mobile_disable_shortcodes'); if (isset($mysite->mobile) && is_array($mobile_disable_shortcodes) && in_array('tooltips', $mobile_disable_shortcodes)) { return; } $out = ''; $showposts = trim($showposts); $wrap = trim($wrap); $teaser = trim($teaser); $column = !empty($column) ? trim($column) : '3'; $thumb = !empty($thumb) ? trim($thumb) : 'medium'; $offset = isset($offset) ? trim($offset) : ''; $post_in = !empty($post_in) ? explode(",", trim($post_in)) : ''; $category_in = !empty($category_in) ? explode(",", trim($category_in)) : ''; $tag_in = !empty($tag_in) ? explode(",", trim($tag_in)) : ''; if (is_front_page()) { $_layout = mysite_get_setting('homepage_layout'); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images'); } else { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $template = get_post_meta($post_obj->ID, '_wp_page_template', true); $images = $_layout == 'full_width' ? 'images' : ($_layout == 'left_sidebar' || $template == 'template-featuretour.php' ? 'small_sidebar_images' : 'big_sidebar_images'); } $blog_query = new WP_Query(); $blog_query->query(array('post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'post', 'showposts' => $showposts, 'nopaging' => 0, 'offset' => $offset, 'ignore_sticky_posts' => 1)); if ($blog_query->have_posts()) { $img_sizes = $mysite->layout[$images]; $carousel_id = 'mysite_blog_jcarousel_' . self::_carousel_id(); $width = ''; $height = ''; switch ($column) { case 1: $main_class = 'mysite_jcarousel_blog post_grid one_column_blog'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'post_grid_image'; $excerpt_lenth = 400; $width = $img_sizes['one_column_blog'][0]; $height = $img_sizes['one_column_blog'][1]; break; case 2: $main_class = 'mysite_jcarousel_blog post_grid two_column_blog'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'post_grid_image'; $column_class = 'one_half'; $excerpt_lenth = 150; $width = $img_sizes['two_column_blog'][0]; $height = $img_sizes['two_column_blog'][1]; break; case 3: $main_class = 'mysite_jcarousel_blog post_grid three_column_blog'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'post_grid_image'; $column_class = 'one_third'; $excerpt_lenth = 75; $width = $img_sizes['three_column_blog'][0]; $height = $img_sizes['three_column_blog'][1]; break; case 4: $main_class = 'mysite_jcarousel_blog post_grid four_column_blog'; $post_class = 'post_grid_module'; $content_class = 'post_grid_content'; $img_class = 'post_grid_image'; $column_class = 'one_fourth'; $excerpt_lenth = 50; $width = $img_sizes['four_column_blog'][0]; $height = $img_sizes['four_column_blog'][1]; break; } # Variable calculations $column_margin_percent = isset($mysite->layout['images']['column_margin']) ? $mysite->layout['images']['column_margin'] : 4; $image_padding = $mysite->layout['images']['image_padding']; $content_area_width = $img_sizes['one_column_portfolio'][0] + $image_padding; $space = $content_area_width * $column_margin_percent / 100; $wrapper_width = round(($width + $space + $image_padding) * $column); $text_width = $img_sizes['four_column_portfolio'][0] + $image_padding + $space; $nav_position = $height / 2 - 15; $fallback_width = $width + $image_padding; $out = '<div class="' . $main_class . (!empty($teaser) ? ' has_jcarousel_text' : ' no_jcarousel_text') . ' noscript">'; # Build the jCarousel $out .= '<script type="text/javascript">'; $out .= 'jQuery(document).ready(function() {'; $out .= 'jQuery("#' . $carousel_id . '").jcarousel({'; # Setup options $out .= 'visible: ' . $column . ','; $out .= 'scroll: ' . $scroll . ','; $out .= 'animation: ' . $animation . ','; $out .= 'auto: ' . $auto . ','; $out .= 'wrap: "' . $wrap . '",'; $out .= 'itemFallbackDimension: "' . $fallback_width . '",'; $out .= 'buttonNextHTML: null, buttonPrevHTML: null,'; $out .= 'initCallback: ' . $carousel_id . '_callback,'; $out .= 'setupCallback: ' . $carousel_id . '_setup,'; $out .= 'buttonNextCallback: ' . $carousel_id . '_next_event,'; if ($wrap != 'first' && $wrap != 'circular' && $wrap != 'both') { $out .= 'buttonPrevCallback: ' . $carousel_id . '_prev_event,'; } $out .= '});'; $out .= '});'; # Add disabled class to next button $out .= 'function ' . $carousel_id . '_next_event(c) {'; $out .= 'if( c.buttonNextState === true ) { jQuery("#' . $carousel_id . '_next").addClass("jcarousel_next_disabled"); }'; $out .= 'if( c.buttonNextState === false ){ jQuery("#' . $carousel_id . '_next").removeClass("jcarousel_next_disabled"); }'; $out .= '}'; # Add disabled class to prev button $out .= 'function ' . $carousel_id . '_prev_event(c) {'; $out .= 'if( c.buttonPrevState === true || c.buttonPrevState === null ) { jQuery("#' . $carousel_id . '_prev").addClass("jcarousel_prev_disabled"); }'; $out .= 'if( c.buttonPrevState === false ){ jQuery("#' . $carousel_id . '_prev").removeClass("jcarousel_prev_disabled"); }'; $out .= '}'; # Setup our custom next prev buttons $out .= 'function ' . $carousel_id . '_callback(c) {'; $out .= 'jQuery("#' . $carousel_id . '_next").live("click", function(){ c.next(); Cufon.refresh(); return false; });'; $out .= 'jQuery("#' . $carousel_id . '_prev").live("click", function(){ c.prev(); Cufon.refresh(); return false; });'; $out .= '}'; # Show after jcarousel is completely setup $out .= 'function ' . $carousel_id . '_setup(c) {'; $out .= "c.clip.parent().parent().parent().parent().parent().removeClass('noscript');"; $out .= '}'; $out .= '</script>'; # Check if description is set if (!empty($teaser)) { # Setup description dimensions $wrapper_width = $wrapper_width - $text_width; # Decrease width of images to fit inside $old_width = $width; $old_height = $height; $width = round(($wrapper_width - $space * $column) / $column - $image_padding); $height = round($old_height * ($width / $old_width)); $out .= '<div class="mysite_jcarousel_text">' . $teaser; $out .= '<div class = "clearboth"></div>'; $out .= '<div class="mysite_jcarousel_nav"><span id = "' . $carousel_id . '_prev" class="mysite_jcarousel_prev"></span><span id="' . $carousel_id . '_next" class="mysite_jcarousel_next"></span></div>'; $out .= '</div>'; } else { # If description is empty just display jcarousel navagation $out .= '<div class="mysite_jcarousel_nav" style="top:' . $nav_position . 'px;">'; $out .= '<span id="' . $carousel_id . '_prev" class="mysite_jcarousel_prev"></span><span id="' . $carousel_id . '_next" class="mysite_jcarousel_next"></span>'; $out .= '</div>'; } # Start displaying the jCarousel HTML and slides $out .= '<div class="portfolio_clip">'; $out .= '<div id="' . $carousel_id . '_wrapper" class="jcarousel_wrapper jcarousel_grid" style="width: ' . $wrapper_width . 'px; height: auto;">'; $out .= '<ul id="' . $carousel_id . '" class="jcarousel-skin-mysite">'; $filter_args = array('width' => $width, 'height' => $height, 'img_class' => $img_class, 'link_class' => 'blog_sc_image_load', 'preload' => false, 'post_content' => $post_content, 'disable' => $disable, 'column' => $column, 'thumb' => $thumb, 'type' => 'blog_grid', 'shortcode' => true, 'echo' => false); $i = 1; while ($blog_query->have_posts()) { $blog_query->the_post(); # Start building slide $out .= '<li style="width: ' . $width . ';margin-right:' . $space . 'px;">'; $out .= '<div class="' . join(' ', get_post_class($post_class, get_the_ID())) . '">'; $out .= mysite_before_post_sc($filter_args); $out .= '<div class="' . $content_class . '">'; $out .= mysite_before_entry_sc($filter_args); $out .= '<div class="post_excerpt">'; if (strpos($disable, 'content') === false) { ob_start(); mysite_post_content($filter_args); $out .= ob_get_clean(); } $out .= '</div>'; $out .= mysite_after_entry_sc($filter_args); $out .= '</div>'; $out .= '</div>'; $i++; // Ending slide $out .= '</li>'; } # Ending jCarousel HTML $out .= '</ul>'; $out .= '</div><div class = "clearboth"></div></div>'; $out .= '</div>'; } else { $out .= __('No blog posts were found for the category selected.', MYSITE_TEXTDOMAIN); } if (is_numeric($offset)) { remove_filter('post_limits', 'my_post_limit'); } wp_reset_query(); return $out; }
function nivo($atts = null, $content = null) { if ($atts == 'generator') { $option = array('name' => __('Nivo', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'nivo', 'options' => array(array('name' => __('Transition Effects', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('The transition effect is the animation that displays when changing from one image to the next.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'effect', 'target' => 'nivo_effects', 'type' => 'select', 'shortcode_dont_multiply' => true), array('name' => __('Slices', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('The Nivo slider transitions are broken up into slices. You can type out the number of slices you want to use here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'slices', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Animation Speed', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('This is how fast the transition animations will take to complete.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'animSpeed', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Slider Transition Speed', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('This is how long an image is displayed before changing to the next.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'pauseTime', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Next & Prev Buttons', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('The next and previous buttons display on the left and rigt side and allow the user to manually change the image.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'directionNav', 'default' => 'disable', 'options' => array('button' => __('Always Display Next & Previous Buttons', MYSITE_ADMIN_TEXTDOMAIN), 'button_hover' => __('Display Next & Previous Buttons on Hover', MYSITE_ADMIN_TEXTDOMAIN), 'disable' => __('Disable Next & Previous Buttons', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'radio', 'shortcode_dont_multiply' => true), array('name' => __('Display Nav Dots', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('The navigation dots display on the bottom and allow the user to manually change the image.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'controlNav', 'options' => array('true' => __('Display Navigation Dots', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'checkbox', 'shortcode_dont_multiply' => true), array('name' => __('Width', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can manually set the width of the slider here. Your images will be resized to fit.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'width', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Height', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can manually set the height of the slider here. Your images will be resized to fit.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'height', 'type' => 'text', 'shortcode_dont_multiply' => true), array('name' => __('Number of images', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Choose the number of images you wish to display in the slider.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'multiply', 'options' => range(1, 20), 'type' => 'select', 'shortcode_multiplier' => true), array('name' => __('Image 1 URL', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('You can upload an image to use here.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'content', 'type' => 'upload', 'shortcode_multiply' => true), array('name' => __('Image 1 Caption <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('With the Nivo slider captions are displayed with the images.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'caption', 'type' => 'text', 'shortcode_multiply' => true), array('value' => 'image', 'nested' => true), 'shortcode_has_atts' => true)); return $option; } global $wp_query, $mysite; extract(shortcode_atts(array('width' => '', 'height' => '', 'effect' => '', 'slices' => '', 'animspeed' => '', 'pausetime' => '', 'directionnav' => '', 'controlnav' => ''), $atts)); $mobile_disable_shortcodes = mysite_get_setting('mobile_disable_shortcodes'); if (isset($mysite->mobile) && is_array($mobile_disable_shortcodes) && in_array('slider', $mobile_disable_shortcodes)) { return; } $out = ''; $nivo_id = self::_nivo_id(); $width = !empty($width) ? trim(str_replace(' ', '', str_replace('px', '', $width))) : ''; $height = !empty($height) ? trim(str_replace(' ', '', str_replace('px', '', $height))) : ''; if (empty($width) || empty($height)) { $post_obj = $wp_query->get_queried_object(); $_layout = get_post_meta($post_obj->ID, '_layout', true); $img_size = $_layout == 'right_sidebar' ? 'big_sidebar_images' : ($_layout == 'full_width' ? 'images' : 'small_sidebar_images'); if (empty($width)) { $width = $mysite->layout[$img_size]['one_column_blog'][0]; } if (empty($height)) { $height = $mysite->layout[$img_size]['one_column_blog'][1]; } } $effect = !empty($effect) ? trim($effect) : 'sliceDown'; $slices = !empty($slices) ? trim($slices) : 15; $animspeed = !empty($animspeed) ? trim($animspeed) : 500; $pausetime = !empty($pausetime) ? trim($pausetime) : 3000; $controlnav = empty($controlnav) ? 'false' : 'true'; if ($directionnav == 'button') { $directionnav = 'true'; $directionnavhide = 'false'; } elseif ($directionnav == 'button_hover') { $directionnav = 'true'; $directionnavhide = 'true'; } elseif ($directionnav == 'disable' || empty($directionnav)) { $directionnav = 'false'; $directionnavhide = 'false'; } $get_disable_cufon = mysite_get_setting('disable_cufon'); $nivo_caption = empty($get_disable_cufon) ? "Cufon.replace('.nivo-caption');" : ''; $script = "<script type=\"text/javascript\">\n\t\t/* <![CDATA[ */\n\t\tjQuery(document).ready(function() {\n\t\t\tjQuery('#mysite_nivo_sc_{$nivo_id} .nivo_sc_load').preloader({\n\t\t\t\tselector: '#nivo_slider_{$nivo_id}',\n\t\t\t\timgAppend: '',\n\t\t\t\tfade: false,\n\t\t\t\tonDone: function(){\n\t\t\t\t\tjQuery('.preload_span').remove();\n\t\t\t\t\tjQuery('#nivo_slider_{$nivo_id}').nivoSlider({\n\t\t\t\t\t\teffect: '{$effect}',\n\t\t\t\t\t\tslices: {$slices},\n\t\t\t\t\t\tanimSpeed: {$animspeed}, //Slide transition speed\n\t\t\t\t\t\tpauseTime: {$pausetime}, // How long each slide will show\n\t\t\t\t\t\tdirectionNav: {$directionnav}, //Next & Prev\n\t\t\t\t\t\tdirectionNavHide: {$directionnavhide}, //Only show on hover\n\t\t\t\t\t\tcontrolNav: {$controlnav}, //1,2,3...\n\t\t\t\t\t\tkeyboardNav:false, //Use left & right arrows\n\t\t\t\t\t\tpauseOnHover: true, //Stop animation while hovering\n\t\t\t\t\t\tmanualAdvance: false, //Force manual transitions\n\t\t\t\t\t\tcustomChange: function(){ {$nivo_caption} }\n\t\t\t\t\t});\n\t\t\t\t\tjQuery('#nivo_slider_{$nivo_id}').removeClass('noscript');\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\t/* ]]> */\n\t\t</script>"; echo $script; if (!preg_match_all('/(.?)\\[(image)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/image\\])?(.?)/s', $content, $matches)) { if (preg_match_all('!https?://.+\\.(?:jpe?g|png|gif)!Ui', $content, $matches)) { $out = '<div id="mysite_nivo_sc_' . $nivo_id . '" class="mysite_nivo_sc" style="width:' . $width . 'px;height:' . $height . 'px;">'; $out .= '<div class="mysite_preloader">'; $out .= '<img src="' . esc_url(THEME_IMAGES_ASSETS . '/transparent.gif') . '" style="background-image: url(' . THEME_IMAGES_ASSETS . '/preloader.png);">'; $out .= '</div>'; $out .= '<div class="nivo_sc_load">'; $out .= '<div id="nivo_slider_' . $nivo_id . '" class="noscript">'; foreach ($matches[0] as $img) { $out .= '<span>'; $out .= mysite_display_image(array('src' => $img, 'alt' => '', 'height' => $height, 'width' => $width)); $out .= '</span>'; } $out .= '</div>'; $out .= '</div>'; $out .= '</div>'; } } else { for ($i = 0; $i < count($matches[0]); $i++) { $matches[3][$i] = shortcode_parse_atts($matches[3][$i]); } $out = '<div id="mysite_nivo_sc_' . $nivo_id . '" class="mysite_nivo_sc" style="width:' . $width . 'px;height:' . $height . 'px;">'; $out .= '<div class="mysite_preloader">'; $out .= '<img src="' . esc_url(THEME_IMAGES_ASSETS . '/transparent.gif') . '" style="background-image: url(' . THEME_IMAGES_ASSETS . '/preloader.png);">'; $out .= '</div>'; $out .= '<div class="nivo_sc_load">'; $out .= '<div id="nivo_slider_' . $nivo_id . '" class="noscript">'; for ($i = 0; $i < count($matches[0]); $i++) { $caption = isset($matches[3][$i]['caption']) ? $matches[3][$i]['caption'] : ''; $title = !empty($caption) ? "#htmlcaption_{$i}_{$nivo_id}" : ''; $out .= '<span>'; $out .= mysite_display_image(array('src' => $matches[5][$i], 'title' => $title, 'alt' => '', 'height' => $height, 'width' => $width)); $out .= '</span>'; } $out .= '</div>'; $out .= '</div>'; $out .= '</div>'; for ($i = 0; $i < count($matches[0]); $i++) { $caption = isset($matches[3][$i]['caption']) ? $matches[3][$i]['caption'] : ''; if (!empty($caption)) { $out .= '<div id="htmlcaption_' . $i . '_' . $nivo_id . '" class="nivo-html-caption">'; $out .= $caption; $out .= '</div>'; } } } return $out; }
/** * */ function blockquote($atts = null, $content = null) { $option = array('name' => __('Blockquotes', MYSITE_ADMIN_TEXTDOMAIN), 'value' => 'blockquote', 'options' => array(array('name' => __('Blockquote Content', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Type out the text that you wish to display with your quote.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'content', 'default' => '', 'type' => 'textarea'), array('name' => __('Align <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Set the alignment for your quote here.<br /><br />Your quote will float along the center, left or right hand sides depending on your choice.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'align', 'default' => '', 'options' => array('left' => __('left', MYSITE_ADMIN_TEXTDOMAIN), 'right' => __('right', MYSITE_ADMIN_TEXTDOMAIN), 'center' => __('center', MYSITE_ADMIN_TEXTDOMAIN)), 'type' => 'select'), array('name' => __('Color Variation <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('Choose one of our predefined color skins to use with your quote.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'variation', 'default' => '', 'target' => 'color_variations', 'type' => 'select'), array('name' => __('Cite Name <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('This is the name of the author. It will display at the end of the quote.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'cite', 'default' => '', 'type' => 'text'), array('name' => __('Cite Link <small>(optional)</small>', MYSITE_ADMIN_TEXTDOMAIN), 'desc' => __('If you found your quote online then paste the URL here. It will display after the author.', MYSITE_ADMIN_TEXTDOMAIN), 'id' => 'citeLink', 'default' => '', 'type' => 'text'), 'shortcode_has_atts' => true)); if ($atts == 'generator') { return $option; } extract(shortcode_atts(array('variation' => '', 'cite' => '', 'citelink' => '', 'citename' => '', 'citeimgcustom' => '', 'citeimgavatar' => '', 'cite_sc' => 'false', 'testimonial_sc' => 'false', 'raw' => 'true'), $atts)); $variation = $variation ? ' class="' . trim($variation) . '_sprite"' : ''; $cite = $cite ? ' <cite>– ' . $cite . $citelink . '</cite>' : ''; if ($testimonial_sc == 'true') { if (!empty($citeimgcustom) || !empty($citeimgavatar) || !empty($cite_sc) || !empty($citelink)) { $cite = '<span class="testimonial_author">'; if (!empty($citeimgcustom)) { $gravatar_size = apply_filters('testimonial_gravatar_size', '40'); $cite .= '<span class="testimonial_image">' . mysite_display_image(array('src' => $citeimgcustom, 'title' => '', 'alt' => '', 'height' => $gravatar_size, 'width' => $gravatar_size, 'wp_resize' => mysite_get_setting('image_resize_type') == 'wordpress' ? true : false)) . '</span>'; } if (!empty($citeimgavatar)) { $cite .= '<span class="testimonial_image">' . get_avatar($citeimgavatar, apply_filters('testimonial_gravatar_size', '40'), THEME_IMAGES_ASSETS . '/testimonial_gravatar_default.png') . '</span>'; } if (!empty($cite_sc) || !empty($citelink)) { $cite .= '<span class="testimonial_meta">'; if (!empty($cite_sc) && $cite_sc != 'false') { $cite .= '<span class="testimonial_author_name">' . $cite_sc . '</span>'; } if (!empty($citelink)) { $cite .= '<span class="testimonial_author_website"><a href="' . esc_url($citelink) . '" class="target_blank">' . (!empty($citename) ? $citename : $citelink) . '</a></span>'; } $cite .= '</span>'; } $cite .= '</span>'; } else { $cite = ''; } } if ($raw == 'true') { return '<blockquote' . $variation . '>' . mysite_remove_wpautop($content) . $cite . '</blockquote>'; } else { return '<blockquote' . $variation . '>' . mysite_remove_wpautop($content) . $cite . '</blockquote>'; } }