Changeset 8440


Ignore:
Timestamp:
01/02/11 19:53:55 (9 years ago)
Author:
rub
Message:

Add upload button on image page

Location:
extensions/FacebookPlug/Plugin
Files:
2 added
13 edited
1 moved

Legend:

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

    r8436 r8440  
    5050               l10n('Social plugins'), 
    5151               add_url_params($base_url, array('tab' => 'social_plugin'))); 
    52 $tabsheet->add('share', 
    53                l10n('Share'), 
    54                add_url_params($base_url, array('tab' => 'share'))); 
     52$tabsheet->add('button', 
     53               l10n('Buttons'), 
     54               add_url_params($base_url, array('tab' => 'button'))); 
    5555$tabsheet->add('advanced', 
    5656               l10n('Advanced'), 
     
    122122    } 
    123123 
    124     case 'share' : 
     124    case 'button' : 
    125125    { 
    126126      $conf['fbp']['share_picture'] = ! empty($_POST['FBP_SHARE_PICTURE']); 
    127127      $conf['fbp']['share_album'] = ! empty($_POST['FBP_SHARE_ALBUM']); 
     128      $conf['fbp']['upload_picture'] = ! empty($_POST['FBP_UPLOAD_PICTURE']); 
    128129      break; 
    129130    } 
     
    224225    break; 
    225226  } 
    226   case 'share' : 
     227  case 'button' : 
    227228  { 
    228229    $template->assign( 
     
    231232        'FBP_SHARE_PICTURE' => fbp_checked($conf['fbp']['share_picture']), 
    232233        'FBP_SHARE_ALBUM' => fbp_checked($conf['fbp']['share_album']), 
     234        'FBP_UPLOAD_PICTURE' => fbp_checked($conf['fbp']['upload_picture']), 
    233235        )); 
    234236    break; 
  • extensions/FacebookPlug/Plugin/include/common.inc.php

    r8425 r8440  
    2626include_once(dirname(__FILE__).'/constants.inc.php'); 
    2727include_once(FBP_DIR.'/include/conf.inc.php'); 
     28include_once(FBP_DIR.'/include/functions.inc.php'); 
    2829include_once(FBP_DIR.'/include/header.inc.php'); 
    2930 
  • extensions/FacebookPlug/Plugin/include/conf.inc.php

    r8436 r8440  
    3939    'share_picture' => true, 
    4040    'share_album' => true, 
     41    'upload_picture' => true, 
    4142    'allow_fb_access_private_page' => true, 
    4243    'social_plugin_like_button' => array(), 
  • extensions/FacebookPlug/Plugin/include/constants.inc.php

    r8425 r8440  
    2525 
    2626define('FACEBOOK_APP_ID', '111499825588662'); 
     27if (!defined('PIWIGO_FACEBOOK_UPLOAD_VERSION')) define('PIWIGO_FACEBOOK_UPLOAD_VERSION', '1.0'); 
     28 
    2729define('FACEBOOK_URL', 'http://www.facebook.com'); 
    2830define('FACEBOOK_PIWIGO_GROUP_URL', FACEBOOK_URL.'/Piwigo'); 
     
    3234define('FACEBOOK_DOC_PLUGINS_URL', FACEBOOK_DEV_URL.'/docs/reference/plugins'); 
    3335 
     36define('PIWIGO_FACEBOOK_UPLOAD_URL', 'http://facebook.piwigo.net/'.PIWIGO_FACEBOOK_UPLOAD_VERSION.'/upload_photo.php'); 
     37 
    3438define('FBP_DIR', dirname(dirname(__FILE__))); 
    3539define('FBP_PATH' , PHPWG_PLUGINS_PATH.basename(FBP_DIR)); 
  • extensions/FacebookPlug/Plugin/include/header.inc.php

    r8436 r8440  
    8686    $template->assign('FACEBOOK_LANGUAGE', fbp_get_fb_language()); 
    8787    $template->assign('FBP_PATH', FBP_PATH); 
     88    $template->assign('FBP_SCRIPT_BASENAME', script_basename()); 
    8889    $template->assign('fbp', $conf['fbp']); 
    8990    //~ $template->smarty->register_modifier('boolean_to_string', 'boolean_to_string'); 
     
    136137        (script_basename() == 'picture') 
    137138        and 
    138         ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'] or $conf['fbp']['share_picture']) 
     139        ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'] or $conf['fbp']['share_picture'] or $conf['fbp']['upload_picture']) 
    139140      ) 
    140141      or 
  • extensions/FacebookPlug/Plugin/include/index.inc.php

    r8437 r8440  
    8888      { 
    8989        set_make_full_url(); 
    90         $page['fbp']['url_image'] = get_thumbnail_url($row); 
     90        $page['fbp']['url_image'] = get_element_url($row); 
     91        $page['fbp']['url_thumbnail_image'] = get_thumbnail_url($row); 
    9192        unset_make_full_url(); 
    9293      } 
     
    112113      $picture = $pictures[rand(0, $C-1)]; 
    113114      set_make_full_url(); 
    114       $page['fbp']['url_image'] = get_thumbnail_url($picture); 
     115      $page['fbp']['url_image'] = get_element_url($picture); 
     116      $page['fbp']['url_thumbnail_image'] = get_thumbnail_url($picture); 
    115117      unset_make_full_url(); 
    116118    } 
    117119  } 
    118 } 
    119  
    120 function fbp_loc_end_index() 
    121 { 
    122   global $template; 
    123  
    124   $template->assign('FBP_SHARE_LI', true); 
    125  
    126   $tpl = 'share'; 
    127   $template->set_filename('fbp_'.$tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl'); 
    128   $template->concat( 
    129         'PLUGIN_INDEX_ACTIONS', 
    130         $template->parse('fbp_'.$tpl, true) 
    131         ); 
    132120} 
    133121 
     
    144132if ($conf['fbp']['share_album']) 
    145133{ 
    146   add_event_handler('loc_end_index', 'fbp_loc_end_index', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */); 
     134  add_event_handler('loc_end_index', 'fbp_add_bar_button', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */); 
    147135} 
    148136 
  • extensions/FacebookPlug/Plugin/include/picture.inc.php

    r8437 r8440  
    6161      $page['fbp']['url'] = make_picture_url(array('image_id' => $page['image_id'])); 
    6262    } 
    63     $page['fbp']['url_image'] = get_thumbnail_url($current_picture); 
     63    $page['fbp']['url_image'] = get_element_url($current_picture); 
     64    $page['fbp']['url_thumbnail_image'] = get_thumbnail_url($current_picture); 
    6465    unset_make_full_url(); 
    6566 
     
    8081} 
    8182 
    82 function fbp_loc_end_picture() 
    83 { 
    84   global $template; 
    85  
    86   $template->assign('FBP_SHARE_LI', false); 
    87  
    88   $tpl = 'share'; 
    89   $template->set_filename('fbp_'.$tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl'); 
    90   $template->concat( 
    91         'PLUGIN_PICTURE_ACTIONS', 
    92         $template->parse('fbp_'.$tpl, true) 
    93         ); 
    94 } 
    9583 
    9684add_event_handler('render_element_content', 'fbp_render_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /*in order to have picture content*/, 2); 
    9785 
    98 if ($conf['fbp']['share_picture']) 
     86if ($conf['fbp']['share_picture'] or $conf['fbp']['upload_picture']) 
    9987{ 
    100   add_event_handler('loc_end_picture', 'fbp_loc_end_picture', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */); 
     88  add_event_handler('loc_end_picture', 'fbp_add_bar_button', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */); 
    10189} 
    10290 
  • extensions/FacebookPlug/Plugin/language/en_UK/admin.config.lang.php

    r8436 r8440  
    9191$lang['Share album page'] = 'Share album page'; 
    9292$lang['Add a icon link on each album page to share on Facebook'] = 'Add a icon link on each album page to share on Facebook'; 
    93 //~ $lang[''] = ''; 
    94 //~ $lang[''] = ''; 
    95 //~ $lang[''] = ''; 
    96 //~ $lang[''] = ''; 
     93$lang['Buttons'] = 'Buttons'; 
     94$lang['Upload'] = 'Upload'; 
     95$lang['Upload picture'] = 'Upload picture'; 
     96$lang['Add a icon link on each picture page to upload image on Facebook'] = 'Add a icon link on each picture page to upload image on Facebook'; 
    9797//~ $lang[''] = ''; 
    9898//~ $lang[''] = ''; 
  • extensions/FacebookPlug/Plugin/language/en_UK/common.lang.php

    r8436 r8440  
    2828$lang['Via Facebook Piwigo application'] = 'Via Facebook Piwigo application'; 
    2929$lang['Share on Facebook'] = 'Share on Facebook'; 
     30$lang['Upload photo on Facebook'] = 'Upload photo on Facebook'; 
    3031 
    3132?> 
  • extensions/FacebookPlug/Plugin/language/fr_FR/admin.config.lang.php

    r8438 r8440  
    9191$lang['Share album page'] = 'Partager la page "album"'; 
    9292$lang['Add a icon link on each album page to share on Facebook'] = 'Ajout d\'une icone contenant un lien afin de partager sur Facebook chaque page \'album\''; 
    93  
     93$lang['Buttons'] = 'Boutons'; 
     94$lang['Upload'] = 'Téléchargement'; 
     95$lang['Upload picture'] = 'Télécharger une image'; 
     96$lang['Add a icon link on each picture page to upload image on Facebook'] = 'Ajout d\'une icone contenant un lien afin de télécharger sur Facebook chaque image'; 
    9497 
    9598?> 
  • extensions/FacebookPlug/Plugin/language/fr_FR/common.lang.php

    r8436 r8440  
    2828$lang['Via Facebook Piwigo application'] = 'Via l\'application Piwigo sur Facebook'; 
    2929$lang['Share on Facebook'] = 'Partager sur Facebook'; 
     30$lang['Upload photo on Facebook'] = 'Télécharger la photo sur Facebook'; 
    3031 
    3132?> 
  • extensions/FacebookPlug/Plugin/tpl/admin.config.tpl

    r8436 r8440  
    224224{/if}{* isset $social_plugin*} 
    225225 
    226 {if isset($share)} 
    227 <fieldset> 
    228   <legend>{'Options'|@translate}</legend> 
     226{if isset($button)} 
     227<fieldset> 
     228  <legend>{'Share'|@translate}</legend> 
    229229  <ul> 
    230230    <li> 
     
    232232        <span class="property">{'Share picture page'|@translate}</span> 
    233233        <a class="HelptipTip" href="#" title="{'Add a icon link on each picture page to share on Facebook'|@translate}"><sup>{' (?)'|@translate}</sup></a> 
    234         <input type="checkbox" name="FBP_SHARE_PICTURE" {$share.FBP_SHARE_PICTURE} /> 
     234        <input type="checkbox" name="FBP_SHARE_PICTURE" {$button.FBP_SHARE_PICTURE} /> 
    235235      </label> 
    236236    </li> 
     
    239239        <span class="property">{'Share album page'|@translate}</span> 
    240240        <a class="HelptipTip" href="#" title="{'Add a icon link on each album page to share on Facebook'|@translate}"><sup>{' (?)'|@translate}</sup></a> 
    241         <input type="checkbox" name="FBP_SHARE_ALBUM" {$share.FBP_SHARE_ALBUM} /> 
    242       </label> 
    243     </li> 
    244   </ul> 
    245 </fieldset> 
    246 {/if}{* isset $share*} 
     241        <input type="checkbox" name="FBP_SHARE_ALBUM" {$button.FBP_SHARE_ALBUM} /> 
     242      </label> 
     243    </li> 
     244  </ul> 
     245</fieldset> 
     246<fieldset> 
     247  <legend>{'Upload'|@translate}</legend> 
     248  <ul> 
     249    <li> 
     250      <label> 
     251        <span class="property">{'Upload picture'|@translate}</span> 
     252        <a class="HelptipTip" href="#" title="{'Add a icon link on each picture page to upload image on Facebook'|@translate}"><sup>{' (?)'|@translate}</sup></a> 
     253        <input type="checkbox" name="FBP_UPLOAD_PICTURE" {$button.FBP_UPLOAD_PICTURE} /> 
     254      </label> 
     255    </li> 
     256</fieldset> 
     257{/if}{* isset $button*} 
    247258 
    248259{if isset($advanced)} 
  • extensions/FacebookPlug/Plugin/tpl/buttons.tpl

    r8439 r8440  
    1 {if $FBP_SHARE_LI}<li>{/if} 
     1{* --------------------------------------------------------------------------- *} 
     2{if $fbp.share_picture or $fbp.share_album} 
     3{if $FBP_SCRIPT_BASENAME == 'index'}<li>{/if} 
    24{* method 1 *} 
    35{* 
     
    2224</script> 
    2325{/literal} 
    24 {if $FBP_SHARE_LI}</li>{/if} 
     26{if $FBP_SCRIPT_BASENAME == 'index'}</li>{/if} 
     27{/if} {* $fbp.share_picture or $fbp.share_album *} 
     28{* --------------------------------------------------------------------------- *} 
     29{if $fbp.upload_picture and $FBP_SCRIPT_BASENAME == 'picture'} 
     30<a href="{$PIWIGO_FACEBOOK_UPLOAD_URL}?u={$fbp_page.url_image|@urlencode}&amp;pu={$fbp_page.url|@urlencode}&amp;pt={$PAGE_TITLE|@replace:'"':' '}&amp;gt={$GALLERY_TITLE|@replace:'"':' '}" title="{'Upload photo on Facebook'|@translate}" rel="nofollow" onclick="window.open(this.href, 'Facebook','width=550,height=350,location=no,status=no,toolbar=no,scrollbars=no,menubar=no'); return false;"><img src="{$FBP_PATH|@cat:'/icon/upload.png'}" class="button" alt="{'Share on Facebook'|@translate}"></a> 
     31{/if} {* $fbp.upload_picture  and $FBP_SCRIPT_BASENAME == 'picture' *} 
     32{* --------------------------------------------------------------------------- *} 
  • extensions/FacebookPlug/Plugin/tpl/init.fb.tpl

    r8435 r8440  
    2020<meta property="og:site_name" content="{if isset($fbp_page.og.site_name)}{$fbp_page.og.site_name|@replace:'"':' '}{else}{$GALLERY_TITLE|@replace:'"':' '}{/if}"> 
    2121<meta property="og:type" content="{if isset($fbp_page.og.type)}{$fbp_page.og.type}{else}article{/if}"> 
    22 <meta property="og:image" content="{if isset($fbp_page.og.url_image)}{$fbp_page.og.url_image}{else}{$fbp_page.url_image}{/if}"> 
     22<meta property="og:image" content="{if isset($fbp_page.og.image)}{$fbp_page.og.image}{else}{$fbp_page.url_thumbnail_image}{/if}"> 
    2323<meta property="og:url" content="{if isset($fbp_page.og.url)}{$fbp_page.og.url}"{else}{$fbp_page.url}{/if}"> 
    2424<meta property="fb:app_id" content="{if isset($fbp_page.og.app_id)}{$fbp_page.og.app_id}{else}{$FACEBOOK_APP_ID}{/if}"> 
Note: See TracChangeset for help on using the changeset viewer.