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

Location:
extensions/FacebookPlug/Plugin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/admin.config.php

    r8243 r8250  
    6565    case 'social_plugin' :
    6666    {
     67      // Like button
    6768      $conf['fbp']['social_plugin_like_button']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']) ? false : true;
    6869      $conf['fbp']['social_plugin_like_button']['url_type'] = $url_type[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_URL_TYPE']];
     
    7172      $conf['fbp']['social_plugin_like_button']['action'] = $action[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ACTION']];
    7273      $conf['fbp']['social_plugin_like_button']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_COLORSCHEME']];
    73 
     74      // Like box
     75      $conf['fbp']['social_plugin_like_box']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED']) ? false : true;
     76      $conf['fbp']['social_plugin_like_box']['url_type'] = $url_type[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_URL_TYPE']];
     77      $conf['fbp']['social_plugin_like_box']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_COLORSCHEME']];
     78      $conf['fbp']['social_plugin_like_box']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_SHOW_FACES']) ? false : true;
     79      $conf['fbp']['social_plugin_like_box']['stream'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_STREAM']) ? false : true;
     80      $conf['fbp']['social_plugin_like_box']['header'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_HEADER']) ? false : true;
    7481      break;
    7582    }
     
    119126            'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['colorscheme'], $colorscheme),
    120127          ),
     128       'like_box' => array
     129          (
     130            'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/like-box',
     131            'ENABLED' => ($conf['fbp']['social_plugin_like_box']['enabled'] ? 'checked="checked"' : ''),
     132            'URL_TYPE_OPTIONS' => $url_type_l10n,
     133            'URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_box']['url_type'], $url_type),
     134            'COLORSCHEME_OPTIONS' => $colorscheme_l10n,
     135            'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_box']['colorscheme'], $colorscheme),
     136            'SHOW_FACES' => ($conf['fbp']['social_plugin_like_box']['show_faces'] ? 'checked="checked"' : ''),
     137            'STREAM' => ($conf['fbp']['social_plugin_like_box']['stream'] ? 'checked="checked"' : ''),
     138            'HEADER' => ($conf['fbp']['social_plugin_like_box']['header'] ? 'checked="checked"' : ''),
     139          ),
    121140        ));
    122141    break;
  • extensions/FacebookPlug/Plugin/include/conf.inc.php

    r8248 r8250  
    4141        'colorscheme' => 'dark',
    4242      ),
     43    'social_plugin_like_box' => array
     44      (
     45        'enabled' => false,
     46        'url_type' => 'page',
     47        'colorscheme' => 'dark',
     48        'show_faces' => true,
     49        'stream' => true,
     50        'header' => true,
     51      ),
    4352  ),
    4453  unserialize($conf['fbp'])
  • 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');
  • extensions/FacebookPlug/Plugin/language/en_UK/plugin.lang.php

    r8241 r8250  
    4343$lang['Verb to display'] = 'Texte à afficher';
    4444$lang['Color scheme'] = 'Jeu de couleurs';
     45$lang['Like box'] = 'Like box';
     46$lang['Show stream'] = 'Show stream';
     47$lang['Show header'] = 'Show header';
    4548
    4649?>
  • extensions/FacebookPlug/Plugin/language/fr_FR/plugin.lang.php

    r8241 r8250  
    4343$lang['Verb to display'] = 'Verb to display';
    4444$lang['Color scheme'] = 'Color scheme';
     45$lang['Like box'] = 'Boite "J\'aime"';
     46$lang['Show stream'] = 'Voir le flux';
     47$lang['Show header'] = 'Voir l\'entête';
     48//~ $lang[''] = '';
     49//~ $lang[''] = '';
     50//~ $lang[''] = '';
    4551
    4652?>
  • extensions/FacebookPlug/Plugin/tpl/admin.config.tpl

    r8241 r8250  
    66<form method="post" class="properties">
    77
    8 <fieldset id="fbpConf">
    9   {if isset($social_plugin)}
     8{if isset($social_plugin)}
     9<fieldset>
    1010  <ul>
    1111    <h3><a href="{$social_plugin.like_button.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like button'|@translate}</a></h3>
     
    2626        </label>
    2727      </li>
    28 
    2928      <li>
    3029        <label>
     
    5756        </label>
    5857      </li>
    59 
    6058{*      <li>
    6159        <span class="property">
     
    6664    </div>
    6765  </ul>
    68   {/if}{* isset $social_plugin*}
     66</fieldset>
    6967
    70   {if isset($advanced)}
     68<fieldset>
     69  <ul>
     70    <h3><a href="{$social_plugin.like_box.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like box'|@translate}</a></h3>
     71    <li>
     72      <label>
     73        <span class="property">{'Enabled'|@translate}</span>
     74        <input type="checkbox" name="FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED" {$social_plugin.like_box.ENABLED} />
     75      </label>
     76    </li>
     77
     78    <div id='like_box'>
     79      <li>
     80        <label>
     81          <span class="property">{'URL type'|@translate}</span>
     82          <select name="FBP_SOCIAL_PLUGIN_LIKE_BOX_URL_TYPE" size="1">
     83            {html_options options=$social_plugin.like_box.URL_TYPE_OPTIONS selected=$social_plugin.like_box.URL_TYPE_OPTIONS_SELECTED}
     84          </select>
     85        </label>
     86      </li>
     87      <li>
     88        <label>
     89          <span class="property">{'Color scheme'|@translate}</span>
     90          <select name="FBP_SOCIAL_PLUGIN_LIKE_BOX_COLORSCHEME" size="1">
     91            {html_options options=$social_plugin.like_box.COLORSCHEME_OPTIONS selected=$social_plugin.like_box.COLORSCHEME_OPTIONS_SELECTED}
     92          </select>
     93        </label>
     94      </li>
     95      <li>
     96        <label>
     97          <span class="property">{'Show faces'|@translate}</span>
     98          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_LIKE_BOX_SHOW_FACES" {$social_plugin.like_box.SHOW_FACES} />
     99        </label>
     100      </li>
     101      <li>
     102        <label>
     103          <span class="property">{'Show stream'|@translate}</span>
     104          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_LIKE_BOX_STREAM" {$social_plugin.like_box.STREAM} />
     105        </label>
     106      </li>
     107      <li>
     108        <label>
     109          <span class="property">{'Show header'|@translate}</span>
     110          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_LIKE_BOX_HEADER" {$social_plugin.like_box.HEADER} />
     111        </label>
     112      </li>
     113    </div>
     114  </ul>
     115</fieldset>
     116{/if}{* isset $social_plugin*}
     117
     118{if isset($advanced)}
     119<fieldset>
    71120  <ul>
    72121    <li>
     
    84133    </li>
    85134  </ul>
    86   {/if}{* isset $advanced*}
     135</fieldset>
     136{/if}{* isset $advanced*}
    87137
    88 </fieldset>
    89138
    90139  <p>
     
    125174      //Init all main checkbox
    126175      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED", "like_button");
     176      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED", "like_box");
    127177    });
    128178
Note: See TracChangeset for help on using the changeset viewer.