Changeset 8241 for extensions/FacebookPlug/Plugin
- Timestamp:
- Dec 23, 2010, 2:45:50 AM (14 years ago)
- Location:
- extensions/FacebookPlug/Plugin
- Files:
-
- 11 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/FacebookPlug/Plugin/include/picture.inc.php
r8221 r8241 24 24 } 25 25 26 function fbp_ AddSocial($content, &$smarty)26 function fbp_header($content, &$smarty) 27 27 { 28 // iframe implementation 29 /* $fbp_content = ' 30 <iframe src="http://www.facebook.com/plugins/like.php?href={$SRC_IMG}&layout=standard&show_faces=true&width={$WIDTH_IMG}&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$WIDTH_IMG}px; height:80px;" allowTransparency="true"></iframe> 31 ';*/ 28 global $conf; 32 29 33 // XFBML implementation 34 // async method 35 /* $fbp_content = ' 36 <div id="fb-root"></div> 30 // replace tag html 31 $search = '<html '; 32 $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" '; 33 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> 37 42 <script> 38 43 {literal} 39 44 window.fbAsyncInit = function() { 40 45 FB.init({ 41 appId : \' 111499825588662\',46 appId : \''.FACEBOOK_APP_ID.'\', 42 47 status : true, // check login status 43 48 cookie : true, // enable cookies to allow the server to access the session … … 55 60 {/literal} 56 61 </script> 57 ';*/ 58 // sync method 59 $fbp_content = ' 62 '; 63 } 64 else 65 { 66 // sync method 67 $fbp_content = ' 60 68 <div id="fb-root"></div> 61 69 <script src="http://connect.facebook.net/en_US/all.js"></script> 62 70 <script> 63 71 FB.init({ldelim} 64 appId : \' 111499825588662\',72 appId : \''.FACEBOOK_APP_ID.'\', 65 73 status : true, // check login status 66 74 cookie : true, // enable cookies to allow the server to access the session … … 70 78 <script src="http://connect.facebook.net/{$LANGUAGE}/all.js#xfbml=1"></script> 71 79 '; 80 } 81 82 $search = '<div id="the_page">'; 83 return preg_replace('#'.$search.'#', $fbp_content.$search, $content); 84 } 85 86 function fbp_add_social($content, &$smarty) 87 { 88 global $conf; 89 $fbp_content .= '<div id="fb-xfbml">'; 90 91 // iframe implementation 92 /* $fbp_content = ' 93 <iframe src="http://www.facebook.com/plugins/like.php?href={$SRC_IMG}&layout=standard&show_faces=true&width={$WIDTH_IMG}&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$WIDTH_IMG}px; height:80px;" allowTransparency="true"></iframe> 94 ';*/ 95 96 // XFBML implementation 72 97 /*$fbp_content .= ' 73 98 <fb:like href="{$SRC_IMG}" show_faces="true" width="{$WIDTH_IMG}"></fb:like> 74 99 ';*/ 75 100 $fbp_content .= ' 76 <fb:like href="{$FBP_URL_PICTURE}" show_faces="true" width="{$WIDTH_IMG}"></fb:like>101 <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> 77 102 '; 103 104 $fbp_content .= '</div>'; 78 105 79 106 return $content.$fbp_content; … … 82 109 function fbp_loc_begin_picture() 83 110 { 84 global $template, $user, $page ;111 global $template, $user, $page, $conf, $picture; 85 112 86 113 // set prefilter 87 114 $template->set_prefilter('header', 'fbp_header'); 88 $template->set_prefilter('default_content', 'fbp_AddSocial'); 89 // Always use full url for FB social plugin 90 //~ set_make_full_url(); 91 // define language 92 $template->assign('LANGUAGE', $user['language']); 93 // define picture FB link 94 set_make_full_url(); 95 $template->assign('FBP_URL_PICTURE', make_picture_url(array('image_id' => $page['image_id']))); 96 unset_make_full_url(); 115 //~ $template->set_prefilter('header', 'fbp_add_fb_init'); 116 if ($conf['fbp']['social_plugin_like_button']['enabled']) 117 { 118 $template->set_prefilter('default_content', 'fbp_add_social'); 119 } 97 120 } 98 121 99 function fbp_loc_end_picture() 122 //~ function fbp_loc_end_picture() 123 function fbp_render_element_content($content, $current_picture) 100 124 { 101 // Restore url 102 //~ unset_make_full_url(); 125 global $template, $user, $page, $conf, $picture; 126 127 if ($conf['fbp']['social_plugin_like_button']['enabled']) 128 { 129 //~ $template->set_prefilter('default_content', 'fbp_add_social'); 130 // Always use full url for FB social plugin 131 //~ set_make_full_url(); 132 // define language 133 $template->assign('LANGUAGE', $user['language']); 134 // define picture FB link 135 set_make_full_url(); 136 if ($conf['fbp']['social_plugin_like_button']['url_type'] == 'image') 137 { 138 $fbp_url_picture = get_element_url($picture['current']); 139 } 140 else 141 { 142 $fbp_url_picture = make_picture_url(array('image_id' => $page['image_id'])); 143 } 144 unset_make_full_url(); 145 $template->assign('FBP_URL_PICTURE', $fbp_url_picture); 146 $template->assign('FBP_SOCIAL_PLUGIN_LIKE_BUTTON', $conf['fbp']['social_plugin_like_button']); 147 } 148 return $content; 103 149 } 104 105 function fbp_header($content, &$smarty)106 {107 $search = '#<html #';108 109 $replacement = '<html xmlns:fb="http://www.facebook.com/2008/fbml" ';110 111 return preg_replace($search, $replacement, $content);112 }113 114 add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture');115 add_event_handler('loc_end_picture', 'fbp_loc_end_picture');116 117 150 118 151 function ftp_loc_end_section_init() 119 152 { 120 global $conf , $user, $page;153 global $conf; 121 154 122 $fbp_ip_check = '66.220.'; 123 //~ $fbp_ip_check = '127.0.'; 124 // No restristion for facebook user 125 if (preg_match('/'. $fbp_ip_check . '/', $_SERVER["REMOTE_ADDR"])) 155 if ($conf['fbp']['social_plugin_like_button']['enabled']) 126 156 { 127 //Allow guest access 128 $conf['guest_access'] = true; 129 // No forbidden categorie 130 $user['forbidden_categories'] = ''; 131 $user['level'] = max($conf['available_permission_levels']); 132 $page['rank_of'][$page['image_id']] = 0; 133 $page['items'] = array_flip($page['rank_of']); 157 if ($conf['fbp']['allow_fb_access_private_page']) 158 { 159 global $user, $page; 160 161 // No restristion for facebook user 162 if (preg_match('/'.FBP_IP_FB. '/', $_SERVER["REMOTE_ADDR"])) 163 { 164 //Allow guest access 165 $conf['guest_access'] = true; 166 // No forbidden categorie 167 $user['forbidden_categories'] = ''; 168 $user['level'] = max($conf['available_permission_levels']); 169 $page['rank_of'][$page['image_id']] = 0; 170 $page['items'] = array_flip($page['rank_of']); 171 } 172 } 134 173 } 135 174 } 136 add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init'); 175 176 if ($conf['fbp']['social_plugin_like_button']['enabled']) 177 { 178 add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture'); 179 add_event_handler('render_element_content', 'fbp_render_element_content', null, 2); 180 //~ add_event_handler('loc_end_picture', 'fbp_loc_end_picture'); 181 add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init'); 182 } 137 183 138 184 ?> -
extensions/FacebookPlug/Plugin/main.inc.php
r8213 r8241 33 33 } 34 34 35 global $conf;36 37 $conf['fbp'] = unserialize($conf['fbp']);38 39 35 if (script_basename() == 'picture') 40 36 { 41 include_once(dirname(__FILE__).'/picture.inc.php'); 37 include_once(dirname(__FILE__).'/include/common.inc.php'); 38 include_once(FBP_DIR.'/include/picture.inc.php'); 42 39 } 43 40 else 44 41 if (script_basename() == 'admin') 45 42 { 46 //~ include_once(dirname(__FILE__).'/admin.inc.php'); 43 include_once(dirname(__FILE__).'/include/common.inc.php'); 44 include_once(FBP_DIR.'/include/admin.inc.php'); 47 45 } 48 46 -
extensions/FacebookPlug/Plugin/maintain.inc.php
r8215 r8241 32 32 ( 33 33 \'fbp\', 34 \''.serialize(array( 'implementation_type' => 'XFBML')).'\',34 \''.serialize(array()).'\', 35 35 \'Parameters of "FacebookPlug" plugin\' 36 36 )
Note: See TracChangeset
for help on using the changeset viewer.