本文整理汇总了PHP中JFBCFactory类的典型用法代码示例。如果您正苦于以下问题:PHP JFBCFactory类的具体用法?PHP JFBCFactory怎么用?PHP JFBCFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JFBCFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$user = JFactory::getUser();
$providers = JFBCFactory::getAllProviders();
$providerData = array();
foreach ($providers as $provider) {
if ($provider->appId && $provider->secretKey) {
$userModel = JFBConnectModelUserMap::getUser($user->get('id'), $provider->systemName);
$userData = $userModel->getData();
$providerInfo = new stdClass();
$providerInfo->profileUrl = $userData->params->get('data.profile_url');
if (empty($providerInfo->profileUrl)) {
//JOOMLA 2.5
$providerInfo->profileUrl = $userData->params->get('profile_url');
}
$providerInfo->isMapped = $userData->provider != null;
$providerInfo->name = $provider->name;
$providerInfo->provider = $provider;
$providerInfo->systemName = $provider->systemName;
$providerData[$provider->name] = $providerInfo;
}
}
$this->providerData = $providerData;
JFBCFactory::addStylesheet('jfbconnect.css');
parent::display($tpl);
}
示例2: setupAuthentication
function setupAuthentication()
{
$options = new JRegistry();
$options->set('authurl', 'https://api.instagram.com/oauth/authorize');
$options->set('tokenurl', 'https://api.instagram.com/oauth/access_token');
$options->set('authmethod', 'get');
$headers = array();
$headers['Content-Type'] = 'application/json';
$options->set('headers', $headers);
$options->set('scope', '');
$this->client = new JFBConnectAuthenticationOauth2($options);
$token = JFactory::getApplication()->getUserState('com_jfbconnect.' . strtolower($this->name) . '.token', null);
if ($token) {
$token = (array) json_decode($token);
$this->client->setToken($token);
}
$this->client->initialize($this);
// Need to override the callback URL to force http or https
$origRedirect = $this->client->getOption('redirecturi');
if (JFBCFactory::config()->get('instagram_callback_ssl')) {
$redirect = str_replace('http://', 'https://', $origRedirect);
} else {
$redirect = str_replace('https://', 'http://', $origRedirect);
}
$this->client->setOption('redirecturi', $redirect);
}
示例3: getFeed
function getFeed()
{
$feedHtml = JFBCFactory::cache()->get('sourcecoast.rss');
if ($feedHtml === false) {
$curl = curl_init();
curl_setopt_array($curl, array(CURLOPT_URL => 'http://feeds.sourcecoast.com/sourcecoast-blog', CURLOPT_USERAGENT => 'spider', CURLOPT_TIMEOUT => 120, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_ENCODING => 'UTF-8'));
$data = curl_exec($curl);
$errorCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($data && !empty($data) && $errorCode == 200) {
$xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($xml) {
$feedHtml = '<h4>Recent News from SourceCoast</h4>';
for ($i = 0; $i < 4; $i++) {
if (isset($xml->channel->item[$i])) {
$item = $xml->channel->item[$i];
$date = JFactory::getDate($item->pubDate);
$dateStr = $date->format(JText::_('DATE_FORMAT_LC4'));
$feedHtml .= '<p><a href="' . $item->link . '">' . $item->title . '</a> <span><em>' . $dateStr . '</em></span></p>';
}
}
}
}
JFBCFactory::cache()->store($feedHtml, 'sourcecoast.rss');
}
return $feedHtml;
}
示例4: save
function save($data)
{
$oldData = array();
if ($data['id'] > 0) {
$table = $this->getTable();
$table->load($data['id']);
$oldData['id'] = $table->id;
$oldData['provider'] = $table->provider;
$oldData['type'] = $table->type;
$oldData['attribs'] = (array) $table->attribs;
}
// Set the dates
$date = JFactory::getDate();
if ($data['id'] == 0) {
$data['created'] = $date->toSql();
}
$data['modified'] = $date->toSql();
if ($data['provider'] != '--' && $data['type'] != '--') {
$channel = JFBCFactory::provider($data['provider'])->channel($data['type']);
$data = $channel->onBeforeSave($data);
// Manipulate the data however may be necessary
}
$return = parent::save($data);
// Used to removed permissions from users that aren't associated with this channel (or anything else needed for cleanup)
if ($return && $data['provider'] != '--' && $data['type'] != '--') {
$data['id'] = $this->getState('channel.id');
$channel->onAfterSave($data, $oldData);
}
return $return;
}
示例5: onAfterDispatch
public function onAfterDispatch()
{
if ($this->enabled) {
$path = JPATH_SITE . '/components/com_jfbconnect/libraries/toolbar/button/';
$files = JFolder::files($path, '\\.php$');
// Probably need to add some way to order these things..
foreach ($files as $f) {
$class = 'JFBConnectToolbarButton' . ucfirst(str_replace('.php', '', $f));
if (class_exists($class)) {
$obj = new $class();
$this->buttons[$obj->order] = $obj;
}
}
ksort($this->buttons);
$doc = JFactory::getDocument();
JFBCFactory::addStylesheet('jfbconnect.css');
if (JFBCFactory::config()->get('facebook_display_errors')) {
// $doc->addScript('media/sourcecoast/js/jquery-ui.js');
$doc->addStyleSheet('media/sourcecoast/css/jquery-ui/jquery-ui.css');
} else {
// $doc->addScript('media/sourcecoast/js/jquery-ui.min.js');
$doc->addStyleSheet('media/sourcecoast/css/jquery-ui/jquery-ui.min.css');
}
}
}
示例6: apply
function apply()
{
$app = JFactory::getApplication();
$configs = JRequest::get('POST');
$model = JFBCFactory::config();
JPluginHelper::importPlugin('socialprofiles');
$profilePlugins = $app->triggerEvent('socialProfilesGetPlugins');
foreach ($profilePlugins as $plugin) {
$pluginName = $plugin->getName();
$settings = new JRegistry();
$search = "profiles_" . $pluginName . "_";
$stdFields = JRequest::getVar('profiles_' . $pluginName);
$settings->loadArray($stdFields);
foreach ($configs as $key => $value) {
$pos = strpos($key, $search);
if ($pos === 0) {
$key = str_replace($search, "", $key);
if (strpos($key, "field_map") != false) {
$key = str_replace("_field_map", ".", $key);
$settings->set('field_map.' . $key, $value);
}
}
}
$model->update("profile_" . $pluginName, $settings->toString());
}
JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_SETTINGS_UPDATED'));
$this->display();
}
示例7: display
function display($tpl = null)
{
$configModel = JFBCFactory::config();
if ($this->getLayout() == 'fbapp') {
$appConfig = $this->get('mergedRecommendations');
$this->assignRef('appConfig', $appConfig);
$appConfigUpdated = $configModel->getUpdatedDate('autotune_app_config');
$fieldsUpdated = $configModel->getUpdatedDate('autotune_field_descriptors');
$this->assignRef('appConfigUpdated', $appConfigUpdated);
$this->assignRef('fieldsUpdated', $fieldsUpdated);
$subscriberId = $configModel->getSetting('sc_download_id', 'No ID Set!');
$this->assignRef('subscriberId', $subscriberId);
}
$this->assignRef('config', $configModel);
$this->addToolbar();
parent::display($tpl);
$atModel = $this->getModel('autotune');
$subStatus = $atModel->getSubscriptionStatus();
if ($subStatus) {
$subStatus = $subStatus->messages;
$this->assignRef('subStatus', $subStatus);
$subStatusUpdated = $configModel->getUpdatedDate('autotune_authorization');
$subStatusUpdated = strftime("%Y/%m/%d", strtotime($subStatusUpdated));
$this->assignRef('subStatusUpdated', $subStatusUpdated);
include 'tmpl/subscription_status.php';
}
}
示例8: getInput
protected function getInput()
{
$html = array();
$provider = $this->element['provider'] ? (string) $this->element['provider'] : null;
$style = $this->element['style'] ? (string) $this->element['style'] . '"' : '';
// Initialize some field attributes.
$class = !empty($this->class) ? ' class="radio ' . $this->class . '"' : ' class="radio"';
$required = $this->required ? ' required aria-required="true"' : '';
$autofocus = $this->autofocus ? ' autofocus' : '';
$disabled = $this->disabled ? ' disabled' : '';
$readonly = $this->readonly;
$style = 'style="float:left;' . $style . '"';
$html[] = '<div style="clear: both"> </div>';
// Start the radio field output.
$html[] = '<fieldset id="' . $this->id . '"' . $class . $required . $autofocus . $disabled . $style . ' >';
// Get the field options.
$options = $this->getOptions();
$p = JFBCFactory::provider($provider);
// Build the radio field output.
$html[] = '<label class="providername">' . $p->name . '</label>';
foreach ($options as $i => $option) {
// Initialize some option attributes.
$checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : '';
$class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
$disabled = !empty($option->disable) || $readonly && !$checked;
$disabled = $disabled ? ' disabled' : '';
$html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '" value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $required . $disabled . ' />';
$html[] = '<label for="' . $this->id . $i . '"' . $class . ' >' . '<img src="' . JUri::root() . 'media/sourcecoast/images/provider/' . $provider . '/' . $option->value . '" />' . '</label>' . ($required = '');
}
// End the radio field output.
$html[] = '</fieldset>';
$html[] = '<div style="clear: both"> </div>';
return implode($html);
}
示例9: requestSent
function requestSent()
{
$jfbcRequestId = JRequest::getInt('jfbcId');
$fbRequestId = JRequest::getString('requestId');
$inToList = JRequest::getVar('to');
// Get the from user id from the request
$to = $inToList[0];
$requestInfo = JFBCFactory::provider('facebook')->api('/' . $fbRequestId . "_" . $to);
$fbFrom = $requestInfo['from']['id'];
// Not using the model, as we're doing a simple store.
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jfbconnect/tables');
$data = array();
$data['fb_request_id'] = $fbRequestId;
$data['fb_user_from'] = $fbFrom;
$data['jfbc_request_id'] = $jfbcRequestId;
$data['created'] = JFactory::getDate()->toSql();
$data['modified'] = null;
// $data['destination_url'] = JRequest::getString('destinationUrl');
foreach ($inToList as $fbTo) {
$row =& JTable::getInstance('JFBConnectNotification', 'Table');
$to = JFilterInput::clean($fbTo, 'ALNUM');
$data['fb_user_to'] = $to;
$row->save($data);
$point = new JFBConnectPoint();
$point->set('name', 'facebook.request.create');
$point->set('key', $to);
$point->award();
}
$app = JFactory::getApplication();
$app->close();
}
示例10: getInput
function getInput()
{
$jid = $this->form->getValue('attribs.user_id');
if ($jid) {
$uid = JFBCFactory::usermap()->getProviderUserId($jid, 'linkedin');
if ($uid) {
$access_token = JFBCFactory::usermap()->getUserAccessToken($jid, 'linkedin');
$params['access_token'] = $access_token;
$liLibrary = JFBCFactory::provider('linkedin');
$liLibrary->client->setToken((array) $access_token);
$url = 'https://api.linkedin.com/v1/companies/?is-company-admin=true&start=0&count=20';
try {
$companies = $liLibrary->client->query($url);
if ($companies->code == '200') {
$this->companies = json_decode($companies->body);
}
return parent::getInput();
} catch (Exception $e) {
return '<div class="jfbc-error">' . JText::_('COM_JFBCONNECT_CHANNEL_LINKEDIN_PERM_TOKEN_EXPIRED_LABEL') . '</div>';
}
} else {
return '<div class="jfbc-error">' . JText::_('COM_JFBCONNECT_CHANNEL_LINKEDIN_PERM_USER_AUTH_ERROR_LABEL') . '</div>';
}
} else {
return '<div class="jfbc-error">' . JText::_('COM_JFBCONNECT_CHANNEL_SELECT_USER_ERROR_LABEL') . '</div>';
}
}
示例11: register
public function register($data = null)
{
//require_once (JPATH_COMPONENT.'/libraries/profile.php');
$mainframe = JFactory::getApplication();
$my = CFactory::getUser();
$config = CFactory::getConfig();
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::_('COM_COMMUNITY_REGISTER_NEW'));
// Hide this form for logged in user
if ($my->id) {
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_REGISTER_ALREADY_USER'), 'warning');
return;
}
// If user registration is not allowed, show 403 not authorized.
$usersConfig = JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration') == '0') {
//show warning message
$this->addWarning(JText::_('COM_COMMUNITY_REGISTRATION_DISABLED'));
return;
}
$fields = array();
$post = JRequest::get('post');
$isUseFirstLastName = CUserHelper::isUseFirstLastName();
$data = array();
$data['fields'] = $fields;
$data['html_field']['jsname'] = empty($post['jsname']) ? '' : $post['jsname'];
$data['html_field']['jsusername'] = empty($post['jsusername']) ? '' : $post['jsusername'];
$data['html_field']['jsemail'] = empty($post['jsemail']) ? '' : $post['jsemail'];
$data['html_field']['jsfirstname'] = empty($post['jsfirstname']) ? '' : $post['jsfirstname'];
$data['html_field']['jslastname'] = empty($post['jslastname']) ? '' : $post['jslastname'];
// $js = 'assets/validate-1.5.min.js';
// CFactory::attach($js, 'js');
$recaptcha = new CRecaptchaHelper();
$recaptchaHTML = $recaptcha->html();
$fbHtml = '';
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) {
//CFactory::load( 'libraries' , 'facebook' );
$facebook = new CFacebook();
$fbHtml = $facebook->getLoginHTML();
}
if ($config->get('usejfbc')) {
if (class_exists('JFBCFactory')) {
$providers = JFBCFactory::getAllProviders();
foreach ($providers as $p) {
$fbHtml .= $p->loginButton();
}
}
}
$tmpl = new CTemplate();
$content = $tmpl->set('data', $data)->set('recaptchaHTML', $recaptchaHTML)->set('config', $config)->set('isUseFirstLastName', $isUseFirstLastName)->set('fbHtml', $fbHtml)->fetch('register/base');
$appsLib = CAppPlugins::getInstance();
$appsLib->loadApplications();
$args = array(&$content);
$appsLib->triggerEvent('onUserRegisterFormDisplay', $args);
echo $this->_getProgressBar(1);
echo $content;
}
示例12: __construct
public function __construct($options = array())
{
$this->debug = intval(JFBCFactory::config()->get('facebook_display_errors'));
$this->text_file = isset($options['text_file']) ? $options['text_file'] : $this->text_file;
if ($this->debug) {
JLog::addLogger(array('text_file' => $this->text_file), JLog::ALL, 'jfbconnect');
}
}
示例13: apply
function apply()
{
$configs = JRequest::get('POST', 4);
$model = $this->getModel('config');
$model->saveSettings($configs);
JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_SETTINGS_UPDATED'));
$this->setRedirect('index.php?option=com_jfbconnect&view=social');
}
示例14: __construct
public function __construct()
{
$this->cache = JFactory::getCache('com_jfbconnect', '');
// Only enable caching if Debug Mode is off
$debug = JFBCFactory::config()->get('facebook_display_errors');
$cacheTimeout = JFBCFactory::config()->get('cache_duration');
$this->cache->setCaching(!$debug && $cacheTimeout != 0);
$this->cache->setLifeTime($cacheTimeout);
}
示例15: importConnections
function importConnections()
{
$app = JFactory::getApplication();
JPluginHelper::importPlugin('socialprofiles');
$profilePlugins = $app->triggerEvent('jfbcImportConnections');
$msg = JText::_('COM_JFBCONNECT_MSG_IMPORT_SUCCESS');
JFBCFactory::log($msg);
$this->display();
}