Exemplo n.º 1
0
function hocwp_facebook_share_and_like_buttons($args = array())
{
    $url = isset($args['url']) ? $args['url'] : '';
    if (empty($url)) {
        $url = get_permalink();
    }
    $layout = isset($args['layout']) ? $args['layout'] : 'button_count';
    $action = isset($args['action']) ? $args['action'] : 'like';
    $show_faces = isset($args['show_faces']) ? $args['show_faces'] : false;
    $show_faces = hocwp_bool_to_string($show_faces);
    $share = isset($args['share']) ? $args['share'] : true;
    $share = hocwp_bool_to_string($share);
    ?>
	<div class="fb-like-buttons like-share">
		<div class="item">
			<div class="fb-like" data-href="<?php 
    echo $url;
    ?>
" data-layout="<?php 
    echo $layout;
    ?>
"
			     data-action="<?php 
    echo $action;
    ?>
" data-show-faces="<?php 
    echo $show_faces;
    ?>
"
			     data-share="<?php 
    echo $share;
    ?>
"></div>
		</div>
	</div>
	<?php 
}
Exemplo n.º 2
0
function hocwp_facebook_page_plugin($args = array())
{
    $href = hocwp_get_value_by_key($args, 'href', hocwp_get_value_by_key($args, 'url'));
    if (empty($href)) {
        $page_id = isset($args['page_id']) ? $args['page_id'] : 'hocwpnet';
        if (!empty($page_id)) {
            $href = 'https://www.facebook.com/' . $page_id;
        }
    }
    if (!hocwp_is_url($href)) {
        $href = 'https://www.facebook.com/' . $href;
    }
    if (empty($href)) {
        return;
    }
    $page_name = isset($args['page_name']) ? $args['page_name'] : '';
    $width = isset($args['width']) ? $args['width'] : 340;
    $height = isset($args['height']) ? $args['height'] : 500;
    $hide_cover = (bool) (isset($args['hide_cover']) ? $args['hide_cover'] : false);
    $hide_cover = hocwp_bool_to_string($hide_cover);
    $show_facepile = (bool) (isset($args['show_facepile']) ? $args['show_facepile'] : true);
    $show_facepile = hocwp_bool_to_string($show_facepile);
    $show_posts = (bool) (isset($args['show_posts']) ? $args['show_posts'] : false);
    $tabs = hocwp_get_value_by_key($args, 'tabs');
    if (!is_array($tabs)) {
        $tabs = explode(',', $tabs);
    }
    $tabs = array_map('trim', $tabs);
    if ($show_posts && !hocwp_in_array('timeline', $tabs)) {
        $tabs[] = 'timeline';
    }
    $show_posts = hocwp_bool_to_string($show_posts);
    $hide_cta = (bool) (isset($args['hide_cta']) ? $args['hide_cta'] : false);
    $hide_cta = hocwp_bool_to_string($hide_cta);
    $small_header = (bool) (isset($args['small_header']) ? $args['small_header'] : false);
    $small_header = hocwp_bool_to_string($small_header);
    $adapt_container_width = (bool) (isset($args['adapt_container_width']) ? $args['adapt_container_width'] : true);
    $adapt_container_width = hocwp_bool_to_string($adapt_container_width);
    ?>
	<div class="fb-page" data-href="<?php 
    echo $href;
    ?>
" data-width="<?php 
    echo $width;
    ?>
"
	     data-height="<?php 
    echo $height;
    ?>
" data-hide-cta="<?php 
    echo $hide_cta;
    ?>
"
	     data-small-header="<?php 
    echo $small_header;
    ?>
"
	     data-adapt-container-width="<?php 
    echo $adapt_container_width;
    ?>
" data-hide-cover="<?php 
    echo $hide_cover;
    ?>
"
	     data-show-facepile="<?php 
    echo $show_facepile;
    ?>
" data-show-posts="<?php 
    echo $show_posts;
    ?>
"
	     data-tabs="<?php 
    echo implode(',', $tabs);
    ?>
">
		<div class="fb-xfbml-parse-ignore">
			<?php 
    if (!empty($page_name)) {
        ?>
				<blockquote cite="<?php 
        echo $href;
        ?>
">
					<a href="<?php 
        echo $href;
        ?>
"><?php 
        echo $page_name;
        ?>
</a>
				</blockquote>
			<?php 
    }
    ?>
		</div>
	</div>
	<?php 
}