本文整理汇总了PHP中JFBCFactory::provider方法的典型用法代码示例。如果您正苦于以下问题:PHP JFBCFactory::provider方法的具体用法?PHP JFBCFactory::provider怎么用?PHP JFBCFactory::provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFBCFactory
的用法示例。
在下文中一共展示了JFBCFactory::provider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: display
function display($tpl = null)
{
$model = JFBCFactory::config();
$jfbcLibrary = JFBCFactory::provider('facebook');
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/models');
$templatesModel = JModelLegacy::getInstance('Styles', 'TemplatesModel');
$allTemplates = $templatesModel->getItems();
$templates = array();
foreach ($allTemplates as $template) {
if ($template->client_id == 0) {
// Make it the same as J15 so we can use the same selectlist
$template->directory = $template->id;
$template->name = $template->title;
$templates[] = $template;
}
}
// Add the "Don't Override" option to set no special template
$defaultTemplate = new stdClass();
$defaultTemplate->directory = -1;
$defaultTemplate->name = JText::_('COM_JFBCONNECT_CANVAS_DISPLAY_TEMPLATE_DEFAULT');
array_unshift($templates, $defaultTemplate);
require_once JPATH_ADMINISTRATOR . '/components/com_jfbconnect/controllers/canvas.php';
$canvasProperties = JFBConnectControllerCanvas::setupCanvasProperties();
$canvasTabTemplate = $model->getSetting('canvas_tab_template', -1);
$canvasCanvasTemplate = $model->getSetting('canvas_canvas_template', -1);
$this->assignRef('canvasProperties', $canvasProperties);
$this->assignRef('canvasTabTemplate', $canvasTabTemplate);
$this->assignRef('canvasCanvasTemplate', $canvasCanvasTemplate);
$this->assignRef('templates', $templates);
$this->assignRef('model', $model);
$this->assignRef('jfbcLibrary', $jfbcLibrary);
$this->addToolbar();
parent::display($tpl);
}
示例3: 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>';
}
}
示例4: 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();
}
示例5: 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);
}
示例6: post
public function post()
{
$app = JFactory::getApplication();
//$type = $app->input->get('type','story','STRING');
$provider_nm = $app->input->get('provider', 'facebook', 'CMD');
$user_id = $app->input->get('user_id', 0, 'INT');
$tokan = $app->input->get('tokan', 0, 'RAW');
$email = $app->input->get('email', '', 'STRING');
$password = $app->input->get('password', '', 'STRING');
//$log_usr = $this->plugin->get('user')->id;
$provider = JFBCFactory::provider($provider_nm);
$provider->client->authenticate();
$loginRegisterModel = JFBCFactory::model('LoginRegister');
//$user = jFactory::getUser(161);
$provider->setSessionToken();
$provider->client->setExtendedAccessToken();
//$provider_obj->client->getUser();
$provider->onBeforeLogin();
$config = JFactory::getConfig();
$lifetime = $config->get('lifetime', 15);
setcookie('jfbconnect_autologin_disable', 1, time() + $lifetime * 60);
$providerUserId = $provider->getProviderUserId();
$userMapModel = JFBCFactory::usermap();
$jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
$jUserEmailId = $userMapModel->getJoomlaUserIdFromEmail($email);
//get temp id
if ($jUserEmailId) {
$providerUserId = $userMapModel->getProviderUserId($jUserEmailId, strtolower($provider->name));
$jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
} else {
if (!$jUserEmailId && JFBCFactory::config()->getSetting('automatic_registration')) {
//# User is not in system, should create their account automatically
//$jUserEmailId = $userMapModel->getJoomlaUserIdFromEmail($email);
if (!$jUserEmailId) {
$pdata = array();
$pdata['email'] = $email;
$pdata['password'] = $password;
$fbuser = $loginRegisterModel->createNewUser($provider);
}
if ($loginRegisterModel->autoCreateUser($providerUserId, $provider)) {
$jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
}
}
}
$jUser = JUser::getInstance($jUserId);
$loginSuccess = false;
// Try to log the user, but not if blocked and initial registration (then there will be a pretty message on how to activate)
if (!$provider->initialRegistration || $jUser->get('block') == 0 && $provider->initialRegistration) {
$options = array('silent' => 1, 'provider' => $provider, 'provider_user_id' => $providerUserId);
// Disable other authentication messages
// hack for J3.2.0 bug. Should remove after 3.2.1 is available.
$password = $provider->secretKey;
$loginSuccess = $app->login(array('username' => $provider->appId, 'password' => $password), $options);
}
$this->plugin->setResponse($jUser);
}
示例7: getProvider
private function getProvider()
{
$input = JFactory::getApplication()->input;
$provider = $input->getCmd('provider', null);
if ($provider) {
return JFBCFactory::provider($provider);
}
// No provider given, not a real call. Redirect to home
$this->setRedirect('index.php');
}
示例8: onUserLogout
function onUserLogout($user, $options = array())
{
// Disable auto-logins for session length after a logout. Prevents auto-logins
$config = JFactory::getConfig();
$lifetime = $config->get('lifetime', 15);
setcookie('jfbconnect_autologin_disable', 1, time() + $lifetime * 60);
setcookie('jfbconnect_permissions_granted', '', time() - 10000, "/");
// clear the granted permissions cookie
// Tell Facebook to delete session information stored for this user.
JFBCFactory::provider('facebook')->client->destroySession();
return true;
}
示例9: canPublish
public function canPublish($data)
{
$canPublish = false;
$jid = $data['attribs']['user_id'];
if ($jid) {
$uid = JFBCFactory::usermap()->getProviderUserId($jid, 'facebook');
if ($uid && isset($data['attribs']['page_id']) && $data['attribs']['page_id'] != '--' && JFBCFactory::provider('facebook')->hasScope($uid, 'manage_pages') && (JFBCFactory::provider('facebook')->hasScope($uid, 'publish_actions') || !$data['attribs']['allow_posts'])) {
$canPublish = true;
}
}
return $canPublish;
}
示例10: setupCanvasProperties
public static function setupCanvasProperties()
{
$jfbcLibrary = JFBCFactory::provider('facebook');
$canvasProperties = new JObject();
$appId = $jfbcLibrary->appId;
if ($appId) {
$params = "?fields=canvas_url,secure_canvas_url,page_tab_default_name,page_tab_url,secure_page_tab_url,namespace,website_url,canvas_fluid_height,canvas_fluid_width";
$appProps = $jfbcLibrary->api($appId . $params, null, FALSE);
$canvasProperties->setProperties($appProps);
}
return $canvasProperties;
}
示例11: places
public function places()
{
JSession::checkToken('get') or die;
$search = JRequest::getString('q', '');
$params = array('type' => 'place', 'fields' => 'id,name,location,picture,were_here_count,is_published,link', 'q' => trim($search));
$center = JRequest::getVar('center');
if ($center) {
$params['center'] = trim($center);
$params['distance'] = 1000;
}
$results = JFBCFactory::provider('facebook')->api('search', $params, true, 'GET');
$results = $results['data'];
$clean_results = array();
foreach ($results as $result) {
if (!(isset($result['is_published']) && $result['is_published'] && isset($result['id']) && $result['id'] && isset($result['name']) && $result['name'])) {
continue;
}
$clean_result = array('label' => trim($result['name']), 'value' => $result['id'], 'link' => $result['link']);
// build location components for use in place summary
if (isset($result['location'])) {
$location = array();
if (isset($result['location']['street']) && $result['location']['street']) {
$location['street'] = trim($result['location']['street']);
}
if (isset($result['location']['city']) && $result['location']['city'] && isset($result['location']['state']) && $result['location']['state']) {
$location['area'] = trim($result['location']['city'] . ', ' . $result['location']['state']);
} else {
if (isset($result['location']['state']) && $result['location']['state'] && isset($result['location']['country']) && $result['location']['country']) {
$location['area'] = trim($result['location']['state'] . ', ' . $result['location']['country']);
} else {
if (isset($result['location']['country']) && $result['location']['country']) {
$location['area'] = trim($result['location']['country']);
}
}
}
if (!empty($location)) {
$clean_result['location'] = $location;
}
unset($location);
}
if (isset($result['were_here_count']) && $result['were_here_count']) {
$clean_result['were_here_count'] = (int) $result['were_here_count'];
}
if (isset($result['picture']['data']['url']) && $result['picture']['data']['url']) {
$clean_result['picture'] = $result['picture']['data']['url'];
}
$clean_results[] = $clean_result;
unset($clean_result);
}
echo json_encode($clean_results);
JFactory::getApplication()->close(0);
}
示例12: channelGetOutboundChannels
public function channelGetOutboundChannels()
{
$input = JFactory::getApplication()->input;
$p = $input->getString('provider');
$options = array();
$options[] = JHtml::_('select.option', "--", "-- Select a Channel --");
$provider = JFBCFactory::provider($p);
$channels = $provider->getChannelsOutbound();
foreach ($channels as $c) {
$options[] = JHtml::_('select.option', strtolower($c->name), $c->name);
}
echo JHTML::_('select.genericlist', $options, 'jform[type]', 'onchange="jfbcAdmin.channels.outbound.fetchChannelSettings(this.value);"', 'value', 'text', '--', 'jform_type');
exit;
}
示例13: addChannel
public function addChannel($channel)
{
$channelId = trim($channel);
$row = JTable::getInstance('Channel', 'Table');
$row->load($channelId);
if ($row->published) {
$options = new JRegistry();
$options->loadObject($row->attribs);
$channel = JFBCFactory::provider($row->provider)->channel($row->type, $options);
// This is a bit hacky as we're temporarily saving the row to use in the addPost. Should be handling this better.
$this->currentRow = $row;
$channel->getStream($this);
}
}
示例14: getOptions
protected function getOptions()
{
$options = array();
$options[] = JHtml::_('select.option', "--", "-- Select a Channel --");
$p = $this->form->getValue('provider');
if ($p && $p != '--') {
$provider = JFBCFactory::provider($p);
$channels = $provider->getChannelsOutbound();
foreach ($channels as $c) {
$options[] = JHtml::_('select.option', strtolower($c->name), $c->name);
}
}
return $options;
}
示例15: deauthorizeUser
function deauthorizeUser()
{
$fbClient = JFBCFactory::provider('facebook')->getFbClient();
$signedRequest = JRequest::getString('signed_request', null, 'POST');
if ($signedRequest) {
$parsed = $fbClient->parseSignedRequest($signedRequest);
$fbUserId = $parsed['user_id'];
if ($fbUserId) {
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jfbconnect/' . 'models');
$userModel = JModelLegacy::getInstance('UserMap', 'JFBConnectModel');
$userModel->setAuthorized($fbUserId, '0');
}
}
exit;
}