Ignore:
Timestamp:
Dec 23, 2010, 11:53:27 AM (13 years ago)
Author:
rub
Message:

Fix use render_element_content to add XFBML
Begin like box implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/include/picture.inc.php

    r8248 r8250  
    9292}
    9393
    94 //~ function fbp_loc_end_picture()
     94function fbp_bool2str($value)
     95{
     96  return ($value ? 'true' : 'false');
     97}
     98
    9599function fbp_render_element_content($content, $current_picture)
    96100{
     
    103107  }
    104108
    105   if ($conf['fbp']['social_plugin_like_button']['enabled'])
     109  if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled'])
    106110  {
    107      // iframe implementation
    108     /*  $$content = '
    109     <iframe src="http://www.facebook.com/plugins/like.php?href={$SRC_IMG}&amp;layout=standard&amp;show_faces=true&amp;width={$WIDTH_IMG}&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$WIDTH_IMG}px; height:80px;" allowTransparency="true"></iframe>
    110     ';*/
    111     // XFBML implementation
    112     $content .= '
    113 <div id="fb-xfbml">
    114 <fb:like href="{$FBP_URL_PICTURE}" layout="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.layout}" show_faces="{if $FBP_SOCIAL_PLUGIN_LIKE_BUTTON.show_faces}true{else}false{/if}" width="{$WIDTH_IMG}" action="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.action}" colorscheme="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.colorscheme}"></fb:like>
    115 </div>';
    116     $content2 = '
    117 <fb:like href="{$FBP_URL_PICTURE}" layout="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.layout}" show_faces="{if $FBP_SOCIAL_PLUGIN_LIKE_BUTTON.show_faces}true{else}false{/if}" width="{$WIDTH_IMG}" action="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.action}" colorscheme="{$FBP_SOCIAL_PLUGIN_LIKE_BUTTON.colorscheme}"></fb:like>
    118 ';
    119 
    120     //~ $template->set_prefilter('default_content', 'fbp_add_social');
    121     // Always use full url for FB social plugin
    122     //~ set_make_full_url();
    123111    // define language
    124112    $template->assign('LANGUAGE', $user['language']);
    125113    // define picture FB link
     114    // Always use full url for FB social plugin
    126115    set_make_full_url();
    127116    if ($conf['fbp']['social_plugin_like_button']['url_type'] == 'image')
    128117    {
    129       $fbp_url_picture = get_element_url($picture['current']);
     118      $fbp_url_picture = get_element_url($current_picture);
    130119    }
    131120    else
     
    134123    }
    135124    unset_make_full_url();
    136     $template->assign('FBP_URL_PICTURE', $fbp_url_picture);
    137     $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BUTTON', $conf['fbp']['social_plugin_like_button']);
    138   }
     125    //~ $template->assign('FBP_URL_PICTURE', $fbp_url_picture);
     126    //~ $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BUTTON', $conf['fbp']['social_plugin_like_button']);
     127    //~ $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BOX', $conf['fbp']['social_plugin_like_box']);
     128
     129     // iframe implementation
     130    /*  $$content = '
     131    <iframe src="http://www.facebook.com/plugins/like.php?href={$SRC_IMG}&amp;layout=standard&amp;show_faces=true&amp;width={$WIDTH_IMG}&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$WIDTH_IMG}px; height:80px;" allowTransparency="true"></iframe>
     132    ';*/
     133    // XFBML implementation
     134    //~ $content .= '
     135//~ <div id="fb-xfbml">';
     136    if ($conf['fbp']['social_plugin_like_button']['enabled'])
     137    {
     138      $content .= '
     139<div id="fb-xfbml">
     140<fb:like href="'.$fbp_url_picture.'" layout="'.$conf['fbp']['social_plugin_like_button']['layout'].'" show_faces="'.fbp_bool2str($conf['fbp']['social_plugin_like_button']['show_faces']).'" width="'.@$current_picture['scaled_width'].'" action="'.$conf['fbp']['social_plugin_like_button']['action'].'" colorscheme="'.$conf['fbp']['social_plugin_like_button']['colorscheme'].'"></fb:like>
     141</div>';
     142    }
     143    if ($conf['fbp']['social_plugin_like_box']['enabled'])
     144    {
     145      $content .= '
     146<div id="fb-xfbml">
     147<fb:like-box href="'.$fbp_url_picture.'" width="'.@$current_picture['scaled_width'].'" show_faces="'.fbp_bool2str($conf['fbp']['social_plugin_like_box']['show_faces']).'" stream="'.fbp_bool2str($conf['fbp']['social_plugin_like_box']['stream']).'" header="'.fbp_bool2str($conf['fbp']['social_plugin_like_box']['header']).'"></fb:like-box>
     148</div>';
     149    }
     150
     151    //~ $content .= '
     152//~ </div>';
     153}
    139154
    140155  return $content;
     
    145160  global $conf;
    146161
    147   if ($conf['fbp']['social_plugin_like_button']['enabled'])
     162  if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled'])
    148163  {
    149164    if ($conf['fbp']['allow_fb_access_private_page'])
     
    166181}
    167182
    168 if ($conf['fbp']['social_plugin_like_button']['enabled'])
     183if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled'])
    169184{
    170185  add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture');
Note: See TracChangeset for help on using the changeset viewer.