Yii Framework Forum: [extension] faceplugs - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

[extension] faceplugs Rate Topic: -----

#1 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 25 January 2011 - 12:42 PM

This topic is to discuss things related to the faceplugs extension
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
1

#2 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 25 January 2011 - 12:50 PM

I just added an modification and would be nice to add it to the official extension

php's magic method to set init properties, in case you want to turn off cookies or something like that
	function __set($name,$value){
    	if(isset($this->init[$name]))
        	$this->init[$name]=$value;
    	else
        	throw new CException('Invalid init property : ' . $name);
	}
	function __get($name){
    	if(isset($this->init[$name]))
        	return $this->init[$name];
    	else
        	throw new CException('Invalid init property : ' . $name);
	}

--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#3 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 25 January 2011 - 02:01 PM

The init properties can be changed by passing in an array to replace the defaults.

However, I can see how this is annoying when only one variable needs to be changed.

I will modify the extension to allow easier manipulation of the init variables.

Thank you for your insight.
0

#4 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 25 January 2011 - 06:46 PM

Thanks I will contribute with more time, since I'll be using it
specially the login/register part
Once I do more I'll post it here

Anyway, thanks for the extension very helpful and well coded
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#5 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 26 January 2011 - 05:48 AM

I've just added the registration plugin and made it easier to change the init properties. Looking forward to your contributions :-)
0

#6 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 26 January 2011 - 08:51 AM

Its missing a 'div' close tag which messes up the layout in efaceplugsbase
function run line 115 :
echo CHtml::tag('div', array('id' => 'fb-root'));

there's no close tag for it
after
Yii::app()->params->fbRootSet = true;
add
echo CHtml::closeTag('div'); 


btw good job on the new features, Thanks!
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#7 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 27 January 2011 - 07:26 AM

OK, I will add an explicit close tag.

I'm working on adding asynchronous loading of the plugin and locale support, this will be released shortly.
0

#8 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 28 January 2011 - 10:39 AM

  • v 1.3 — 2011-01-28 :
    • Add asynchronous connection.
    • Add language support.
    • Add debugging option.
    • Add https support.
    • Allow init variables to be modified individually.
    • Better loading of init variables and JS.
    • Fixed div tag that was not closing

--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#9 User is offline   Alan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 14-December 10
  • Location:Tokyo, Japan

Posted 08 February 2011 - 10:37 PM

View PostGustavo, on 28 January 2011 - 10:39 AM, said:

  • v 1.3 — 2011-01-28 :
    • Add asynchronous connection.
    • Add language support.
    • Add debugging option.
    • Add https support.
    • Allow init variables to be modified individually.
    • Better loading of init variables and JS.
    • Fixed div tag that was not closing



Would you be able to show an example of the login code. I have tried this but not been able to make it work. I was able to make the like button work effectively.

thanks
0

#10 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 10 February 2011 - 12:01 PM

View PostAlan, on 08 February 2011 - 10:37 PM, said:

Would you be able to show an example of the login code. I have tried this but not been able to make it work. I was able to make the like button work effectively.

thanks


The login plugin requires the facebook application ID, do you have it set ?
0

#11 User is offline   Alan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 14-December 10
  • Location:Tokyo, Japan

Posted 10 February 2011 - 08:30 PM

View Postianaré, on 10 February 2011 - 12:01 PM, said:

The login plugin requires the facebook application ID, do you have it set ?


yes, I have the facebook appid set in config/main.php as

'params'=>array(		
      'fbAppId' => 'xxxxxxxxxxxxx'
)


and I have this for the widget in the view

$this->widget('ext.faceplugs.LoginButton', array(
		       'url' => $this->createAbsoluteUrl('/')		       
		    ));


The Login button shows on the screen, but it wont click to anywhere.
0

#12 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 11 February 2011 - 04:13 AM

That's really strange I have similar code and it will at least open up a popup window allowing login.

<?php $this->widget('ext.faceplugs.LoginButton'); ?>


Though passing the URL won't hurt, it's simply not used by the plugin.

Depending on app settings the originating page URL may not be valid but this should not stop it from allowing the user to log in.

Maybe there is something wrong with the code being generated, can you post the HTML / JS on the page ?

