コード例 #1
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => strtolower($smof_data['tagline_bg']) . strtolower($evl_options['evl_shortcode_tagline_bg_color']), 'border' => '0px', 'bordercolor' => strtolower($smof_data['tagline_border_color']) . strtolower($evl_options['evl_shortcode_tagline_border_color']), 'button' => '', 'buttoncolor' => 'default', 'button_shape' => strtolower($smof_data['button_shape']), 'button_size' => strtolower($smof_data['button_size']), 'button_type' => strtolower($smof_data['button_type']), 'content_alignment' => 'left', 'description' => '', 'highlightposition' => 'left', 'link' => '', 'linktarget' => '_self', 'shadow' => 'no', 'shadowopacity' => '0.7', 'title' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $additional_content = '';
     $styles = "<style type='text/css'>.reading-box-container-{$this->tagline_box_counter} .element-bottomshadow:before,.reading-box-container-{$this->tagline_box_counter} .element-bottomshadow:after{opacity:{$shadowopacity};}</style>";
     if (isset($link) && $link && (isset($button) && $button) && self::$args['content_alignment'] != 'center') {
         self::$args['button_class'] = ' continue';
         $additional_content = sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('tagline-shortcode-button'), $button);
     }
     if (isset($title) && $title) {
         $additional_content .= sprintf('<h2>%s</h2>', $title);
     }
     if (isset($description) && $description) {
         $additional_content .= sprintf('<p>%s</p>', $description);
     }
     if (isset($link) && $link && (isset($button) && $button) && self::$args['content_alignment'] == 'center') {
         self::$args['button_class'] = ' continue';
         $additional_content .= sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('tagline-shortcode-button'), $button);
     }
     if (isset($link) && $link && (isset($button) && $button)) {
         self::$args['button_class'] = ' mobile-button';
         $additional_content .= sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('tagline-shortcode-button'), $button);
     }
     $html = sprintf('%s<div %s><section %s>%s%s</section></div>', $styles, T4PCore_Plugin::attributes('tagline-shortcode'), T4PCore_Plugin::attributes('tagline-shortcode-reading-box'), do_shortcode($content), $additional_content);
     $this->tagline_box_counter++;
     return $html;
 }
コード例 #2
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'bottom_margin' => '', 'icon' => '', 'sep_color' => $smof_data['sep_color'] . $evl_options['evl_shortcode_separator_color'], 'style_type' => 'none', 'top_margin' => '', 'width' => '', 'bottom' => '', 'color' => '', 'style' => '', 'top' => ''), $args);
     if ($defaults['style']) {
         $defaults['style_type'] = $defaults['style'];
     }
     extract($defaults);
     self::$args = $defaults;
     if ($bottom) {
         self::$args['bottom_margin'] = $bottom;
     }
     if ($color) {
         self::$args['sep_color'] = $color;
     }
     if ($top) {
         self::$args['top_margin'] = $top;
         if (!$bottom && $defaults['style'] != 'none') {
             self::$args['bottom_margin'] = $top;
         }
     }
     if ($icon && $style_type != 'none') {
         $icon_insert = sprintf('<span %s><i %s></i></span>', T4PCore_Plugin::attributes('separator-shortcode-icon-wrapper'), T4PCore_Plugin::attributes('separator-shortcode-icon'));
     } else {
         $icon_insert = '';
     }
     $html = sprintf('<div %s></div><div %s>%s</div>', T4PCore_Plugin::attributes('t4p-sep-clear'), T4PCore_Plugin::attributes('separator-shortcode'), $icon_insert);
     return $html;
 }
コード例 #3
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'animation' => false, 'delay' => 0, 'placement' => 'top', 'title' => 'none', 'trigger' => 'hover'), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<span %s>%s</span>', T4PCore_Plugin::attributes('tooltip-shortcode'), do_shortcode($content));
     return $html;
 }
