Validates link in "ezobject://" format.

@param int $objectId
@return bool
763291
protected function validateEzObject($objectId)
    {
        try {
            $this->contentHandler->loadContentInfo($objectId);
        } catch (NotFoundException $e) {
            return false;
        }

        return true;
    }
682612
public function isValidUntil($strPageId)
    {
        $blnReturn = true;

        foreach ($this->__elements as $objPage) {
            if (! $blnReturn || $objPage->getId() == $strPageId) {
                break;
            }

            if (! $objPage->isValid()) {
                $blnReturn = false;
            }
        }

        return $blnReturn;
    }
779854
public function delete($endpointId)
    {
        if (ArrayOperations::checkNull([$endpointId])) {
            throw
            new PlivoValidationException(
                'endpoint id is mandatory');
        }
        
        $this->client->delete(
            $this->uri . $endpointId . '/',
            []
        );
    }
857753
static function fetchListByContentObjectId( $objectId )
    {
        $conds = array( 'object_id' => $objectId );
        $objectList = eZPersistentObject::fetchObjectList( self::definition(), null, $conds );
        return $objectList;
    }
456306
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException('Link has to be an object, "' . gettype($object) . '" given.');
        }

        $links = get_object_vars($object);

        if (! array_key_exists('about', $links)) {
            throw new ValidationException('ErrorLink MUST contain these properties: about');
        }

        if (! is_string($links['about']) and ! is_object($links['about'])) {
            throw new ValidationException('Link has to be an object or string, "' . gettype($links['about']) . '" given.');
        }

        if (is_string($links['about'])) {
            $this->set('about', strval($links['about']));
        } else {
            $this->set('about', $this->create('Link', $links['about']));
        }

        unset($links['about']);

        // custom links
        foreach ($links as $name => $value) {
            $this->setLink($name, $value);
        }
    }
1044951
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $classAttribute = $contentObjectAttribute->contentClassAttribute();
        $httpFileName = $base . "_data_mediafilename_" . $contentObjectAttribute->attribute( "id" );
        $maxSize = 1024 * 1024 * $classAttribute->attribute( self::MAX_FILESIZE_FIELD );
        $mustUpload = false;

        if ( $contentObjectAttribute->validateIsRequired() )
        {
            $contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
            $version = $contentObjectAttribute->attribute( "version" );
            $media = eZMedia::fetch( $contentObjectAttributeID, $version );
            if ( $media === null || !$media->attribute( 'filename' ) )
            {
                $mustUpload = true;
            }
        }

        $canFetchResult = eZHTTPFile::canFetch( $httpFileName, $maxSize );
        if ( $mustUpload && $canFetchResult == eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                'A valid media file is required.' ) );
            return eZInputValidator::STATE_INVALID;
        }
        if ( $canFetchResult == eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                'The size of the uploaded file exceeds the limit set by upload_max_filesize directive in php.ini. Please contact the site administrator.') );
            return eZInputValidator::STATE_INVALID;
        }
        if ( $canFetchResult == eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                'The size of the uploaded file exceeds site maximum: %1 bytes.' ), $maxSize );
            return eZInputValidator::STATE_INVALID;
        }
        return eZInputValidator::STATE_ACCEPTED;
    }