Mine looks like this :
<div id="fb-root"></div><fb:login-button></fb:login-button>

....

<script type="text/javascript">
/*<![CDATA[*/
window.fbAsyncInit = function(){FB.init({'status':true,'cookie':true,'xfbml':true,'appId':'xxxxxxxxxx'});};
				(function(){
				var e=document.createElement('script');
				e.async=true;
				e.src='http://connect.facebook.net/en_US/all.js';
				document.getElementById('fb-root').appendChild(e);}());
/*]]>*/
</script>

0

#13 User is offline   Alan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 14-December 10
  • Location:Tokyo, Japan

Posted 16 February 2011 - 09:17 AM

View Postianaré, on 11 February 2011 - 04:13 AM, said:

That's really strange I have similar code and it will at least open up a popup window allowing login.

<?php $this->widget('ext.faceplugs.LoginButton'); ?>


Though passing the URL won't hurt, it's simply not used by the plugin.

Depending on app settings the originating page URL may not be valid but this should not stop it from allowing the user to log in.

Maybe there is something wrong with the code being generated, can you post the HTML / JS on the page ?

Mine looks like this :
<div id="fb-root"></div><fb:login-button></fb:login-button>

....

<script type="text/javascript">
/*<![CDATA[*/
window.fbAsyncInit = function(){FB.init({'status':true,'cookie':true,'xfbml':true,'appId':'xxxxxxxxxx'});};
				(function(){
				var e=document.createElement('script');
				e.async=true;
				e.src='http://connect.facebook.net/en_US/all.js';
				document.getElementById('fb-root').appendChild(e);}());
/*]]>*/
</script>



I dont have any of that code showing at all. I downloaded the latest version update where you have a text error message in in the case of no app_id and found that was coming up.

In head, when relying on Param fbAppId
<meta property="og:app_id" />


button code showing after I declare app_id locally
<fb:login-button></fb:login-button>



I inserted the app_id into the widget and the error went away, but still the button is not clickable and I dont see the js call that you have here.

I have the fbAppId set in my parameters correctly, but I notice in the EFaceplugsBase.php file that the registerOpenGraph function is called in init() on line 244 before the $this->app_id has a chance to be checked for local declaration as app_id from the widget, or if not getting fbAppId from the parameter. This is happening inside run() on line 275 after the init() has been called.

'params'=>array(				
      'fbAppId' => 'XXXXXXXXXXX',
)


So the registerOpenGraph() which makes the meta tag for app_id is called before the parameter value is passed in.

Is this correct ?
0

#14 User is offline   jumamidin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-December 10

Posted 16 February 2011 - 10:20 AM

Hi ianare! Hi Gustavo!

Has any relation to the famous facebook.php with your extension.

How can I use it with db?

Where can I take user_id(from facebook to make my own userId) with your extension?

Which one have to I use <iframe> or js sdk?
What are difference of them?

Please, make me clear these!!!

Thanks!
0

#15 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 16 February 2011 - 10:53 AM

Hi Juma
The extension is just a PHP wrapper for all facebook plugins
It uses JS SDK, and SDK creates an iframe
more about the js sdk here http://developers.fa...nce/javascript/

the app_id you must get from http://www.facebook.com/developers/

a complete documentation of each plugin can be found here http://developers.fa...m/docs/plugins/
after you get an Id you can use all plugins, including the registration one that you are more interested

To use it with DB (I suppose you mean use registration plugin and save data to db), you must define a 'redirect_uri' and this url defined will receive json response from facebook, to save in db just json_decode the response and save in the database
more about the registration plugin and response here http://developers.fa...s/registration/

I think that will clarify things a bit for you
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

#16 User is offline   jumamidin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-December 10

Posted 24 February 2011 - 10:03 AM

View PostGustavo, on 16 February 2011 - 10:53 AM, said:

Hi Juma
The extension is just a PHP wrapper for all facebook plugins
It uses JS SDK, and SDK creates an iframe
more about the js sdk here http://developers.fa...nce/javascript/

the app_id you must get from http://www.facebook.com/developers/

