예제 #1
4
 public function like_box_ifreame_content_generator($atts)
 {
     self::$id_for_content++;
     $atts = shortcode_atts(array('profile_id' => '', 'animation_efect' => 'none', 'background_color' => '', 'theme_color' => 'light', 'border_color' => '#FFFFF', 'show_border' => 'yes', 'stream' => '0', 'connections' => '6', 'width' => '300', 'height' => '550', 'header' => '0', 'locale' => 'en_US'), $atts, 'wpdevart_like_box');
     $output = '<iframe id="like_box_content_' . self::$id_for_content . '" src="http://www.facebook.com/plugins/fan.php?id=' . $atts['profile_id'] . '&amp;width=' . $atts['width'] . '&amp;colorscheme=' . $atts['theme_color'] . '&amp;height=' . $atts['height'] . '&amp;connections=' . $atts['connections'] . '&amp;stream=' . $atts['stream'] . '&amp;header=' . $atts['header'] . '&amp;locale=' . $atts['locale'] . '&amp;show_border=' . ($atts['show_border'] == 'yes' ? 'true' : 'false') . '" scrolling="no" frameborder="0" allowTransparency="true" style="' . ($atts['show_border'] == 'yes' ? 'border:1px solid ' . $atts['border_color'] . ';' : 'border:none') . ' overflow:hidden;visibility:hidden; max-width:100%; width:' . $atts['width'] . 'px; height:' . $atts['height'] . 'px;background-color:' . $atts['background_color'] . ';"></iframe>';
     $output .= '<script>jQuery(document).ready(function(){like_box_animated_element("' . like_box_setting::get_animations_type_array($atts['animation_efect']) . '","like_box_content_' . self::$id_for_content . '"); jQuery(window).scroll(function(){like_box_animated_element("' . like_box_setting::get_animations_type_array($atts['animation_efect']) . '","like_box_content_' . self::$id_for_content . '");})});</script>';
     return $output;
 }
예제 #2
0
    public static function generete_iframe_by_array($params)
    {
        self::$id_for_iframe++;
        $output_code = '';
        //default parametrs for iframe
        $defaults = array('iframe_id' => 'facbook_like_box_' . self::$id_for_iframe, 'profile_id' => '', 'width' => '300', 'height' => '550', 'show_border' => 'show', 'border_color' => '#FFFFF', 'header' => 'small', 'show_cover_photo' => 'true', 'connections' => 'show', 'stream' => '0', 'animation_efect' => 'none', 'locale' => 'en_US');
        $params = array_merge($defaults, $params);
        $params['width'] = max((int) $params['width'], 180);
        $params['width'] = min((int) $params['width'], 500);
        if ($params['header'] == 'small' || $params['header'] == '0' || $params['header'] == 'no') {
            $params['header'] = 'true';
        } else {
            $params['header'] = 'false';
        }
        if ((int) $params['connections'] > 0 || $params['connections'] == "show") {
            $params['connections'] = 'true';
        } else {
            $params['connections'] = 'false';
        }
        if ($params['stream'] == '0' || $params['stream'] == 'hide') {
            $params['stream'] = 'false';
        } else {
            $params['stream'] = 'true';
        }
        if ($params['show_cover_photo'] == 'true' || $params['show_cover_photo'] == 'show') {
            $params['show_cover_photo'] = 'false';
        } else {
            $params['show_cover_photo'] = 'true';
        }
        $like_box_array_query = array('adapt_container_width' => 'true', 'container_width' => $params['width'], 'width' => $params['width'], 'height' => $params['height'], 'hide_cover' => $params['show_cover_photo'], 'href' => urlencode("https://www.facebook.com/" . $params['profile_id']), 'locale' => $params['locale'], 'sdk' => 'joey', 'show_facepile' => $params['connections'], 'show_posts' => $params['stream'], 'small_header' => $params['header']);
        $like_box_src = add_query_arg($like_box_array_query, 'http://www.facebook.com/v2.4/plugins/page.php');
        $output_code .= '<iframe id="' . $params['iframe_id'] . '" src="' . $like_box_src . '" scrolling="no" allowTransparency="true" style="' . ($params['show_border'] == 'yes' || $params['show_border'] == 'show' ? 'border:1px solid ' . $params['border_color'] . ';' : 'border:none') . ' overflow:hidden;visibility:hidden; max-width:500px; width:' . $params['width'] . 'px; height:' . $params['height'] . 'px;"></iframe>';
        $output_code .= '<script>
		if(typeof(jQuery)=="undefined")
			jQuery=window.parent.jQuery;
		if(typeof(like_box_animated_element)=="undefined")
			like_box_animated_element=window.parent.like_box_animated_element;
		if(typeof(like_box_set_width_cur_element)=="undefined")
			like_box_set_width_cur_element=window.parent.like_box_animated_element;		
		jQuery(document).ready(function(){';
        if ($params['animation_efect'] != 'none') {
            $output_code .= '
				like_box_animated_element("' . like_box_setting::get_animations_type_array($params['animation_efect']) . '","' . $params['iframe_id'] . '");
				like_box_set_width_cur_element("' . $params['iframe_id'] . '",' . $params['width'] . ')
				jQuery(window).scroll(function(){
					like_box_animated_element("' . self::get_animations_type_array($params['animation_efect']) . '","' . $params['iframe_id'] . '");
				})';
        } else {
            $output_code .= '
			document.getElementById("' . $params['iframe_id'] . '").style.visibility="visible"
			like_box_set_width_cur_element("' . $params['iframe_id'] . '",' . $params['width'] . ')
			';
        }
        $output_code .= '});</script>';
        return $output_code;
    }
예제 #3
0
파일: widget.php 프로젝트: sosthai/sosthai
 function widget($args, $instance)
 {
     self::$id_of_like_box++;
     extract($args);
     $title = $instance['title'];
     $profile_id = $instance['profile_id'];
     $connections = $instance['connections'];
     $width = $instance['width'];
     $height = $instance['height'];
     $header = $instance['header'] ? 1 : 0;
     $locale = $instance['locale'];
     // Before widget //
     echo $before_widget;
     // Title of widget //
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     // Widget output //
     echo '<iframe id="like_box_widget_' . self::$id_of_like_box . '" src="http://www.facebook.com/plugins/fan.php?id=' . $profile_id . '&amp;width=' . $width . '&amp;colorscheme=' . $facbook_likbox_theme . '&amp;height=' . $height . '&amp;connections=' . $connections . '&amp;stream=' . $stream . '&amp;header=' . $header . '&amp;locale=' . $locale . '&amp;show_border=' . ($show_border == 'yes' ? 'true' : 'false') . '" scrolling="no" frameborder="0" allowTransparency="true" style="' . ($show_border == 'yes' ? 'border:1px solid ' . $facbook_lik_box_border_color . ';' : 'border:none') . ' overflow:hidden;visibility:hidden; max-width:100%; width:' . $width . 'px; height:' . $height . 'px;background-color:' . $facbook_bg_color . ';"></iframe>';
     echo '<script>jQuery(document).ready(function(){like_box_animated_element("' . like_box_setting::get_animations_type_array($animation) . '","like_box_widget_' . self::$id_of_like_box . '"); jQuery(window).scroll(function(){like_box_animated_element("' . like_box_setting::get_animations_type_array($animation) . '","like_box_widget_' . self::$id_of_like_box . '");})});</script>';
     // After widget //
     echo $after_widget;
 }