Changeset 8254


Ignore:
Timestamp:
12/23/10 15:57:51 (9 years ago)
Author:
rub
Message:

Use tpl instead of XFBML on php

Location:
extensions/FacebookPlug/Plugin
Files:
3 added
3 edited

Legend:

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

    r8250 r8254  
    4444      ( 
    4545        'enabled' => false, 
     46        'url' => 'http://www.facebook.com/Piwigo', 
    4647        'url_type' => 'page', 
    4748        'colorscheme' => 'dark', 
  • extensions/FacebookPlug/Plugin/include/picture.inc.php

    r8250 r8254  
    3232  $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" '; 
    3333 
    34   $content = preg_replace('#'.$search.'#', $replacement, $content); 
    35  
    36   // Piwigo init 
    37   if ($conf['fbp']['async_script']) 
    38   { 
    39     // async method 
    40     $fbp_content = ' 
    41 <div id="fb-root"></div> 
    42 <script> 
    43 {literal} 
    44   window.fbAsyncInit = function() {  
    45     FB.init({  
    46       appId  : \''.FACEBOOK_APP_ID.'\',  
    47       status : true, // check login status  
    48       cookie : true, // enable cookies to allow the server to access the session  
    49       xfbml  : true  // parse XFBML  
    50     });  
    51   };  
    52   (function() { 
    53     var e = document.createElement(\'script\'); 
    54   {/literal} 
    55     e.src = document.location.protocol + \'//connect.facebook.net/{$LANGUAGE}/all.js\'; 
    56 {literal} 
    57     e.async = true; 
    58     document.getElementById(\'fb-root\').appendChild(e); 
    59   }()); 
    60 {/literal} 
    61 </script> 
    62 '; 
    63   } 
    64   else 
    65   { 
    66     // sync method 
    67     $fbp_content = ' 
    68 <div id="fb-root"></div> 
    69 <script src="http://connect.facebook.net/en_US/all.js"></script> 
    70 <script> 
    71   FB.init({ldelim} 
    72     appId  : \''.FACEBOOK_APP_ID.'\', 
    73     status : true, // check login status 
    74     cookie : true, // enable cookies to allow the server to access the session 
    75     xfbml  : true  // parse XFBML 
    76  {rdelim}); 
    77 </script> 
    78 <script src="http://connect.facebook.net/{$LANGUAGE}/all.js#xfbml=1"></script> 
    79 '; 
    80   } 
     34  //~ $content = preg_replace('#'.$search.'#', $replacement, $content); 
     35  return preg_replace('#'.$search.'#', $replacement, $content); 
     36  //~ $fbp_content = file_get_contents(FBP_DIR.'/tpl/init.fb.tpl'); 
    8137 
    8238  $search = '<div id="the_page">'; 
     
    9046  // set prefilter 
    9147  $template->set_prefilter('header', 'fbp_header'); 
    92 } 
    9348 
    94 function fbp_bool2str($value) 
    95 { 
    96   return ($value ? 'true' : 'false'); 
     49  $template->assign('FACEBOOK_APP_ID', FACEBOOK_APP_ID); 
     50  // define language 
     51  $template->assign('LANGUAGE', $user['language']); 
     52  $template->assign('fbp', $conf['fbp']); 
     53  $template->smarty->register_modifier('boolean_to_string', 'boolean_to_string'); 
     54 
     55  $template->set_filename('init.fb', FBP_DIR.'/tpl/init.fb.tpl'); 
     56  $template->append('head_elements', $template->parse('init.fb', true)); 
    9757} 
    9858 
     
    10969  if ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_like_box']['enabled']) 
    11070  { 
    111     // define language 
    112     $template->assign('LANGUAGE', $user['language']); 
    11371    // define picture FB link 
    11472    // Always use full url for FB social plugin 
     
    12381    } 
    12482    unset_make_full_url(); 
    125     //~ $template->assign('FBP_URL_PICTURE', $fbp_url_picture); 
     83    $template->assign('fbp_url_picture', $fbp_url_picture); 
    12684    //~ $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BUTTON', $conf['fbp']['social_plugin_like_button']); 
    12785    //~ $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BOX', $conf['fbp']['social_plugin_like_box']); 
     
    13694    if ($conf['fbp']['social_plugin_like_button']['enabled']) 
    13795    { 
    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>'; 
     96      //~ $content .= ' 
     97//~ <div id="fb-xfbml"> 
     98//~ <fb:like href="'.$fbp_url_picture.'" layout="'.$conf['fbp']['social_plugin_like_button']['layout'].'" show_faces="'.boolean_to_string($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> 
     99//~ </div>'; 
     100      $template->set_filename('social.plugin.like.button', FBP_DIR.'/tpl/social.plugin.like.button.tpl'); 
     101      $content .= $template->parse('social.plugin.like.button', true); 
    142102    } 
    143103    if ($conf['fbp']['social_plugin_like_box']['enabled']) 
    144104    { 
    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>'; 
     105      //~ $content .= ' 
     106//~ <div id="fb-xfbml"> 
     107//~ <fb:like-box href="'.$fbp_url_picture.'" width="'.@$current_picture['scaled_width'].'" show_faces="'.boolean_to_string($conf['fbp']['social_plugin_like_box']['show_faces']).'" stream="'.boolean_to_string($conf['fbp']['social_plugin_like_box']['stream']).'" header="'.boolean_to_string($conf['fbp']['social_plugin_like_box']['header']).'"></fb:like-box> 
     108//~ </div>'; 
     109      $template->set_filename('social.plugin.like.box', FBP_DIR.'/tpl/social.plugin.like.box.tpl'); 
     110      $content .= $template->parse('social.plugin.like.box', true); 
    149111    } 
    150112 
  • extensions/FacebookPlug/Plugin/tpl/admin.config.tpl

    r8250 r8254  
    119119<fieldset> 
    120120  <ul> 
    121     <li> 
     121{*    <li> 
    122122      <label> 
    123123        <span class="property">{'Asynchronous Facebook access'|@translate}</span> 
     
    125125      </label> 
    126126    </li> 
    127  
     127*} 
    128128    <li> 
    129129      <label> 
Note: See TracChangeset for help on using the changeset viewer.