566473
static function generateObjectViewCache( $objectID )
    {
        // Generate the view cache
        $ini = eZINI::instance();
        $object = eZContentObject::fetch( $objectID );
        $user = eZUser::currentUser();

        eZDebug::accumulatorStart( 'generate_cache', '', 'Generating view cache' );
        if ( $ini->variable( 'ContentSettings', 'PreViewCache' ) == 'enabled' )
        {
            $preCacheSiteaccessArray = $ini->variable( 'ContentSettings', 'PreCacheSiteaccessArray' );

            $currentSiteAccess = $GLOBALS['eZCurrentAccess'];

            // This is the default view parameters for content/view
            $viewParameters = array( 'offset' => false,
                                     'year' => false,
                                     'month' => false,
                                     'day' => false,
                                     'namefilter' => false );
            if ( is_array( $preCacheSiteaccessArray ) && count( $preCacheSiteaccessArray ) > 0 )
            {
                foreach ( $preCacheSiteaccessArray as $changeToSiteAccess )
                {
                    $newSiteAccess = $currentSiteAccess;
                    $newSiteAccess['name'] = $changeToSiteAccess;
                    unset( $newSiteAccess['uri_part'] );//eZSiteAccess::load() will take care of setting correct one
                    eZSiteAccess::load( $newSiteAccess );

                    $tpl = eZTemplate::factory();

                    // Get the sitedesign and cached view preferences for this siteaccess
                    $siteini = eZINI::instance( 'site.ini');
                    $cachedViewPreferences = $siteini->variable( 'ContentSettings', 'CachedViewPreferences' );

                    $language = false; // Needs to be specified if you want to generate the cache for a specific language
                    $viewMode = 'full';

                    $assignedNodes = $object->assignedNodes();
                    foreach ( $assignedNodes as $node )
                    {
                        // We want to generate the cache for the specified user
                        $previewCacheUsers = $ini->variable( 'ContentSettings', 'PreviewCacheUsers' );
                        foreach ( $previewCacheUsers as $previewCacheUserID )
                        {
                            // If the text is 'anon' we need to fetch the Anonymous user ID.
                            if ( $previewCacheUserID === 'anonymous' )
                            {
                                $previewCacheUserID = $siteini->variable( "UserSettings", "AnonymousUserID" );
                                $previewCacheUser = eZUser::fetch( $previewCacheUserID  );
                            }
                            else if ( $previewCacheUserID === 'current' )
                            {
                                $previewCacheUser = $user;
                            }
                            else
                            {
                                $previewCacheUser = eZUser::fetch( $previewCacheUserID  );
                            }
                            if ( !$previewCacheUser )
                                continue;

                            // Before we generate the view cache we must change the currently logged in user to $previewCacheUser
                            // If not the templates might read in wrong personalized data (preferences etc.)
                            eZUser::setCurrentlyLoggedInUser( $previewCacheUser, $previewCacheUser->attribute( 'contentobject_id' ), eZUser::NO_SESSION_REGENERATE );

                            // Cache the current node
                            $cacheFileArray = eZNodeviewfunctions::generateViewCacheFile( $previewCacheUser, $node->attribute( 'node_id' ), false, false, $language, $viewMode, $viewParameters, $cachedViewPreferences );
                            $tmpRes = eZNodeviewfunctions::generateNodeView( $tpl, $node, $node->attribute( 'object' ), $language, $viewMode, false, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true, $viewParameters );

                            // Cache the parent node
                            $parentNode = $node->attribute( 'parent' );
                            $objectID = $parentNode->attribute( 'contentobject_id' );
                            // if parent objectID is null or is 0 we should not create cache.
                            if ( $objectID )
                            {
                                $cacheFileArray = eZNodeviewfunctions::generateViewCacheFile( $previewCacheUser, $parentNode->attribute( 'node_id' ), 0, false, $language, $viewMode, $viewParameters, $cachedViewPreferences );
                                $tmpRes = eZNodeviewfunctions::generateNodeView( $tpl, $parentNode, $parentNode->attribute( 'object' ), $language, $viewMode, 0, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true, $viewParameters );
                            }
                        }
                    }
                }
                // Restore the old user as the current one
                eZUser::setCurrentlyLoggedInUser( $user, $user->attribute( 'contentobject_id' ), eZUser::NO_SESSION_REGENERATE );

                // restore siteaccess
                eZSiteAccess::load( $currentSiteAccess );
            }
        }

        if ( $ini->variable( 'ContentSettings', 'StaticCache' ) == 'enabled' )
        {
            $nodes = array();
            $ini = eZINI::instance();
            $useURLAlias =& $GLOBALS['eZContentObjectTreeNodeUseURLAlias'];
            $pathPrefix = $ini->variable( 'SiteAccessSettings', 'PathPrefix' );

            // get staticCacheHandler instance
            $optionArray = array( 'iniFile'      => 'site.ini',
                                  'iniSection'   => 'ContentSettings',
                                  'iniVariable'  => 'StaticCacheHandler' );

            $options = new ezpExtensionOptions( $optionArray );
            $staticCacheHandler = eZExtension::getHandlerClass( $options );

            if ( !isset( $useURLAlias ) )
            {
                $useURLAlias = $ini->variable( 'URLTranslator', 'Translation' ) == 'enabled';
            }

            eZContentCacheManager::nodeListForObject( $object, true, self::CLEAR_DEFAULT, $nodes, $handledObjectList );

            // If no nodes returns it means that ClearCacheMethod = self::CLEAR_NO_CACHE
            if ( count( $nodes ) )
            {
                foreach ( $nodes as $nodeID )
                {
                    if ( $useURLAlias )
                    {
                        $oNode = eZContentObjectTreeNode::fetch( $nodeID, false, true );
                        if ( !isset( $oNode ) )
                            continue;

                        $urlAlias = $oNode->urlAlias();
                        if ( $pathPrefix != '' )
                        {
                            $tempAlias = substr( $pathPrefix, strlen( $pathPrefix ) -1 ) == '/'
                                            ? $urlAlias . '/'
                                            : $urlAlias;
                            if ( strncmp( $tempAlias, $pathPrefix, strlen( $tempAlias) ) == 0 )
                                $urlAlias = substr( $tempAlias, strlen( $pathPrefix ) );
                        }
                    }
                    else
                    {
                        $urlAlias = 'content/view/full/' . $nodeID;
                    }
                    $staticCacheHandler->cacheURL( '/' . $urlAlias, $nodeID );
                }
                $staticCacheHandler->generateAlwaysUpdatedCache();
            }
        }
        eZDebug::accumulatorStop( 'generate_cache' );
    }
