本文整理汇总了PHP中JFBCFactory::log方法的典型用法代码示例。如果您正苦于以下问题:PHP JFBCFactory::log方法的具体用法?PHP JFBCFactory::log怎么用?PHP JFBCFactory::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFBCFactory
的用法示例。
在下文中一共展示了JFBCFactory::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchStatus
public function fetchStatus($providerUserId)
{
$status = "";
$url = 'https://api.vk.com/method/wall.get';
$url .= '?owner_id=' . $providerUserId;
$url .= '&count=10&extended=0&filter=owner';
try {
$data = $this->provider->client->query($url);
if ($data->code == 200) {
$posts = json_decode($data->body, true);
foreach ($posts['response'] as $post) {
if (is_array($post)) {
if ($post['post_type'] == 'post' && $post['text'] !== "") {
$status = $post['text'];
break;
}
}
}
}
} catch (Exception $e) {
if (JFBCFactory::config()->get('facebook_display_errors')) {
JFBCFactory::log($e->getMessage());
}
}
return $status;
}
示例2: 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();
}
示例3: 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=canvas');
}
示例4: 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();
}
示例5: unlink
public function unlink()
{
JSession::checkToken('get') or die('Invalid Token');
$provider = JRequest::getString('provider', '');
$user = JFactory::getUser();
$userModel = JFBConnectModelUserMap::getUser($user->get('id'), $provider);
$provider_user_id = $userModel->getProviderUserId($user->get('id'), $provider);
$userModel->deleteMapping($provider_user_id, $provider);
JFBCFactory::log(JText::sprintf('COM_JFBCONNECT_ACCOUNT_LINKED_ACCOUNTS_UNLINK_MESSAGE', $provider));
$this->setRedirect(JRoute::_('index.php?option=com_jfbconnect&view=account'));
}
示例6: getTagHtml
protected function getTagHtml()
{
JFBCFactory::log('Deprecated Like Box called. Use Page Plugin instead.', 'warning', true);
$tag = '<div class="fb-page"';
$tag .= $this->getField('show_faces', null, 'boolean', 'true', 'data-show-facepile');
$tag .= $this->getField('stream', null, 'boolean', 'false', 'data-show-posts');
$tag .= $this->getField('hide_cover', null, 'boolean', 'false', 'data-hide-cover');
$tag .= $this->getField('width', null, null, '', 'data-width');
$tag .= $this->getField('height', null, null, '', 'data-height');
$tag .= $this->getField('href', 'url', null, '', 'data-href');
$tag .= '></div>';
return $tag;
}
示例7: fetchProfile
public function fetchProfile($userId, $fields)
{
$profile = new JFBConnectProfileDataWindowsLive();
$url = 'https://apis.live.net/v5.0/' . $userId;
try {
$jdata = $this->provider->client->query($url);
if ($jdata->code == 200) {
$data = json_decode($jdata->body, true);
$profile->loadObject($data);
}
} catch (Exception $e) {
if (JFBCFactory::config()->get('facebook_display_errors')) {
JFBCFactory::log($e->getMessage());
}
}
return $profile;
}
示例8: fetchProfile
public function fetchProfile($userId, $fields)
{
$profile = new JFBConnectProfileDataInstagram();
$url = 'https://api.instagram.com/v1/users/' . $userId;
// get the current user
try {
$jdata = $this->provider->client->query($url);
if ($jdata->code == 200) {
$data = json_decode($jdata->body, true);
$profile->loadObject($data['data']);
}
} catch (Exception $e) {
if (JFBCFactory::config()->get('facebook_display_errors')) {
JFBCFactory::log($e->getMessage());
}
}
return $profile;
}
示例9: fetchProfile
public function fetchProfile($user, $fields)
{
$profile = new JFBConnectProfileDataAmazon();
$url = 'https://api.amazon.com/user/profile';
// get the current user
try {
$jdata = $this->provider->client->query($url);
$data = json_decode($jdata->body, true);
if (is_array($data)) {
$profile->loadObject($data);
}
} catch (Exception $e) {
if (JFBCFactory::config()->get('facebook_display_errors')) {
JFBCFactory::log($e->getMessage());
}
}
return $profile;
}
示例10: loginMap
public function loginMap()
{
JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
$provider = JFactory::getApplication()->input->getCmd('provider');
$provider = JFBCFactory::provider($provider);
SCSocialUtilities::setJFBCNewMappingEnabled();
$loginRegisterModel = $this->getModel('LoginRegister', 'JFBConnectModel');
$redirect = $loginRegisterModel->getLoginRedirect($provider);
$returnParam = '&return=' . base64_encode($redirect);
$providerUserId = $provider->getProviderUserId();
if (!$providerUserId) {
$app->redirect(JRoute::_('index.php?option=com_jfbconnect&view=loginregister&provider=' . $provider->systemName . $returnParam, false));
}
// Populate the data array:
$data = array();
$data['username'] = JRequest::getVar('username', '', 'method', 'username');
$data['password'] = JRequest::getString('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
// Perform the log in.
$error = $app->login($data);
// Check if the log in succeeded.
if (JError::isError($error) || $error == false) {
$app->redirect(JRoute::_('index.php?option=com_jfbconnect&view=loginregister&provider=' . $provider->systemName . $returnParam, false));
} else {
$jUser = JFactory::getUser();
if (JFBCFactory::usermap()->map($jUser->get('id'), $providerUserId, $provider->systemName, $provider->client->getToken())) {
JFBCFactory::log(JText::sprintf('COM_JFBCONNECT_MAP_USER_SUCCESS', $provider->name));
}
/* Don't import on just a mapping update, for now. Need to investigate.
$jUser = JFactory::getUser();
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$fbUserId = $jfbcLibrary->getMappedFbUserId();
$args = array($jUser->get('id'), $fbUserId);
JPluginHelper::importPlugin('jfbcprofiles');
$app->triggerEvent('scProfilesImportProfile', $args);
JFBCFactory::log('Profile Imported!');*/
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/' . 'models');
$loginRegisterModel = JModelLegacy::getInstance('LoginRegister', 'JFBConnectModel');
$redirect = $loginRegisterModel->getLoginRedirect($provider);
$app->redirect($redirect);
}
}
示例11: migrate
public function migrate()
{
$app = JFactory::getApplication();
$migration = $app->input->getCmd('migration');
$parts = explode('.', $migration);
if ($parts[0]) {
include_once JPATH_ADMINISTRATOR . '/components/com_jfbconnect/helpers/migrator/' . $parts[0] . '.php';
$class = 'JFBConnectMigrator' . $parts[0];
$migrator = new $class();
$subtask = isset($parts[1]) ? $parts[1] : 'migrate';
$result = $migrator->{$subtask}();
if ($result) {
JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_MIGRATION_COMPLETE'));
} else {
JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_MIGRATION_ERROR'), 'error');
}
}
$this->setRedirect('index.php?option=com_jfbconnect&view=config');
}
示例12: api
function api($api, $params = null, $callAsUser = true, $method = null, $suppressErrors = false)
{
$this->apiError = null;
if (!$method) {
if ($params) {
$method = "POST";
} else {
$method = "GET";
}
}
if (!$callAsUser) {
$params['access_token'] = $this->appId . "|" . $this->secretKey;
}
/* else if (!$params || (is_array($params) && (!array_key_exists('access_token', $params))))
{
// Get the access token for the current user
$jUser = JFactory::getUser();
$userMapModel = new JFBConnectModelUserMap();
$userMapModel->getData($jUser->get('id'));
$accessToken = $userMapModel->_data->access_token;
if ($accessToken != '' && $accessToken != null)
$params['access_token'] = $accessToken;
}*/
try {
if ($params != null) {
// Graph API call with paramters (either App call or POST call)
$apiData = $this->client->api($api, $method, $params);
} else {
// Graph API call to only get data
$apiData = $this->client->api($api);
}
} catch (JFBCFacebookApiException $e) {
$this->apiError = $e->getMessage();
// Only display errors on the front-end if the config is set to do so
$app = JFactory::getApplication();
if (!$suppressErrors && ($app->isAdmin() || $this->configModel->get('facebook_display_errors'))) {
JFBCFactory::log(JText::_('COM_JFBCONNECT_FB_API_ERROR') . $e->getMessage(), 'error');
}
$apiData = null;
}
return $apiData;
}
示例13: fetchProfile
public function fetchProfile($userId, $fields)
{
if (!is_array($fields)) {
$fields = array($fields);
}
if (in_array('first_name', $fields)) {
$fields[] = 'first-name';
unset($fields[array_search('first_name', $fields)]);
}
if (in_array('last_name', $fields)) {
$fields[] = 'last-name';
unset($fields[array_search('last_name', $fields)]);
}
if (in_array('full_name', $fields)) {
$fields[] = 'first-name';
$fields[] = 'last-name';
unset($fields[array_search('full_name', $fields)]);
}
if (in_array('email', $fields)) {
$fields[] = 'email-address';
unset($fields[array_search('email', $fields)]);
}
if (in_array('middle_name', $fields)) {
unset($fields[array_search('middle_name', $fields)]);
}
$fields = array_unique($fields);
$profile = new JFBConnectProfileDataLinkedin();
if (!empty($fields)) {
$url = 'https://api.linkedin.com/v1/people/' . $userId . ':(' . implode(',', $fields) . ')';
try {
$data = $this->provider->client->query($url);
$data = json_decode($data->body, true);
$profile->loadObject($data);
} catch (Exception $e) {
if (JFBCFactory::config()->get('facebook_display_errors')) {
JFBCFactory::log($e->getMessage());
}
}
}
return $profile;
}
示例14: __construct
public function __construct(JRegistry $options = null, JHttp $http = null, JInput $input = null, JApplicationWeb $application = null)
{
// We want to use cURL, so need to build this all up. This also helps poke into each of the things when debugging
$httpOptions = new JRegistry();
$httpOptions->set('follow_location', false);
try {
$transport = new JFBConnectJoomlaHttpTransportCurl($httpOptions);
} catch (Exception $e) {
JFBCFactory::log('JFBConnect requires the CURL PHP extension to be installed and callable.', 'error');
$transport = null;
}
$http = new JHttp($httpOptions, $transport);
$this->transport = $transport;
$options = isset($options) ? $options : new JRegistry();
$options->set('state', JSession::getFormToken());
// This is sent back to us to identify the provider
if (!$options->exists('sendheaders')) {
$options->set('sendheaders', true);
}
parent::__construct($options, $http, $input, $application);
}
示例15: callback
public function callback()
{
$input = JFactory::getApplication()->input;
// Have to do our own token checking here. Redirect shouldn't happen to normal users since token was just inserted
// when they tried to authenticate
$token = JSession::getFormToken();
$returnToken = $input->get('state', '', 'alnum');
if ($token != $returnToken) {
$this->setRedirect('index.php', JText::_('JLIB_ENVIRONMENT_SESSION_EXPIRED'));
$this->redirect();
}
$provider = $this->getProvider();
try {
$provider->client->authenticate();
} catch (Exception $e) {
JFBCFactory::log(JText::sprintf('COM_JFBCONNECT_UNABLE_TO_RETRIEVE_USER', ucwords($provider->name)), 'warning');
if (JFBCFactory::config()->getSetting('facebook_display_errors')) {
JFBCFactory::log($e->getMessage(), 'error');
}
$this->redirectOnFailedAuth();
}
$this->doLogin($provider);
}