a complete documentation of each plugin can be found here http://developers.fa...m/docs/plugins/
after you get an Id you can use all plugins, including the registration one that you are more interested

To use it with DB (I suppose you mean use registration plugin and save data to db), you must define a 'redirect_uri' and this url defined will receive and json response from facebook, to save in db just json_decode the response and save in the database
more about the registration plugin and response here http://developers.fa...s/registration/

I think that will clarify things a bit for you

0

#17 User is offline   jumamidin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-December 10

Posted 24 February 2011 - 10:03 AM

thanks, Gustavo!
0

#18 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 23 March 2011 - 12:26 PM

Sorry for taking so long to respond. A new version has been released which should fix this bug. Let me know ;-)

View PostAlan, on 16 February 2011 - 09:17 AM, said:

I dont have any of that code showing at all. I downloaded the latest version update where you have a text error message in in the case of no app_id and found that was coming up.

In head, when relying on Param fbAppId
<meta property="og:app_id" />


button code showing after I declare app_id locally
<fb:login-button></fb:login-button>



I inserted the app_id into the widget and the error went away, but still the button is not clickable and I dont see the js call that you have here.

I have the fbAppId set in my parameters correctly, but I notice in the EFaceplugsBase.php file that the registerOpenGraph function is called in init() on line 244 before the $this->app_id has a chance to be checked for local declaration as app_id from the widget, or if not getting fbAppId from the parameter. This is happening inside run() on line 275 after the init() has been called.

'params'=>array(				
      'fbAppId' => 'XXXXXXXXXXX',
)


So the registerOpenGraph() which makes the meta tag for app_id is called before the parameter value is passed in.

Is this correct ?

0

#19 User is offline   Majestic 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 138
  • Joined: 28-March 11
  • Location:Germany, Stuttgart

Posted 08 June 2011 - 11:12 AM

Hey guys, I'm sorry, but I just can't get this extension to work and can't figure out what the problem is.

I always get this error code:

CException

Objekt-Konfiguration muss ein Array sein, das ein "class"-Element beinhaltet.

C:\xampp\htdocs\test\protected\extensions\faceplugs\EFaceplugsBase.php(265)

253         if ($this->app_id) {
254             $this->registerOpenGraph('app_id', $this->app_id);
255         }
256 
257         foreach ($this->og as $type => $value) {
258             $this->registerOpenGraph($type, $value);
259         }
260     }
261 
262     public function run()
263     {
264         //run only once
265         if (!isset(Yii::app()->params->fbRootSet)) {
266             if ($this->debugMode === 'auto' && YII_DEBUG === true) {
267                 $this->debugMode = 'on';
268             }
269             if ($this->debugMode === 'on') {
270                 $this->scriptFile = 'static.ak.fbcdn.net/connect/en_US/core.debug.js';
271             }
272             else {
273                 $this->setScriptLocale();
274             }
275 
276             $protocol = 'http';
277             if (isset($_SERVER['HTTPS'])) {


I put the AppId in the config and in the view it looks like this:
$og = array(
    'title' => $model->translations[0]->title,
    'site_name' => 'Test',
    'description' => $model->translations[0]->description,
    'type' => 'website',
);

$this->widget('ext.faceplugs.LikeButton', array(
    'url' => $this->createAbsoluteUrl('/'),
    'og' => $og,
    'layout' => 'button_count',
    'action' => 'recommend',
    'colorscheme' => 'dark',
));


If I create a Like button directly I can get it to work ... anyone got an idea for this issue? would be awesome!
0

#20 User is offline   Gustavo 

  • Master Member
  • Yii
  • Group: Moderators
  • Posts: 916
  • Joined: 27-July 10
  • Location:Curitiba - Brasil

Posted 08 June 2011 - 11:55 AM

hey
this looks like a bug to me
try to change the line 265 from
if (!isset(Yii::app()->params->fbRootSet)) {

to
if (!isset(Yii::app()->params['fbRootSet'])) {


or there is some error in your params config
--
Extensions:
translate modue - module to handle translations
multiActiveRecord - db selection in models
redisCache - redis cache component
mpCpanel - interact with cpanel api
mUploadify - use uploadify uploader in your application

Gustavo Salomé Silva
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users