コード例 #4
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = shortcode_atts(array('class' => '', 'name' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<div %s></div>', T4PCore_Plugin::attributes('menu-anchor-shortcode'));
     return $html;
 }
コード例 #5
0
 /**
  * Render the shortcode
  * 
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = shortcode_atts(array('class' => '', 'id' => '', 'circle' => 'yes', 'circlecolor' => '', 'circlebordercolor' => '', 'flip' => '', 'icon' => '', 'iconcolor' => '', 'rotate' => '', 'size' => 'large', 'spin' => 'no', 'animation_type' => '', 'animation_direction' => 'down', 'animation_speed' => '0.1'), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<i %s>%s</i>', T4PCore_Plugin::attributes('fontawesome-shortcode'), do_shortcode($content));
     return $html;
 }
コード例 #6
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = shortcode_atts(array('class' => 't4p-lightbox', 'id' => '', 'caption' => '', 'content_type' => 'image', 'lightbox_height' => '', 'lightbox_width' => '', 'src' => '', 'thumbnail' => '', 'title' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('lightbox-shortcode'), do_shortcode($content));
     return $html;
 }
コード例 #7
0
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = shortcode_atts(array('circle' => '', 'circlecolor' => '', 'icon' => '', 'iconcolor' => ''), $args);
     extract($defaults);
     self::$child_args = $defaults;
     $html = sprintf('<li %s><span %s><i %s></i></span><span %s>%s</span></li>', T4PCore_Plugin::attributes('checklist-shortcode-li-item'), T4PCore_Plugin::attributes('checklist-shortcode-span'), T4PCore_Plugin::attributes('checklist-shortcode-icon'), T4PCore_Plugin::attributes('t4p-li-item-content'), do_shortcode($content));
     $this->circle_class = 'circle-no';
     return $html;
 }
コード例 #8
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $woocommerce, $smof_data;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_slug' => '', 'number_posts' => 10, 'show_cats' => 'yes', 'show_price' => 'yes', 'show_buttons' => 'yes', 'picture_size' => 'fixed'), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = '';
     $buttons = '';
     if (class_exists('Woocommerce')) {
         $number_posts = (int) $number_posts;
         $args = array('post_type' => 'product', 'posts_per_page' => $number_posts, 'meta_query' => array(array('key' => '_thumbnail_id', 'compare' => '!=', 'value' => null)));
         if ($cat_slug) {
             $cat_id = explode(',', $cat_slug);
             $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cat_id));
         }
         $css_class = 'simple-products-slider';
         if ($picture_size != 'fixed') {
             $css_class = 'simple-products-slider-variable';
         }
         $products = new WP_Query($args);
         $products_wrapper = $product = '';
         if ($products->have_posts()) {
             while ($products->have_posts()) {
                 $products->the_post();
                 $image = $price_tag = $terms = '';
                 if (has_post_thumbnail()) {
                     if ($smof_data['image_rollover']) {
                         $image = get_the_post_thumbnail(get_the_ID(), 'shop_catalog');
                     } else {
                         $image = sprintf('<a href="%s">%s</a>', get_permalink(get_the_ID()), get_the_post_thumbnail(get_the_ID(), 'shop_catalog'));
                     }
                     if ($show_cats == 'yes') {
                         $terms = get_the_term_list(get_the_ID(), 'product_cat', sprintf('<span %s>', T4PCore_Plugin::attributes('cats')), ', ', '</span>');
                     }
                     ob_start();
                     woocommerce_get_template('loop/price.php');
                     $price = ob_get_contents();
                     ob_end_clean();
                     if ($price && $show_price == 'yes') {
                         $price_tag = $price;
                     }
                     if ($show_buttons == 'yes') {
                         ob_start();
                         woocommerce_get_template('loop/add-to-cart.php');
                         $cart_button = ob_get_contents();
                         ob_end_clean();
                         $buttons = sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('product-buttons'), $cart_button, get_permalink());
                     }
                     $product .= sprintf('<li><div %s aria-haspopup="true">%s<div %s><div %s><h3><a href="%s">%s</a></h3><br />%s%s%s</div></div></div></li>', T4PCore_Plugin::attributes('woo-product-slider-shortcode-img-div'), $image, T4PCore_Plugin::attributes('image-extras'), T4PCore_Plugin::attributes('image-extras-content'), get_permalink(), get_the_title(), $terms, $price_tag, $buttons);
                 }
             }
             $products_wrapper = sprintf('<ul>%s</ul>', $product);
         }
         $html = sprintf('<div %s><div %s><div %s><div %s>%s</div><div %s><span %s></span><span %s></span></div></div></div><div class="t4p-clearfix"></div></div>', T4PCore_Plugin::attributes('woo-product-slider-shortcode'), T4PCore_Plugin::attributes($css_class . ' simple-products-slider'), T4PCore_Plugin::attributes('es-carousel-wrapper t4p-carousel-large'), T4PCore_Plugin::attributes('es-carousel'), $products_wrapper, T4PCore_Plugin::attributes('es-nav'), T4PCore_Plugin::attributes('es-nav-prev'), T4PCore_Plugin::attributes('es-nav-next'));
     }
     return $html;
 }
コード例 #9
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'boxed' => '', 'boxed_radius' => '', 'color' => strtolower($smof_data['dropcap_color']) . strtolower($evl_options['evl_shortcode_dropcap_color'])), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<span %s>%s</span>', T4PCore_Plugin::attributes('dropcap-shortcode'), do_shortcode($content));
     return $html;
 }
コード例 #10
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'color' => $evl_options['evl_general_link'] . $smof_data['primary_color'], 'rounded' => 'no'), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<span %s>%s</span>', T4PCore_Plugin::attributes('highlight-shortcode'), do_shortcode($content));
     return $html;
 }
コード例 #11
0
 /**
  * Render the shortcode
  *
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = shortcode_atts(array('class' => '', 'id' => '', 'last' => 'no'), $args);
     extract($defaults);
     self::$args = $defaults;
     $clearfix = '';
     if (self::$args['last'] == 'yes') {
         $clearfix = sprintf('<div %s></div>', T4PCore_Plugin::attributes('t4p-clearfix'));
     }
     $html = sprintf('<div %s>%s</div>%s', T4PCore_Plugin::attributes('one-half-shortcode'), do_shortcode($content), $clearfix);
     return $html;
 }
コード例 #12
0
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('alt' => '', 'image' => '', 'link' => '', 'linktarget' => '_self'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     $output = sprintf('<img src="%s" alt="%s" />', $image, $alt);
     if ($link) {
         $output = sprintf('<a href="%s" target="%s">%s</a>', $link, $linktarget, $output);
     }
     $html = sprintf('<li><div %s>%s</div></li>', T4PCore_Plugin::attributes('image'), $output);
     return $html;
 }
コード例 #13
0
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('open' => 'no', 'title' => ''), $args);
     extract($defaults);
     self::$child_args = $defaults;
     self::$child_args['toggle_class'] = '';
     if ($open == 'yes') {
         self::$child_args['toggle_class'] = 'in';
     }
     $this->collaps_id = uniqid('collapse-');
     $html = sprintf('<div %s><div %s><h4 %s><a %s><i %s></i>%s</a></h4></div><div %s><div %s>%s</div></div></div>', T4PCore_Plugin::attributes('panel panel-default'), T4PCore_Plugin::attributes('panel-heading'), T4PCore_Plugin::attributes('panel-title toggle'), T4PCore_Plugin::attributes('toggle-shortcode-data-toggle'), T4PCore_Plugin::attributes('toggle-shortcode-fa-icon'), $title, T4PCore_Plugin::attributes('toggle-shortcode-collapse'), T4PCore_Plugin::attributes('panel-body toggle-content'), do_shortcode($content));
     return $html;
 }
コード例 #14
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'api_params' => '', 'autoplay' => "false", 'center' => 'no', 'height' => 360, 'id' => '', 'width' => 600), $args);
     extract($defaults);
     self::$args = $defaults;
     if ($autoplay == 'true' || $autoplay == 'yes') {
         $autoplay = '&amp;autoplay=1';
     } else {
         $autoplay = '';
     }
     $html = sprintf('<div %s><div %s><iframe title="YouTube video player" src="http://www.youtube.com/embed/%s?wmode=transparent%s%s" width="%s" height="%s" frameborder="0" allowfullscreen></iframe></div></div>', T4PCore_Plugin::attributes('youtube-shortcode'), T4PCore_Plugin::attributes('youtube-shortcode-video-sc'), $id, $autoplay, $api_params, $width, $height);
     return $html;
 }
コード例 #15
0
 /**
  * Render the parent shortcode
  * @param  array $args    Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => strtolower($smof_data['sharing_box_bg_color']) . strtolower($evl_options['evl_shortcode_sharing_box_bg_color']), 'description' => '', 'icon_colors' => strtolower($smof_data['sharing_social_links_icon_color']) . strtolower($evl_options['evl_sharing_box_icon_color']), 'box_colors' => strtolower($smof_data['sharing_social_links_box_color']) . strtolower($evl_options['evl_sharing_box_box_color']), 'icons_boxed' => strtolower($smof_data['sharing_social_links_boxed']) . strtolower($evl_options['evl_sharing_box_control_color']), 'icons_boxed_radius' => strtolower($smof_data['sharing_social_links_boxed_radius']) . strtolower($evl_options['evl_sharing_box_radius']), 'link' => '', 'pinterest_image' => '', 'social_networks' => $this->get_theme_options_settings(), 'tagline' => __('Share This', 't4p-core'), 'tagline_color' => strtolower($smof_data['sharing_box_tagline_text_color']) . strtolower($evl_options['evl_shortcode_sharing_box_tagline_text_color']), 'title' => '', 'tooltip_placement' => strtolower($smof_data['sharing_social_links_tooltip_placement']) . strtolower($evl_options['evl_sharing_box_tooltip_position'])), $args);
     extract($defaults);
     self::$args = $defaults;
     $social_networks = explode('|', $social_networks);
     $icon_colors = explode('|', $icon_colors);
     $num_of_icon_colors = count($icon_colors);
     $box_colors = explode('|', $box_colors);
     $num_of_box_colors = count($box_colors);
     $args['icons_boxed_radius'] = isset($args['icons_boxed_radius']) ? $args['icons_boxed_radius'] : '';
     $icons = '';
     if (isset($smof_data['social_sorter']) && $smof_data['social_sorter']) {
         $order = $smof_data['social_sorter'];
         $ordered_array = explode(',', $order);
         if (isset($ordered_array) && $ordered_array && is_array($ordered_array)) {
             foreach ($social_networks as $reorder_social_network) {
                 $social_networks_old[$reorder_social_network] = $reorder_social_network;
             }
             $social_networks = array();
             foreach ($ordered_array as $key => $field_order) {
                 $field_order_number = str_replace('social_sorter_', '', $field_order);
                 $find_the_field = $smof_data['social_sorter_' . $field_order_number];
                 $field_name = str_replace('_link', '', $smof_data['social_sorter_' . $field_order_number]);
                 if ($field_name == 'google') {
                     $field_name = 'googleplus';
                 } elseif ($field_name == 'email') {
                     $field_name = 'mail';
                 }
                 if (!isset($social_networks_old[$field_name])) {
                     continue;
                 }
                 $social_networks[] = $social_networks_old[$field_name];
             }
         }
     }
     for ($i = 0; $i < count($social_networks); $i++) {
         if ($num_of_icon_colors == 1) {
             $icon_colors[$i] = $icon_colors[0];
         }
         if ($num_of_box_colors == 1) {
             $box_colors[$i] = $box_colors[0];
         }
         $icon_options = array('social_network' => $social_networks[$i], 'icon_color' => $i < count($icon_colors) ? $icon_colors[$i] : '', 'box_color' => $i < count($box_colors) ? $box_colors[$i] : '');
         $icons .= sprintf('<span class="t4p-icon-holder"><a %s></a></span>', T4PCore_Plugin::attributes('sharingbox-shortcode-icon', $icon_options));
     }
     $html = sprintf('<style type="text/css">.t4p-sharing-box .t4p-icon-holder, .t4p-sharing-box .t4p-social-networks.boxed-icons a:after {border-radius:%s;}</style><div %s><h4 %s>%s</h4><div %s>%s</div></div>', $args['icons_boxed_radius'], T4PCore_Plugin::attributes('sharingbox-shortcode'), T4PCore_Plugin::attributes('sharingbox-shortcode-tagline'), $tagline, T4PCore_Plugin::attributes('sharingbox-shortcode-social-networks'), $icons);
     return $html;
 }
コード例 #16
0
ファイル: class-vimeo.php プロジェクト: berniecultess/infirev
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'api_params' => '', 'autoplay' => 'no', 'center' => 'no', 'height' => 360, 'id' => '', 'width' => 600), $args);
     extract($defaults);
     self::$args = $defaults;
     $protocol = is_ssl() ? 's' : '';
     if ($autoplay == 'true' || $autoplay == 'yes') {
         $autoplay = '?autoplay=1';
     } else {
         $autoplay = '?autoplay=0';
     }
     $html = sprintf('<div %s><div %s><iframe src="http%s://player.vimeo.com/video/%s%s%s" width="%s" height="%s" frameborder="0"></iframe></div></div>', T4PCore_Plugin::attributes('vimeo-shortcode'), T4PCore_Plugin::attributes('vimeo-shortcode-video-sc'), $protocol, $id, $autoplay, $api_params, $width, $height);
     return $html;
 }
コード例 #17
0
 /**
  * Render the shortcode
  * 
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundattachment' => 'scroll', 'backgroundcolor' => $smof_data['full_width_bg_color'] . $evl_options['evl_shortcode_full_width_bg_color'], 'backgroundimage' => '', 'backgroundposition' => 'left top', 'backgroundrepeat' => 'no-repeat', 'bordercolor' => $smof_data['full_width_border_color'] . $evl_options['evl_shortcode_full_width_border_color'], 'bordersize' => $smof_data['full_width_border_size'] . $evl_options['evl_shortcode_full_width_border_size'], 'borderstyle' => 'solid', 'menu_anchor' => '', 'paddingbottom' => '20px', 'paddingtop' => '20px', 'paddingBottom' => '', 'paddingTop' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $this->depracted_args();
     if ($defaults['menu_anchor']) {
         $html = sprintf('<div id="%s"><div %s><div %s>%s</div></div></div>', $defaults['menu_anchor'], T4PCore_Plugin::attributes('fullwidth-shortcode'), T4PCore_Plugin::attributes('t4p-row'), do_shortcode($content));
     } else {
         $html = sprintf('<div %s><div %s>%s</div></div>', T4PCore_Plugin::attributes('fullwidth-shortcode'), T4PCore_Plugin::attributes('t4p-row'), do_shortcode($content));
     }
     return $html;
 }
コード例 #18
0
ファイル: class-alert.php プロジェクト: berniecultess/infirev
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'accent_color' => '', 'background_color' => '', 'border_size' => '', 'box_shadow' => 'no', 'icon' => '', 'type' => 'general', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     switch ($args['type']) {
         case 'general':
             $this->alert_class = 'info';
             if (!$icon || $icon != 'none') {
                 self::$args['icon'] = $icon = 'fa-info-circle';
             }
             break;
         case 'error':
             $this->alert_class = 'danger';
             if (!$icon || $icon != 'none') {
                 self::$args['icon'] = $icon = 'fa-exclamation-triangle';
             }
             break;
         case 'success':
             $this->alert_class = 'success';
             if (!$icon || $icon != 'none') {
                 self::$args['icon'] = $icon = 'fa-check-circle';
             }
             break;
         case 'notice':
             $this->alert_class = 'warning';
             if (!$icon || $icon != 'none') {
                 self::$args['icon'] = $icon = 'fa-lg fa-cog';
             }
             break;
         case 'blank':
             $this->alert_class = 'blank';
             break;
         case 'custom':
             $this->alert_class = 'custom';
             break;
     }
     $html = sprintf('<div %s>', T4PCore_Plugin::attributes('alert-shortcode')) . "\n";
     $html .= sprintf('  <button %s>&times;</button>', T4PCore_Plugin::attributes('alert-shortcode-button')) . "\n";
     if ($icon && $icon != 'none') {
         $html .= sprintf('<span %s><i %s></i></span>', T4PCore_Plugin::attributes('alert-icon'), T4PCore_Plugin::attributes('alert-shortcode-icon'));
     }
     $html .= do_shortcode($content);
     $html .= '</div>' . "\n";
     return $html;
 }
コード例 #19
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $sc_content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'animation' => false, 'content' => '', 'content_bg_color' => $smof_data['popover_content_bg_color'] . $evl_options['evl_shortcode_popover_content_bg_color'], 'delay' => '', 'placement' => strtolower($smof_data['popover_placement']) . strtolower($evl_options['evl_shortcode_popover_position']), 'title' => '', 'title_bg_color' => $smof_data['popover_heading_bg_color'] . $evl_options['evl_shortcode_popover_heading_bg_color'], 'bordercolor' => $smof_data['popover_border_color'] . $evl_options['evl_shortcode_popover_border_color'], 'textcolor' => $smof_data['popover_text_color'] . $evl_options['evl_shortcode_popover_text_color'], 'trigger' => 'click'), $args);
     extract($defaults);
     self::$args = $defaults;
     if ($placement == 'bottom') {
         $arrow_color = $title_bg_color;
     } else {
         $arrow_color = $content_bg_color;
     }
     $styles = sprintf('<style>.popover-%s.%s .arrow{border-%s-color:%s;}.popover-%s{border-color:%s;}.popover{background-color:%s;}.popover-%s .popover-title{background-color:%s;color:%s;border-color:%s;}.popover-%s .popover-content{background-color:%s;color:%s;}.popover-%s.%s .arrow:after{border-%s-color:%s;}</style>', $this->popover_counter, $placement, $placement, $bordercolor, $this->popover_counter, $bordercolor, $bordercolor, $this->popover_counter, $title_bg_color, $textcolor, $bordercolor, $this->popover_counter, $content_bg_color, $textcolor, $this->popover_counter, $placement, $placement, $arrow_color);
     $html = sprintf('<span %s>%s%s</span>', T4PCore_Plugin::attributes('popover-shortcode'), $styles, do_shortcode($sc_content));
     $this->popover_counter++;
     return $html;
 }
コード例 #20
0
ファイル: class-title.php プロジェクト: berniecultess/infirev
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'content_align' => 'left', 'sep_color' => '', 'size' => 1, 'style_type' => 'double'), $args);
     extract($defaults);
     self::$args = $defaults;
     if (!$style_type) {
         self::$args['style_type'] = $style_type = 'double';
     }
     if (strpos($style_type, 'underline') === false) {
         if (self::$args['content_align'] == 'right') {
             $html = sprintf('<div %s><div %s><div %s></div></div><h%s %s>%s</h%s></div>', T4PCore_Plugin::attributes('title-shortcode'), T4PCore_Plugin::attributes('title-sep-container'), T4PCore_Plugin::attributes('title-shortcode-sep'), $size, T4PCore_Plugin::attributes('title-shortcode-heading'), do_shortcode($content), $size);
         } else {
             $html = sprintf('<div %s><h%s %s>%s</h%s><div %s><div %s></div></div></div>', T4PCore_Plugin::attributes('title-shortcode'), $size, T4PCore_Plugin::attributes('title-shortcode-heading'), do_shortcode($content), $size, T4PCore_Plugin::attributes('title-sep-container'), T4PCore_Plugin::attributes('title-shortcode-sep'));
         }
     } else {
         $html = sprintf('<div %s><h%s %s>%s</h%s></div>', T4PCore_Plugin::attributes('title-shortcode'), $size, T4PCore_Plugin::attributes('title-shortcode-heading'), do_shortcode($content), $size);
     }
     return $html;
 }
コード例 #21
0
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('alt' => '', 'image' => '', 'link' => '', 'linktarget' => '_self'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     $image_id = T4PCore_Plugin::get_attachment_id_from_url($image);
     if (!$alt && empty($alt) && $image_id) {
         self::$child_args['alt'] = $alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
     }
     if ($image_id) {
         self::$child_args['title_attr'] = get_post_field('post_excerpt', $image_id);
     }
     $output = sprintf('<img src="%s" alt="%s" />', $image, $alt);
     if ($link || self::$parent_args['lightbox'] == 'yes') {
         $output = sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('image-carousel-shortcode-slide-link'), $output);
     }
     $html = sprintf('<li><div %s>%s</div></li>', T4PCore_Plugin::attributes('image'), $output);
     return $html;
 }
コード例 #22
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'animated_stripes' => 'no', 'filledcolor' => '', 'percentage' => '70', 'striped' => 'no', 'textcolor' => '', 'unfilledcolor' => '', 'unit' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     if (!$filledcolor) {
         self::$args['filledcolor'] = $evl_options['evl_shortcode_progress_filled_color'] . $smof_data['progressbar_filled_color'];
     }
     if (!$textcolor) {
         self::$args['textcolor'] = $evl_options['evl_shortcode_progress_text_color'] . $smof_data['progressbar_text_color'];
     }
     if (!$unfilledcolor) {
         self::$args['unfilledcolor'] = $evl_options['evl_shortcode_progress_unfilled_color'] . $smof_data['progressbar_unfilled_color'];
     }
     $html = sprintf('<div %s><div %s></div><span %s>%s %s%s</div>', T4PCore_Plugin::attributes('progressbar-shortcode'), T4PCore_Plugin::attributes('progressbar-shortcode-content'), T4PCore_Plugin::attributes('progressbar-shortcode-span'), $content, $percentage, $unit);
     return $html;
 }
コード例 #23
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => 't4p-soundcloud', 'id' => '', 'auto_play' => 'true', 'color' => 'ff7700', 'comments' => 'true', 'height' => 81, 'url' => '', 'width' => '100%'), $args);
     extract($defaults);
     self::$args = $defaults;
     if ($comments == 'yes') {
         $comments = 'true';
     } elseif ($comments == 'no') {
         $comments = 'false';
     }
     if ($auto_play == 'yes') {
         $autoplay = 'true';
     } else {
         $autoplay = 'false';
     }
     if ($color) {
         $color = str_replace('#', '', $color);
     }
     $html = sprintf('<div %s><iframe width="%s" height="%s" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=%s&amp;show_comments=%s&amp;auto_play=%s&amp;color=%s"></iframe></div>', T4PCore_Plugin::attributes('soundcloud-shortcode'), $width, $height, $url, $comments, $autoplay, $color);
     return $html;
 }
コード例 #24
0
 /**
  * Render the child shortcode
  * 
  * @param  array  $args     Shortcode paramters
  * @param  string $content  Content between shortcode
  * @return string           HTML output
  */
 function render_child($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'countdown' => 'no', 'filledcolor' => strtolower($smof_data['counter_filled_color']) . strtolower($evl_options['evl_shortcode_counter_circle_filled_color']), 'unfilledcolor' => strtolower($smof_data['counter_unfilled_color']) . strtolower($evl_options['evl_shortcode_counter_circle_unfilled_color']), 'scales' => 'no', 'size' => '220', 'speed' => '1500', 'value' => '1'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     if ($scales == 'yes') {
         self::$child_args['scales'] = true;
     } else {
         self::$child_args['scales'] = false;
     }
     if ($countdown == 'yes') {
         self::$child_args['countdown'] = true;
     } else {
         self::$child_args['countdown'] = false;
     }
     $output = sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('counter-circle-shortcode'), do_shortcode($content));
     $html = sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('counter-circle-wrapper-shortcode'), $output);
     return $html;
 }
