本文整理汇总了PHP中eZURI类的典型用法代码示例。如果您正苦于以下问题:PHP eZURI类的具体用法?PHP eZURI怎么用?PHP eZURI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZURI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: modify
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
{
$uri = new eZURI( $namedParameters[ 'uri' ] );
$moduleName = $uri->element( 0 );
$moduleList = eZINI::instance( 'module.ini' )->variable( 'ModuleSettings', 'ModuleList' );
if ( in_array( $moduleName, $moduleList, true ) )
$check = eZModule::accessAllowed( $uri );
$operatorValue = isset( $check['result'] ) ? $check['result'] : false;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:9,代码来源:ezmoduleoperator.php
示例2: parse
protected function parse()
{
$urlAlias = '/' . $this->rawResult['main_url_alias'];
eZURI::transformURI($urlAlias, false, 'full');
$this->data = array('id' => $this->rawResult['id'], 'name' => $this->rawResult['name'], 'class_identifier' => $this->rawResult['class_identifier'], 'main_node_id' => $this->rawResult['main_node_id'], 'href' => $urlAlias);
$fromDate = self::getDateTime($this->rawResult['fields']['attr_from_time_dt']);
if (!$fromDate instanceof DateTime) {
throw new Exception("Value of 'attr_from_time_dt' not a valid date");
}
$this->data['fromDateTime'] = $fromDate;
$this->data['from'] = $fromDate->getTimestamp();
$this->data['identifier'] = $fromDate->format(OpenPACalendarData::FULLDAY_IDENTIFIER_FORMAT);
if (isset($this->rawResult['fields']['attr_to_time_dt'])) {
$toDate = self::getDateTime($this->rawResult['fields']['attr_to_time_dt']);
if (!$toDate instanceof DateTime) {
throw new Exception("Param 'attr_to_time_dt' is not a valid date");
}
if ($toDate->getTimestamp() == 0) {
$toDate = $this->fakeToTime($this->data['fromDateTime']);
}
} else {
$toDate = $this->fakeToTime($this->data['fromDateTime']);
}
$this->data['toDateTime'] = $toDate;
$this->data['to'] = $toDate->getTimestamp();
$this->data['duration'] = $this->data['to'] - $this->data['from'];
$this->isValid = $this->isValid();
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:28,代码来源:occalendarsearchresultitem.php
示例3: requestToken
public function requestToken($Account)
{
$NGPushIni = eZINI::instance('ngpush.ini');
$SiteIni = eZINI::instance('site.ini');
$AccessToken = $NGPushIni->variable($Account, 'AccessToken');
// If access tokens are given
if ($AccessToken) {
//Save request signing tokens to cache
ngPushBase::save_token($Account, $AccessToken, 'main_token');
} else {
$AdministrationUrl = '/';
eZURI::transformURI($AdministrationUrl, false, 'full');
$AdministrationUrl = base64_encode($AdministrationUrl);
$SettingsBlock = base64_encode($Account);
$redirectUrl = 'http://' . $NGPushIni->variable('PushNodeSettings', 'ConnectURL') . '/redirect.php/' . $AdministrationUrl . '/' . $SettingsBlock . '?case=facebook';
$Facebook = new Facebook(array('appId' => $NGPushIni->variable($Account, 'AppAPIKey'), 'secret' => $NGPushIni->variable($Account, 'AppSecret')));
$Permissions = array('publish_actions', 'user_posts');
if ($NGPushIni->variable($Account, 'EntityType') == 'page') {
$Permissions[] = 'manage_pages';
}
$state = md5(uniqid(rand(), true));
$http = eZHTTPTool::instance();
$http->setSessionVariable('ngpush_state', $state);
$LoginUrl = $Facebook->getLoginUrl(array('redirect_uri' => $redirectUrl, 'scope' => implode($Permissions, ','), 'state' => $state));
self::$response['RequestPermissionsUrl'] = $LoginUrl;
}
}
开发者ID:netgen,项目名称:ngpush,代码行数:27,代码来源:ngpush_facebook_base.php
示例4: getRedirectUri
/**
* This method is used to process the first part of authentication workflow, before redirect
*
* @return array Array with status and redirect URI
*/
public function getRedirectUri()
{
$ngConnectINI = eZINI::instance('ngconnect.ini');
$http = eZHTTPTool::instance();
$consumerKey = trim($ngConnectINI->variable('LoginMethod_twitter', 'AppConsumerKey'));
$consumerSecret = trim($ngConnectINI->variable('LoginMethod_twitter', 'AppConsumerSecret'));
if (empty($consumerKey) || empty($consumerSecret)) {
return array('status' => 'error', 'message' => 'Consumer key or consumer secret undefined.');
}
$callbackUri = self::CALLBACK_URI_PART;
$loginWindowType = trim($ngConnectINI->variable('ngconnect', 'LoginWindowType'));
if ($loginWindowType == 'popup') {
$callbackUri = '/layout/set/ngconnect' . self::CALLBACK_URI_PART;
}
$state = md5(session_id() . (string) time());
$http->setSessionVariable('NGConnectOAuthState', $state);
$callbackUri .= '?state=' . $state;
eZURI::transformURI($callbackUri, false, 'full');
$connection = new TwitterOAuth($consumerKey, $consumerSecret);
$connection->host = self::TWITTER_API_URI;
$tempCredentials = $connection->getRequestToken($callbackUri);
$redirectUri = $connection->getAuthorizeURL($tempCredentials);
if (!$redirectUri) {
return array('status' => 'error', 'message' => 'Invalid redirection URI.');
}
$http->setSessionVariable('NGConnectOAuthToken', $tempCredentials['oauth_token']);
$http->setSessionVariable('NGConnectOAuthTokenSecret', $tempCredentials['oauth_token_secret']);
return array('status' => 'success', 'redirect_uri' => $redirectUri);
}
开发者ID:netgen,项目名称:ngconnect,代码行数:34,代码来源:ngconnectauthtwitter.php
示例5: requestToken
public function requestToken($Account)
{
$NGPushIni = eZINI::instance('ngpush.ini');
$ConsumerKey = $NGPushIni->variable($Account, 'ConsumerKey');
$ConsumerSecret = $NGPushIni->variable($Account, 'ConsumerSecret');
$AccessToken = $NGPushIni->variable($Account, 'AccessToken');
$AccessTokenSecret = $NGPushIni->variable($Account, 'AccessTokenSecret');
// If access tokens are given
if ($AccessToken && $AccessTokenSecret) {
// Save request signing tokens to cache
ngPushBase::save_token($Account, $AccessToken, 'request_sign_oauth_token');
ngPushBase::save_token($Account, $AccessTokenSecret, 'request_sign_oauth_token_secret');
ngPushBase::save_token($Account, $AccessToken . '%%%' . $AccessTokenSecret, 'main_token');
} else {
$connection = new TwitterOAuth($ConsumerKey, $ConsumerSecret);
$connection->host = "https://api.twitter.com/1.1/";
$AdministrationUrl = '/';
eZURI::transformURI($AdministrationUrl, false, 'full');
$AdministrationUrl = base64_encode($AdministrationUrl);
$SettingsBlock = base64_encode($Account);
$temporary_credentials = $connection->getRequestToken('http://' . $NGPushIni->variable('PushNodeSettings', 'ConnectURL') . '/redirect.php/' . $AdministrationUrl . '/' . $SettingsBlock . '?case=twitter');
// Save request signing tokens to cache
ngPushBase::save_token($Account, $temporary_credentials['oauth_token'], 'request_sign_oauth_token');
ngPushBase::save_token($Account, $temporary_credentials['oauth_token_secret'], 'request_sign_oauth_token_secret');
$redirect_url = $connection->getAuthorizeURL($temporary_credentials, FALSE);
self::$response['RequestPermissionsUrl'] = $redirect_url;
}
}
开发者ID:netgen,项目名称:ngpush,代码行数:28,代码来源:ngpush_twitter_base.php
示例6: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case 'ngurl':
if (empty($namedParameters['siteaccess'])) {
return;
}
$ini = eZSiteAccess::getIni($namedParameters['siteaccess'], 'site.ini');
$destinationLocale = $ini->variable('RegionalSettings', 'ContentObjectLocale');
$siteLanguageList = $ini->variable('RegionalSettings', 'SiteLanguageList');
$nodeID = eZURLAliasML::fetchNodeIDByPath($operatorValue);
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeID, $destinationLocale, false);
if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
if ($this->isModuleUrl($operatorValue) || $this->isCurrentLocaleAvailable($siteLanguageList)) {
$destinationUrl = $operatorValue;
} else {
$destinationUrl = '';
}
} else {
$destinationUrl = $destinationElement[0]->getPath($destinationLocale, $siteLanguageList);
}
$siteaccessUrlMapping = eZINI::instance('nglanguageswitcher.ini')->variable('LanguageSwitcher', 'SiteAccessUrlMapping');
$destinationUrl = eZURI::encodeURL($destinationUrl);
$operatorValue = rtrim($siteaccessUrlMapping[$namedParameters['siteaccess']], '/') . '/' . ltrim($destinationUrl, '/');
break;
}
}
开发者ID:netgen,项目名称:nglanguageswitcher,代码行数:27,代码来源:nglanguageswitchertemplatefunctions.php
示例7: feZMetaData_ContentActionHandler
function feZMetaData_ContentActionHandler( &$module, &$http, &$objectID )
{
// Action when user clicks on the Add Button
if( $http->hasPostVariable( 'AddMetaDataButton' ) )
{
$link = 'fezmetadata/edit/0/(contentObjectID)/'.$objectID;
$link .= '/(metaDataName)/'.$_POST['metaDataName'];
$link .= '/(language)/'.$_POST['language'];
eZURI::transformURI( $link );
$http->redirect( $link );
}
// Action when user clicks on the Remove Button
if( $http->hasPostVariable( 'RemoveMetaDataButton' ) and $http->hasPostVariable( 'MetaDataIDSelection' ) )
{
$metaDataSelection = $http->postVariable( 'MetaDataIDSelection' );
foreach( $metaDataSelection as $metaData )
{
$metaDataObject = feZMetaData::fetch( $metaData );
$metaDataObject->remove();
}
eZContentCacheManager::clearContentCache( $objectID );
$ContentObject = eZContentObject::fetch( $objectID );
$ContentNodeID = $ContentObject->mainNodeID();
return $module->redirect( 'content', 'view', array( 'full', $ContentNodeID ) );
}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:27,代码来源:content_actionhandler.php
示例8: message
public static function message($publishHandler, eZContentObject $object, $message, $messageLength = null, $options)
{
$url = false;
if (isset($options['include_url']) && (bool) $options['include_url'] === true) {
$url = $object->attribute('main_node')->attribute('url_alias');
eZURI::transformURI($url, true, 'full');
if (isset($options['shorten_url']) && (bool) $options['shorten_url'] === true) {
$urlReturned = $publishHandler->shorten($url, $options['shorten_handler']);
if (is_string($urlReturned)) {
$url = $urlReturned;
}
}
if ($messageLength != null) {
$messageLength = $messageLength - strlen($url) - 1;
}
}
if (class_exists('Normalizer')) {
$message = Normalizer::normalize($message, Normalizer::FORM_C);
}
if ($messageLength != null) {
$message = mb_substr($message, 0, $messageLength);
}
if ($url) {
$message .= ' ' . $url;
}
return $message;
}
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:27,代码来源:nxcSocialNetworksMessageHandlerDefault.php
示例9: getLoginURL
public function getLoginURL(array $scopes = null, $redirectURL = null)
{
eZURI::transformURI($redirectURL, false, 'full');
$connection = $this->getFacebookConnection();
$params = array('scope' => implode(', ', $scopes), 'redirect_uri' => $redirectURL);
return $connection->getLoginUrl($params);
}
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:7,代码来源:facebook.php
示例10: testUserParameters
/**
* Test scenario for issue #13186: UserParameters works differently in 4.0 compared to 3.10
*
* @result $eZURI->userParameters() returns an empty array
* @expected $eZURI->userParameters() should return array( "ole" => "a", "dull" => "boy" ).
*
* @link http://issues.ez.no/13186
*/
public function testUserParameters()
{
$expectedParams = array("ole" => "a", "dull" => "boy");
$eZURI = eZURI::instance();
$userParams = $eZURI->userParameters();
$this->assertEquals($expectedParams, $userParams);
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:15,代码来源:ezuri_regression.php
示例11: getMetadataByLocation
/**
* Returns metadata for given content location as array
* @param ezpContentLocation $location
* @return array
*/
public static function getMetadataByLocation(ezpContentLocation $location)
{
$url = $location->url_alias;
eZURI::transformURI($url, false, 'full');
// $url is passed as a reference
$aMetadata = array('nodeId' => (int) $location->node_id, 'nodeRemoteId' => $location->remote_id, 'fullUrl' => $url);
return $aMetadata;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:13,代码来源:rest_content_model.php
示例12: status
public static function status( $args )
{
if ( count( $args ) != 2 )
{
throw new ezcBaseFunctionalityNotSupportedException( 'status', 'Missing argument(s)' );
}
list( $contentObjectId, $version ) = $args;
$process = ezpContentPublishingProcess::fetchByContentObjectVersion( $contentObjectId, $version );
// No process: check if the object's still a draft
// @todo Change to a PENDING check when applied (operation => step 2)
if ( $process instanceof ezpContentPublishingProcess )
{
$return = array();
$status = $process->attribute( 'status' ) == ezpContentPublishingProcess::STATUS_WORKING ? 'working' : 'finished';
switch( $process->attribute( 'status' ) )
{
case ezpContentPublishingProcess::STATUS_WORKING:
$status = 'working';
break;
case ezpContentPublishingProcess::STATUS_FINISHED:
$status = 'finished';
$objectVersion = $process->attribute( 'version' );
$object = $objectVersion->attribute( 'contentobject' );
$node = $object->attribute( 'main_node' );
$uri = $node->attribute( 'url_alias' );
eZURI::transformURI( $uri );
$return['node_uri'] = $uri;
break;
case ezpContentPublishingProcess::STATUS_PENDING:
$status = 'pending';
break;
case ezpContentPublishingProcess::STATUS_DEFERRED:
$status = 'deferred';
$versionViewUri = "content/versionview/{$contentObjectId}/{$version}";
eZURI::transformURI( $versionViewUri );
$return['versionview_uri'] = $versionViewUri;
break;
}
$return['status'] = $status;
}
else
{
$version = eZContentObjectVersion::fetchVersion( $version, $contentObjectId );
if ( $version === null )
throw new ezcBaseFunctionalityNotSupportedException( 'status', 'Object version not found' );
else
$return = array( 'status' => 'queued' );
}
return $return;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:57,代码来源:ezjscserverfunctionspublishingqueue.php
示例13: processAuth
/**
* This method is used to process the second part of authentication workflow, after redirect
*
* @return array Array with status and user details
*/
public function processAuth()
{
$ngConnectINI = eZINI::instance('ngconnect.ini');
$http = eZHTTPTool::instance();
$appID = trim($ngConnectINI->variable('LoginMethod_facebook', 'FacebookAppID'));
$appSecret = trim($ngConnectINI->variable('LoginMethod_facebook', 'FacebookAppSecret'));
if (empty($appID) || empty($appSecret)) {
return array('status' => 'error', 'message' => 'Facebook app ID or Facebook app secret undefined.');
}
$code = trim($http->getVariable('code', ''));
$state = trim($http->getVariable('state', ''));
if (empty($code) || empty($state)) {
return array('status' => 'error', 'message' => 'code or state GET parameters undefined.');
}
if (!$http->hasSessionVariable('NGConnectOAuthState') || $state != $http->sessionVariable('NGConnectOAuthState')) {
$http->removeSessionVariable('NGConnectOAuthState');
return array('status' => 'error', 'message' => 'State parameter does not match stored value.');
} else {
$http->removeSessionVariable('NGConnectOAuthState');
}
$callbackUri = self::CALLBACK_URI_PART;
$loginWindowType = trim($ngConnectINI->variable('ngconnect', 'LoginWindowType'));
if ($loginWindowType == 'popup') {
$callbackUri = '/layout/set/ngconnect' . self::CALLBACK_URI_PART;
}
eZURI::transformURI($callbackUri, false, 'full');
$tokenUri = str_replace(array('%app_id%', '%site_url%', '%app_secret%', '%code%'), array(urlencode($appID), urlencode($callbackUri), urlencode($appSecret), urlencode($code)), self::TOKEN_URI);
$accessToken = ngConnectFunctions::fetchDataFromUrl($tokenUri);
if (!$accessToken) {
return array('status' => 'error', 'message' => 'Error while retrieving access token.');
}
$accessTokenJson = json_decode($accessToken, true);
if ($accessTokenJson !== null) {
return array('status' => 'error', 'message' => $accessTokenJson['error']['message']);
}
$graphUri = str_replace(array('%access_token%'), array(trim($accessToken)), self::GRAPH_URI);
$graphResponse = ngConnectFunctions::fetchDataFromUrl($graphUri);
if (!$graphResponse) {
return array('status' => 'error', 'message' => 'Error while retrieving graph response.');
}
$user = json_decode($graphResponse, true);
if ($user === null) {
return array('status' => 'error', 'message' => 'Invalid JSON data returned.');
}
if (!isset($user['id'])) {
return array('status' => 'error', 'message' => 'Invalid Facebook user.');
}
$pictureUri = self::PICTURE_URI;
$imageSize = trim($ngConnectINI->variable('LoginMethod_facebook', 'ImageSize'));
if ($imageSize == 'original') {
$pictureUri = $pictureUri . '?type=large';
}
$result = array('status' => 'success', 'login_method' => 'facebook', 'id' => $user['id'], 'first_name' => isset($user['first_name']) ? $user['first_name'] : '', 'last_name' => isset($user['last_name']) ? $user['last_name'] : '', 'email' => isset($user['email']) ? $user['email'] : '', 'picture' => str_replace('%user_id%', $user['id'], $pictureUri));
return $result;
}
开发者ID:netgen,项目名称:ngconnect,代码行数:60,代码来源:ngconnectauthfacebook.php
示例14: fetchMapMarkers
public static function fetchMapMarkers($parentNodeId, $childrenClassIdentifiers)
{
foreach ($childrenClassIdentifiers as $key => $value) {
if (empty($value)) {
unset($childrenClassIdentifiers[$key]);
}
}
$sortBy = array('name' => 'asc');
$result = array();
if ($parentNode = self::getNode($parentNodeId)) {
if (!empty($childrenClassIdentifiers)) {
$childrenClassTypes = (array) eZContentClass::fetchList(0, true, false, null, null, $childrenClassIdentifiers);
} else {
$childrenClassTypes = self::getChildrenClasses($parentNodeId);
}
// ricavo gli attributi delle classi
$geoAttributes = array();
foreach ($childrenClassTypes as $classType) {
if ($classType instanceof eZContentClass) {
$geoAttributes = array_merge($geoAttributes, eZContentClassAttribute::fetchFilteredList(array('contentclass_id' => $classType->attribute('id'), 'version' => $classType->attribute('version'), 'data_type_string' => 'ezgmaplocation')));
}
}
if (count($geoAttributes)) {
// imposto i filtri di ricerca
$geoFields = $geoFieldsNames = array();
foreach ($geoAttributes as $geoAttribute) {
if ($geoAttribute instanceof eZContentClassAttribute) {
$geoFields[$geoAttribute->attribute('identifier')] = $geoAttribute->attribute('name');
$geoFieldsNames[] = "subattr_{$geoAttribute->attribute('identifier')}___coordinates____gpt";
}
}
$childrenParameters = array('SearchSubTreeArray' => array($parentNode->attribute('node_id')), 'Filter' => array('-meta_id_si:' . $parentNode->attribute('contentobject_id')), 'SearchLimit' => 1000, 'AsObjects' => false, 'SortBy' => $sortBy, 'FieldsToReturn' => $geoFieldsNames);
// cerco i figli
$solr = new OCSolr();
$children = $solr->search('', $childrenParameters);
if ($children['SearchCount'] > 0) {
foreach ($children['SearchResult'] as $item) {
foreach ($geoFieldsNames as $geoFieldsName) {
@(list($longitude, $latitude) = explode(',', $item['fields'][$geoFieldsName][0]));
if (intval($latitude) > 0 && intval($longitude) > 0) {
$href = isset($item['main_url_alias']) ? $item['main_url_alias'] : $item['main_url_alias_ms'];
eZURI::transformURI($href, false, 'full');
$popup = isset($item['name']) ? $item['name'] : $item['name_t'];
$id = isset($item['id_si']) ? $item['id_si'] : $item['id'];
$result[] = array('id' => $id, 'type' => null, 'lat' => floatval($latitude), 'lon' => floatval($longitude), 'lng' => floatval($longitude), 'popupMsg' => $popup, 'title' => $popup, 'description' => "<h3><a href='{$href}'>{$popup}</a></h3>", 'urlAlias' => $href, 'objectID' => $id);
}
}
}
}
}
}
return array('result' => $result);
}
开发者ID:OpencontentCoop,项目名称:ocbootstrap,代码行数:53,代码来源:ocbtoolsfunctioncollection.php
示例15: processAuth
/**
* This method is used to process the second part of authentication workflow, after redirect
*
* @return array Array with status and user details
*/
public function processAuth()
{
$ngConnectINI = eZINI::instance('ngconnect.ini');
$http = eZHTTPTool::instance();
$clientID = trim($ngConnectINI->variable('LoginMethod_google', 'GoogleClientID'));
$clientSecret = trim($ngConnectINI->variable('LoginMethod_google', 'GoogleClientSecret'));
if (empty($clientID) || empty($clientSecret)) {
return array('status' => 'error', 'message' => 'Google client ID or Google client secret undefined.');
}
$code = trim($http->getVariable('code', ''));
$state = trim($http->getVariable('state', ''));
if (empty($code) || empty($state)) {
return array('status' => 'error', 'message' => 'code or state GET parameters undefined.');
}
if (!$http->hasSessionVariable('NGConnectOAuthState') || $state != $http->sessionVariable('NGConnectOAuthState')) {
$http->removeSessionVariable('NGConnectOAuthState');
return array('status' => 'error', 'message' => 'State parameter does not match stored value.');
} else {
$http->removeSessionVariable('NGConnectOAuthState');
}
$callbackUri = self::CALLBACK_URI_PART;
$loginWindowType = trim($ngConnectINI->variable('ngconnect', 'LoginWindowType'));
if ($loginWindowType == 'popup') {
$callbackUri = '/layout/set/ngconnect' . self::CALLBACK_URI_PART;
}
eZURI::transformURI($callbackUri, false, 'full');
$scope = self::SCOPE;
$userScope = trim($ngConnectINI->variable('LoginMethod_google', 'Scope'));
if (!empty($userScope)) {
$scope = $userScope . ' ' . $scope;
}
$client = new Google_Client();
$client->setApplicationName(trim($ngConnectINI->variable('LoginMethod_google', 'MethodName')));
$client->setScopes($scope);
$client->setClientId($clientID);
$client->setClientSecret($clientSecret);
$client->setRedirectUri($callbackUri);
$client->setUseObjects(true);
$plus = new Google_PlusService($client);
$authString = $client->authenticate();
$accessToken = $client->getAccessToken();
if (empty($authString) || empty($accessToken)) {
return array('status' => 'error', 'message' => 'Unable to authenticate to Google.');
}
$me = $plus->people->get('me');
if (!$me instanceof Google_Person) {
return array('status' => 'error', 'message' => 'Invalid Google user.');
}
$result = array('status' => 'success', 'login_method' => 'google', 'id' => $me->id, 'first_name' => !empty($me->name->givenName) ? $me->name->givenName : '', 'last_name' => !empty($me->name->familyName) ? $me->name->familyName : '', 'email' => !empty($me->emails[0]['value']) ? $me->emails[0]['value'] : '', 'picture' => !empty($me->image->url) ? $me->image->url : '');
return $result;
}
开发者ID:netgen,项目名称:ngconnect,代码行数:56,代码来源:ngconnectauthgoogle.php
示例16: getAccessToken
public function getAccessToken($redirectURL = null)
{
$http = eZHTTPTool::instance();
if ($http->hasGetVariable('code') === false) {
throw new Exception('Wrong request token. Refresh the page or try again later.');
}
if ($redirectURL !== null) {
eZURI::transformURI($redirectURL, false, 'full');
$this->connection->setRedirectUri($redirectURL);
}
$this->connection->authenticate();
$accessToken = $this->connection->getAccessToken();
return array('token' => $accessToken, 'secret' => null);
}
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:14,代码来源:google.php
示例17: checkIfNeeded
public static function checkIfNeeded(eZURI $uri)
{
$original = $uri->uriString();
$parts = $uri->URIArray;
$checkUrls = array($original);
$countParts = count($parts);
for ($i = 0; $i <= $countParts; $i++) {
$slice = array_slice($parts, 0, $i);
if (!empty($slice)) {
$sliceString = implode('/', $slice);
$checkUrls[] = $sliceString . '/*';
}
}
$ini = eZINI::instance('cookielaw.ini');
if ($ini->hasVariable('UriExcludeList', 'Exclude')) {
$excludeList = (array) $ini->variable('UriExcludeList', 'Exclude');
foreach ($checkUrls as $url) {
if (in_array($url, $excludeList)) {
self::$isActive = false;
}
}
}
}
开发者ID:OpencontentCoop,项目名称:occookielaw,代码行数:23,代码来源:occookielaw.php
示例18: getAuthorizeURL
public function getAuthorizeURL(array $scopes = null, $redirectURL = null)
{
$http = eZHTTPTool::instance();
if ($redirectURL !== null) {
eZURI::transformURI($redirectURL, false, 'full');
$this->connection->setCallbackUrl($redirectURL);
}
$response = $this->connection->retrieveTokenRequest($scopes);
if ($response['success'] === true) {
$http->setSessionVariable('linkedin_request_token', $response['linkedin']);
return LinkedIn::_URL_AUTH . $response['linkedin']['oauth_token'];
} else {
throw new Exception('Request token retrieval failed. Refresh the page or try again later.');
}
}
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:15,代码来源:linkedin.php
示例19: getAccessToken
public function getAccessToken($redirectURL = null)
{
$http = eZHTTPTool::instance();
if ($redirectURL === null) {
$redirectURL = '/nxc_social_network_token/get_access_token/facebook';
}
eZURI::transformURI($redirectURL, false, 'full');
$data = file_get_contents('https://graph.facebook.com/oauth/access_token?' . 'client_id=' . $this->appSettings['key'] . '&' . 'client_secret=' . $this->appSettings['secret'] . '&' . 'code=' . $http->getVariable('code') . '&' . 'redirect_uri=' . $redirectURL);
if (strpos($data, 'access_token=') !== false) {
preg_match('/access_token=([^&]*)/i', $data, $matches);
if (isset($matches[1])) {
return array('token' => $matches[1], 'secret' => null);
}
}
throw new Exception('Could not get access token. Refresh the page or try again later.');
}
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:16,代码来源:facebook.php
示例20: getIncludeTag
/** Get an include tag for the given base URL and parameters.
*
* This performs the processing common to both types of includes.
* @param string $url The base of the URL that should be included.
* @param array $keys An associative array of GET parameters to add to the
* URL before including it.
* @return string The generated esi:include tag for the given URL.
*/
private function getIncludeTag($url, $params)
{
if ($this->sendDoESIHeader) {
header(self::DO_ESI_HEADER);
}
nxcESIEAS::setUseESI(true);
foreach ($params as $key => $value) {
$url .= '&' . rawurlencode($key) . '=' . rawurlencode($value);
}
eZURI::transformURI($url);
$include = '<esi:include src="' . $url;
if ($this->continueOnError) {
$include .= '" onerror="continue';
}
$include .= '"/>';
return $include;
}
开发者ID:nxc,项目名称:nxc_esi,代码行数:25,代码来源:nxcesitypeesi.php
注:本文中的eZURI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论