本文整理汇总了PHP中eZHTTPTool类的典型用法代码示例。如果您正苦于以下问题:PHP eZHTTPTool类的具体用法?PHP eZHTTPTool怎么用?PHP eZHTTPTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZHTTPTool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modifySelection
/**
* Aggiorna la selezione delle tematiche da sincronizzare
* @param eZHTTPTool $http
*/
public function modifySelection($http)
{
if ($http->hasPostVariable('BrowseActionName') && $http->postVariable('BrowseActionName') == 'SelectDestinationNodeID') {
// Scelta del nodo di destinazione
$nodeIDArray = $http->postVariable('SelectedNodeIDArray');
$this->object->setAttribute('destination_node_id', $nodeIDArray[0]);
$this->object->store();
} else {
// Abilitazione e disabilitazione delle tematiche
$tematicheChanged = false;
foreach ($http->attribute('post') as $key => $value) {
$action = explode('_', $key);
if ($action[0] == 'DisableTag') {
if (($_key = array_search($value, $this->getTematiche())) !== false) {
$_tematiche = $this->getTematiche();
unset($_tematiche[$_key]);
$this->object->setAttribute('tags', implode(';', $_tematiche));
}
$tematicheChanged = true;
} else {
if ($action[0] == 'EnableTag') {
$_tematiche = $this->getTematiche();
$_tematiche[] = $value;
$this->object->setAttribute('tags', implode(';', $_tematiche));
$tematicheChanged = true;
}
}
}
if ($tematicheChanged) {
$this->object->store();
}
}
}
示例2: 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;
}
}
示例3: fetchIDListByUserID
static function fetchIDListByUserID($userID)
{
if ($userID == eZUser::anonymousId()) {
$userCache = eZUSer::getUserCacheByAnonymousId();
$ruleArray = $userCache['discount_rules'];
} else {
$http = eZHTTPTool::instance();
$handler = eZExpiryHandler::instance();
$expiredTimeStamp = 0;
if ($handler->hasTimestamp('user-discountrules-cache')) {
$expiredTimeStamp = $handler->timestamp('user-discountrules-cache');
}
$ruleTimestamp =& $http->sessionVariable('eZUserDiscountRulesTimestamp');
$ruleArray = false;
// check for cached version in session
if ($ruleTimestamp > $expiredTimeStamp) {
if ($http->hasSessionVariable('eZUserDiscountRules' . $userID)) {
$ruleArray =& $http->sessionVariable('eZUserDiscountRules' . $userID);
}
}
if (!is_array($ruleArray)) {
$ruleArray = self::generateIDListByUserID((int) $userID);
$http->setSessionVariable('eZUserDiscountRules' . $userID, $ruleArray);
$http->setSessionVariable('eZUserDiscountRulesTimestamp', time());
}
}
$rules = array();
foreach ($ruleArray as $ruleRow) {
$rules[] = $ruleRow['id'];
}
return $rules;
}
示例4: fetchObjectAttributeHTTPInput
/**
* Set parameters from post data, expects post data to be validated by
* {@link eZGmapLocationType::validateObjectAttributeHTTPInput()}
*
* @param eZHTTPTool $http
* @param string $base
* @param eZContentObjectAttribute $contentObjectAttribute
*/
function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
$validPostData = false;
if ($http->hasPostVariable($base . '_data_gmaplocation_latitude_' . $contentObjectAttribute->attribute('id')) && $http->hasPostVariable($base . '_data_gmaplocation_longitude_' . $contentObjectAttribute->attribute('id'))) {
$latitude = $http->postVariable($base . '_data_gmaplocation_latitude_' . $contentObjectAttribute->attribute('id'));
$longitude = $http->postVariable($base . '_data_gmaplocation_longitude_' . $contentObjectAttribute->attribute('id'));
$validPostData = $latitude !== '' && $longitude !== '' && is_numeric($latitude) && is_numeric($longitude);
}
if ($validPostData) {
$address = '';
if ($http->hasPostVariable($base . '_data_gmaplocation_address_' . $contentObjectAttribute->attribute('id'))) {
$address = $http->postVariable($base . '_data_gmaplocation_address_' . $contentObjectAttribute->attribute('id'));
$address = htmlentities($address, ENT_QUOTES, 'UTF-8');
}
if ($contentObjectAttribute->attribute('data_int') != 0) {
$location = eZGmapLocation::fetch($contentObjectAttribute->attribute('id'), $contentObjectAttribute->attribute('version'));
$location->setAttribute('latitude', $latitude);
$location->setAttribute('longitude', $longitude);
$location->setAttribute('address', $address);
} else {
$location = new eZGmapLocation(array('contentobject_attribute_id' => $contentObjectAttribute->attribute('id'), 'contentobject_version' => $contentObjectAttribute->attribute('version'), 'latitude' => $latitude, 'longitude' => $longitude, 'address' => $address));
$contentObjectAttribute->setAttribute('data_int', 1);
}
$contentObjectAttribute->setContent($location);
} else {
if ($contentObjectAttribute->attribute('data_int') != 0) {
$contentObjectAttribute->setAttribute('data_int', 0);
eZGmapLocation::removeById($contentObjectAttribute->attribute('id'), $contentObjectAttribute->attribute('version'));
}
}
return true;
}
示例5: get
function get($oid)
{
$oidroot = $this->oidRoot();
$oidroot = $oidroot[0];
switch (preg_replace('/\\.0$/', '', $oid)) {
case $oidroot . '1.1':
if (in_array('ezfind', eZExtension::activeExtensions())) {
$ini = eZINI::instance('solr.ini');
$data = eZHTTPTool::getDataByURL($ini->variable('SolrBase', 'SearchServerURI') . "/admin/ping", false);
if (stripos($data, '<str name="status">OK</str>') !== false) {
$status = 1;
} else {
$status = 0;
}
} else {
$status = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $status);
case $oidroot . '1.2':
if (in_array('ezfind', eZExtension::activeExtensions())) {
$ini = eZINI::instance('solr.ini');
$data = eZHTTPTool::getDataByURL($ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp", false);
if (preg_match('#<stat +name="numDocs" +>[ \\t\\r\\n]*(\\d+)[ \\t\\r\\n]*</stat>#', $data, $status)) {
$status = $status[1];
} else {
$status = -2;
}
} else {
$status = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $status);
}
return self::NO_SUCH_OID;
}
示例6: answer
function answer()
{
if ($this->Answer !== false) {
return $this->Answer;
}
$http = eZHTTPTool::instance();
$prefix = eZSurveyType::PREFIX_ATTRIBUTE;
$postSurveyAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $this->contentObjectAttributeID();
if ($http->hasPostVariable($postSurveyAnswer)) {
$surveyAnswer = $http->postVariable($postSurveyAnswer);
return $surveyAnswer;
}
$user = eZUser::instance();
$value = $this->Default;
if ($user->isLoggedIn() === true) {
switch ($this->Text3) {
case "user_email":
$value = $this->userEmail();
break;
case "user_name":
$value = $this->userName();
break;
default:
$value = $this->defaultUserValue();
}
}
return $value;
}
示例7: redirect
/**
* Handles redirection to the mobile optimized interface
*
*/
public function redirect()
{
$http = eZHTTPTool::instance();
$currentSiteAccess = eZSiteAccess::current();
if ($http->hasGetVariable('notmobile')) {
setcookie('eZMobileDeviceDetect', 1, time() + (int) eZINI::instance()->variable('SiteAccessSettings', 'MobileDeviceDetectCookieTimeout'), '/');
$http->redirect(eZSys::indexDir());
eZExecution::cleanExit();
}
if (!isset($_COOKIE['eZMobileDeviceDetect']) && !in_array($currentSiteAccess['name'], eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessList'))) {
$currentUrl = eZSys::serverURL() . eZSys::requestURI();
$redirectUrl = eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessURL');
// Do not redirect if already on the redirect url
if (strpos($currentUrl, $redirectUrl) !== 0) {
// Default siteaccess name needs to be removed from the uri when redirecting
$uri = explode('/', ltrim(eZSys::requestURI(), '/'));
if (array_shift($uri) == $currentSiteAccess['name']) {
$http->redirect($redirectUrl . '/' . implode('/', $uri));
} else {
$http->redirect($redirectUrl . eZSys::requestURI());
}
}
eZExecution::cleanExit();
}
}
示例8: createClass
static function createClass( $tpl,
$module,
$stepArray,
$basePath,
$storageName = false,
$metaData = false )
{
if ( !$storageName )
{
$storageName = 'eZWizard';
}
if ( !$metaData )
{
$http = eZHTTPTool::instance();
$metaData = $http->sessionVariable( $storageName . '_meta' );
}
if ( !isset( $metaData['current_step'] ) ||
$metaData['current_step'] < 0 )
{
$metaData['current_step'] = 0;
eZDebug::writeNotice( 'Setting wizard step to : ' . $metaData['current_step'], __METHOD__ );
}
$currentStep = $metaData['current_step'];
if ( count( $stepArray ) <= $currentStep )
{
eZDebug::writeError( 'Invalid wizard step count: ' . $currentStep, __METHOD__ );
return false;
}
$filePath = $basePath . $stepArray[$currentStep]['file'];
if ( !file_exists( $filePath ) )
{
eZDebug::writeError( 'Wizard file not found : ' . $filePath, __METHOD__ );
return false;
}
include_once( $filePath );
$className = $stepArray[$currentStep]['class'];
eZDebug::writeNotice( 'Creating class : ' . $className, __METHOD__ );
$returnClass = new $className( $tpl, $module, $storageName );
if ( isset( $stepArray[$currentStep]['operation'] ) )
{
$operation = $stepArray[$currentStep]['operation'];
return $returnClass->$operation();
eZDebug::writeNotice( 'Running : "' . $className . '->' . $operation . '()". Specified in StepArray', __METHOD__ );
}
if ( isset( $metaData['current_stage'] ) )
{
$returnClass->setMetaData( 'current_stage', $metaData['current_stage'] );
eZDebug::writeNotice( 'Setting wizard stage to : ' . $metaData['current_stage'], __METHOD__ );
}
return $returnClass;
}
示例9: getNextItems
/**
* Returns block item XHTML
*
* @param mixed $args
* @return array
*/
public static function getNextItems($args)
{
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$result = array();
$galleryID = $http->postVariable('gallery_id');
$offset = $http->postVariable('offset');
$limit = $http->postVariable('limit');
$galleryNode = eZContentObjectTreeNode::fetch($galleryID);
if ($galleryNode instanceof eZContentObjectTreeNode) {
$params = array('Depth' => 1, 'Offset' => $offset, 'Limit' => $limit);
$pictureNodes = $galleryNode->subtree($params);
foreach ($pictureNodes as $validNode) {
$tpl->setVariable('node', $validNode);
$tpl->setVariable('view', 'block_item');
$tpl->setVariable('image_class', 'blockgallery1');
$content = $tpl->fetch('design:node/view/view.tpl');
$result[] = $content;
if ($counter === $limit) {
break;
}
}
}
return $result;
}
示例10: execute
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$http = eZHTTPTool::instance();
eZDebug::writeNotice($parameters, "parameters");
$orderID = $parameters['order_id'];
$order = eZOrder::fetch($orderID);
if (empty($orderID) || get_class($order) != 'ezorder') {
eZDebug::writeWarning("Can't proceed without a Order ID.", "SimpleStockCheck");
return eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT;
}
// Decrement the quantitity field
$order = eZOrder::fetch($orderID);
$productCollection = $order->productCollection();
$ordereditems = $productCollection->itemList();
foreach ($ordereditems as $item) {
$contentObject = $item->contentObject();
$contentObjectVersion = $contentObject->version($contentObject->attribute('current_version'));
$contentObjectAttributes = $contentObjectVersion->contentObjectAttributes();
foreach (array_keys($contentObjectAttributes) as $key) {
$contentObjectAttribute = $contentObjectAttributes[$key];
$contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
// Each attribute has an attribute identifier called 'quantity' that identifies it.
if ($contentClassAttribute->attribute("identifier") == "quantity") {
$contentObjectAttribute->setAttribute("data_int", $contentObjectAttribute->attribute("value") - $item->ItemCount);
$contentObjectAttribute->store();
}
}
}
return eZWorkflowEventType::STATUS_ACCEPTED;
}
示例11: gather
static function gather()
{
$contentTypes = array('Objects (including users)' => array('table' => 'ezcontentobject'), 'Users' => array('table' => 'ezuser'), 'Nodes' => array('table' => 'ezcontentobject_tree'), 'Content Classes' => array('table' => 'ezcontentclass'), 'Information Collections' => array('table' => 'ezinfocollection'), 'Pending notification events' => array('table' => 'eznotificationevent', 'wherecondition' => 'status = 0'), 'Objects pending indexation' => array('table' => 'ezpending_actions', 'wherecondition' => "action = 'index_object'"), 'Binary files (content)' => array('table' => 'ezbinaryfile'), 'Image files (content)' => array('table' => 'ezimagefile'), 'Media files (content)' => array('table' => 'ezmedia'), 'Maximum children per node' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY parent_node_id ) nodes'), 'Maximum nodes per object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY contentobject_id ) nodes'), 'Maximum incoming relations to an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY to_contentobject_id ) links', 'nvl' => 0), 'Maximum outgoing relations from an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY from_contentobject_id ) links', 'nvl' => 0));
$db = eZDB::instance();
$contentList = array();
foreach ($contentTypes as $key => $desc) {
if (isset($desc['table'])) {
$sql = 'SELECT COUNT(*) AS NUM FROM ' . $desc['table'];
if (@$desc['wherecondition']) {
$sql .= ' WHERE ' . $desc['wherecondition'];
}
} else {
$sql = $desc['sql'];
}
$count = $db->arrayQuery($sql);
$contentList[$key] = $count[0]['NUM'] === null ? $desc['nvl'] : $count[0]['NUM'];
}
if (in_array('ezfind', eZExtension::activeExtensions())) {
$ini = eZINI::instance('solr.ini');
$ezfindpingurl = $ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp";
$data = eZHTTPTool::getDataByURL($ezfindpingurl, false);
//var_dump( $data );
if (preg_match('#<stat +name="numDocs" ?>([^<]+)</stat>#', $data, $matches)) {
$contentList['Documents in SOLR'] = trim($matches[1]);
} else {
$contentList['Documents in SOLR'] = 'Unknown';
}
}
return $contentList;
}
示例12: push
public static function push($args)
{
if (!self::userHasAccessToModule()) {
return self::$noAccessResponse;
}
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('nodeID') && $http->hasPostVariable('accountID')) {
$NGPushIni = eZINI::instance('ngpush.ini');
$NGPushAccount = $http->postVariable('accountID');
$NGPushNodeID = $http->postVariable('nodeID');
switch ($NGPushIni->variable($NGPushAccount, 'Type')) {
case 'twitter':
$TwitterStatus = $http->postVariable('tw_status');
return ngPushTwitterStatus::push($NGPushAccount, $TwitterStatus);
break;
case 'facebook_feed':
$Arguments = array('name' => $http->postVariable('fb_name'), 'description' => $http->postVariable('fb_description'), 'message' => $http->postVariable('fb_message'), 'link' => $http->postVariable('fb_link'), 'picture' => $http->postVariable('fb_picture'));
return ngPushFacebookFeed::push($NGPushAccount, $Arguments);
break;
default:
break;
}
}
return array('status' => 'error', 'message' => 'Account not found!');
}
示例13: setState
public function setState()
{
$http = eZHTTPTool::instance();
if ($http->hasGetVariable('state')) {
$this->connection->setState(base64_encode($http->getVariable('state')));
}
}
示例14: fetchAccountInformation
function fetchAccountInformation(&$module)
{
$http = eZHTTPTool::instance();
$http->setSessionVariable('RedirectAfterLogin', '/shop/basket/');
$http->setSessionVariable('DoCheckoutAutomatically', true);
$module->redirectTo('/user/login/');
}
示例15: acquireToken
/**
* @return string
*/
protected function acquireToken()
{
$response = eZHTTPTool::getDataByURL($this->tokenAcquireApiUrl);
$xml = simplexml_load_string($response);
return (string)$xml->data->string;
}