コード例 #25
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => $smof_data['section_sep_bg'] . $evl_options['evl_shortcode_section_separator_bg_color_candy'], 'bordersize' => $smof_data['section_sep_border_size'] . $evl_options['evl_shortcode_section_separator_border_size'], 'bordercolor' => $smof_data['section_sep_border_color'] . $evl_options['evl_shortcode_section_separator_border_color'], 'divider_candy' => '', 'icon' => '', 'icon_color' => $smof_data['icon_color'] . $evl_options['evl_shortcode_icon_color']), $args);
     extract($defaults);
     self::$args = $defaults;
     if ($icon) {
         if (!$icon_color) {
             self::$args['icon_color'] = $bordercolor;
         }
         $icon = sprintf('<div %s></div>', T4PCore_Plugin::attributes('section-separator-shortcode-icon'));
     }
     if ($divider_candy == 'bottom') {
         $candy = sprintf('<div %s></div>', T4PCore_Plugin::attributes('section-separator-shortcode-divider-candy', array('divider_candy' => 'bottom')));
     } elseif ($divider_candy == 'top') {
         $candy = sprintf('<div %s></div>', T4PCore_Plugin::attributes('section-separator-shortcode-divider-candy', array('divider_candy' => 'top')));
     } elseif (strpos($divider_candy, 'top') !== false && strpos($divider_candy, 'bottom') !== false) {
         $candy = sprintf('<div %s></div><div %s></div>', T4PCore_Plugin::attributes('section-separator-shortcode-divider-candy', array('divider_candy' => 'top')), T4PCore_Plugin::attributes('section-separator-shortcode-divider-candy', array('divider_candy' => 'bottom')));
     }
     $html = sprintf('<div %s>%s%s</div>', T4PCore_Plugin::attributes('section-separator-shortcode'), $icon, $candy);
     return $html;
 }