508015
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        $postVariableName = $base . "_data_object_relation_id_" . $contentObjectAttribute->attribute( "id" );
        if ( $http->hasPostVariable( $postVariableName ) )
        {
            $relatedObjectID = $http->postVariable( $postVariableName );
            $classAttribute = $contentObjectAttribute->contentClassAttribute();

            if ( $contentObjectAttribute->validateIsRequired() and $relatedObjectID == 0 )
            {
                $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                                     'Missing objectrelation input.' ) );
                return eZInputValidator::STATE_INVALID;
            }
        }
        else if ( $contentObjectAttribute->validateIsRequired() )
        {
            $contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes', 'Missing objectrelation input.' ) );
            return eZInputValidator::STATE_INVALID;
        }

        return eZInputValidator::STATE_ACCEPTED;
    }
948122
protected function check_object_id( $object_id ) {
		$term = get_term( $object_id );
		if ( ! $term ) {
			WP_CLI::error( "Could not find the term with ID {$object_id}." );
		}
		return $term->term_id;
	}
827117
public static function isQueued( $objectId, $version )
    {
        $process = ezpContentPublishingProcess::fetchByContentObjectVersion( $objectId, $version );
        return ( $process instanceof ezpContentPublishingProcess );
    }
1338694
public function getObjectInstanceById(ICollection $collection, $objectId)
    {
        $collectionName = $collection->getName();
        if (isset($this->objectsById[$collectionName][$objectId])) {
            return $this->objectsById[$collectionName][$objectId];
        } else {
            return null;
        }
    }
98914
public function urlServe($objectId, $forceDownload = false)
    {
        $isTrashed = false;

        if (empty($objectId)) {
            $oObj = $this->emptyObject();
        } elseif (is_numeric($objectId)) {

            $oObj = $this->getObject($objectId);

            if (!$oObj) {

                /**
                 * If the user is a logged in admin with can_browse_trash permission then have a look in the trash
                 */

                if (userHasPermission('admin:cdn:trash:browse')) {
                    $oObj = $this->getObjectFromTrash($objectId);
                    if (!$oObj) {
                        //  Cool, guess it really doesn't exist. Let the renderer show a bad_src graphic
                        $oObj = $this->emptyObject();
                    } else {
                        $isTrashed = true;
                    }
                } else {
                    //  Let the renderer show a bad_src graphic
                    $oObj = $this->emptyObject();
                }
            }
        } elseif (is_object($objectId)) {
            $oObj = $objectId;
        } else {
            throw new UrlException('Supplied $objectId must be numeric or an object', 1);
        }

        $url = $this->callDriver(
            'urlServe',
            [$oObj->file->name->disk, $oObj->bucket->slug, $forceDownload],
            $oObj->driver
        );
        $url .= $isTrashed ? '?trashed=1' : '';

        return $url;
    }
1094896
public static function encode($objectType, $objectId)
    {
        //====================================================================//
        // Safety Checks
        if (empty($objectType)) {
            return false;
        }
        if (empty($objectId)) {
            return false;
        }

        //====================================================================//
        // Create & Return Field Id Data String
        return   $objectId.IDSPLIT.$objectType;
    }
