本文整理汇总了PHP中eZURL类的典型用法代码示例。如果您正苦于以下问题:PHP eZURL类的具体用法?PHP eZURL怎么用?PHP eZURL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZURL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validateUniqueURLHTTPInput
/**
* This method validates unique URL.
*
* @param string $data
* @param object $contentObjectAttribute
* @return boolean
*/
public static function validateUniqueURLHTTPInput($data, $contentObjectAttribute)
{
$ini = eZINI::instance('uniquedatatypes.ini');
$uniqueURLINI = $ini->group('UniqueURLSettings');
if (count($uniqueURLINI['AllowedSchemaList'])) {
if (!eregi("^(" . implode('|', $uniqueURLINI['AllowedSchemaList']) . ")", $data)) {
$contentObjectAttribute->setValidationError(ezpI18n::tr('extension/ezuniquedatatypes', 'Only URLs beginning with "%schemas" are accepted!', '', array('%schemas' => implode('", "', $uniqueURLINI['AllowedSchemaList']))));
return eZInputValidator::STATE_INVALID;
}
}
$url = eZURL::urlByURL($data);
if (is_object($url)) {
$contentObjectID = $contentObjectAttribute->ContentObjectID;
$contentClassAttributeID = $contentObjectAttribute->ContentClassAttributeID;
$db = eZDB::instance();
if ($uniqueURLINI['CurrentVersionOnly'] == 'true') {
$query = "SELECT COUNT(*) AS row_counter\n\t\t\t\t\tFROM ezcontentobject co, ezcontentobject_attribute coa\n\t\t\t\t\tWHERE co.id = coa.contentobject_id\n\t\t\t\t\tAND co.current_version = coa.version\n\t\t\t\t\tAND coa.contentclassattribute_id = " . $db->escapeString($contentClassAttributeID) . "\n\t\t\t\t\tAND coa.contentobject_id <> " . $db->escapeString($contentObjectID) . "\n AND coa.data_int = " . $db->escapeString($url->ID);
} else {
$query = "SELECT COUNT(*) AS row_counter\n\t\t\t\t\tFROM ezcontentobject_attribute coa\n\t\t\t\t\tWHERE coa.contentclassattribute_id = " . $db->escapeString($contentClassAttributeID) . "\n\t\t\t\t\tAND coa.contentobject_id <> " . $db->escapeString($contentObjectID) . "\n AND coa.data_int = " . $db->escapeString($url->ID);
}
if (self::EZUNIQUEURL_DEBUG) {
eZDebug::writeDebug('Query: ' . $query, 'eZUniqueURLType::validateUniqueURLHTTPInput');
}
$rows = $db->arrayQuery($query);
$rowCount = (int) $rows[0]['row_counter'];
if ($rowCount >= 1) {
$contentObjectAttribute->setValidationError(ezpI18n::tr('extension/ezuniquedatatypes', 'Given URL already exists in another content object of this type!'));
return eZInputValidator::STATE_INVALID;
}
}
return eZInputValidator::STATE_ACCEPTED;
}
开发者ID:Opencontent,项目名称:ezuniquedatatypes,代码行数:39,代码来源:ezuniqueurltype.php
示例2: testFetchByUrl
/**
* @group ezurl
*/
public function testFetchByUrl()
{
$url = 'http://ez.no/ezpublish';
$urlObj = eZURL::create($url);
$urlObj->store();
$urlObj2 = eZURL::fetchByUrl($url);
self::assertInstanceOf('eZURL', $urlObj2);
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:11,代码来源:ezurl_test.php
示例3: fetchListCount
function fetchListCount($isValid, $onlyPublished)
{
$parameters = array('is_valid' => $isValid, 'only_published' => $onlyPublished);
$listCount = eZURL::fetchListCount($parameters);
if ($listCount === null) {
$result = array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
} else {
$result = array('result' => $listCount);
}
return $result;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:11,代码来源:ezurlfunctioncollection.php
示例4: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array
*/
public static function getAttributeContent( eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute )
{
$url = eZURL::fetch( $contentObjectAttribute->attribute( 'data_int' ) );
return array(
'content' => array(
'url' => ( $url instanceof eZURL ) ? $url->attribute( 'url' ) : null,
'text' => $contentObjectAttribute->attribute( 'data_text' ),
),
'has_rendered_content' => false,
'rendered' => null,
);
}
开发者ID:ataxel,项目名称:tp,代码行数:17,代码来源:ezurlsolrstorage.php
示例5: publishHandlerObject
function publishHandlerObject($element, &$params)
{
$ret = null;
$objectID = $element->getAttribute('id');
// protection from self-embedding
if ($objectID == $this->contentObjectID) {
$this->isInputValid = false;
$this->Messages[] = ezpI18n::tr('kernel/classes/datatypes', 'Object %1 can not be embeded to itself.', false, array($objectID));
return $ret;
}
if (!in_array($objectID, $this->relatedObjectIDArray)) {
$this->relatedObjectIDArray[] = $objectID;
}
// If there are any image object with links.
$href = $element->getAttributeNS($this->Namespaces['image'], 'ezurl_href');
//washing href. single and double quotes inside url replaced with their urlencoded form
$href = str_replace(array('\'', '"'), array('%27', '%22'), $href);
$urlID = $element->getAttributeNS($this->Namespaces['image'], 'ezurl_id');
if ($href != null) {
$urlID = eZURL::registerURL($href);
$element->setAttributeNS($this->Namespaces['image'], 'image:ezurl_id', $urlID);
$element->removeAttributeNS($this->Namespaces['image'], 'ezurl_href');
}
if ($urlID != null) {
$this->urlIDArray[] = $urlID;
}
$this->convertCustomAttributes($element);
return $ret;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:29,代码来源:ezsimplifiedxmlinputparser.php
示例6: unserializeContentObjectAttribute
function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
{
$urlNode = $attributeNode->getElementsByTagName('url')->item(0);
if (is_object($urlNode)) {
unset($url);
$url = urldecode($urlNode->textContent);
$urlID = eZURL::registerURL($url);
if ($urlID) {
$urlObject = eZURL::fetch($urlID);
$urlObject->setAttribute('original_url_md5', $urlNode->getAttribute('original-url-md5'));
$urlObject->setAttribute('is_valid', $urlNode->getAttribute('is-valid'));
$urlObject->setAttribute('last_checked', $urlNode->getAttribute('last-checked'));
$urlObject->setAttribute('created', time());
$urlObject->setAttribute('modified', time());
$urlObject->store();
$objectAttribute->setAttribute('data_int', $urlID);
}
}
$textNode = $attributeNode->getElementsByTagName('text')->item(0);
if ($textNode) {
$objectAttribute->setAttribute('data_text', $textNode->textContent);
}
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:23,代码来源:ezurltype.php
示例7: publishHandlerLink
/**
* publishHandlerLink (Publish handler, pass 2 after schema validation)
* Publish handler for link element, converts href to [object|node|link]_id.
*
* @param DOMElement $element
* @param array $param parameters for xml element
* @return null|array changes structure if it contains 'result' key
*/
function publishHandlerLink($element, &$params)
{
$ret = null;
$href = $element->getAttribute('href');
if ($href) {
$objectID = false;
if (strpos($href, 'ezobject') === 0 && preg_match("@^ezobject://([0-9]+)/?(#.+)?@i", $href, $matches)) {
$objectID = $matches[1];
if (isset($matches[2])) {
$anchorName = substr($matches[2], 1);
}
$element->setAttribute('object_id', $objectID);
if (!eZContentObject::exists($objectID)) {
$this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Object %1 does not exist.', false, array($objectID));
}
} elseif (strpos($href, 'eznode') === 0 && preg_match("@^eznode://([^#]+)(#.+)?@i", $href, $matches)) {
$nodePath = trim($matches[1], '/');
if (isset($matches[2])) {
$anchorName = substr($matches[2], 1);
}
if (is_numeric($nodePath)) {
$nodeID = $nodePath;
$node = eZContentObjectTreeNode::fetch($nodeID);
if (!$node instanceof eZContentObjectTreeNode) {
$this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node %1 does not exist.', false, array($nodeID));
}
} else {
$node = eZContentObjectTreeNode::fetchByURLPath($nodePath);
if (!$node instanceof eZContentObjectTreeNode) {
$this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node '%1' does not exist.', false, array($nodePath));
} else {
$nodeID = $node->attribute('node_id');
}
$element->setAttribute('show_path', 'true');
}
if (isset($nodeID) && $nodeID) {
$element->setAttribute('node_id', $nodeID);
}
if (isset($node) && $node instanceof eZContentObjectTreeNode) {
$objectID = $node->attribute('contentobject_id');
}
} elseif (strpos($href, '#') === 0) {
$anchorName = substr($href, 1);
} else {
$temp = explode('#', $href);
$url = $temp[0];
if (isset($temp[1])) {
$anchorName = $temp[1];
}
if ($url) {
// Protection from XSS attack
if (preg_match("/^(java|vb)script:.*/i", $url)) {
$this->isInputValid = false;
$this->Messages[] = "Using scripts in links is not allowed, '{$url}' has been removed";
$element->removeAttribute('href');
return $ret;
}
// Check mail address validity following RFC 5322 and RFC 5321
if (preg_match("/^mailto:([^.][a-z0-9!#\$%&'*+-\\/=?`{|}~^]+@([a-z0-9.-]+))/i", $url, $mailAddr)) {
if (!eZMail::validate($mailAddr[1])) {
$this->isInputValid = false;
if ($this->errorLevel >= 0) {
$this->Messages[] = ezpI18n::tr('kernel/classes/datatypes/ezxmltext', "Invalid e-mail address: '%1'", false, array($mailAddr[1]));
}
$element->removeAttribute('href');
return $ret;
}
}
// Store urlID instead of href
$url = str_replace(array('&', '%28', '%29'), array('&', '(', ')'), $url);
$urlID = eZURL::registerURL($url);
if ($urlID) {
if (!in_array($urlID, $this->urlIDArray)) {
$this->urlIDArray[] = $urlID;
}
$element->setAttribute('url_id', $urlID);
}
}
}
if ($objectID && !in_array($objectID, $this->linkedObjectIDArray)) {
$this->linkedObjectIDArray[] = $objectID;
}
if (isset($anchorName) && $anchorName) {
$element->setAttribute('anchor_name', $anchorName);
}
}
return $ret;
}
开发者ID:legende91,项目名称:ez,代码行数:96,代码来源:ezoeinputparser.php
示例8: array
}
if ($Module->isCurrentAction('SetValid')) {
$urlSelection = $Module->actionParameter('URLSelection');
eZURL::setIsValid($urlSelection, true);
} else {
if ($Module->isCurrentAction('SetInvalid')) {
$urlSelection = $Module->actionParameter('URLSelection');
eZURL::setIsValid($urlSelection, false);
}
}
if ($ViewMode == 'all') {
$listParameters = array('is_valid' => null, 'offset' => $offset, 'limit' => $limit, 'only_published' => true);
$countParameters = array('only_published' => true);
} elseif ($ViewMode == 'valid') {
$listParameters = array('is_valid' => true, 'offset' => $offset, 'limit' => $limit, 'only_published' => true);
$countParameters = array('is_valid' => true, 'only_published' => true);
} elseif ($ViewMode == 'invalid') {
$listParameters = array('is_valid' => false, 'offset' => $offset, 'limit' => $limit, 'only_published' => true);
$countParameters = array('is_valid' => false, 'only_published' => true);
}
$list = eZURL::fetchList($listParameters);
$listCount = eZURL::fetchListCount($countParameters);
$viewParameters = array('offset' => $offset, 'limit' => $limit);
$tpl = eZTemplate::factory();
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('url_list', $list);
$tpl->setVariable('url_list_count', $listCount);
$tpl->setVariable('view_mode', $ViewMode);
$Result = array();
$Result['content'] = $tpl->fetch("design:url/list.tpl");
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/url', 'URL')), array('url' => false, 'text' => ezpI18n::tr('kernel/url', 'List')));
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:list.php
示例9: handleList
static function handleList( $parameters = array(), $asCount = false )
{
$parameters = array_merge( array( 'as_object' => true,
'is_valid' => null,
'offset' => false,
'limit' => false,
'only_published' => false ),
$parameters );
$asObject = $parameters['as_object'];
$isValid = $parameters['is_valid'];
$offset = $parameters['offset'];
$limit = $parameters['limit'];
$onlyPublished = $parameters['only_published'];
$limitArray = null;
if ( !$asCount and $offset !== false and $limit !== false )
$limitArray = array( 'offset' => $offset,
'length' => $limit );
$conditions = array();
if( $isValid === false ) $isValid = 0;
if ( $isValid !== null )
{
$conditions['is_valid'] = $isValid;
}
if ( count( $conditions ) == 0 )
$conditions = null;
if ( $onlyPublished ) // Only fetch published urls
{
$conditionQuery = "";
if ( $isValid !== null )
{
$isValid = (int) $isValid;
$conditionQuery = " AND ezurl.is_valid=$isValid ";
}
$db = eZDB::instance();
$cObjAttrVersionColumn = eZPersistentObject::getShortAttributeName( $db, eZURLObjectLink::definition(), 'contentobject_attribute_version' );
if ( $asCount )
{
$urls = $db->arrayQuery( "SELECT count( DISTINCT ezurl.id ) AS count
FROM
ezurl,
ezurl_object_link,
ezcontentobject_attribute,
ezcontentobject_version
WHERE
ezurl.id = ezurl_object_link.url_id
AND ezurl_object_link.contentobject_attribute_id = ezcontentobject_attribute.id
AND ezurl_object_link.$cObjAttrVersionColumn = ezcontentobject_attribute.version
AND ezcontentobject_attribute.contentobject_id = ezcontentobject_version.contentobject_id
AND ezcontentobject_attribute.version = ezcontentobject_version.version
AND ezcontentobject_version.status = " . eZContentObjectVersion::STATUS_PUBLISHED . "
$conditionQuery" );
return $urls[0]['count'];
}
else
{
$query = "SELECT DISTINCT ezurl.*
FROM
ezurl,
ezurl_object_link,
ezcontentobject_attribute,
ezcontentobject_version
WHERE
ezurl.id = ezurl_object_link.url_id
AND ezurl_object_link.contentobject_attribute_id = ezcontentobject_attribute.id
AND ezurl_object_link.$cObjAttrVersionColumn = ezcontentobject_attribute.version
AND ezcontentobject_attribute.contentobject_id = ezcontentobject_version.contentobject_id
AND ezcontentobject_attribute.version = ezcontentobject_version.version
AND ezcontentobject_version.status = " . eZContentObjectVersion::STATUS_PUBLISHED . "
$conditionQuery";
if ( !$offset && !$limit )
{
$urlArray = $db->arrayQuery( $query );
}
else
{
$urlArray = $db->arrayQuery( $query, array( 'offset' => $offset,
'limit' => $limit ) );
}
if ( $asObject )
{
$urls = array();
foreach ( $urlArray as $url )
{
$urls[] = new eZURL( $url );
}
return $urls;
}
else
$urls = $urlArray;
return $urls;
}
}
else
{
if ( $asCount )
{
$urls = eZPersistentObject::fetchObjectList( eZURL::definition(),
//.........这里部分代码省略.........
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:101,代码来源:ezurl.php
示例10: handleInlineNode
static function handleInlineNode($child, $generator, $prevLineBreak = false)
{
$paragraphParameters = array();
$imageArray = array();
switch ($child->localName) {
case "line":
// @todo: (Alex) check why this is needed here and not after the next line
if ($prevLineBreak) {
$paragraphParameters[] = array(eZOOGenerator::LINE, '');
}
// Todo: support inline tags
$paragraphParameters[] = array(eZOOGenerator::TEXT, $child->textContent);
foreach ($child->childNodes as $lineChild) {
if ($lineChild->localName == 'embed') {
// Only support objects of image class for now
$object = eZContentObject::fetch($lineChild->getAttribute("object_id"));
if ($object && $object->canRead()) {
$classIdentifier = $object->attribute("class_identifier");
// Todo: read class identifiers from configuration
if ($classIdentifier == "image") {
$imageSize = $lineChild->getAttribute('size');
if ($imageSize == "") {
$imageSize = "large";
}
$imageAlignment = $lineChild->getAttribute('align');
if ($imageAlignment == "") {
$imageAlignment = "center";
}
$dataMap = $object->dataMap();
$imageAttribute = $dataMap['image'];
$imageHandler = $imageAttribute->content();
$originalImage = $imageHandler->attribute('original');
$fileHandler = eZClusterFileHandler::instance($originalImage['url']);
$uniqueFile = $fileHandler->fetchUnique();
$displayImage = $imageHandler->attribute($imageSize);
$displayWidth = $displayImage['width'];
$displayHeight = $displayImage['height'];
$imageArray[] = array("FileName" => $uniqueFile, "Alignment" => $imageAlignment, "DisplayWidth" => $displayWidth, "DisplayHeight" => $displayHeight);
}
} else {
eZDebug::writeError("Image (object_id = " . $child->getAttribute('object_id') . " ) could not be used (does not exist or due to insufficient privileges)");
}
}
}
break;
// text nodes
// text nodes
case "":
$paragraphParameters[] = array(eZOOGenerator::TEXT, $child->textContent);
break;
case "link":
$href = $child->getAttribute('href');
if (!$href) {
$url_id = $child->getAttribute('url_id');
if ($url_id) {
$eZUrl = eZURL::fetch($url_id);
if (is_object($eZUrl)) {
$href = $eZUrl->attribute('url');
}
}
}
$paragraphParameters[] = array(eZOOGenerator::LINK, $href, $child->textContent);
break;
case "emphasize":
case "strong":
$style = $child->localName == 'strong' ? 'bold' : 'italic';
$paragraphParameters[] = array(eZOOGenerator::STYLE_START, $style);
foreach ($child->childNodes as $inlineNode) {
$return = self::handleInlineNode($inlineNode);
$paragraphParameters = array_merge($paragraphParameters, $return['paragraph_parameters']);
}
$paragraphParameters[] = array(eZOOGenerator::STYLE_STOP);
break;
case "literal":
$literalContent = $child->textContent;
$literalContentArray = explode("\n", $literalContent);
foreach ($literalContentArray as $literalLine) {
$generator->addParagraph("Preformatted_20_Text", htmlspecialchars($literalLine));
}
break;
case "custom":
$customTagName = $child->getAttribute('name');
// Check if the custom tag is inline
$ini = eZINI::instance('content.ini');
$isInlineTagList = $ini->variable('CustomTagSettings', 'IsInline');
$isInline = array_key_exists($customTagName, $isInlineTagList) && $isInlineTagList[$customTagName];
// Handle inline custom tags
if ($isInline) {
$paragraphParameters[] = array(eZOOGenerator::STYLE_START, "eZCustominline_20_{$customTagName}");
$paragraphParameters[] = array(eZOOGenerator::TEXT, $child->textContent);
$paragraphParameters[] = array(eZOOGenerator::STYLE_STOP);
} else {
$GLOBALS['CustomTagStyle'] = "eZCustom_20_{$customTagName}";
foreach ($child->childNodes as $customParagraph) {
// Alex 2008-06-03: changed $level (3rd argument) to $prevLineBreak
self::handleNode($customParagraph, $generator, $prevLineBreak);
}
$GLOBALS['CustomTagStyle'] = false;
}
break;
//.........这里部分代码省略.........
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezooconverter.php
示例11: foreach
$translateResult = eZURLAliasML::translate($url);
if (!$translateResult) {
$isInternal = false;
// Check if it is a valid internal link.
foreach ($siteURLs as $siteURL) {
$siteURL = preg_replace("/\\/\$/e", "", $siteURL);
$fp = @fopen($siteURL . "/" . $url, "r");
if (!$fp) {
// do nothing
} else {
$isInternal = true;
fclose($fp);
}
}
$translateResult = $isInternal;
}
if ($translateResult) {
if (!$isValid) {
eZURL::setIsValid($linkID, true);
}
$cli->output($cli->stylize('success', "valid"));
} else {
if ($isValid) {
eZURL::setIsValid($linkID, false);
}
$cli->output($cli->stylize('warning', "invalid"));
}
}
eZURL::setLastChecked($linkID);
}
$cli->output("All links have been checked!");
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:linkcheck.php
示例12: array
<?php
/**
* Vue gérant les redirections de liens référencés dans eZ Publish
* Utile pour les liens sponsorisés, notamment pour éviter les problèmes de validation HTML
* ou pour cacher les régies publicitaires
* @copyright Copyright (C) 2011 - Metal France. All rights reserved
* @author Jerome Vieilledent
* @version 3.0
* @package metalfrance
* @subpackage mf
*/
$Module = $Params['Module'];
$Result = array();
$http = eZHTTPTool::instance();
$mfINI = eZINI::instance('metalfrance.ini');
$url = eZURL::url((int) $Params['LinkID']);
eZHTTPTool::redirect($url, array(), '302');
开发者ID:obenyoussef,项目名称:metalfrance,代码行数:18,代码来源:gateway.php
示例13: fetchLinkList
static function fetchLinkList($contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true)
{
$linkList = array();
$urlObjectLinkList = self::fetchLinkObjectList($contentObjectAttributeID, $contentObjectAttributeVersion, $asObject);
foreach ($urlObjectLinkList as $urlObjectLink) {
if ($asObject) {
$linkID = $urlObjectLink->attribute('url_id');
$linkList[] = eZURL::fetch($linkID);
} else {
$linkID = $urlObjectLink['url_id'];
$linkList[] = $linkID;
}
}
return $linkList;
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezurlobjectlink.php
示例14: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case $this->ININameHasVariable:
case $this->ININame:
if (count($operatorParameters) > 0) {
$iniGroup = $tpl->elementValue($operatorParameters[0], $rootNamespace, $currentNamespace);
if (count($operatorParameters) == 1) {
$tpl->error($operatorName, "Missing variable name parameter");
return;
}
$iniVariable = $tpl->elementValue($operatorParameters[1], $rootNamespace, $currentNamespace);
$iniName = isset($operatorParameters[2]) ? $tpl->elementValue($operatorParameters[2], $rootNamespace, $currentNamespace) : false;
$iniPath = isset($operatorParameters[3]) ? $tpl->elementValue($operatorParameters[3], $rootNamespace, $currentNamespace) : false;
// If we should check for existence of variable.
// You can use like:
// ezini( <BlockName>, <SettingName>, <FileName>, <IniPath>, _use under template compiling mode_ , <Should We Check for existence: 'hasVariable' or true()> )
// ezini_hasvariable( <BlockName>, <SettingName>, <FileName>, <IniPath>... )
if ($operatorName == $this->ININameHasVariable) {
$checkExistence = true;
} else {
$checkExistence = isset($operatorParameters[5]) ? ($tpl->elementValue($operatorParameters[5], $rootNamespace, $currentNamespace) === true or $tpl->elementValue($operatorParameters[5], $rootNamespace, $currentNamespace) == 'hasVariable') ? true : false : false;
}
if ($iniPath !== false) {
$ini = eZINI::instance($iniName, $iniPath, null, null, null, true);
} elseif ($iniName !== false) {
$ini = eZINI::instance($iniName);
} else {
$ini = eZINI::instance();
}
if ($ini->hasVariable($iniGroup, $iniVariable)) {
$operatorValue = !$checkExistence ? $ini->variable($iniGroup, $iniVariable) : true;
} else {
if ($checkExistence) {
$operatorValue = false;
return;
}
if ($iniPath !== false) {
// Return empty string instead of displaying error when using 'path' parameter
// and DirectAccess mode for ezini.
$operatorValue = '';
} else {
if ($iniName === false) {
$iniName = 'site.ini';
}
$tpl->error($operatorName, "!!!No such variable '{$iniVariable}' in group '{$iniGroup}' for {$iniName}");
}
}
return;
} else {
$tpl->error($operatorName, "Missing group name parameter");
}
break;
case $this->HTTPNameHasVariable:
case $this->HTTPName:
$http = eZHTTPTool::instance();
if (count($operatorParameters) > 0) {
$httpType = eZURLOperator::HTTP_OPERATOR_TYPE_POST;
$httpName = $tpl->elementValue($operatorParameters[0], $rootNamespace, $currentNamespace);
if (count($operatorParameters) > 1) {
$httpTypeName = strtolower($tpl->elementValue($operatorParameters[1], $rootNamespace, $currentNamespace));
if ($httpTypeName == 'post') {
$httpType = eZURLOperator::HTTP_OPERATOR_TYPE_POST;
} else {
if ($httpTypeName == 'get') {
$httpType = eZURLOperator::HTTP_OPERATOR_TYPE_GET;
} else {
if ($httpTypeName == 'session') {
$httpType = eZURLOperator::HTTP_OPERATOR_TYPE_SESSION;
} else {
if ($httpTypeName == 'cookie') {
$httpType = eZURLOperator::HTTP_OPERATOR_TYPE_COOKIE;
} else {
$tpl->warning($operatorName, "Unknown http type '{$httpTypeName}'");
}
}
}
}
}
// If we should check for existence of http variable
// You can use like:
// ezhttp( <Variable>, <Method: post, get, session>, <Should We Check for existence: 'hasVariable' or true()> )
// ezhttp_hasvariable( <Variable>, <Method> )
if ($operatorName == $this->HTTPNameHasVariable) {
$checkExistence = true;
} else {
$checkExistence = isset($operatorParameters[2]) ? ($tpl->elementValue($operatorParameters[2], $rootNamespace, $currentNamespace) === true or $tpl->elementValue($operatorParameters[2], $rootNamespace, $currentNamespace) == 'hasVariable') ? true : false : false;
}
switch ($httpType) {
case eZURLOperator::HTTP_OPERATOR_TYPE_POST:
if ($http->hasPostVariable($httpName)) {
$operatorValue = !$checkExistence ? $http->postVariable($httpName) : true;
} else {
// If only check for existence - return false
if ($checkExistence) {
$operatorValue = false;
return;
}
$tpl->error($operatorName, "Unknown post variable '{$httpName}'");
}
//.........这里部分代码省略.........
开发者ID:stevoland,项目名称:ez_patch,代码行数:101,代码来源:ezurloperator.php
示例15: outputObject
function outputObject( $element, &$attributes, &$sectionLevel )
{
$ret = null;
if ( isset( $attributes['image:ezurl_id'] ) )
{
$linkID = $attributes['image:ezurl_id'];
if ( $linkID != null )
{
$href = eZURL::url( $linkID );
$attributes['href'] = $href;
}
}
return $ret;
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:14,代码来源:ezsimplifiedxmleditoutput.php
示例16: getenv
break;
case '3':
$limit = 50;
break;
default:
$limit = 10;
break;
}
} else {
$limit = 10;
}
$offset = $Params['Offset'];
if (!is_numeric($offset)) {
$offset = 0;
}
$url = eZURL::fetch($urlID);
if (!$url) {
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$link = $url->attribute('url');
if (preg_match("/^(http:)/i", $link) or preg_match("/^(ftp:)/i", $link) or preg_match("/^(https:)/i", $link) or preg_match("/^(file:)/i", $link) or preg_match("/^(mailto:)/i", $link)) {
// No changes
} else {
$domain = getenv('HTTP_HOST');
$protocol = eZSys::serverProtocol();
$preFix = $protocol . "://" . $domain;
$preFix .= eZSys::wwwDir();
$link = preg_replace("/^\\//e", "", $link);
$link = $preFix . "/" . $link;
}
$viewParameters = array('offset' => $offset, 'limit' => $limit);
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:view.php
示例17: importAttribute
/**
* Imports a value to an attribute adapting it to the proper type.
* Not written by me, downloaded from ez.no! Extended it only!
* @param data The value (string/int/float).
* @param contentObjectAttribute The attribute to modify.
*/
function importAttribute($data, &$contentObjectAttribute)
{
$contentClassAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
$dataTypeString = $contentClassAttribute->attribute('data_type_string');
ezDebug::writeDebug("Converting " . $data . " to expected " . $dataTypeString);
switch ($dataTypeString) {
case 'ezfloat':
case 'ezprice':
$contentObjectAttribute->setAttribute('data_float', $data);
$contentObjectAttribute->store();
break;
case 'ezboolean':
case 'ezdate':
case 'ezdatetime':
case 'ezinteger':
case 'ezsubtreesubscription':
case 'eztime':
$contentObjectAttribute->setAttribute('data_int', $data);
$contentObjectAttribute->store();
break;
case 'ezobjectrelation':
// $data is contentobject_id to relate to
// $oldData = $contentObjectAttribute->attribute( 'data_int' );
$contentObjectAttribute->setAttribute('data_int', $data);
$contentObjectAttribute->store();
$object = $contentObjectAttribute->object();
$contentObjectVersion = $contentObjectAttribute->attribute('version');
$contentClassAttributeID = $contentObjectAttribute->attribute('contentclassattribute_id');
// Problem with translations if removing old relations ?!
// $object->removeContentObjectRelation( $oldData, $contentObjectVersion, $contentClassAttributeID, eZContentObject::RELATION_ATTRIBUTE );
$object->addContentObjectRelation($data, $contentObjectVersion, $contentClassAttributeID, RELATION_ATTRIBUTE);
break;
case 'ezurl':
$urlID = eZURL::registerURL($data);
$contentObjectAttribute->setAttribute('data_int', $urlID);
// Fall through to set data_text
// Fall through to set data_text
case 'ezemail':
case 'ezisbn':
case 'ezstring':
case 'eztext':
$contentObjectAttribute->setAttribute('data_text', $data);
$contentObjectAttribute->store();
break;
case 'ezxmltext':
/* $parser = new eZXMLInputParser();
$document = $parser->process( $data );
$data = eZXMLTextType::domString( $document );
$contentObjectAttribute->fromString( $data );*/
$contentObjectAttribute->setAttribute('data_text', $data);
$contentObjectAttribute->store();
break;
// case 'ezimage':
// $this->saveImage( $data, $contentObjectAttribute );
// break;
// case 'ezbinaryfile':
// $this->saveFile( $data, $contentObjectAttribute );
// break;
// case 'ezenum':
//removed enum - function can be found at ez.no
// break;
// case 'ezimage':
// $this->saveImage( $data, $contentObjectAttribute );
// break;
// case 'ezbinaryfile':
// $this->saveFile( $data, $contentObjectAttribute );
// break;
// case 'ezenum':
//removed enum - function can be found at ez.no
// break;
case 'ezuser':
// $data is assumed to be an associative array( login, password, email );
$user = new eZUser($contentObjectAttribute->attribute('contentobject_id'));
if (isset($data['login'])) {
$user->setAttribute('login', $data['login']);
}
if (isset($data['email'])) {
$user->setAttribute('email', $data['email']);
}
if (isset($data['password'])) {
$hashType = eZUser::hashType() . '';
$newHash = $user->createHash($data['login'], $data['password'], eZUser::site(), $hashType);
$user->setAttribute('password_hash_type', $hashType);
$user->setAttribute('password_hash', $newHash);
}
$user->store();
break;
default:
die('Can not store ' . $data . ' as datatype: ' . $dataTypeString);
}
}
开发者ID:informaticatrentina,项目名称:batchtool,代码行数:97,代码来源:lib.php
示例18: fetchLinkList
static function fetchLinkList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true )
{
$linkList = array();
$conditions = array( 'contentobject_attribute_id' => $contentObjectAttributeID );
if ( $contentObjectAttributeVersion !== false )
$conditions['contentobject_attribute_version'] = $contentObjectAttributeVersion;
$urlObjectLinkList = eZPersistentObject::fetchObjectList( eZURLObjectLink:
|
请发表评论