コード例 #26
0
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = shortcode_atts(array('lightbox' => 'no', 'link' => NULL, 'linktarget' => '_self', 'type' => 'image'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     self::$child_args['alt'] = '';
     self::$child_args['title'] = '';
     self::$child_args['src'] = $src = str_replace('&#215;', 'x', $content);
     if ($lightbox == 'yes' && $type == 'image') {
         if (!empty($link) && $link) {
             $image_id = T4PCore_Plugin::get_attachment_id_from_url($link);
         } else {
             $image_id = T4PCore_Plugin::get_attachment_id_from_url($src);
         }
         if ($image_id) {
             self::$child_args['alt'] = get_post_meta($image_id, '_wp_attachment_image_alt', true);
             self::$child_args['title'] = get_post_field("post_excerpt", $image_id);
         }
     }
     if (isset($link) && empty($link) && !$link && $type == 'image') {
         self::$child_args['link'] = $link = $src;
     }
     $html = sprintf('<li %s>', T4PCore_Plugin::attributes('slider-shortcode-slide-li'));
     if (!empty($link) && $link) {
         $html .= sprintf('<a %s>', T4PCore_Plugin::attributes('slider-shortcode-slide-link'));
     }
     if (!empty($type) && $type == 'video') {
         $html .= sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('full-video'), do_shortcode($content));
     } else {
         $html .= sprintf('<img %s />', T4PCore_Plugin::attributes('slider-shortcode-slide-img'));
     }
     if (!empty($link) && $link) {
         $html .= '</a>';
     }
     $html .= '</li>';
     return $html;
 }