684062
public function validateObjectAttributeHTTPInput($http, $base, $objectAttribute)
    {
        $objectAttributeId = $objectAttribute->attribute('id');

        $value = trim($http->postVariable($base . self::RICH_TEXT_VARIABLE . $objectAttributeId, ''));

        if (empty($value) || $value === Value::EMPTY_VALUE) {
            if ($objectAttribute->validateIsRequired()) {
                $objectAttribute->setValidationError(ezpI18n::tr('extension/ezrichtext/datatypes', 'Rich text is required.'));

                return eZInputValidator::STATE_INVALID;
            }

            return eZInputValidator::STATE_ACCEPTED;
        }

        try {
            $value = $this->fieldType->acceptValue($value);
        } catch (InvalidArgumentException $e) {
            $objectAttribute->setValidationError($e->getMessage());

            return eZInputValidator::STATE_INVALID;
        }

        $errors = $this->fieldType->validate(new FieldDefinition(), $value);
        if (empty($errors)) {
            return eZInputValidator::STATE_ACCEPTED;
        }

        $objectAttribute->setValidationError(
            $errors[0]->getTranslatableMessage()->message
        );

        return eZInputValidator::STATE_INVALID;
    }
485021
public function load($objectID) {
        $category = new CMDBCategory($this->api);
        $netInfo = $category->read($objectID, 'C__CATS__NET');

        if (count($netInfo) !== 1 ||
            !array_key_exists(0, $netInfo) ||
            !is_array($netInfo[0])) {
            throw new RuntimeException(sprintf(
                'Nothing found for object identifier %s',
                $objectID
            ));
        }

        if (!array_key_exists('type', $netInfo[0]) ||
            !is_array($netInfo[0]['type']) ||
            !array_key_exists('const', $netInfo[0]['type']) ||
            !is_string($netInfo[0]['type']['const']) ||
            $netInfo[0]['type']['const'] !== 'C__CATS_NET_TYPE__IPV4') {
            throw new RuntimeException('Works only for IPv4');
        }

        if (!array_key_exists('range_from', $netInfo[0]) ||
            !is_string($netInfo[0]['range_from']) ||
            !array_key_exists('range_to', $netInfo[0]) ||
            !is_string($netInfo[0]['range_to'])) {
            throw new RuntimeException(sprintf(
                'Subnet #%s has no IP address range',
                $objectID
            ));
        }

        $this->first = $this->convertIPv4Address($netInfo[0]['range_from']);
        $this->last = $this->convertIPv4Address($netInfo[0]['range_to']);

        $takenIPAddresses = $category->read($objectID, 'C__CATS__NET_IP_ADDRESSES');

        foreach ($takenIPAddresses as $takenIPAddress) {
            $this->taken[] = $takenIPAddress['title'];
        }

        $this->current = $this->first;

        return $this;
    }
432673
static public function fetchRelatedObjectsID( $objectID, $attributeID, $allRelations)
    {
        if ( !is_array( $allRelations ) || $allRelations === array() )
        {
            $allRelations = array( 'common', 'xml_embed', 'attribute' );
            if ( eZContentObject::isObjectRelationTyped() )
            {
                $allRelations[] = 'xml_link';
            }
        }

        $relatedObjectsTyped = array();
        foreach ( $allRelations as $relationType )
        {
            $relatedObjectsTyped[$relationType] =
                eZContentFunctionCollection::fetchRelatedObjects( $objectID, $attributeID, array( $relationType ), false, array() );
        }

        $relatedObjectsTypedIDArray = array();
        foreach ( $relatedObjectsTyped as $relationTypeName => $relatedObjectsByType )
        {
            $relatedObjectsTypedIDArray[$relationTypeName] = array();
            foreach ( $relatedObjectsByType['result'] as $relatedObjectByType )
            {
                $relatedObjectsTypedIDArray[$relationTypeName][] = $relatedObjectByType->ID;
            }
        }

        return array( 'result' => $relatedObjectsTypedIDArray );
    }
962535
public static function getEntityClassFromObjectID($objectID)
    {
        $type = explode('::', $objectID)[0];

        if (in_array($type, static::getEntities(), true)) {
            return $type;
        }

        throw new EntityNotFoundInObjectID("Entity class from ObjectID {$objectID} not found.");
    }