Ignore:
Timestamp:
Dec 24, 2010, 6:00:49 PM (13 years ago)
Author:
rub
Message:

Add comments social plugin.
Fix FB connexion

Location:
extensions/FacebookPlug/Plugin
Files:
1 added
7 edited

Legend:

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

    r8282 r8295  
    3838// Data
    3939$base_url = get_admin_plugin_menu_link(__FILE__);
    40 $url_type = array('page', 'image');
    41 $url_type_l10n = array_map('l10n', $url_type);
     40$picture_url_type = array('page', 'image');
     41$picture_url_type_l10n = array_map('l10n', $picture_url_type);
    4242$layout = array('standard', 'button_count', 'box_count');
    4343$layout_l10n = array_map('l10n', $layout);
     
    6767      // Like button
    6868      $conf['fbp']['social_plugin_like_button']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']) ? false : true;
    69       $conf['fbp']['social_plugin_like_button']['url_type'] = $url_type[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_URL_TYPE']];
    7069      $conf['fbp']['social_plugin_like_button']['layout'] = $layout[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT']];
    7170      $conf['fbp']['social_plugin_like_button']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES']) ? false : true;
     
    7574      $conf['fbp']['social_plugin_facepile']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_ENABLED']) ? false : true;
    7675      $conf['fbp']['social_plugin_facepile']['max_rows'] = intval($_POST['FBP_SOCIAL_PLUGIN_FACEPILE_MAX_ROWS']);
     76      // Comments
     77      $conf['fbp']['social_plugin_comments']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED']) ? false : true;
     78      $conf['fbp']['social_plugin_comments']['numposts'] = intval($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_NUMPOSTS']);
     79      $conf['fbp']['social_plugin_comments']['title'] = $_POST['FBP_SOCIAL_PLUGIN_COMMENTS_TITLE'];
     80      $conf['fbp']['social_plugin_comments']['simple'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_SIMPLE']) ? false : true;
     81      $conf['fbp']['social_plugin_comments']['reverse'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_REVERSE']) ? false : true;
     82      $conf['fbp']['social_plugin_comments']['publish_feed'] = empty($_POST['FBP_SOCIAL_PLUGIN_COMMENTS_PUBLISH_FEED']) ? false : true;
    7783      // Like box
    7884      $conf['fbp']['social_plugin_like_box']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED']) ? false : true;
     
    8894    {
    8995      $conf['fbp']['async_script'] = empty($_POST['FBP_ASYNC_SCRIPT']) ? false : true;
     96      $conf['fbp']['picture_url_type'] = $picture_url_type[$_POST['FBP_PICTURE_URL_TYPE']];
    9097      $conf['fbp']['allow_fb_access_private_page'] = empty($_POST['FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE']) ? false : true;
    9198      break;
     
    122129            'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/like/',
    123130            'ENABLED' => ($conf['fbp']['social_plugin_like_button']['enabled'] ? 'checked="checked"' : ''),
    124             'URL_TYPE_OPTIONS' => $url_type_l10n,
    125             'URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['url_type'], $url_type),
    126131            'LAYOUT_OPTIONS' => $layout_l10n,
    127132            'LAYOUT_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['layout'], $layout),
     
    137142            'ENABLED' => ($conf['fbp']['social_plugin_facepile']['enabled'] ? 'checked="checked"' : ''),
    138143            'MAX_ROWS' => $conf['fbp']['social_plugin_facepile']['max_rows'],
     144          ),
     145       'comments' => array
     146          (
     147            'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/comments/',
     148            'ENABLED' => ($conf['fbp']['social_plugin_comments']['enabled'] ? 'checked="checked"' : ''),
     149            'NUMPOSTS' => $conf['fbp']['social_plugin_comments']['numposts'],
     150            'TITLE' => $conf['fbp']['social_plugin_comments']['title'],
     151            'SIMPLE' => ($conf['fbp']['social_plugin_comments']['simple'] ? 'checked="checked"' : ''),
     152            'REVERSE' => ($conf['fbp']['social_plugin_comments']['reverse'] ? 'checked="checked"' : ''),
     153            'PUBLISH_FEED' => ($conf['fbp']['social_plugin_comments']['publish_feed'] ? 'checked="checked"' : ''),
    139154          ),
    140155       'like_box' => array
     
    158173      array(
    159174        'FBP_ASYNC_SCRIPT'=> ($conf['fbp']['async_script'] ? 'checked="checked"' : ''),
     175        'FBP_PICTURE_URL_TYPE_OPTIONS' => $picture_url_type_l10n,
     176        'FBP_PICTURE_URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['picture_url_type'], $picture_url_type),
    160177        'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
    161178        ));
  • extensions/FacebookPlug/Plugin/include/conf.inc.php

    r8282 r8295  
    3030  array
    3131  (
     32    'async_script' => false,
     33    'picture_url_type' => 'page',
    3234    'allow_fb_access_private_page' => true,
    33     'async_script' => false,
    3435    'social_plugin_like_button' => array(),
     36    'social_plugin_facepile' => array(),
     37    'social_plugin_comments' => array(),
    3538    'social_plugin_like_box' => array(),
    36     'social_plugin_facepile' => array(),
    3739  ),
    3840  unserialize($conf['fbp']));
     
    4345  (
    4446    'enabled' => true,
    45     'url_type' => 'page',
    4647    'layout' => 'standard',
    4748    'show_faces' => true,
     
    5152  ),
    5253  $conf['fbp']['social_plugin_like_button']);
     54
     55$conf['fbp']['social_plugin_facepile'] = array_merge(
     56  // default values
     57  array
     58  (
     59    'enabled' => true,
     60    'max_rows' => 1,
     61    'width' => null,
     62  ),
     63  $conf['fbp']['social_plugin_facepile']);
     64
     65$conf['fbp']['social_plugin_comments'] = array_merge(
     66  // default values
     67  array
     68  (
     69    'enabled' => false,
     70    'numposts' => 5,
     71    'css' => null,
     72    'title' => null,
     73    'simple' => true,
     74    'reverse' => false,
     75    'publish_feed' => true,
     76    'width' => null,
     77  ),
     78  $conf['fbp']['social_plugin_comments']);
    5379
    5480$conf['fbp']['social_plugin_like_box'] = array_merge(
     
    6692  $conf['fbp']['social_plugin_like_box']);
    6793
    68 $conf['fbp']['social_plugin_facepile'] = array_merge(
    69   // default values
    70   array
    71   (
    72     'enabled' => true,
    73     //'url_type' => 'page',
    74     'max_rows' => 1,
    75     'width' => null,
    76   ),
    77   $conf['fbp']['social_plugin_facepile']);
    78 
    79 // Same value of like button
    80 $conf['fbp']['social_plugin_facepile']['url_type'] = $conf['fbp']['social_plugin_like_button']['url_type'];
    81 
    8294//~ print_r($conf['fbp']);
    8395
  • extensions/FacebookPlug/Plugin/include/picture.inc.php

    r8282 r8295  
    3434  {
    3535    $tpl = 'social.plugin.facepile';
    36     $type = $conf['fbp']['social_plugin_facepile']['url_type'];
    3736  }
    3837  else if ($conf['fbp']['social_plugin_like_button']['enabled'])
    3938  {
    4039    $tpl = 'social.plugin.like.button';
    41     $type = $conf['fbp']['social_plugin_like_button']['url_type'];
     40  }
     41  else if ($conf['fbp']['social_plugin_comments']['enabled'])
     42  {
     43    $tpl = 'social.plugin.comments';
    4244  }
    4345  else
     
    5052  // Always use full url for FB social plugin
    5153  set_make_full_url();
    52   if ($type == 'image')
     54  if ($conf['fbp']['picture_url_type'] == 'image')
    5355  {
    5456    $fbp_url_picture = get_element_url($current_picture);
     
    6062  unset_make_full_url();
    6163  $template->assign('fbp_url_picture', $fbp_url_picture);
     64  $template->assign('fbp_urlencode_picture', urlencode($fbp_url_picture));
    6265
    6366  // XFBML implementation
     
    7275  global $conf;
    7376
    74   if ($conf['fbp']['social_plugin_like_button']['enabled'])
     77  if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'])
    7578  {
    7679    if ($conf['fbp']['allow_fb_access_private_page'])
     
    9396}
    9497
    95 if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'])
     98if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'])
    9699{
    97100  //~ add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture');
  • extensions/FacebookPlug/Plugin/language/en_UK/plugin.lang.php

    r8282 r8295  
    4040$lang['Like button'] = 'Like button';
    4141$lang['Enabled'] = 'Enabled';
    42 $lang['URL type'] = 'URL type';
     42$lang['Picture URL type'] = 'Picture URL type';
    4343$lang['Layout style'] = 'Layout style';
    4444$lang['Show faces'] = 'Show faces';
     
    5353$lang['Data updated with success'] = 'Data updated with success';
    5454$lang['Data updated with error'] = 'Data updated with error';
    55 
    5655$lang['Facepile'] = 'Facepile';
    5756$lang['on slideshow pages'] = 'on slideshow pages';
    5857$lang['Num rows'] = 'Num rows';
    59 $lang[''] = '';
    60 $lang[''] = '';
    61 $lang[''] = '';
    62 $lang[''] = '';
    63 $lang[''] = '';
    64 $lang[''] = '';
    65 $lang[''] = '';
    66 $lang[''] = '';
    67 $lang[''] = '';
    68 $lang[''] = '';
    69 $lang[''] = '';
    70 $lang[''] = '';
    71 $lang[''] = '';
    72 $lang[''] = '';
    73 $lang[''] = '';
    74 $lang[''] = '';
     58$lang['Comments'] = 'Comments';
     59$lang['Num posts'] = 'Num posts';
     60$lang['Title'] = 'Title';
     61$lang['Simple'] = 'Simple';
     62$lang['Reverse'] = 'Reverse';
     63$lang['Publish feed'] = 'Publish feed';
     64//~ $lang[''] = '';
    7565
    7666?>
  • extensions/FacebookPlug/Plugin/language/fr_FR/plugin.lang.php

    r8282 r8295  
    4040$lang['Like button'] = 'Bouton "J\'aime"';
    4141$lang['Enabled'] = 'Activé';
    42 $lang['URL type'] = 'Type d\'URL';
     42$lang['Picture URL type'] = 'Type d\'URL pour les images';
    4343$lang['Layout style'] = 'Style d\'affichage';
    4444$lang['Show faces'] = 'Voir les faces';
     
    5656$lang['on slideshow pages'] = 'sur les diaporamas';
    5757$lang['Num rows'] = 'Nombre de lignes';
     58$lang['Comments'] = 'Commentaires';
     59$lang['Num posts'] = 'Nombre de commentaires affichés';
     60$lang['Title'] = 'Titre';
     61$lang['Simple'] = 'Simple';
     62$lang['Reverse'] = 'Ordre inversé';
     63$lang['Publish feed'] = 'Publier les commentaires';
    5864
    5965?>
  • extensions/FacebookPlug/Plugin/tpl/admin.config.tpl

    r8282 r8295  
    2020      <li>
    2121        <label>
    22           <span class="property">{'URL type'|@translate}</span>
    23           <select name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_URL_TYPE" size="1">
    24             {html_options options=$social_plugin.like_button.URL_TYPE_OPTIONS selected=$social_plugin.like_button.URL_TYPE_OPTIONS_SELECTED}
    25           </select>
    26         </label>
    27       </li>
    28       <li>
    29         <label>
    3022          <span class="property">{'Layout style'|@translate}</span>
    3123          <select name="FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT" size="1">
     
    8375<fieldset>
    8476  <ul>
     77    <h3><a href="{$social_plugin.comments.FB_PAGE}" onclick="window.open(this.href); return false;">{'Comments'|@translate}</a> {'on picture pages'|@translate}</h3>
     78    <li>
     79      <label>
     80        <span class="property">{'Enabled'|@translate}</span>
     81        <input type="checkbox" name="FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED" {$social_plugin.comments.ENABLED} />
     82      </label>
     83    </li>
     84
     85    <div id='comments'>
     86      <li>
     87        <label>
     88          <span class="property">{'Num posts'|@translate}</span>
     89          <input type="text" size="3" maxlength="4" name="FBP_SOCIAL_PLUGIN_COMMENTS_NUMPOSTS" value="{$social_plugin.comments.NUMPOSTS}" />
     90        </label>
     91      </li>
     92      <li>
     93        <label>
     94          <span class="property">{'Title'|@translate}</span>
     95          <input type="text" size="39" name="FBP_SOCIAL_PLUGIN_COMMENTS_TITLE" value="{$social_plugin.comments.TITLE}" />
     96        </label>
     97      </li>
     98      <li>
     99        <label>
     100          <span class="property">{'Simple'|@translate}</span>
     101          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_COMMENTS_SIMPLE" {$social_plugin.comments.SIMPLE} />
     102        </label>
     103      </li>
     104      <li>
     105        <label>
     106          <span class="property">{'Reverse'|@translate}</span>
     107          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_COMMENTS_REVERSE" {$social_plugin.comments.REVERSE} />
     108        </label>
     109      </li>
     110      <li>
     111        <label>
     112          <span class="property">{'Publish feed'|@translate}</span>
     113          <input type="checkbox" name="FBP_SOCIAL_PLUGIN_COMMENTS_PUBLISH_FEED" {$social_plugin.comments.PUBLISH_FEED} />
     114        </label>
     115      </li>
     116    </div>
     117  </ul>
     118</fieldset>
     119
     120<fieldset>
     121  <ul>
    85122    <h3><a href="{$social_plugin.like_box.FB_PAGE}" onclick="window.open(this.href); return false;">{'Like box'|@translate}</a> {'on main pages'|@translate}</h3>
    86123    <li>
     
    139176    </li>
    140177*}
     178    <li>
     179      <label>
     180        <span class="property">{'Picture URL type'|@translate}</span>
     181        <select name="FBP_PICTURE_URL_TYPE" size="1">
     182          {html_options options=$advanced.FBP_PICTURE_URL_TYPE_OPTIONS selected=$advanced.FBP_PICTURE_URL_TYPE_OPTIONS_SELECTED}
     183        </select>
     184      </label>
     185    </li>
    141186    <li>
    142187      <label>
     
    188233      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED", "like_button");
    189234      init_checkbox("FBP_SOCIAL_PLUGIN_FACEPILE_ENABLED", "facepile");
     235      init_checkbox("FBP_SOCIAL_PLUGIN_COMMENTS_ENABLED", "comments");
    190236      init_checkbox("FBP_SOCIAL_PLUGIN_LIKE_BOX_ENABLED", "like_box");
    191237    });
  • extensions/FacebookPlug/Plugin/tpl/init.fb.tpl

    r8283 r8295  
     1<!-- By FacebookPlug a Piwigo Plugin -->
    12{if $fbp.async_script}
    23<div id="fb-root"></div>
     
    1213  (function() {ldelim}
    1314    var e = document.createElement(script);
    14     e.src = document.location.protocol + //connect.facebook.net/{$LANGUAGE}/all.js;
     15    e.src = document.location.protocol + //connect.facebook.net/{$LANGUAGE}/all.js#appId={$FACEBOOK_APP_ID}&amp;xfbml=1;
    1516    e.async = true;
    1617    document.getElementById(fb-root).appendChild(e);
     
    1920{else}
    2021<div id="fb-root"></div>
    21 <script src="http://connect.facebook.net/{$LANGUAGE}/all.js#xfbml=1"></script>
     22<script src="http://connect.facebook.net/{$LANGUAGE}/all.js#appId={$FACEBOOK_APP_ID}&amp;xfbml=1"></script>
    2223<script>
    2324  FB.init({ldelim}
Note: See TracChangeset for help on using the changeset viewer.