예제 #1
0
 function onFacebookPage($page, &$class)
 {
     global $mainframe;
     $class->addMenu('profile', JText::_('PROFILE'), 'profile', 'right', 5);
     JPluginHelper::importPlugin('facebook');
     $content = '';
     if ($page == 'profile') {
         $facebook =& JoomlaFacebook::getFacebookPlatform();
         $facebook->require_install();
         if (JRequest::getVar('action') == 'save' || JRequest::getVar('action') == 'update') {
             $error = '';
             if (JRequest::getVar('action') == 'save') {
                 $fbml = '<p style="text-align:right"><a href="http://apps.facebook.com/' . JoomlaFacebook::getAppname() . '/profile&action=update">Update Profile Box</a></p>';
                 $fbml .= $this->_params->get('header');
                 $mainframe->triggerEvent('onFacebookSaveForm', array(&$fbml, &$error));
                 $fbml .= $this->_params->get('footer');
                 $facebook->api_client->profile_setFBML($fbml, $facebook->require_login());
             }
             $mainframe->triggerEvent('onFacebookUpdate', array(&$error));
             if ($error != '') {
                 $content .= '<fb:error><fb:message>' . JText::_('UPDATEERROR') . '</fb:message> ' . $error . '</fb:error>';
             } else {
                 $content .= '<fb:success message="' . JText::_('UPDATESUCCESS') . '" /> ';
             }
         }
         $content .= '<h1>' . JText::_('PROFILESETTING') . '</h1><fb:editor action="profile" labelwidth="100">  ';
         $mainframe->triggerEvent('onFacebookConfigForm', array(&$content));
         $content .= '<br/><fb:editor-custom><input type="hidden" name="action" value="save"/></fb:editor-custom><fb:editor-buttonset><fb:editor-button value="' . JText::_('APPLY') . '"/><fb:editor-cancel href="" /></fb:editor-buttonset></fb:editor>';
         $class->addContent($content, 0);
     }
     return true;
 }
예제 #2
0
 function onFacebookPage($page, &$class)
 {
     global $mainframe;
     $facebook =& JoomlaFacebook::getFacebookPlatform();
     $class->addMenu('invite', JText::_('INVITE'), 'invite', 'right', 10);
     $invitetext = $this->_params->get('invitetext', '');
     $invitetext .= '<fb:req-choice url="http://apps.facebook.com/"' . JoomlaFacebook::getAppname() . ' label=' . JText::_('VISITSITE') . '>';
     $invitetext = str_replace('SITENAME', $mainframe->getCfg('sitename'), $invitetext);
     if ($page == 'invite') {
         $class->addContent('<fb:request-form method="post" content="' . htmlentities($invitetext) . '" type="' . htmlentities($mainframe->getCfg('sitename')) . '" invite="false" action="http://app.facebook.com/joomlatest"><fb:multi-friend-selector actiontext="' . JText::_('INVITETITLE') . '" bypass="******"/></fb:request-form>', 0);
     }
     return true;
 }
 function onFacebookUpdate($error)
 {
     $facebook =& JoomlaFacebook::getFacebookPlatform();
     $db =& JFactory::getDBO();
     $query = 'SELECT id,title,created FROM #__content ORDER BY created DESC LIMIT 0,' . $this->_params->get('num', 10);
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $config =& JFactory::getConfig();
     $n = 0;
     foreach ($result as $record) {
         $facebook->api_client->fbml_setRefHandle('content-' . $n, '<a href="' . JURI::base() . '/index.php?option=com_content&id=' . $record->id . '">' . $record->title . '</a> (Created on' . $record->created . ')');
         $n++;
     }
     return true;
 }