コード例 #27
0
ファイル: class-modal.php プロジェクト: berniecultess/infirev
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'name' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('modal-text-link-shortcode'), do_shortcode($content));
     return $html;
 }
コード例 #28
0
 function get_image_extras($id)
 {
     $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'full');
     if (get_post_meta($id, 'pyre_video_url', true)) {
         $full_image[0] = get_post_meta($id, 'pyre_video_url', true);
     }
     $terms = '';
     if (self::$args['layout'] != 'carousel') {
         $terms = sprintf('<br /><h4>%s</h4>', get_the_term_list(get_the_ID(), 'portfolio_category', '', '<span class="rw-comma">,</span> ', ''));
     }
     $image_extras = sprintf('<div %s><div %s><a %s></a><a %s></a><br /><h3 %s><a %s>%s</a></h3>%s</div></div>', T4PCore_Plugin::attributes('image-extras'), T4PCore_Plugin::attributes('image-extras-content recent-works-shortcode'), T4PCore_Plugin::attributes('recentworks-shortcode-img-link-icon'), T4PCore_Plugin::attributes('recentworks-shortcode-img-zoom-icon', array('href' => $full_image[0])), T4PCore_Plugin::attributes('entry-title'), T4PCore_Plugin::attributes('recentworks-shortcode-img-h3-link'), get_the_title($id), $terms);
     return $image_extras;
 }
コード例 #29
0
 /**
  * Render the parent shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_id' => '', 'cat_slug' => '', 'columns' => 3, 'excerpt' => 'no', 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'layout' => 'default', 'meta' => 'yes', 'number_posts' => 4, 'strip_html' => 'yes', 'title' => 'yes', 'thumbnail' => 'yes', 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $defaults['strip_html'] == 'yes' ? $defaults['strip_html'] = true : ($defaults['strip_html'] = false);
     if ($defaults['number_posts']) {
         $defaults['posts_per_page'] = $defaults['number_posts'];
     }
     if ($defaults['excerpt_length'] || $defaults['excerpt_length'] === '0') {
         $defaults['excerpt_words'] = $defaults['excerpt_length'];
     }
     //check for cats to exclude; needs to be checked via exclude_cats param and '-' prefixed cats on cats param
     //exclution via exclude_cats param
     $cats_to_exclude = explode(',', $defaults['exclude_cats']);
     if ($cats_to_exclude) {
         foreach ($cats_to_exclude as $cat_to_exclude) {
             $idObj = get_category_by_slug($cat_to_exclude);
             if ($idObj) {
                 $cats_id_to_exclude[] = $idObj->term_id;
             }
         }
         if (isset($cats_id_to_exclude) && $cats_id_to_exclude) {
             $defaults['category__not_in'] = $cats_id_to_exclude;
         }
     }
     //setting up cats to be used and exclution using '-' prefix on cats param; transform slugs to ids
     $cat_ids = '';
     $categories = explode(',', $defaults['cat_slug']);
     if (isset($categories) && $categories) {
         foreach ($categories as $category) {
             if ($category) {
                 if (strpos($category, '-') === 0) {
                     $cat_ids .= '-' . get_category_by_slug($category)->cat_ID . ',';
                 } else {
                     $cat_ids .= get_category_by_slug($category)->cat_ID . ',';
                 }
             }
         }
     }
     $defaults['cat'] = substr($cat_ids, 0, -1);
     $defaults['cat'] .= $defaults['cat_id'];
     $items = '';
     $args = array('posts_per_page' => $defaults['number_posts'], 'ignore_sticky_posts' => 1, 'has_password' => false);
     if ($defaults['cat']) {
         $args['cat'] = $defaults['cat'];
     }
     $recent_posts = new WP_Query($args);
     $count = 1;
     while ($recent_posts->have_posts()) {
         $recent_posts->the_post();
         $attachment = $date_box = $slideshow = $slides = $content = '';
         if ($layout == 'icon-on-side') {
             switch (get_post_format()) {
                 case 'gallery':
                     $format_class = 'camera-retro';
                     break;
                 case 'link':
                     $format_class = 'link';
                     break;
                 case 'image':
                     $format_class = 'picture-o';
                     break;
                 case 'quote':
                     $format_class = 'quote-left';
                     break;
                 case 'video':
                     $format_class = 'youtube-play';
                     break;
                 case 'audio':
                     $format_class = 'headphones';
                     break;
                 case 'chat':
                     $format_class = 'comments-o';
                     break;
                 default:
                     $format_class = 'pencil';
                     break;
             }
             $date_box = sprintf('<div %s><div %s><i %s></i></div></div>', T4PCore_Plugin::attributes('date-and-formats'), T4PCore_Plugin::attributes('format-box'), T4PCore_Plugin::attributes('t4p-icon-' . $format_class));
         }
         if ($thumbnail == 'yes' && $layout != 'icon-on-side') {
             if ($layout == 'default') {
                 $image_size = 'recent-posts';
             } elseif ($layout == 'thumbnails-on-side') {
                 $image_size = 'portfolio-two';
             }
             if ($smof_data['legacy_posts_slideshow']) {
                 $args = array('exclude' => get_post_thumbnail_id(), 'numberposts' => $smof_data['posts_slideshow_number'] - 1, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => null, 'post_type' => 'attachment');
                 $attachments = get_posts($args);
                 if ($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
                     if (get_post_meta(get_the_ID(), 'pyre_video', true)) {
                         $slides .= sprintf('<li><div %s>%s</div></li>', T4PCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true));
                     }
                     if (has_post_thumbnail()) {
                         $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size);
                         $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                         $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
                         $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), T4PCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => get_the_title())));
                     }
                     if ($smof_data['posts_slideshow']) {
                         foreach ($attachments as $attachment) {
                             $attachment_image = wp_get_attachment_image_src($attachment->ID, $image_size);
                             $full_image = wp_get_attachment_image_src($attachment->ID, 'full');
                             $attachment_data = wp_get_attachment_metadata($attachment->ID);
                             $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), T4PCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title)));
                         }
                     }
                     $slideshow = sprintf('<div %s><ul %s>%s</ul></div>', T4PCore_Plugin::attributes('recentposts-shortcode-slideshow'), T4PCore_Plugin::attributes('slides'), $slides);
                 }
             } else {
                 if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
                     if (get_post_meta(get_the_ID(), 'pyre_video', true)) {
                         $slides .= sprintf('<li><div %s>%s</div></li>', T4PCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true));
                     }
                     if (has_post_thumbnail()) {
                         $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size);
                         $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                         $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
                         $attachment = get_post(get_post_thumbnail_id());
                         $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), T4PCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title)));
                     }
                     if ($smof_data['posts_slideshow']) {
                         $i = 2;
                         while ($i <= $smof_data['posts_slideshow_number']) {
                             $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post');
                             if ($attachment_new_id) {
                                 $attachment_image = wp_get_attachment_image_src($attachment_new_id, $image_size);
                                 $full_image = wp_get_attachment_image_src($attachment_new_id, 'full');
                                 $attachment_data = wp_get_attachment_metadata($attachment_new_id);
                                 $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), T4PCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => '')));
                             }
                             $i++;
                         }
                     }
                     $slideshow = sprintf('<div %s><ul %s>%s</ul></div>', T4PCore_Plugin::attributes('recentposts-shortcode-slideshow'), T4PCore_Plugin::attributes('slides'), $slides);
                 }
             }
         }
         if ($title == 'yes') {
             $content .= sprintf('<h3><a href="%s">%s</a></h3>', get_permalink(get_the_ID()), get_the_title());
         }
         if ($meta == 'yes') {
             $comments = '';
             if (get_comments_number(get_the_ID()) >= 1) {
                 $comments = sprintf('<span %s>|</span><a href="%s">%s %s</a></span>', T4PCore_Plugin::attributes('meta-separator'), get_permalink(get_the_ID()), get_comments_number(get_the_ID()), __('Comments', 't4p-core'));
             }
             $content .= sprintf('<p %s><span><time %s>%s</time></span>%s</p>', T4PCore_Plugin::attributes('meta'), T4PCore_Plugin::attributes('date'), get_the_time($smof_data['date_format'], get_the_ID()), $comments);
         }
         if ($excerpt == 'yes') {
             $content .= t4p_content($excerpt_words, $strip_html);
         }
         $items .= sprintf('<article %s>%s%s<div %s>%s</div></article>', T4PCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, T4PCore_Plugin::attributes('recent-posts-content'), $content);
         $count++;
     }
     $html = sprintf('<div %s><section %s><div %s>%s</div></section></div>', T4PCore_Plugin::attributes('recentposts-shortcode'), T4PCore_Plugin::attributes('recentposts-shortcode-section'), T4PCore_Plugin::attributes('row holder'), $items);
     wp_reset_query();
     return $html;
 }
コード例 #30
0
    /**
     * Render the shortcode
     * @param  array $args     Shortcode paramters
     * @param  string $content Content between shortcode
     * @return string          HTML output
     */
    function render($args, $content = '')
    {
        global $smof_data;
        $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'animation' => 'no', 'address' => '', 'height' => '300px', 'icon' => '', 'infobox' => '', 'infobox_background_color' => '', 'infobox_content' => '', 'infobox_text_color' => '', 'map_style' => '', 'overlay_color' => '', 'popup' => 'yes', 'scale' => 'yes', 'scrollwheel' => 'yes', 'type' => 'roadmap', 'width' => '100%', 'zoom' => '14', 'zoom_pancontrol' => 'yes'), $args);
        extract($defaults);
        self::$args = $defaults;
        $html = '';
        if ($address) {
            $addresses = explode('|', $address);
            if ($infobox_content) {
                $infobox_content_array = explode('|', $infobox_content);
            } else {
                $infobox_content_array = '';
            }
            if ($icon) {
                $icon_array = explode('|', $icon);
            } else {
                $icon_array = '';
            }
            if ($addresses) {
                self::$args['address'] = $addresses;
            }
            $num_of_addresses = count($addresses);
            if (is_array($infobox_content_array) && !empty($infobox_content_array)) {
                for ($i = 0; $i < $num_of_addresses; $i++) {
                    if (!$infobox_content_array[$i]) {
                        $infobox_content_array[$i] = $addresses[$i];
                    }
                }
                self::$args['infobox_content'] = $infobox_content_array;
            } else {
                self::$args['infobox_content'] = self::$args['address'];
            }
            if ($icon && strpos($icon, '|') === false) {
                for ($i = 0; $i < $num_of_addresses; $i++) {
                    $icon_array[$i] = $icon;
                }
            }
            if ($map_style == 'theme') {
                $map_style = 'custom';
                $icon = 'theme';
                $animation = 'yes';
                $infobox = 'custom';
                $infobox_background_color = T4PCore_Plugin::hex2rgb($smof_data['primary_color']);
                $infobox_background_color = 'rgba(' . $infobox_background_color[0] . ', ' . $infobox_background_color[1] . ', ' . $infobox_background_color[2] . ', 0.8)';
                $overlay_color = $smof_data['primary_color'];
                $brightness_level = T4PCore_Plugin::calc_color_brightness($smof_data['primary_color']);
                if ($brightness_level > 140) {
                    $infobox_text_color = '#fff';
                } else {
                    $infobox_text_color = '#747474';
                }
            }
            if ($icon == 'theme' && $map_style == 'custom') {
                for ($i = 0; $i < $num_of_addresses; $i++) {
                    $icon_array[$i] = plugins_url('images/t4p_map_marker.png', dirname(__FILE__));
                }
            }
            wp_print_scripts('google-maps-api');
            wp_print_scripts('google-maps-infobox');
            foreach (self::$args['address'] as $add) {
                $coordinates[] = $this->get_coordinates($add);
            }
            if (!is_array($coordinates)) {
                return;
            }
            $map_id = uniqid('t4p_map_');
            // generate a unique ID for this map
            $this->map_id = $map_id;
            ob_start();
            ?>
			<script type="text/javascript">
				var map_<?php 
            echo $map_id;
            ?>
;
				var markers = [];
				var counter = 0;
				function t4p_run_map_<?php 
            echo $map_id;
            ?>
() {
					var location = new google.maps.LatLng(<?php 
            echo $coordinates[0]['lat'];
            ?>
, <?php 
            echo $coordinates[0]['lng'];
            ?>
);
					var map_options = {
						zoom: <?php 
            echo $zoom;
            ?>
,
						center: location,
						mapTypeId: google.maps.MapTypeId.<?php 
            echo strtoupper($type);
            ?>
,
						scrollwheel: <?php 
            echo $scrollwheel == 'yes' ? 'true' : 'false';
            ?>
,
						scaleControl: <?php 
            echo $scale == 'yes' ? 'true' : 'false';
            ?>
,
						panControl: <?php 
            echo $zoom_pancontrol == 'yes' ? 'true' : 'false';
            ?>
,
						zoomControl: <?php 
            echo $zoom_pancontrol == 'yes' ? 'true' : 'false';
            ?>
						
					};
					map_<?php 
            echo $map_id;
            ?>
 = new google.maps.Map(document.getElementById("<?php 
            echo esc_attr($map_id);
            ?>
"), map_options);
					<?php 
            $i = 0;
            ?>
					<?php 
            foreach ($coordinates as $key => $coordinate) {
                ?>
					
					var content_string = "<div class='info-window'><?php 
                echo self::$args['infobox_content'][$key];
                ?>
</div>";
					
					<?php 
                if ($overlay_color && $map_style == 'custom') {
                    ?>
					var styles = [
					  {
						stylers: [
						  { hue: '<?php 
                    echo $overlay_color;
                    ?>
' },
						  { saturation: -20 }
						]
					  },{
						featureType: "road",
						elementType: "geometry",
						stylers: [
						  { lightness: 100 },
						  { visibility: "simplified" }
						]
					  },{
						featureType: "road",
						elementType: "labels",
					  }
					];

					map_<?php 
                    echo $map_id;
                    ?>
.setOptions({styles: styles});
					
					<?php 
                }
                ?>

					map_<?php 
                echo $map_id;
                ?>
_args = {
						position: new google.maps.LatLng("<?php 
                echo $coordinate['lat'];
                ?>
", "<?php 
                echo $coordinate['lng'];
                ?>
"),
						map: map_<?php 
                echo $map_id;
                ?>
					};

					<?php 
                if ($animation == 'yes' && $map_style == 'custom') {
                    ?>
					map_<?php 
                    echo $map_id;
                    ?>
_args.animation = google.maps.Animation.DROP;
					<?php 
                }
                ?>
					<?php 
                if ($icon == 'theme' && isset($icon_array[$i]) && $icon_array[$i] && $map_style == 'custom') {
                    ?>
					map_<?php 
                    echo $map_id;
                    ?>
_args.icon = new google.maps.MarkerImage( '<?php 
                    echo $icon_array[$i];
                    ?>
', null, null, null, new google.maps.Size( 37, 55 ) );
					<?php 
                } else {
                    if (isset($icon_array[$i]) && $icon_array[$i] && $map_style == 'custom') {
                        ?>
					map_<?php 
                        echo $map_id;
                        ?>
_args.icon = '<?php 
                        echo $icon_array[$i];
                        ?>
';
					<?php 
                    }
                }
                ?>
					<?php 
                $i++;
                ?>

					markers[counter] = new google.maps.Marker(map_<?php 
                echo $map_id;
                ?>
_args);
					
					<?php 
                if ($infobox == 'custom' && $map_style == 'custom') {
                    ?>
					
						var info_box_div = document.createElement('div');
						info_box_div.className = 't4p-info-box';
						info_box_div.style.cssText = 'background-color:<?php 
                    echo $infobox_background_color;
                    ?>
;color:<?php 
                    echo $infobox_text_color;
                    ?>
;';

						info_box_div.innerHTML = content_string;

						var info_box_options = {
							 content: info_box_div
							,disableAutoPan: false
							,maxWidth: 150
							,pixelOffset: new google.maps.Size(-125, 10)
							,zIndex: null
							,boxStyle: { 
							  background: 'none'
							  ,opacity: 1
							  ,width: "250px"
							 }
							,closeBoxMargin: "2px 2px 2px 2px"
							,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
							,infoBoxClearance: new google.maps.Size(1, 1)

						};

						markers[counter]['infowindow'] = new InfoBox(info_box_options);
						markers[counter]['infowindow'].open(map_<?php 
                    echo $map_id;
                    ?>
, markers[counter]);
						<?php 
                    if ($popup != 'yes') {
                        ?>
							markers[counter]['infowindow'].setVisible( false );
						<?php 
                    }
                    ?>
						google.maps.event.addListener(markers[counter], 'click', function() {
							if( this['infowindow'].getVisible() ) {
								this['infowindow'].setVisible( false );
							} else {
								this['infowindow'].setVisible( true );
							}
						}); 					
						
					<?php 
                } else {
                    ?>
					
						markers[counter]['infowindow'] = new google.maps.InfoWindow({
							content: content_string
						});					
						
						<?php 
                    if ($popup == 'yes') {
                        ?>
							markers[counter]['infowindow'].show = true;
							markers[counter]['infowindow'].open(map_<?php 
                        echo $map_id;
                        ?>
, markers[counter]);
						<?php 
                    }
                    ?>
						

						google.maps.event.addListener(markers[counter], 'click', function() {
							if(this['infowindow'].show) {
								this['infowindow'].close(map_<?php 
                    echo $map_id;
                    ?>
, this);
								this['infowindow'].show = false;
							} else {
								this['infowindow'].open(map_<?php 
                    echo $map_id;
                    ?>
, this);
								this['infowindow'].show = true;
							}
						});
					
					<?php 
                }
                ?>
					
					counter++;
					<?php 
            }
            ?>

				}

				google.maps.event.addDomListener(window, 'load', t4p_run_map_<?php 
            echo $map_id;
            ?>
);

			</script>
			<?php 
            if ($defaults['id']) {
                $html = ob_get_clean() . sprintf('<div id="%s"><div %s></div></div>', $defaults['id'], T4PCore_Plugin::attributes('google-map-shortcode'));
            } else {
                $html = ob_get_clean() . sprintf('<div %s></div>', T4PCore_Plugin::attributes('google-map-shortcode'));
            }
        }
        return $html;
    }